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,53 +9,53 @@ 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>
|
||||
/// <returns>Basic information about campuses.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<List<CampusBasicInfoResponse>>> Get()
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets basic information about campuses.
|
||||
/// </summary>
|
||||
/// <returns>Basic information about campuses.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
public async Task<ActionResult<List<CampusBasicInfoResponse>>> Get()
|
||||
{
|
||||
var result = await mediator.Send(new GetCampusBasicInfoListQuery());
|
||||
var result = await mediator.Send(new GetCampusBasicInfoListQuery());
|
||||
|
||||
return Ok(result.Campuses
|
||||
.Select(c => new CampusBasicInfoResponse()
|
||||
{
|
||||
Id = c.Id,
|
||||
CodeName = c.CodeName,
|
||||
FullName = c.FullName
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets details of a specific campus by ID.
|
||||
/// </summary>
|
||||
/// <param name="id">Campus ID.</param>
|
||||
/// <returns>Details of the specified campus.</returns>
|
||||
[HttpGet("{id:int}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[BadRequestResponse]
|
||||
[NotFoundResponse]
|
||||
public async Task<ActionResult<CampusDetailsResponse>> GetDetails(int id)
|
||||
{
|
||||
var result = await mediator.Send(new GetCampusDetailsQuery()
|
||||
return Ok(result.Campuses
|
||||
.Select(c => new CampusBasicInfoResponse()
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
|
||||
return Ok(new CampusDetailsResponse()
|
||||
{
|
||||
Id = result.Id,
|
||||
CodeName = result.CodeName,
|
||||
FullName = result.FullName,
|
||||
Address = result.Address
|
||||
});
|
||||
}
|
||||
Id = c.Id,
|
||||
CodeName = c.CodeName,
|
||||
FullName = c.FullName
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets details of a specific campus by ID.
|
||||
/// </summary>
|
||||
/// <param name="id">Campus ID.</param>
|
||||
/// <returns>Details of the specified campus.</returns>
|
||||
[HttpGet("{id:int}")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[BadRequestResponse]
|
||||
[NotFoundResponse]
|
||||
public async Task<ActionResult<CampusDetailsResponse>> GetDetails(int id)
|
||||
{
|
||||
var result = await mediator.Send(new GetCampusDetailsQuery()
|
||||
{
|
||||
Id = id
|
||||
});
|
||||
|
||||
return Ok(new CampusDetailsResponse()
|
||||
{
|
||||
Id = result.Id,
|
||||
CodeName = result.CodeName,
|
||||
FullName = result.FullName,
|
||||
Address = result.Address
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user