mirror of
https://github.com/QuotifyTeam/QuotifyBE.git
synced 2025-12-16 19:20:06 +01:00
feat: helper functions for checking roles and a demo endpoint
This commit is contained in:
@@ -109,13 +109,12 @@ public class QuotesController : ControllerBase
|
||||
[HttpPost("new")]
|
||||
[Authorize]
|
||||
[EnableCors]
|
||||
[ProducesResponseType(201)] // ? FIXME
|
||||
[ProducesResponseType(201)]
|
||||
[ProducesResponseType(typeof(ErrorDTO), 400)]
|
||||
[ProducesResponseType(typeof(ErrorDTO), 403)]
|
||||
public async Task<IActionResult> CreateQuote([FromBody] CreateQuoteDTO request)
|
||||
{
|
||||
// Get user ID from claims
|
||||
// FIXME
|
||||
var userIdClaim = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
if (userIdClaim == null || !int.TryParse(userIdClaim, out int userId))
|
||||
// https://stackoverflow.com/a/47708867
|
||||
|
||||
Reference in New Issue
Block a user