-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!(software): change model and properly implement PATCH (#138)
* Introduce the `url` and `alias` fields instead of a single `urls` field, to better express the concepts. * Implement PATCH with application/merge-patch+json semantics. * Don't soft delete Software and SoftwareURLs: because of the unique columns it wouldn't be possible to add a software with a previously used (and deleted) object, because is still there, albeit invisible to the API users. * Manually handle SoftwareURLs associations, because Update(&software) is not smart enough to synch the associations and remove them when necessary. Replace() with Session(&gorm.Session{FullSaveAssociations: true}) doesn't work either because the foreign key is set to null instead of being deleted and, more importantly, wouldn't even work with our NOT NULL constraint on that foreign key. (go-gorm/gorm#4010 (comment)) * Add tests
- Loading branch information
Showing
10 changed files
with
441 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.