photoprism/internal/entity/album_fixtures.go
Theresa Gresch ad9167360d
Feature/246 (#345)
* Import: Implement "add to album" in backend #246

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Import: Implement "add to album" in frontend #246

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Add OriginalName to photo search result

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Add json tags to PhotoName and PhotoPath

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Photo: Use EstimateCountry() in UpdateLocation()

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Photo: Set OriginalName earlier while indexing

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Ignore whitespace when stripping sequence from filename #335

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Fix labels count for SQLite

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Import: Show name of new albums #246

Signed-off-by: Michael Mayer <michael@liquidbytes.net>

* Frontend: Add acceptance test files

Co-authored-by: Michael Mayer <michael@liquidbytes.net>
2020-06-01 09:45:24 +02:00

120 lines
3.3 KiB
Go

package entity
import (
"time"
)
type AlbumMap map[string]Album
func (m AlbumMap) Get(name string) Album {
if result, ok := m[name]; ok {
return result
}
return *NewAlbum(name, TypeAlbum)
}
func (m AlbumMap) Pointer(name string) *Album {
if result, ok := m[name]; ok {
return &result
}
return NewAlbum(name, TypeAlbum)
}
var AlbumFixtures = AlbumMap{
"christmas2030": {
ID: 1000000,
CoverUID: "",
AlbumUID: "at9lxuqxpogaaba7",
AlbumSlug: "christmas2030",
AlbumType: TypeAlbum,
AlbumTitle: "Christmas2030",
AlbumDescription: "Wonderful christmas",
AlbumNotes: "",
AlbumOrder: "oldest",
AlbumTemplate: "",
AlbumFavorite: false,
Links: []Link{},
CreatedAt: time.Date(2019, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
DeletedAt: nil,
},
"holiday-2030": {
ID: 1000001,
CoverUID: "",
AlbumUID: "at9lxuqxpogaaba8",
AlbumSlug: "holiday-2030",
AlbumType: TypeAlbum,
AlbumTitle: "Holiday2030",
AlbumDescription: "Wonderful christmas",
AlbumNotes: "",
AlbumOrder: "newest",
AlbumTemplate: "",
AlbumFavorite: true,
Links: []Link{},
CreatedAt: time.Date(2019, 7, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 2, 1, 0, 0, 0, 0, time.UTC),
DeletedAt: nil,
},
"berlin-2019": {
ID: 1000002,
CoverUID: "",
AlbumUID: "at9lxuqxpogaaba9",
AlbumSlug: "berlin-2019",
AlbumType: TypeAlbum,
AlbumTitle: "Berlin2019",
AlbumDescription: "Wonderful christmas",
AlbumNotes: "",
AlbumOrder: "oldest",
AlbumTemplate: "",
AlbumFavorite: false,
Links: []Link{},
CreatedAt: time.Date(2019, 7, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 2, 1, 0, 0, 0, 0, time.UTC),
DeletedAt: nil,
},
"april-1990": {
ID: 1000003,
CoverUID: "",
AlbumUID: "at1lxuqipogaaba1",
AlbumSlug: "april-1990",
AlbumType: TypeFolder,
AlbumTitle: "April 1990",
AlbumDescription: "Spring is the time of year when many things change.",
AlbumNotes: "Thunderstorms cause most of the severe spring weather.",
AlbumOrder: "oldest",
AlbumTemplate: "",
AlbumFilter: "path:\"1990/04\"",
AlbumFavorite: false,
Links: []Link{},
CreatedAt: time.Date(2019, 7, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 2, 1, 0, 0, 0, 0, time.UTC),
DeletedAt: nil,
},
"import": {
ID: 1000004,
CoverUID: "",
AlbumUID: "at6axuzitogaaiax",
AlbumSlug: "import",
AlbumType: TypeAlbum,
AlbumTitle: "Import Album",
AlbumDescription: "",
AlbumNotes: "",
AlbumOrder: "name",
AlbumTemplate: "",
AlbumFilter: "",
AlbumFavorite: false,
Links: []Link{},
CreatedAt: time.Date(2020, 1, 1, 0, 0, 0, 0, time.UTC),
UpdatedAt: time.Date(2020, 2, 1, 0, 0, 0, 0, time.UTC),
DeletedAt: nil,
},
}
// CreateAlbumFixtures inserts known entities into the database for testing.
func CreateAlbumFixtures() {
for _, entity := range AlbumFixtures {
Db().Create(&entity)
}
}