Skip to content

Commit

Permalink
importing multiple times the same project updates the existing project
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoOliveira committed Apr 15, 2024
1 parent 541df3d commit cacd385
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/downloader/thingiverse/thingiverse.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func Fetch(url string) error {
return err
}

if p, err := database.GetProjectByPathAndName(project.Path, project.Name); err == nil && p.UUID != "" {
project.UUID = p.UUID
}

if err = utils.CreateFolder(utils.ToLibPath(project.FullPath())); err != nil {
log.Println("error creating project folder")
return err
Expand All @@ -66,7 +70,7 @@ func Fetch(url string) error {

project.Initialized = true

return database.InsertProject(project)
return database.UpdateProject(project)
}

func fetchDetails(id string, project *entities.Project, httpClient *http.Client) error {
Expand Down

0 comments on commit cacd385

Please sign in to comment.