diff --git a/infr-project/application/platform_convert.go b/infr-project/application/platform_convert.go index 8bad48e3..5476ac9e 100644 --- a/infr-project/application/platform_convert.go +++ b/infr-project/application/platform_convert.go @@ -307,6 +307,7 @@ func (s *PlatformService) mergeProject(providerProject *platformProvider.Project modelProject := models.PlatformProject{} if project != nil { modelProject.Id = project.Id + modelProject.Description = project.Description modelProject.Name = project.Name modelProject.Secrets = s.convertToPlatformModelSecrets(project.Secrets) modelProject.Webhooks = s.convertToPlatformModelWebhooks(project.Webhooks) @@ -320,6 +321,10 @@ func (s *PlatformService) mergeProject(providerProject *platformProvider.Project if len(modelProject.Name) == 0 { modelProject.Name = providerProject.Name } + if len(modelProject.Description) == 0 { + modelProject.Description = providerProject.Description + } + modelProject.Url = providerProject.Url modelProject.ProviderProjectId = providerProject.ID modelProject.Environments = s.convertToPlatformModelEnvironments(providerProject.Envs) diff --git a/infr-project/docs/docs.go b/infr-project/docs/docs.go index 2b5fd168..aa5c9b74 100644 --- a/infr-project/docs/docs.go +++ b/infr-project/docs/docs.go @@ -2072,6 +2072,9 @@ const docTemplate = `{ "$ref": "#/definitions/viewmodels.Deployment" } }, + "description": { + "type": "string" + }, "environments": { "type": "array", "items": { diff --git a/infr-project/docs/swagger.json b/infr-project/docs/swagger.json index 69d3edf5..09bf5563 100644 --- a/infr-project/docs/swagger.json +++ b/infr-project/docs/swagger.json @@ -2061,6 +2061,9 @@ "$ref": "#/definitions/viewmodels.Deployment" } }, + "description": { + "type": "string" + }, "environments": { "type": "array", "items": { diff --git a/infr-project/docs/swagger.yaml b/infr-project/docs/swagger.yaml index 541835fd..5a8e525e 100644 --- a/infr-project/docs/swagger.yaml +++ b/infr-project/docs/swagger.yaml @@ -407,6 +407,8 @@ definitions: items: $ref: '#/definitions/viewmodels.Deployment' type: array + description: + type: string environments: items: $ref: '#/definitions/viewmodels.ProjectEnv' diff --git a/infr-project/platform/project.go b/infr-project/platform/project.go index bab2017e..88847ab4 100644 --- a/infr-project/platform/project.go +++ b/infr-project/platform/project.go @@ -7,6 +7,7 @@ type PlatformProject struct { Id string `json:"id" bson:"id"` Name string `json:"name" bson:"name"` Url string `json:"url" bson:"url"` + Description string `json:"description" bson:"description"` Properties map[string]Property `json:"properties" bson:"properties"` Secrets map[string]Secret `json:"secrets" bson:"secrets"` Webhooks []Webhook `json:"webhooks" bson:"webhooks"` @@ -31,6 +32,12 @@ func WithProjectSecrets(secrets map[string]Secret) ProjectOption { } } +func WithProjectDescription(description string) ProjectOption { + return func(w *PlatformProject) { + w.Description = description + } +} + func NewPlatformProject(id string, name string, url string, opts ...ProjectOption) *PlatformProject { project := &PlatformProject{ Id: id, @@ -52,6 +59,11 @@ func (w *PlatformProject) UpdateName(name string) *PlatformProject { return w } +func (w *PlatformProject) UpdateDescription(description string) *PlatformProject { + w.Description = description + return w +} + func (w *PlatformProject) UpdateUrl(url string) *PlatformProject { w.Url = url return w diff --git a/infr-project/platform/serialization_project.go b/infr-project/platform/serialization_project.go index cfc3e571..3aab3860 100644 --- a/infr-project/platform/serialization_project.go +++ b/infr-project/platform/serialization_project.go @@ -48,6 +48,10 @@ func makePlatformProjectEntity(r *PlatformProject, m map[string]interface{}, mar r.Url = value } + if value, ok := m["description"].(string); ok { + r.Description = value + } + if value, ok := m["provider_project_id"].(string); ok { r.ProviderProjectId = value } @@ -107,6 +111,7 @@ func makePlatformProjectMap(r *PlatformProject) map[string]interface{} { "secrets": secrets, "webhooks": r.Webhooks, "provider_project_id": r.ProviderProjectId, + "description": r.Description, } return m diff --git a/infr-project/view_models/platform.go b/infr-project/view_models/platform.go index 8e330e73..6108cf7a 100644 --- a/infr-project/view_models/platform.go +++ b/infr-project/view_models/platform.go @@ -83,6 +83,7 @@ type PlatformProject struct { Id string `json:"id"` Name string `json:"name"` Url string `json:"url"` + Description string `json:"description"` Properties []Property `json:"properties"` Secrets []Secret `json:"secrets"` Webhooks []Webhook `json:"webhooks"`