diff --git a/backend/ResQueue/ResQueue/Features/Messages/ArchiveMessages/ArchiveMessagesFeature.cs b/backend/ResQueue/ResQueue/Features/Messages/ArchiveMessages/ArchiveMessagesFeature.cs index 6809981..7bb2d72 100644 --- a/backend/ResQueue/ResQueue/Features/Messages/ArchiveMessages/ArchiveMessagesFeature.cs +++ b/backend/ResQueue/ResQueue/Features/Messages/ArchiveMessages/ArchiveMessagesFeature.cs @@ -51,6 +51,9 @@ public async Task> ExecuteAsync( await queuesCollection.UpdateOneAsync(session, x => x.Id == ObjectId.Parse(request.Dto.QueueId), Builders.Update.Inc(x => x.TotalMessages, -result.ModifiedCount)); + await queuesCollection.UpdateOneAsync(session, x => x.Id == ObjectId.Parse(request.Dto.QueueId), + Builders.Update.Max(x => x.TotalMessages, 0)); + await session.CommitTransactionAsync(); return OperationResult.Success(new ArchiveMessagesFeatureResponse());