Project Init
Some checks failed
Code Coverage / Generate Coverage Report (push) Has been cancelled
Tests / Run Tests (9.0.x) (push) Has been cancelled
Tests / Docker Build Test (push) Has been cancelled
Tests / Test Summary (push) Has been cancelled

This commit is contained in:
Yaojia Wang
2025-11-03 00:04:19 +01:00
parent 014d62bcc2
commit 8caf8c1bcf
7 changed files with 276 additions and 1 deletions

View File

@@ -38,6 +38,35 @@ public class ProjectRepository : IProjectRepository
.ToListAsync(cancellationToken);
}
public async Task<Project?> GetProjectWithEpicAsync(EpicId epicId, CancellationToken cancellationToken = default)
{
return await _context.Projects
.Include(p => p.Epics)
.ThenInclude(e => e.Stories)
.Where(p => p.Epics.Any(e => e.Id == epicId))
.FirstOrDefaultAsync(cancellationToken);
}
public async Task<Project?> GetProjectWithStoryAsync(StoryId storyId, CancellationToken cancellationToken = default)
{
return await _context.Projects
.Include(p => p.Epics)
.ThenInclude(e => e.Stories)
.ThenInclude(s => s.Tasks)
.Where(p => p.Epics.Any(e => e.Stories.Any(s => s.Id == storyId)))
.FirstOrDefaultAsync(cancellationToken);
}
public async Task<Project?> GetProjectWithTaskAsync(TaskId taskId, CancellationToken cancellationToken = default)
{
return await _context.Projects
.Include(p => p.Epics)
.ThenInclude(e => e.Stories)
.ThenInclude(s => s.Tasks)
.Where(p => p.Epics.Any(e => e.Stories.Any(s => s.Tasks.Any(t => t.Id == taskId))))
.FirstOrDefaultAsync(cancellationToken);
}
public async Task AddAsync(Project project, CancellationToken cancellationToken = default)
{
await _context.Projects.AddAsync(project, cancellationToken);