[backend/core] Fix UpdateUserPublicKeyAsync(User) method
This commit is contained in:
parent
0c644f7b25
commit
d7ac26db61
1 changed files with 4 additions and 1 deletions
|
@ -442,10 +442,13 @@ public class UserService(
|
|||
|
||||
var key = await db.UserPublickeys.FirstOrDefaultAsync(p => p.User == user) ?? new UserPublickey { User = user };
|
||||
|
||||
var insert = key.KeyId == null!;
|
||||
|
||||
key.KeyId = actor.PublicKey.Id;
|
||||
key.KeyPem = actor.PublicKey.PublicKey;
|
||||
|
||||
db.Update(key);
|
||||
if (insert) db.Add(key);
|
||||
else db.Update(key);
|
||||
await db.SaveChangesAsync();
|
||||
return key;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue