Merge branch 'frontend' into develop

This commit is contained in:
Daniel_I_Am 2020-08-30 11:53:08 +02:00
commit 2fb75190af
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84
2 changed files with 11 additions and 10 deletions

View File

@ -57,21 +57,22 @@ namespace ChaosBot.WebServer.App
} }
[HttpDelete] [HttpDelete]
[Route("{guildId}")] [Route("{guildId}/{command}")]
public async Task<IActionResult> DeleteCustomCommands([FromRoute]ulong guildId, [FromBody]CustomCommandRequest customCommandRequest) public async Task<IActionResult> DeleteCustomCommands([FromRoute]ulong guildId, [FromRoute]string command)
{ {
if (!CheckPermissions.GetResult(Request, guildId, out IActionResult result)) if (!CheckPermissions.GetResult(Request, guildId, out IActionResult result))
return result; return result;
await using ChaosbotContext dbContext = new ChaosbotContext(); await using ChaosbotContext dbContext = new ChaosbotContext();
CustomCommand customCommand = new CustomCommand IQueryable<CustomCommand> customCommandQuery = dbContext.CustomCommands;
{ CustomCommand customCommand = customCommandQuery
DiscordGuildId = guildId, .Where(cc => cc.DiscordGuildId == guildId)
Command = customCommandRequest.Command, .First(cc => cc.Command == command);
Type = customCommandRequest.Type,
Content = customCommandRequest.Content if (customCommand == null)
}; return NotFound();
dbContext.CustomCommands.Remove(customCommand); dbContext.CustomCommands.Remove(customCommand);
await dbContext.SaveChangesAsync(); await dbContext.SaveChangesAsync();

@ -1 +1 @@
Subproject commit 018538162a471a6a028149d27f4b3e992c3c7998 Subproject commit 5d42f98ba9efc9ff5f31f4fb4cd4f2f560584433