Account deletion

This commit is contained in:
2025-05-24 23:29:36 +08:00
parent 80b7812a87
commit 59bc9edd4b
13 changed files with 191 additions and 20 deletions

View File

@ -219,6 +219,24 @@ public class AccountController(
return profile;
}
[HttpDelete("me")]
[Authorize]
public async Task<ActionResult> RequestDeleteAccount()
{
if (HttpContext.Items["CurrentUser"] is not Account currentUser) return Unauthorized();
try
{
await accounts.RequestAccountDeletion(currentUser);
}
catch (InvalidOperationException)
{
return BadRequest("You already requested account deletion within 24 hours.");
}
return Ok();
}
public class StatusRequest
{
public StatusAttitude Attitude { get; set; }