refactor: add SqlKata for SQL generation, move connection handling into ModelRepository

This commit is contained in:
spiral
2021-09-29 21:51:38 -04:00
parent 6251d29abb
commit 92e45a07ff
60 changed files with 806 additions and 640 deletions

View File

@@ -50,8 +50,7 @@ namespace PluralKit.Bot
private async Task<string> MakeAndSetNewToken(PKSystem system)
{
var patch = new SystemPatch { Token = StringUtils.GenerateToken() };
system = await _db.Execute(conn => _repo.UpdateSystem(conn, system.Id, patch));
system = await _repo.UpdateSystem(system.Id, new() { Token = StringUtils.GenerateToken() });
return system.Token;
}