Skip to content

feat(api): Snapshot complete CRUD + enhanced SnapshotInfo #3456

Description

@AdaAibaby

Problem

GET /snapshots lists snapshots but there is no way to retrieve a single snapshot by ID or delete one. The SnapshotInfo schema only exposes snapshotID and names — users cannot see resource specs (vCPU, RAM, disk) or creation time without listing all snapshots and filtering client-side.

Proposed changes

New endpoints

  • GET /snapshots/{snapshotID} — return SnapshotInfo for a single snapshot (404 if not found or not owned by team)
  • DELETE /snapshots/{snapshotID} — soft-delete a snapshot template, release its aliases, return 204

Enhanced SnapshotInfo

Add four fields populated from the existing ListTeamSnapshotTemplatesRow query result (no new DB queries needed):

Field Source column
cpuCount vcpu
memoryMB ram_mb
diskSizeMB total_disk_size_mb
createdAt created_at

Implementation notes

  • GET handler resolves the alias via templateCache.ResolveAlias (same path as POST /snapshots/{id}/fork) then calls ListTeamSnapshotTemplates with PageLimit=1.
  • DELETE handler reuses the existing unexported softDeleteTemplate helper from template_delete.go and invalidates the template cache.
  • api.gen.go is manually maintained (not regenerated from spec); updated by hand following existing patterns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions