diff --git a/Endpoint/Controllers/V1/CampusController.cs b/Endpoint/Controllers/V1/CampusController.cs new file mode 100644 index 0000000..c383608 --- /dev/null +++ b/Endpoint/Controllers/V1/CampusController.cs @@ -0,0 +1,45 @@ +using MediatR; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Mirea.Api.DataAccess.Application.Cqrs.Campus.Queries.GetCampusBasicInfoList; +using Mirea.Api.DataAccess.Application.Cqrs.Campus.Queries.GetCampusDetails; +using Mirea.Api.Endpoint.Common.Extensions; +using System.Threading.Tasks; + +namespace Mirea.Api.Endpoint.Controllers.V1 +{ + public class CampusController(IMediator mediator) : BaseControllerV1 + { + /// + /// Gets basic information about campuses. + /// + /// Basic information about campuses. + [HttpGet] + [ProducesResponseType(StatusCodes.Status200OK)] + public async Task> GetBasicInfo() + { + var result = await mediator.Send(new GetCampusBasicInfoListQuery()); + + return Ok(result); + } + + /// + /// Gets details of a specific campus by ID. + /// + /// Campus ID. + /// Details of the specified campus. + [HttpGet("{id:int}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [BadRequestResponse] + [NotFoundResponse] + public async Task> GetDetails(int id) + { + var result = await mediator.Send(new GetCampusDetailsQuery() + { + Id = id + }); + + return Ok(result); + } + } +}