From ae768108939e2bd143fd9c4c14a59ce6c498e120 Mon Sep 17 00:00:00 2001 From: MUzairS15 Date: Thu, 13 Jun 2024 22:30:53 +0530 Subject: [PATCH 1/2] change version to v1alpha1 and add class property Signed-off-by: MUzairS15 --- .../catalog/{v1beta1 => v1alpha1}/catalog.go | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) rename models/catalog/{v1beta1 => v1alpha1}/catalog.go (75%) diff --git a/models/catalog/v1beta1/catalog.go b/models/catalog/v1alpha1/catalog.go similarity index 75% rename from models/catalog/v1beta1/catalog.go rename to models/catalog/v1alpha1/catalog.go index 3de4b7aa..f3416386 100644 --- a/models/catalog/v1beta1/catalog.go +++ b/models/catalog/v1alpha1/catalog.go @@ -1,4 +1,4 @@ -package v1beta1 +package v1alpha1 import ( "database/sql/driver" @@ -9,6 +9,7 @@ import ( // CatalogData defines model for catalog_data. type CatalogData struct { + ContentClass ContentClass `json:"content_class,omitempty"` //Tracks the specific content version that has been made available in the Catalog PublishedVersion string `json:"published_version"` @@ -63,5 +64,39 @@ func (cd *CatalogData) IsNil() bool { return cd == nil || (len(cd.Compatibility) == 0 && cd.PatternCaveats == "" && cd.PatternInfo == "" && - cd.Type == "") + cd.Type == "" && + cd.ContentClass.String() != "") } + +type ContentClass string + +const ( + Official ContentClass = "offcial" + Verified ContentClass = "verified" + Project ContentClass = "project" + Community ContentClass = "community" +) + +func (c ContentClass) String() string { + switch c { + case Official: + return "official" + case Verified: + return "verified" + case Project: + return "Project" + case Community: + fallthrough + default: + return "community" + } +} + +func GetCatalogClasses() []ContentClass { + return []ContentClass{ + Official, + Verified, + Project, + Community, + } +} \ No newline at end of file From 42a02875aa46d526af0eef54cca95c24df4337b1 Mon Sep 17 00:00:00 2001 From: Mohd Uzair Date: Sat, 15 Jun 2024 18:31:06 +0530 Subject: [PATCH 2/2] Update models/catalog/v1alpha1/catalog.go Co-authored-by: Lee Calcote Signed-off-by: Mohd Uzair --- models/catalog/v1alpha1/catalog.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/catalog/v1alpha1/catalog.go b/models/catalog/v1alpha1/catalog.go index f3416386..ba4c9b5b 100644 --- a/models/catalog/v1alpha1/catalog.go +++ b/models/catalog/v1alpha1/catalog.go @@ -71,7 +71,7 @@ func (cd *CatalogData) IsNil() bool { type ContentClass string const ( - Official ContentClass = "offcial" + Official ContentClass = "official" Verified ContentClass = "verified" Project ContentClass = "project" Community ContentClass = "community"