diff options
Diffstat (limited to 'src/marlin.web/Controllers/VCSController.cs')
| -rw-r--r-- | src/marlin.web/Controllers/VCSController.cs | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/marlin.web/Controllers/VCSController.cs b/src/marlin.web/Controllers/VCSController.cs index 7370e0d..8086e99 100644 --- a/src/marlin.web/Controllers/VCSController.cs +++ b/src/marlin.web/Controllers/VCSController.cs @@ -27,15 +27,16 @@ public class VCSController(ApplicationDbContext dbContext, VersionControlSyncSer [HttpGet("details/{id}")] public async Task<IActionResult> Details(Guid id, CancellationToken ct) { - var item = await dbContext.Sources + var item = await dbContext + .Sources .Include(x => x.Branches) .ThenInclude(x => x.Commit) + .ThenInclude(x => x.WorkflowSnapshot) .FirstOrDefaultAsync(x => x.Id == id, ct); if (item == null) return this.NotFound(); - // Only Id/Label projected — a secret's Content never needs to leave the secrets pages. var secretOptions = await dbContext.Secrets .Where(x => x.SourceId == id) .Select(x => new SecretOption(x.Id, x.Label)) @@ -44,6 +45,37 @@ public class VCSController(ApplicationDbContext dbContext, VersionControlSyncSer return this.View((item, secretOptions)); } + [HttpGet("details/{sourceId}/{commitId}/blobs")] + public async Task<IActionResult> Blobs(Guid sourceId, Guid commitId) + { + var blobs = await dbContext + .SourceBlobs + .Include(x => x.Commit) + .ThenInclude(x => x.Source) + .Where(x => x.CommitId == commitId && x.SourceId == sourceId) + .ToListAsync(); + + if (!blobs.Any()) + return this.NotFound(); + + return this.View(blobs); + } + + [HttpGet("details/{sourceId}/{commitId}/workflow")] + public async Task<IActionResult> Workflow(Guid sourceId, Guid commitId) + { + var snapshot = await dbContext + .WorkflowSnapshots + .Include(x => x.Commit) + .ThenInclude(x => x.Source) + .FirstOrDefaultAsync(x => x.CommitId == commitId && x.Commit.SourceId == sourceId); + + if (snapshot == null) + return this.NotFound(); + + return this.View(snapshot); + } + [HttpPost("edit/{id}")] public async Task<IActionResult> Edit(Guid id, VersionControlSource vcs, CancellationToken ct) { |
