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; namespace Mirea.Api.Endpoint.Controllers;
[Produces("application/json")]
[Route("api/v{version:apiVersion}/[controller]")]
[ApiController] [ApiController]
[Route("api/[controller]/[action]")]
public class BaseController : ControllerBase; 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,9 +9,10 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Mirea.Api.Endpoint.Controllers.V1 namespace Mirea.Api.Endpoint.Controllers.V1;
{
public class CampusController(IMediator mediator) : BaseControllerV1 [ApiVersion("1.0")]
public class CampusController(IMediator mediator) : BaseController
{ {
/// <summary> /// <summary>
/// Gets basic information about campuses. /// Gets basic information about campuses.
@ -58,4 +59,3 @@ namespace Mirea.Api.Endpoint.Controllers.V1
}); });
} }
} }
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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