diff --git a/frontend/src/common/clipboard.js b/frontend/src/common/clipboard.js index 32d3c8baa..8ca6f398d 100644 --- a/frontend/src/common/clipboard.js +++ b/frontend/src/common/clipboard.js @@ -95,7 +95,7 @@ class Clipboard { } for (let i = rangeStart; i <= rangeEnd; i++) { - this.add(models[i]) + this.add(models[i]); } return (rangeEnd - rangeStart) + 1; diff --git a/frontend/src/model/photo.js b/frontend/src/model/photo.js index dd7a4ca90..3b2837f04 100644 --- a/frontend/src/model/photo.js +++ b/frontend/src/model/photo.js @@ -1,6 +1,5 @@ import Abstract from "model/abstract"; import Api from "common/api"; -import truncate from "truncate"; import { DateTime } from "luxon"; class Photo extends Abstract { @@ -106,10 +105,10 @@ class Photo extends Abstract { getLocation() { if (this.LocDescription) { - return this.LocDescription + return this.LocDescription; } - return "Unknown" + return "Unknown"; } getCamera() { diff --git a/internal/api/album.go b/internal/api/album.go index 4b40b2190..8c6cce5b5 100644 --- a/internal/api/album.go +++ b/internal/api/album.go @@ -94,7 +94,7 @@ func CreateAlbum(router *gin.RouterGroup, conf *config.Config) { event.Publish("count.albums", event.Data{ "count": 1, }) - */ + */ event.Success(fmt.Sprintf("album \"%s\" created", m.AlbumName)) @@ -401,7 +401,6 @@ func DownloadAlbum(router *gin.RouterGroup, conf *config.Config) { }) } - // POST /api/v1/albums/:uuid/thumbnail/:type // // Parameters: diff --git a/internal/api/album_test.go b/internal/api/album_test.go index 19c930576..70af0fcaf 100644 --- a/internal/api/album_test.go +++ b/internal/api/album_test.go @@ -58,7 +58,6 @@ func TestDislikeAlbum(t *testing.T) { }) } - func TestAlbumThumbnail(t *testing.T) { t.Run("invalid type", func(t *testing.T) { app, router, ctx := NewApiTest() diff --git a/internal/api/label.go b/internal/api/label.go index 1fb2c7de0..fec3b2a1e 100644 --- a/internal/api/label.go +++ b/internal/api/label.go @@ -171,7 +171,7 @@ func LabelThumbnail(router *gin.RouterGroup, conf *config.Config) { return } - gc.Set(cacheKey, thumbData, time.Hour * 4) + gc.Set(cacheKey, thumbData, time.Hour*4) log.Debugf("%s cached [%s]", cacheKey, time.Since(start)) diff --git a/internal/entity/category_test.go b/internal/entity/category_test.go index 97745ad77..51a6dfabb 100644 --- a/internal/entity/category_test.go +++ b/internal/entity/category_test.go @@ -1,8 +1,9 @@ package entity import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestCategory_TableName(t *testing.T) { diff --git a/internal/entity/event.go b/internal/entity/event.go index a7da71528..ef5f3cb27 100644 --- a/internal/entity/event.go +++ b/internal/entity/event.go @@ -13,8 +13,8 @@ type Event struct { EventSlug string EventName string EventType string - EventDescription string `gorm:"type:text;"` - EventNotes string `gorm:"type:text;"` + EventDescription string `gorm:"type:text;"` + EventNotes string `gorm:"type:text;"` EventBegin time.Time `gorm:"type:datetime;"` EventEnd time.Time `gorm:"type:datetime;"` EventLat float64 diff --git a/internal/entity/event_test.go b/internal/entity/event_test.go index 1ddbfe4f4..a2e15cffd 100644 --- a/internal/entity/event_test.go +++ b/internal/entity/event_test.go @@ -1,8 +1,9 @@ package entity import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestEvent_TableName(t *testing.T) { diff --git a/internal/entity/keyword_test.go b/internal/entity/keyword_test.go index 1069e19b9..caedf3d91 100644 --- a/internal/entity/keyword_test.go +++ b/internal/entity/keyword_test.go @@ -1,8 +1,9 @@ package entity import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestNewKeyword(t *testing.T) { diff --git a/internal/entity/location.go b/internal/entity/location.go index fe4ab4e5b..8f947e09c 100644 --- a/internal/entity/location.go +++ b/internal/entity/location.go @@ -12,10 +12,10 @@ import ( // Photo location type Location struct { maps.Location - LocNotes string `gorm:"type:text;"` - LocFavorite bool - CreatedAt time.Time - UpdatedAt time.Time + LocNotes string `gorm:"type:text;"` + LocFavorite bool + CreatedAt time.Time + UpdatedAt time.Time } func NewLocation(lat, lng float64) *Location { @@ -33,7 +33,7 @@ func (m *Location) Category() string { } func (m *Location) Find(db *gorm.DB) error { - if err := db.First(m, "id LIKE ?", m.ID + "%").Error; err == nil { + if err := db.First(m, "id LIKE ?", m.ID+"%").Error; err == nil { return err } diff --git a/internal/entity/location_test.go b/internal/entity/location_test.go index 59dfcfdaa..3c4547138 100644 --- a/internal/entity/location_test.go +++ b/internal/entity/location_test.go @@ -1,12 +1,13 @@ package entity import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) func TestLocation_Label(t *testing.T) { - l := NewLocation(1,1) + l := NewLocation(1, 1) l.LocCategory = "restaurant" result := l.Category() diff --git a/internal/maps/countries.go b/internal/maps/countries.go index 95853400c..66cbd963b 100644 --- a/internal/maps/countries.go +++ b/internal/maps/countries.go @@ -251,4 +251,4 @@ var CountryNames = map[string]string{ "ye": "Yemen", "zm": "Zambia", "zw": "Zimbabwe", -} \ No newline at end of file +} diff --git a/internal/maps/location.go b/internal/maps/location.go index 948825a2b..b28a4f76d 100644 --- a/internal/maps/location.go +++ b/internal/maps/location.go @@ -34,11 +34,11 @@ type LocationSource interface { Source() string } -func NewLocation (lat, lng float64) *Location { +func NewLocation(lat, lng float64) *Location { id := OlcEncode(lat, lng) result := &Location{ - ID: id, + ID: id, LocLat: lat, LocLng: lng, } @@ -59,15 +59,21 @@ func (l *Location) Query() error { func (l *Location) Assign(s LocationSource) error { l.LocSource = s.Source() - if l.LocLat == 0 { l.LocLat = s.Latitude() } - if l.LocLng == 0 { l.LocLng = s.Longitude() } + if l.LocLat == 0 { + l.LocLat = s.Latitude() + } + if l.LocLng == 0 { + l.LocLng = s.Longitude() + } if l.Unknown() { l.LocCategory = "unknown" return errors.New("maps: unknown location") } - if l.ID == "" { l.ID = OlcEncode(l.LocLat, l.LocLng) } + if l.ID == "" { + l.ID = OlcEncode(l.LocLat, l.LocLng) + } l.LocTitle = s.Title() l.LocCity = s.City() diff --git a/internal/maps/olc.go b/internal/maps/olc.go index cb4643951..a8213c4ea 100644 --- a/internal/maps/olc.go +++ b/internal/maps/olc.go @@ -4,7 +4,7 @@ import olc "github.com/google/open-location-code/go" var OlcLength = 8 -func OlcEncode (lat, lng float64) string { +func OlcEncode(lat, lng float64) string { if lat < -90 || lat > 90 { log.Warnf("olc: latitude out of range (%f)", lat) return "" diff --git a/internal/maps/osm/title.go b/internal/maps/osm/title.go index 74425efb7..e66d6dd60 100644 --- a/internal/maps/osm/title.go +++ b/internal/maps/osm/title.go @@ -7,7 +7,7 @@ import ( ) var labelTitles = map[string]string{ - "airport": "Airport", + "airport": "Airport", "visitor center": "Visitor Center", } diff --git a/internal/photoprism/exif.go b/internal/photoprism/exif.go index 313005100..3f8d93b2e 100644 --- a/internal/photoprism/exif.go +++ b/internal/photoprism/exif.go @@ -21,22 +21,22 @@ type Exif struct { Artist string CameraMake string CameraModel string - Description string - LensMake string - LensModel string - Flash bool - FocalLength int - Exposure string - Aperture float64 - FNumber float64 - Iso int - Lat float64 - Lng float64 - Altitude int - Width int - Height int - Orientation int - All map[string]string + Description string + LensMake string + LensModel string + Flash bool + FocalLength int + Exposure string + Aperture float64 + FNumber float64 + Iso int + Lat float64 + Lng float64 + Altitude int + Width int + Height int + Orientation int + All map[string]string } var im *exif.IfdMapping diff --git a/internal/photoprism/label.go b/internal/photoprism/label.go index df463e76f..904eb4d40 100644 --- a/internal/photoprism/label.go +++ b/internal/photoprism/label.go @@ -84,5 +84,5 @@ func (l Labels) Title(fallback string) string { return label.Name } - return fallback + return fallback } diff --git a/internal/repo/photo.go b/internal/repo/photo.go index 6b7a95294..3a45f89ba 100644 --- a/internal/repo/photo.go +++ b/internal/repo/photo.go @@ -53,7 +53,7 @@ type PhotoResult struct { LensMake string // Country - CountryID string + CountryID string // Location LocationID string