photoprism/internal/entity/query/lens.go
Keith Martin c3eda657fd
Metadata: Add Lens Make and Model updates via CLI & API #5644 #5656
Adds the ability to override a lens's Make/Model (e.g. fixing Pentax lenses that ExifTool decodes as `4 38`) via a new photoprism lenses update CLI command and a `PUT /api/v1/lenses/:id endpoint`, plus a `GET /api/v1/lenses` search endpoint, a new lenses ACL resource, and an lenses ls list command.
2026-06-15 09:37:32 +02:00

35 lines
588 B
Go

package query
import (
"github.com/photoprism/photoprism/internal/entity"
)
// FindLensBySlug returns an existing entity if exists.
func FindLensBySlug(slug string) *entity.Lens {
if slug == "" {
return nil
}
l := entity.Lens{}
if err := Db().Where("lens_slug = ?", slug).First(&l).Error; err != nil {
return nil
}
return &l
}
// FindLensByID returns an existing entity if exists.
func FindLensByID(id uint) *entity.Lens {
if id == 0 {
return nil
}
l := entity.Lens{}
if err := Db().Where("id = ?", id).First(&l).Error; err != nil {
return nil
}
return &l
}