Add Application configuration #11
@ -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;
|
@ -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;
|
@ -9,9 +9,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
{
|
||||
public class CampusController(IMediator mediator) : BaseControllerV1
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
public class CampusController(IMediator mediator) : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets basic information about campuses.
|
||||
@ -58,4 +59,3 @@ namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
{
|
||||
public class DisciplineController(IMediator mediator) : BaseControllerV1
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
public class DisciplineController(IMediator mediator) : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a paginated list of disciplines.
|
||||
@ -62,4 +63,3 @@ namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
{
|
||||
public class FacultyController(IMediator mediator) : BaseControllerV1
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
public class FacultyController(IMediator mediator) : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a paginated list of faculties.
|
||||
@ -66,4 +67,3 @@ namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
{
|
||||
public class GroupController(IMediator mediator) : BaseControllerV1
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
public class GroupController(IMediator mediator) : BaseController
|
||||
{
|
||||
private static int GetCourseNumber(string groupName)
|
||||
{
|
||||
@ -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]
|
||||
@ -105,4 +106,3 @@ namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,10 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
{
|
||||
public class LectureHallController(IMediator mediator) : BaseControllerV1
|
||||
namespace Mirea.Api.Endpoint.Controllers.V1;
|
||||
|
||||
[ApiVersion("1.0")]
|
||||
public class LectureHallController(IMediator mediator) : BaseController
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves a list of all lecture halls.
|
||||
@ -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]
|
||||
@ -81,4 +82,3 @@ namespace Mirea.Api.Endpoint.Controllers.V1
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user