Skip to content

Commit f359e53

Browse files
committed
feat: return templates that are building for the first time
1 parent 42288c5 commit f359e53

File tree

7 files changed

+132
-117
lines changed

7 files changed

+132
-117
lines changed

packages/api/internal/api/spec.gen.go

Lines changed: 98 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/api/internal/api/types.gen.go

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/api/internal/handlers/templates_list.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func (a *APIStore) GetTemplates(c *gin.Context, params api.GetTemplatesParams) {
8585
LastSpawnedAt: item.Env.LastSpawnedAt,
8686
SpawnCount: item.Env.SpawnCount,
8787
BuildCount: item.Env.BuildCount,
88+
BuildStatus: api.TemplateBuildStatus(item.BuildStatus),
8889
CreatedBy: createdBy,
8990
EnvdVersion: envdVersion,
9091
})

packages/db/queries/get_team_templates.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- name: GetTeamTemplates :many
22
SELECT sqlc.embed(e),
3-
eb.id as build_id, eb.vcpu as build_vcpu, eb.ram_mb as build_ram_mb, eb.total_disk_size_mb as build_total_disk_size_mb, eb.envd_version as build_envd_version, eb.firecracker_version as build_firecracker_version,
3+
eb.id as build_id, eb.vcpu as build_vcpu, eb.ram_mb as build_ram_mb, eb.total_disk_size_mb as build_total_disk_size_mb, eb.envd_version as build_envd_version, eb.firecracker_version as build_firecracker_version, eb.status as build_status,
44
u.id as creator_id, u.email as creator_email,
55
COALESCE(ea.aliases, ARRAY[]::text[])::text[] AS aliases
66
FROM public.envs AS e
@@ -13,7 +13,7 @@ LEFT JOIN LATERAL (
1313
LEFT JOIN LATERAL (
1414
SELECT b.*
1515
FROM public.env_builds AS b
16-
WHERE b.env_id = e.id AND b.status = 'uploaded'
16+
WHERE b.env_id = e.id
1717
ORDER BY b.finished_at DESC
1818
LIMIT 1
1919
) eb ON TRUE

packages/db/queries/get_team_templates.sql.go

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/openapi.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ components:
540540
- buildCount
541541
- envdVersion
542542
- aliases
543+
- buildStatus
543544
properties:
544545
templateID:
545546
type: string
@@ -588,6 +589,8 @@ components:
588589
description: Number of times the template was built
589590
envdVersion:
590591
$ref: "#/components/schemas/EnvdVersion"
592+
buildStatus:
593+
$ref: "#/components/schemas/TemplateBuildStatus"
591594

592595
TemplateBuildRequest:
593596
required:
@@ -800,6 +803,15 @@ components:
800803
items:
801804
$ref: "#/components/schemas/BuildLogEntry"
802805

806+
TemplateBuildStatus:
807+
type: string
808+
description: Status of the template build
809+
enum:
810+
- building
811+
- waiting
812+
- ready
813+
- error
814+
803815
TemplateBuild:
804816
required:
805817
- templateID
@@ -827,13 +839,7 @@ components:
827839
type: string
828840
description: Identifier of the build
829841
status:
830-
type: string
831-
description: Status of the template
832-
enum:
833-
- building
834-
- waiting
835-
- ready
836-
- error
842+
$ref: "#/components/schemas/TemplateBuildStatus"
837843
reason:
838844
$ref: "#/components/schemas/BuildStatusReason"
839845

tests/integration/internal/api/models.gen.go

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)