backend + web: Add admin account lifecycle management
This commit is contained in:
1 parent
fcf7cd0596
commit
91d0c06c83
25 files changed
+1148
-97
No files matched your search
@@ -6,10 +6,16 @@ namespace Helpdesk.Application.Notifications;
|
||||
|
||||
public sealed class PushDeviceService(IAppDbContext db, ICurrentUser currentUser)
|
||||
{
|
||||
public Task RegisterAsync(string token, CancellationToken ct)
|
||||
public async Task RegisterAsync(string token, CancellationToken ct)
|
||||
{
|
||||
ValidateToken(token);
|
||||
return db.RegisterPushDeviceAsync(currentUser.Id, token, ct);
|
||||
await using var transaction = await db.BeginWriteAsync(ct);
|
||||
var user = await db.LockUserAsync(currentUser.Id, ct);
|
||||
if (user is not { IsActive: true, IsDeleted: false })
|
||||
throw new UnauthorizedException("Účet není aktivní.");
|
||||
|
||||
await db.RegisterPushDeviceAsync(user.Id, token, ct);
|
||||
await transaction.CommitAsync(ct);
|
||||
}
|
||||
|
||||
public async Task UnregisterAsync(string token, CancellationToken ct)
|
||||
|
||||
Reference in new issue
Block a user