Skip to content

Commit

Permalink
refactor: Update repository update calls to use SaveChangesAsync()
Browse files Browse the repository at this point in the history
  • Loading branch information
foxminchan committed Aug 30, 2024
1 parent 7f91619 commit 6a458eb
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public async Task<Result> Handle(DeleteBookCommand request, CancellationToken ca

book.Delete();

await repository.UpdateAsync(book, cancellationToken);
await repository.SaveChangesAsync(cancellationToken);

return Result.Success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public async Task<Result> Handle(RemoveBookImageCommand request, CancellationTok

await azurite.DeleteFileAsync(book.ImageUrl!, cancellationToken);
book.RemoveImage();
await repository.UpdateAsync(book, cancellationToken);
await repository.SaveChangesAsync(cancellationToken);

return Result.Success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task<Result> Handle(UpdateBookCommand request, CancellationToken ca
book.Embed(embedding);
}

await repository.UpdateAsync(book, cancellationToken);
await repository.SaveChangesAsync(cancellationToken);

return Result.Success();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task Consume(ConsumeContext<FeedbackCreatedIntegrationEvent> contex

try
{
await repository.UpdateAsync(book);
await repository.SaveChangesAsync();
}
catch (Exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task Consume(ConsumeContext<FeedbackDeletedIntegrationEvent> contex

book.RemoveRating(@event.Rating);

await repository.UpdateAsync(book);
await repository.SaveChangesAsync();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public async Task<Result> Handle(CancelOrderCommand request, CancellationToken c

order.MarkAsCanceled();

await repository.UpdateAsync(order, cancellationToken);
await repository.SaveChangesAsync(cancellationToken);

var email = identityService.GetEmail();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public async Task<Result> Handle(CompleteOrderCommand request, CancellationToken

order.MarkAsCompleted();

await repository.UpdateAsync(order, cancellationToken);
await repository.SaveChangesAsync(cancellationToken);

var email = identityService.GetEmail();

Expand Down

0 comments on commit 6a458eb

Please sign in to comment.