mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 08:40:11 +00:00
Major database refactor (again)
This commit is contained in:
parent
3996cd48c7
commit
c7612df37e
55 changed files with 1014 additions and 1100 deletions
|
|
@ -10,9 +10,11 @@ namespace PluralKit.Bot
|
|||
public class Token
|
||||
{
|
||||
private readonly IDatabase _db;
|
||||
public Token(IDatabase db)
|
||||
private readonly ModelRepository _repo;
|
||||
public Token(IDatabase db, ModelRepository repo)
|
||||
{
|
||||
_db = db;
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public async Task GetToken(Context ctx)
|
||||
|
|
@ -45,7 +47,7 @@ namespace PluralKit.Bot
|
|||
private async Task<string> MakeAndSetNewToken(PKSystem system)
|
||||
{
|
||||
var patch = new SystemPatch {Token = StringUtils.GenerateToken()};
|
||||
system = await _db.Execute(conn => conn.UpdateSystem(system.Id, patch));
|
||||
system = await _db.Execute(conn => _repo.UpdateSystem(conn, system.Id, patch));
|
||||
return system.Token;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue