refactor: change the api path
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m59s
All checks were successful
.NET Test Pipeline / build-and-test (pull_request) Successful in 1m59s
This commit is contained in:
@ -9,57 +9,57 @@ 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>
|
||||
/// <param name="page">Page number. Start from 0.</param>
|
||||
/// <param name="pageSize">Number of items per page.</param>
|
||||
/// <returns>Paginated list of disciplines.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[BadRequestResponse]
|
||||
public async Task<ActionResult<List<DisciplineResponse>>> Get([FromQuery] int? page, [FromQuery] int? pageSize)
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a paginated list of disciplines.
|
||||
/// </summary>
|
||||
/// <param name="page">Page number. Start from 0.</param>
|
||||
/// <param name="pageSize">Number of items per page.</param>
|
||||
/// <returns>Paginated list of disciplines.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[BadRequestResponse]
|
||||
public async Task<ActionResult<List<DisciplineResponse>>> Get([FromQuery] int? page, [FromQuery] int? pageSize)
|
||||
var result = await mediator.Send(new GetDisciplineListQuery()
|
||||
{
|
||||
var result = await mediator.Send(new GetDisciplineListQuery()
|
||||
{
|
||||
Page = page,
|
||||
PageSize = pageSize
|
||||
});
|
||||
Page = page,
|
||||
PageSize = pageSize
|
||||
});
|
||||
|
||||
return Ok(result.Disciplines
|
||||
.Select(d => new DisciplineResponse()
|
||||
{
|
||||
Id = d.Id,
|
||||
Name = d.Name
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets details of a specific discipline by ID.
|
||||
/// </summary>
|
||||
/// <param name="id">Discipline ID.</param>
|
||||
/// <returns>Details of the specified discipline.</returns>
|
||||
[HttpGet("{id:int}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[BadRequestResponse]
|
||||
[NotFoundResponse]
|
||||
public async Task<ActionResult<DisciplineResponse>> GetDetails(int id)
|
||||
{
|
||||
var result = await mediator.Send(new GetDisciplineInfoQuery()
|
||||
return Ok(result.Disciplines
|
||||
.Select(d => new DisciplineResponse()
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
|
||||
return Ok(new DisciplineResponse()
|
||||
{
|
||||
Id = result.Id,
|
||||
Name = result.Name
|
||||
});
|
||||
}
|
||||
Id = d.Id,
|
||||
Name = d.Name
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets details of a specific discipline by ID.
|
||||
/// </summary>
|
||||
/// <param name="id">Discipline ID.</param>
|
||||
/// <returns>Details of the specified discipline.</returns>
|
||||
[HttpGet("{id:int}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[BadRequestResponse]
|
||||
[NotFoundResponse]
|
||||
public async Task<ActionResult<DisciplineResponse>> GetDetails(int id)
|
||||
{
|
||||
var result = await mediator.Send(new GetDisciplineInfoQuery()
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
|
||||
return Ok(new DisciplineResponse()
|
||||
{
|
||||
Id = result.Id,
|
||||
Name = result.Name
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user