Backend: View and edit archived photos
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
6a2f4f6b51
commit
6941028c4f
2 changed files with 4 additions and 4 deletions
|
@ -77,7 +77,7 @@ func SavePhoto(model Photo, form form.Photo, db *gorm.DB) error {
|
|||
|
||||
model.IndexKeywords(db)
|
||||
|
||||
return db.Save(&model).Error
|
||||
return db.Unscoped().Save(&model).Error
|
||||
}
|
||||
|
||||
// BeforeCreate computes a unique UUID, and set a default takenAt before indexing a new photo
|
||||
|
|
|
@ -347,7 +347,7 @@ func (q *Query) Photos(f form.PhotoSearch) (results []PhotoResult, err error) {
|
|||
|
||||
// PhotoByID returns a Photo based on the ID.
|
||||
func (q *Query) PhotoByID(photoID uint64) (photo entity.Photo, err error) {
|
||||
if err := q.db.Where("id = ?", photoID).Preload("Links").Preload("Description").First(&photo).Error; err != nil {
|
||||
if err := q.db.Unscoped().Where("id = ?", photoID).Preload("Links").Preload("Description").First(&photo).Error; err != nil {
|
||||
return photo, err
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ func (q *Query) PhotoByID(photoID uint64) (photo entity.Photo, err error) {
|
|||
|
||||
// PhotoByUUID returns a Photo based on the UUID.
|
||||
func (q *Query) PhotoByUUID(photoUUID string) (photo entity.Photo, err error) {
|
||||
if err := q.db.Where("photo_uuid = ?", photoUUID).Preload("Links").Preload("Description").First(&photo).Error; err != nil {
|
||||
if err := q.db.Unscoped().Where("photo_uuid = ?", photoUUID).Preload("Links").Preload("Description").First(&photo).Error; err != nil {
|
||||
return photo, err
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ func (q *Query) PhotoByUUID(photoUUID string) (photo entity.Photo, err error) {
|
|||
|
||||
// PreloadPhotoByUUID returns a Photo based on the UUID with all dependencies preloaded.
|
||||
func (q *Query) PreloadPhotoByUUID(photoUUID string) (photo entity.Photo, err error) {
|
||||
if err := q.db.Where("photo_uuid = ?", photoUUID).
|
||||
if err := q.db.Unscoped().Where("photo_uuid = ?", photoUUID).
|
||||
Preload("Labels", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Order("photos_labels.label_uncertainty ASC, photos_labels.label_id DESC")
|
||||
}).
|
||||
|
|
Loading…
Reference in a new issue