aboutsummaryrefslogtreecommitdiffstats
path: root/code/api/Endpoints/Account/DeleteEndpoint.cs
blob: 75a508a5da929ae9ff46dd5c8f69d0d3b1591844 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
namespace I2R.Storage.Api.Endpoints.Account;

public class DeleteEndpoint : EndpointBase
{
    private readonly UserService _userService;

    public DeleteEndpoint(UserService userService) {
        _userService = userService;
    }

    [HttpDelete("~/account/delete")]
    public async Task<ActionResult> Handle() {
        await _userService.MarkUserAsDeletedAsync(LoggedInUser.Id, LoggedInUser.Id);
        await _userService.LogOutUserAsync(HttpContext);
        return Ok();
    }
}