Add endpoint to delete members
- Add endpoint to delete members through a DELETE request
This commit is contained in:
parent
9f2faeea5a
commit
13fe0b7ef9
@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user