Skip to content

Commit

Permalink
fix(Project): Map string to null
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaunEgan committed Aug 2, 2021
1 parent 0669275 commit 2bc0605
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions models.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Project struct {
Id string `json:"id"`
Name string `json:"name"`
Framework string `json:"framework"`
RootDirectory *string `json:"rootDirectory"`
RootDirectory string `json:"rootDirectory"`
NodeVersion string `json:"nodeVersion"`
AccountId string `json:"accountId"`
UpdatedAt int64 `json:"updatedAt"`
Expand All @@ -37,7 +37,7 @@ type CreateProjectOptions struct {
Framework string
RepositoryType string
RepositoryName string
RootDirectory *string
RootDirectory string
}

type CreateProjectRequest struct {
Expand Down
7 changes: 5 additions & 2 deletions projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ func (p *ProjectApi) CreateProject(ctx context.Context, options *CreateProjectOp
body := &CreateProjectRequest{
Name: options.Name,
Framework: options.Framework,
RootDirectory: options.RootDirectory,
}

if options.RepositoryType != "" && options.RepositoryName != "" {
Expand All @@ -35,6 +34,10 @@ func (p *ProjectApi) CreateProject(ctx context.Context, options *CreateProjectOp
}
}

if options.RootDirectory != "" {
body.RootDirectory = &options.RootDirectory
}

payload, err := json.Marshal(body)
if err != nil {
return nil, err
Expand Down Expand Up @@ -86,7 +89,7 @@ func (p *ProjectApi) UpdateProject(ctx context.Context, name string, project *Pr

body := &UpdateProjectRequest{
Framework: project.Framework,
RootDirectory: project.RootDirectory,
RootDirectory: &project.RootDirectory,
}
payload, err := json.Marshal(body)
if err != nil {
Expand Down

0 comments on commit 2bc0605

Please sign in to comment.