Skip to content

Commit 1dc5a42

Browse files
committed
refactor(controllers)!: adjust routes to match public identifier
1 parent fd6be45 commit 1dc5a42

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/Dotnet.Samples.AspNetCore.WebApi/Controllers/PlayerController.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Dotnet.Samples.AspNetCore.WebApi.Controllers;
99

1010
[ApiController]
11-
[Route("[controller]")]
11+
[Route("players")]
1212
[Produces("application/json")]
1313
public class PlayerController(
1414
IPlayerService playerService,
@@ -94,13 +94,12 @@ public async Task<IResult> GetAsync()
9494
}
9595

9696
/// <summary>
97-
/// Retrieves a Player by its ID
97+
/// Retrieves a Player by its internal Id (GUID)
9898
/// </summary>
99-
/// <param name="id">The ID of the Player</param>
99+
/// <param name="id">The internal Id (GUID) of the Player</param>
100100
/// <response code="200">OK</response>
101101
/// <response code="404">Not Found</response>
102-
[Authorize(Roles = "Admin")]
103-
[ApiExplorerSettings(IgnoreApi = true)]
102+
[Authorize]
104103
[HttpGet("{id:Guid}", Name = "RetrieveById")]
105104
[ProducesResponseType<PlayerResponseModel>(StatusCodes.Status200OK)]
106105
[ProducesResponseType(StatusCodes.Status404NotFound)]
@@ -125,7 +124,7 @@ public async Task<IResult> GetByIdAsync([FromRoute] Guid id)
125124
/// <param name="squadNumber">The Squad Number of the Player</param>
126125
/// <response code="200">OK</response>
127126
/// <response code="404">Not Found</response>
128-
[HttpGet("squadNumber/{squadNumber:int}", Name = "RetrieveBySquadNumber")]
127+
[HttpGet("{squadNumber:int}", Name = "RetrieveBySquadNumber")]
129128
[ProducesResponseType<PlayerResponseModel>(StatusCodes.Status200OK)]
130129
[ProducesResponseType(StatusCodes.Status404NotFound)]
131130
public async Task<IResult> GetBySquadNumberAsync([FromRoute] int squadNumber)

0 commit comments

Comments
 (0)