Add member routes to API

This commit is contained in:
Ske
2019-07-10 00:19:18 +02:00
parent 4874879979
commit 9a5152a74c
8 changed files with 96 additions and 4 deletions

View File

@@ -99,9 +99,9 @@ namespace PluralKit.API.Controllers
}
[HttpPatch]
[RequiresSystem]
public async Task<ActionResult<PKSystem>> EditSystem([FromBody] PKSystem newSystem)
{
if (_auth.CurrentSystem == null) return Unauthorized("No token specified in Authorization header.");
var system = _auth.CurrentSystem;
system.Name = newSystem.Name;
@@ -115,10 +115,9 @@ namespace PluralKit.API.Controllers
}
[HttpPost("switches")]
[RequiresSystem]
public async Task<IActionResult> PostSwitch([FromBody] PostSwitchParams param)
{
if (_auth.CurrentSystem == null) return Unauthorized("No token specified in Authorization header.");
if (param.Members.Distinct().Count() != param.Members.Count())
return BadRequest("Duplicate members in member list.");