Skip to content

Commit

Permalink
project: support new required updatedAt arg
Browse files Browse the repository at this point in the history
updated_at is required on project update call
  • Loading branch information
talset committed Mar 29, 2023
1 parent 6e3c58e commit c20063e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/cycloid/middleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ type Middleware interface {
DeleteProject(org, project string) error
GetProject(org string, project string) (*models.Project, error)
ListProjects(org string) ([]*models.Project, error)
UpdateProject(org, projectName, projectCanonical string, envs []*models.NewEnvironment, description, stackRef, owner, configRepo string) (*models.Project, error)
UpdateProject(org, projectName, projectCanonical string, envs []*models.NewEnvironment, description, stackRef, owner, configRepo string, updatedAt uint64) (*models.Project, error)

DeleteRole(org, role string) error
GetRole(org, role string) (*models.Role, error)
Expand Down
3 changes: 2 additions & 1 deletion cmd/cycloid/middleware/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (m *middleware) CreateProject(org, projectName, projectCanonical, env, pipe
return d, err
}

func (m *middleware) UpdateProject(org, projectName, projectCanonical string, envs []*models.NewEnvironment, description, stackRef, owner, configRepo string) (*models.Project, error) {
func (m *middleware) UpdateProject(org, projectName, projectCanonical string, envs []*models.NewEnvironment, description, stackRef, owner, configRepo string, updatedAt uint64) (*models.Project, error) {

params := organization_projects.NewUpdateProjectParams()
params.SetOrganizationCanonical(org)
Expand All @@ -138,6 +138,7 @@ func (m *middleware) UpdateProject(org, projectName, projectCanonical string, en
ConfigRepositoryCanonical: configRepo,
Environments: envs,
Owner: owner,
UpdatedAt: &updatedAt,
}

err := body.Validate(strfmt.Default)
Expand Down
3 changes: 2 additions & 1 deletion cmd/cycloid/projects/create-env.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ func createEnv(cmd *cobra.Command, args []string) error {
projectData.Description,
*projectData.ServiceCatalog.Ref,
*projectData.Owner.Username,
projectData.ConfigRepositoryCanonical)
projectData.ConfigRepositoryCanonical,
*projectData.UpdatedAt)

err = printer.SmartPrint(p, nil, err, "unable to update project", printer.Options{}, cmd.OutOrStdout())
if err != nil {
Expand Down

0 comments on commit c20063e

Please sign in to comment.