backend: Make refresh token rotation atomic
This commit is contained in:
1 parent
483bb10fbd
commit
fd37986f5e
5 files changed
+20
-14
No files matched your search
@@ -30,7 +30,7 @@ public sealed partial class ProposalService(
|
||||
{
|
||||
await GetActorRoleAsync(ct);
|
||||
var (title, description) = ValidateDetails(request);
|
||||
await using (var transaction = await db.BeginProposalWriteAsync(ct))
|
||||
await using (var transaction = await db.BeginWriteAsync(ct))
|
||||
{
|
||||
var proposal = await LockProposalAsync(id, ct);
|
||||
if (!proposal.IsAuthor(currentUser.Id))
|
||||
@@ -63,7 +63,7 @@ public sealed partial class ProposalService(
|
||||
if (note is not null && Encoding.UTF8.GetByteCount(note) > MaxTextBytes)
|
||||
throw new BadRequestException("Vyjádření je příliš dlouhé.");
|
||||
|
||||
await using (var transaction = await db.BeginProposalWriteAsync(ct))
|
||||
await using (var transaction = await db.BeginWriteAsync(ct))
|
||||
{
|
||||
var proposal = await LockProposalAsync(id, ct);
|
||||
var previous = proposal.Status;
|
||||
@@ -94,7 +94,7 @@ public sealed partial class ProposalService(
|
||||
{
|
||||
await GetActorRoleAsync(ct);
|
||||
var actorId = currentUser.Id;
|
||||
await using var transaction = await db.BeginProposalWriteAsync(ct);
|
||||
await using var transaction = await db.BeginWriteAsync(ct);
|
||||
var proposal = await LockProposalAsync(id, ct);
|
||||
if (proposal.IsAuthor(actorId))
|
||||
throw new ForbiddenException("Autor nemůže hlasovat o vlastním návrhu.");
|
||||
|
||||
Reference in new issue
Block a user