Add endpoint to delete members

- Add endpoint to delete members through a DELETE request
This commit is contained in:
Grey Himmel 2019-07-28 18:03:50 -04:00 committed by Astrid
parent 9f2faeea5a
commit 13fe0b7ef9

View File

@ -109,5 +109,19 @@ namespace PluralKit.API.Controllers
return Ok(member); return Ok(member);
} }
[HttpDelete("{hid}")]
[RequiresSystem]
public async Task<ActionResult<PKMember>> DeleteMember(string hid)
{
var member = await _members.GetByHid(hid);
if (member == null) return NotFound("Member not found.");
if (member.System != _auth.CurrentSystem.Id) return Unauthorized($"Member '{hid}' is not part of your system.");
_members.Delete(member);
return Ok();
}
} }
} }