Skip to content

Commit

Permalink
Added peoject description
Browse files Browse the repository at this point in the history
  • Loading branch information
futugyou committed Jan 9, 2025
1 parent ead2078 commit 003f25a
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 0 deletions.
5 changes: 5 additions & 0 deletions infr-project/application/platform_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions infr-project/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2072,6 +2072,9 @@ const docTemplate = `{
"$ref": "#/definitions/viewmodels.Deployment"
}
},
"description": {
"type": "string"
},
"environments": {
"type": "array",
"items": {
Expand Down
3 changes: 3 additions & 0 deletions infr-project/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2061,6 +2061,9 @@
"$ref": "#/definitions/viewmodels.Deployment"
}
},
"description": {
"type": "string"
},
"environments": {
"type": "array",
"items": {
Expand Down
2 changes: 2 additions & 0 deletions infr-project/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ definitions:
items:
$ref: '#/definitions/viewmodels.Deployment'
type: array
description:
type: string
environments:
items:
$ref: '#/definitions/viewmodels.ProjectEnv'
Expand Down
12 changes: 12 additions & 0 deletions infr-project/platform/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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,
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions infr-project/platform/serialization_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions infr-project/view_models/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 003f25a

Please sign in to comment.