24 lines
996 B
C#
24 lines
996 B
C#
using Helpdesk.Application.Abstractions;
|
||||
|
|
using Helpdesk.Application.Users;
|
|||
|
|
using Microsoft.AspNetCore.Authorization;
|
|||
|
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
|
|
|||
|
|
namespace Helpdesk.Api.Controllers;
|
|||
|
|
|
|||
|
|
/// <summary>Profil přihlášeného uživatele.</summary>
|
|||
|
|
[ApiController]
|
|||
|
|
[Authorize]
|
|||
|
|
[Route("api/users")]
|
|||
|
|
[Produces("application/json")]
|
|||
|
|
public sealed class UsersController(UserService users, ICurrentUser currentUser) : ControllerBase
|
|||
|
|
{
|
|||
|
|
/// <summary>Můj profil.</summary>
|
|||
|
|
[HttpGet("me")]
|
|||
|
|
public Task<UserDto> GetMe(CancellationToken ct) => users.GetMeAsync(currentUser, ct);
|
|||
|
|
|
|||
|
|
/// <summary>Úprava profilu – jméno, telefon (ukládá se šifrovaně), e-mailové notifikace.</summary>
|
|||
|
|
[HttpPut("me")]
|
|||
|
|
[ProducesResponseType<UserDto>(StatusCodes.Status200OK)]
|
|||
|
|
[ProducesResponseType<ValidationProblemDetails>(StatusCodes.Status400BadRequest)]
|
|||
|
|
public Task<UserDto> UpdateMe(UpdateProfileRequest request, CancellationToken ct) => users.UpdateMeAsync(currentUser, request, ct);
|
|||
|
|
}
|