Add Application configuration #11

Merged
Wesser merged 128 commits from feat/add-setup into release/v1.0.0 2024-06-01 07:35:30 +03:00
9 changed files with 314 additions and 320 deletions
Showing only changes of commit ae0b9daefa - Show all commits

View File

@ -2,6 +2,7 @@
namespace Mirea.Api.Endpoint.Controllers;
[Produces("application/json")]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiController]
[Route("api/[controller]/[action]")]
public class BaseController : ControllerBase;

View File

@ -1,8 +0,0 @@
using Microsoft.AspNetCore.Mvc;
namespace Mirea.Api.Endpoint.Controllers.V1;
[ApiVersion("1.0")]
[Produces("application/json")]
[Route("api/v{version:apiVersion}/[controller]/[action]")]
public class BaseControllerV1 : BaseController;

View File

@ -9,10 +9,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1
namespace Mirea.Api.Endpoint.Controllers.V1;
[ApiVersion("1.0")]
public class CampusController(IMediator mediator) : BaseController
{
public class CampusController(IMediator mediator) : BaseControllerV1
{
/// <summary>
/// Gets basic information about campuses.
/// </summary>
@ -57,5 +58,4 @@ namespace Mirea.Api.Endpoint.Controllers.V1
Address = result.Address
});
}
}
}

View File

@ -9,10 +9,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1
namespace Mirea.Api.Endpoint.Controllers.V1;
[ApiVersion("1.0")]
public class DisciplineController(IMediator mediator) : BaseController
{
public class DisciplineController(IMediator mediator) : BaseControllerV1
{
/// <summary>
/// Gets a paginated list of disciplines.
/// </summary>
@ -61,5 +62,4 @@ namespace Mirea.Api.Endpoint.Controllers.V1
Name = result.Name
});
}
}
}

View File

@ -9,10 +9,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1
namespace Mirea.Api.Endpoint.Controllers.V1;
[ApiVersion("1.0")]
public class FacultyController(IMediator mediator) : BaseController
{
public class FacultyController(IMediator mediator) : BaseControllerV1
{
/// <summary>
/// Gets a paginated list of faculties.
/// </summary>
@ -65,5 +66,4 @@ namespace Mirea.Api.Endpoint.Controllers.V1
CampusName = result.CampusName
});
}
}
}

View File

@ -10,10 +10,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1
namespace Mirea.Api.Endpoint.Controllers.V1;
[ApiVersion("1.0")]
public class GroupController(IMediator mediator) : BaseController
{
public class GroupController(IMediator mediator) : BaseControllerV1
{
private static int GetCourseNumber(string groupName)
{
var current = DateTime.Now;
@ -86,7 +87,7 @@ namespace Mirea.Api.Endpoint.Controllers.V1
/// </summary>
/// <param name="id">The ID of the faculty.</param>
/// <returns>A list of groups belonging to the specified faculty.</returns>
[HttpGet("{id:int}")]
[HttpGet("GetByFaculty/{id:int}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[BadRequestResponse]
[NotFoundResponse]
@ -104,5 +105,4 @@ namespace Mirea.Api.Endpoint.Controllers.V1
FacultyId = g.FacultyId
}));
}
}
}

View File

@ -9,10 +9,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1
namespace Mirea.Api.Endpoint.Controllers.V1;
[ApiVersion("1.0")]
public class LectureHallController(IMediator mediator) : BaseController
{
public class LectureHallController(IMediator mediator) : BaseControllerV1
{
/// <summary>
/// Retrieves a list of all lecture halls.
/// </summary>
@ -64,7 +65,7 @@ namespace Mirea.Api.Endpoint.Controllers.V1
/// </summary>
/// <param name="id">The ID of the campus.</param>
/// <returns>A list of lecture halls in the specified campus.</returns>
[HttpGet("{id:int}")]
[HttpGet("GetByCampus/{id:int}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[BadRequestResponse]
[NotFoundResponse]
@ -80,5 +81,4 @@ namespace Mirea.Api.Endpoint.Controllers.V1
CampusId = l.CampusId
}));
}
}
}

View File

@ -11,7 +11,8 @@ using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1;
public class ProfessorController(IMediator mediator) : BaseControllerV1
[ApiVersion("1.0")]
public class ProfessorController(IMediator mediator) : BaseController
{
/// <summary>
/// Retrieves a list of professors.

View File

@ -12,7 +12,8 @@ using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1;
public class ScheduleController(IMediator mediator) : BaseControllerV1
[ApiVersion("1.0")]
public class ScheduleController(IMediator mediator) : BaseController
{
/// <summary>
/// Retrieves schedules based on various filters.
@ -25,7 +26,6 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
[BadRequestResponse]
[NotFoundResponse]
public async Task<ActionResult<List<ScheduleResponse>>> Get([FromBody] ScheduleRequest request)
{
if ((request.Groups == null || request.Groups.Length == 0) &&
(request.Disciplines == null || request.Disciplines.Length == 0) &&
@ -85,7 +85,7 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
/// <param name="professors">An array of professor IDs.</param>
/// <param name="lectureHalls">An array of lecture hall IDs.</param>
/// <returns>A response containing schedules for the specified group.</returns>
[HttpGet("{id:int}")]
[HttpGet("GetByGroup/{id:int}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[BadRequestResponse]
@ -142,7 +142,7 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
/// <param name="groups">An array of group IDs.</param>
/// <param name="lectureHalls">An array of lecture hall IDs.</param>
/// <returns>A response containing schedules for the specified professor.</returns>
[HttpGet("{id:int}")]
[HttpGet("GetByProfessor/{id:int}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[BadRequestResponse]
@ -203,7 +203,7 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
/// <param name="professors">An array of professor IDs.</param>
/// <param name="groups">An array of group IDs.</param>
/// <returns>A response containing schedules for the specified lecture hall.</returns>
[HttpGet("{id:int}")]
[HttpGet("GetByLectureHall/{id:int}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[BadRequestResponse]
@ -264,7 +264,7 @@ public class ScheduleController(IMediator mediator) : BaseControllerV1
/// <param name="professors">An array of professor IDs.</param>
/// <param name="lectureHalls">An array of lecture hall IDs.</param>
/// <returns>A response containing schedules for the specified discipline.</returns>
[HttpGet("{id:int}")]
[HttpGet("GetByDiscipline/{id:int}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[BadRequestResponse]