feat: add validation to prevent users from starting multiple sections in progress

This commit is contained in:
2026-01-04 14:13:29 +03:30
parent 4ada29a98a
commit 0bfcde6a3f
4 changed files with 13 additions and 2 deletions

View File

@@ -45,4 +45,11 @@ public class TaskSectionRepository:RepositoryBase<Guid,TaskSection>,ITaskSection
.Include(x => x.AdditionalTimes)
.ToListAsync(cancellationToken);
}
public async Task<bool> HasUserAnyInProgressSectionAsync(long userId, CancellationToken cancellationToken = default)
{
return await _context.TaskSections
.AnyAsync(x => x.CurrentAssignedUserId == userId && x.Status == TaskSectionStatus.InProgress,
cancellationToken);
}
}