diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2026-09-13 13:22:20 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2026-09-13 13:22:20 +1000 |
| commit | df0737e55afeb5c01eb39909605970d1d3a73ffc (patch) | |
| tree | 09823eaa310c60eefd2420dc305acae45c81900f /src/marlin.web/Controllers/VCSController.cs | |
| parent | ee69ce25b2fba871920260028bb10c2d6b62b26f (diff) | |
refactor: cleanup; feat: connection to agent
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) { |
