44 "encoding/json"
55 "fmt"
66
7- openapi_types "github.com/oapi-codegen/runtime/types"
87 "github.com/openshift-hyperfleet/hyperfleet-api/pkg/api"
98 "github.com/openshift-hyperfleet/hyperfleet-api/pkg/api/openapi"
109)
@@ -43,20 +42,6 @@ func ConvertCluster(req *openapi.ClusterCreateRequest) (*api.Cluster, error) {
4342 }, nil
4443}
4544
46- // Helper to convert string to openapi_types.Email
47- func toEmail (s string ) openapi_types.Email {
48- return openapi_types .Email (s )
49- }
50-
51- // Helper to convert *string to *openapi_types.Email (for optional email fields)
52- func toEmailPtr (s * string ) * openapi_types.Email {
53- if s == nil || * s == "" {
54- return nil
55- }
56- e := openapi_types .Email (* s )
57- return & e
58- }
59-
6045// PresentCluster converts api.Cluster (GORM model) to openapi.Cluster
6146func PresentCluster (cluster * api.Cluster ) (openapi.Cluster , error ) {
6247 // Unmarshal Spec
@@ -105,9 +90,9 @@ func PresentCluster(cluster *api.Cluster) (openapi.Cluster, error) {
10590 }
10691
10792 result := openapi.Cluster {
108- CreatedBy : toEmail ( cluster .CreatedBy ) ,
93+ CreatedBy : cluster .CreatedBy ,
10994 CreatedTime : cluster .CreatedTime ,
110- DeletedBy : toEmailPtr ( cluster .DeletedBy ) ,
95+ DeletedBy : cluster .DeletedBy ,
11196 DeletedTime : cluster .DeletedTime ,
11297 Generation : cluster .Generation ,
11398 Href : & href ,
@@ -119,7 +104,7 @@ func PresentCluster(cluster *api.Cluster) (openapi.Cluster, error) {
119104 Status : openapi.ClusterStatus {
120105 Conditions : openapiConditions ,
121106 },
122- UpdatedBy : toEmail ( cluster .UpdatedBy ) ,
107+ UpdatedBy : cluster .UpdatedBy ,
123108 UpdatedTime : cluster .UpdatedTime ,
124109 }
125110
0 commit comments