Skip to content

Commit f93c385

Browse files
committed
HMS-9959: support extended release versions for templates
1 parent 3b661af commit f93c385

13 files changed

Lines changed: 184 additions & 23 deletions

_playwright-tests/test-utils/src/client/models/ApiTemplateRequest.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,18 @@ export interface ApiTemplateRequest {
3737
* @memberof ApiTemplateRequest
3838
*/
3939
description?: string;
40+
/**
41+
* Extended release type (eus, e4s)
42+
* @type {string}
43+
* @memberof ApiTemplateRequest
44+
*/
45+
extendedRelease?: string;
46+
/**
47+
* Extended release version (9.4, 9.6, etc.)
48+
* @type {string}
49+
* @memberof ApiTemplateRequest
50+
*/
51+
extendedReleaseVersion?: string;
4052
/**
4153
* Name of the template
4254
* @type {string}
@@ -87,6 +99,8 @@ export function ApiTemplateRequestFromJSONTyped(json: any, ignoreDiscriminator:
8799
'arch': json['arch'],
88100
'date': json['date'] == null ? undefined : json['date'],
89101
'description': json['description'] == null ? undefined : json['description'],
102+
'extendedRelease': json['extended_release'] == null ? undefined : json['extended_release'],
103+
'extendedReleaseVersion': json['extended_release_version'] == null ? undefined : json['extended_release_version'],
90104
'name': json['name'],
91105
'repositoryUuids': json['repository_uuids'],
92106
'useLatest': json['use_latest'] == null ? undefined : json['use_latest'],
@@ -108,6 +122,8 @@ export function ApiTemplateRequestToJSONTyped(value?: ApiTemplateRequest | null,
108122
'arch': value['arch'],
109123
'date': value['date'],
110124
'description': value['description'],
125+
'extended_release': value['extendedRelease'],
126+
'extended_release_version': value['extendedReleaseVersion'],
111127
'name': value['name'],
112128
'repository_uuids': value['repositoryUuids'],
113129
'use_latest': value['useLatest'],

_playwright-tests/test-utils/src/client/models/ApiTemplateResponse.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ export interface ApiTemplateResponse {
6464
* @memberof ApiTemplateResponse
6565
*/
6666
description?: string;
67+
/**
68+
* Extended release type (eus, e4s)
69+
* @type {string}
70+
* @memberof ApiTemplateResponse
71+
*/
72+
extendedRelease?: string;
73+
/**
74+
* Extended release version (9.4, 9.6, etc.)
75+
* @type {string}
76+
* @memberof ApiTemplateResponse
77+
*/
78+
extendedReleaseVersion?: string;
6779
/**
6880
* Error of last update_latest_snapshot task that updated the template
6981
* @type {string}
@@ -178,6 +190,8 @@ export function ApiTemplateResponseFromJSONTyped(json: any, ignoreDiscriminator:
178190
'createdBy': json['created_by'] == null ? undefined : json['created_by'],
179191
'date': json['date'] == null ? undefined : json['date'],
180192
'description': json['description'] == null ? undefined : json['description'],
193+
'extendedRelease': json['extended_release'] == null ? undefined : json['extended_release'],
194+
'extendedReleaseVersion': json['extended_release_version'] == null ? undefined : json['extended_release_version'],
181195
'lastUpdateSnapshotError': json['last_update_snapshot_error'] == null ? undefined : json['last_update_snapshot_error'],
182196
'lastUpdateTask': json['last_update_task'] == null ? undefined : ApiTaskInfoResponseFromJSON(json['last_update_task']),
183197
'lastUpdateTaskUuid': json['last_update_task_uuid'] == null ? undefined : json['last_update_task_uuid'],
@@ -212,6 +226,8 @@ export function ApiTemplateResponseToJSONTyped(value?: Omit<ApiTemplateResponse,
212226
'created_by': value['createdBy'],
213227
'date': value['date'],
214228
'description': value['description'],
229+
'extended_release': value['extendedRelease'],
230+
'extended_release_version': value['extendedReleaseVersion'],
215231
'last_update_snapshot_error': value['lastUpdateSnapshotError'],
216232
'last_update_task': ApiTaskInfoResponseToJSON(value['lastUpdateTask']),
217233
'last_update_task_uuid': value['lastUpdateTaskUuid'],

api/docs.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5355,6 +5355,14 @@ const docTemplate = `{
53555355
"description": "Description of the template",
53565356
"type": "string"
53575357
},
5358+
"extended_release": {
5359+
"description": "Extended release type (eus, e4s)",
5360+
"type": "string"
5361+
},
5362+
"extended_release_version": {
5363+
"description": "Extended release version (9.4, 9.6, etc.)",
5364+
"type": "string"
5365+
},
53585366
"name": {
53595367
"description": "Name of the template",
53605368
"type": "string"
@@ -5399,6 +5407,14 @@ const docTemplate = `{
53995407
"description": "Description of the template",
54005408
"type": "string"
54015409
},
5410+
"extended_release": {
5411+
"description": "Extended release type (eus, e4s)",
5412+
"type": "string"
5413+
},
5414+
"extended_release_version": {
5415+
"description": "Extended release version (9.4, 9.6, etc.)",
5416+
"type": "string"
5417+
},
54025418
"last_update_snapshot_error": {
54035419
"description": "Error of last update_latest_snapshot task that updated the template",
54045420
"type": "string"

api/openapi.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,14 @@
17371737
"description": "Description of the template",
17381738
"type": "string"
17391739
},
1740+
"extended_release": {
1741+
"description": "Extended release type (eus, e4s)",
1742+
"type": "string"
1743+
},
1744+
"extended_release_version": {
1745+
"description": "Extended release version (9.4, 9.6, etc.)",
1746+
"type": "string"
1747+
},
17401748
"name": {
17411749
"description": "Name of the template",
17421750
"type": "string"
@@ -1787,6 +1795,14 @@
17871795
"description": "Description of the template",
17881796
"type": "string"
17891797
},
1798+
"extended_release": {
1799+
"description": "Extended release type (eus, e4s)",
1800+
"type": "string"
1801+
},
1802+
"extended_release_version": {
1803+
"description": "Extended release version (9.4, 9.6, etc.)",
1804+
"type": "string"
1805+
},
17901806
"last_update_snapshot_error": {
17911807
"description": "Error of last update_latest_snapshot task that updated the template",
17921808
"type": "string"

db/migrations.latest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20260116141110
1+
20260123120000
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
BEGIN;
2+
3+
ALTER TABLE templates
4+
DROP COLUMN IF EXISTS extended_release,
5+
DROP COLUMN IF EXISTS extended_release_version;
6+
7+
COMMIT;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
BEGIN;
2+
3+
ALTER TABLE templates
4+
ADD COLUMN IF NOT EXISTS extended_release VARCHAR(10) DEFAULT NULL,
5+
ADD COLUMN IF NOT EXISTS extended_release_version VARCHAR(10) DEFAULT NULL;
6+
7+
COMMIT;

pkg/api/templates.go

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ import (
99
)
1010

1111
type TemplateRequest struct {
12-
UUID *string `json:"uuid" readonly:"true" swaggerignore:"true"`
13-
Name *string `json:"name" validate:"required"` // Name of the template
14-
Description *string `json:"description"` // Description of the template
15-
RepositoryUUIDS []string `json:"repository_uuids" validate:"required"` // Repositories to add to the template
16-
Arch *string `json:"arch" validate:"required"` // Architecture of the template
17-
Version *string `json:"version" validate:"required"` // Version of the template
18-
Date *EmptiableDate `json:"date"` // Latest date to include snapshots for
19-
OrgID *string `json:"org_id" readonly:"true" swaggerignore:"true"` // Organization ID of the owner
20-
User *string `json:"created_by" readonly:"true" swaggerignore:"true"` // User creating the template
21-
UseLatest *bool `json:"use_latest"` // Use latest snapshot for all repositories in the template
12+
UUID *string `json:"uuid" readonly:"true" swaggerignore:"true"`
13+
Name *string `json:"name" validate:"required"` // Name of the template
14+
Description *string `json:"description"` // Description of the template
15+
RepositoryUUIDS []string `json:"repository_uuids" validate:"required"` // Repositories to add to the template
16+
Arch *string `json:"arch" validate:"required"` // Architecture of the template
17+
Version *string `json:"version" validate:"required"` // Version of the template
18+
ExtendedRelease *string `json:"extended_release"` // Extended release type (eus, e4s)
19+
ExtendedReleaseVersion *string `json:"extended_release_version"` // Extended release version (9.4, 9.6, etc.)
20+
Date *EmptiableDate `json:"date"` // Latest date to include snapshots for
21+
OrgID *string `json:"org_id" readonly:"true" swaggerignore:"true"` // Organization ID of the owner
22+
User *string `json:"created_by" readonly:"true" swaggerignore:"true"` // User creating the template
23+
UseLatest *bool `json:"use_latest"` // Use latest snapshot for all repositories in the template
2224
}
2325

2426
type TemplateResponse struct {
@@ -28,6 +30,8 @@ type TemplateResponse struct {
2830
Description string `json:"description"` // Description of the template
2931
Arch string `json:"arch"` // Architecture of the template
3032
Version string `json:"version"` // Version of the template
33+
ExtendedRelease string `json:"extended_release,omitempty"` // Extended release type (eus, e4s)
34+
ExtendedReleaseVersion string `json:"extended_release_version,omitempty"` // Extended release version (9.4, 9.6, etc.)
3135
Date time.Time `json:"date"` // Latest date to include snapshots for
3236
RepositoryUUIDS []string `json:"repository_uuids"` // Repositories added to the template
3337
Snapshots []SnapshotResponse `json:"snapshots,omitempty" readonly:"true"` // The list of snapshots in use by the template
@@ -69,13 +73,15 @@ func (r *TemplateCollectionResponse) SetMetadata(meta ResponseMetadata, links Li
6973
}
7074

7175
type TemplateFilterData struct {
72-
Name string `json:"name"` // Filter templates by name using an exact match.
73-
Arch string `json:"arch"` // Filter templates by arch using an exact match.
74-
Version string `json:"version"` // Filter templates by version using an exact match.
75-
Search string `json:"search"` // Search string based query to optionally filter on
76-
RepositoryUUIDs []string `json:"repository_uuids"` // List templates that contain one or more of these Repositories
77-
SnapshotUUIDs []string `json:"snapshot_uuids"` // List templates that contain one or more of these Snapshots
78-
UseLatest bool `json:"use_latest"` // List templates that have use_latest set to true
76+
Name string `json:"name"` // Filter templates by name using an exact match.
77+
Arch string `json:"arch"` // Filter templates by arch using an exact match.
78+
Version string `json:"version"` // Filter templates by version using an exact match.
79+
ExtendedRelease string `json:"extended_release"` // Filter templates by extended release type using an exact match.
80+
ExtendedReleaseVersion string `json:"extended_release_version"` // Filter templates by extended release version using an exact match.
81+
Search string `json:"search"` // Search string based query to optionally filter on
82+
RepositoryUUIDs []string `json:"repository_uuids"` // List templates that contain one or more of these Repositories
83+
SnapshotUUIDs []string `json:"snapshot_uuids"` // List templates that contain one or more of these Snapshots
84+
UseLatest bool `json:"use_latest"` // List templates that have use_latest set to true
7985
}
8086

8187
// Provides defaults if not provided during PUT request

pkg/dao/templates.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@ func (t templateDaoImpl) filteredDbForList(orgID string, filteredDB *gorm.DB, fi
400400
if filterData.Version != "" {
401401
filteredDB = filteredDB.Where("version = ?", filterData.Version)
402402
}
403+
if filterData.ExtendedRelease != "" {
404+
filteredDB = filteredDB.Where("extended_release = ?", filterData.ExtendedRelease)
405+
}
406+
if filterData.ExtendedReleaseVersion != "" {
407+
filteredDB = filteredDB.Where("extended_release_version = ?", filterData.ExtendedReleaseVersion)
408+
}
403409
if filterData.Search != "" {
404410
containsSearch := "%" + filterData.Search + "%"
405411
filteredDB = filteredDB.
@@ -761,6 +767,12 @@ func templatesCreateApiToModel(api api.TemplateRequest, model *models.Template)
761767
if api.UseLatest != nil {
762768
model.UseLatest = *api.UseLatest
763769
}
770+
if api.ExtendedRelease != nil {
771+
model.ExtendedRelease = *api.ExtendedRelease
772+
}
773+
if api.ExtendedReleaseVersion != nil {
774+
model.ExtendedReleaseVersion = *api.ExtendedReleaseVersion
775+
}
764776
}
765777

766778
func templatesUpdateApiToModel(api api.TemplateUpdateRequest, model *models.Template) {
@@ -793,6 +805,8 @@ func templatesModelToApi(model models.Template, apiTemplate *api.TemplateRespons
793805
apiTemplate.Description = model.Description
794806
apiTemplate.Version = model.Version
795807
apiTemplate.Arch = model.Arch
808+
apiTemplate.ExtendedRelease = model.ExtendedRelease
809+
apiTemplate.ExtendedReleaseVersion = model.ExtendedReleaseVersion
796810
apiTemplate.Date = model.Date.UTC()
797811
apiTemplate.CreatedBy = model.CreatedBy
798812
apiTemplate.LastUpdatedBy = model.LastUpdatedBy

pkg/handler/templates.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,12 @@ func (th *TemplateHandler) update(c echo.Context, fillDefaults bool) error {
224224

225225
func ParseTemplateFilters(c echo.Context) api.TemplateFilterData {
226226
filterData := api.TemplateFilterData{
227-
Name: "",
228-
Version: "",
229-
Arch: "",
230-
Search: "",
227+
Name: "",
228+
Version: "",
229+
Arch: "",
230+
Search: "",
231+
ExtendedRelease: "",
232+
ExtendedReleaseVersion: "",
231233
}
232234
repositoryUUIDs := ""
233235
snapshotUUIDs := ""
@@ -239,6 +241,8 @@ func ParseTemplateFilters(c echo.Context) api.TemplateFilterData {
239241
String("repository_uuids", &repositoryUUIDs).
240242
String("snapshot_uuids", &snapshotUUIDs).
241243
Bool("use_latest", &filterData.UseLatest).
244+
String("extended_release", &filterData.ExtendedRelease).
245+
String("extended_release_version", &filterData.ExtendedReleaseVersion).
242246
BindError()
243247

244248
if err != nil {

0 commit comments

Comments
 (0)