photoprism/internal/entity/album_fixtures.go

207 lines
5.7 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, AlbumDefault)
}
func (m AlbumMap) Pointer(name string) *Album {
if result, ok := m[name]; ok {
return &result
}
return NewAlbum(name, AlbumDefault)
}
var AlbumFixtures = AlbumMap{
"christmas2030": {
ID: 1000000,
AlbumUID: "at9lxuqxpogaaba7",
AlbumSlug: "christmas-2030",
AlbumPath: "",
AlbumType: AlbumDefault,
AlbumTitle: "Christmas 2030",
AlbumLocation: "",
AlbumCategory: "",
AlbumCaption: "",
AlbumDescription: "Wonderful Christmas",
AlbumNotes: "",
AlbumFilter: "",
AlbumOrder: "oldest",
AlbumTemplate: "",
AlbumCountry: UnknownID,
AlbumYear: 0,
AlbumMonth: 0,
AlbumDay: 0,
AlbumFavorite: false,
AlbumPrivate: false,
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,
AlbumUID: "at9lxuqxpogaaba8",
AlbumSlug: "holiday-2030",
AlbumPath: "",
AlbumType: AlbumDefault,
AlbumTitle: "Holiday 2030",
AlbumLocation: "",
AlbumCategory: "",
AlbumCaption: "",
AlbumDescription: "Wonderful Christmas Holiday",
AlbumNotes: "",
AlbumFilter: "",
AlbumOrder: "newest",
AlbumTemplate: "",
AlbumCountry: UnknownID,
AlbumYear: 0,
AlbumMonth: 0,
AlbumDay: 0,
AlbumFavorite: true,
AlbumPrivate: false,
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,
AlbumUID: "at9lxuqxpogaaba9",
AlbumSlug: "berlin-2019",
AlbumPath: "",
AlbumType: AlbumDefault,
AlbumTitle: "Berlin 2019",
AlbumLocation: "Berlin",
AlbumCategory: "City",
AlbumCaption: "",
AlbumDescription: "We love Berlin 🌿!",
AlbumNotes: "",
AlbumFilter: "",
AlbumOrder: "oldest",
AlbumTemplate: "",
AlbumCountry: "",
AlbumYear: 0,
AlbumMonth: 0,
AlbumDay: 0,
AlbumFavorite: false,
AlbumPrivate: false,
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,
AlbumUID: "at1lxuqipogaaba1",
AlbumSlug: "april-1990",
AlbumPath: "1990/04",
AlbumType: AlbumFolder,
AlbumTitle: "April 1990",
AlbumLocation: "",
AlbumCategory: "Friends",
AlbumCaption: "",
AlbumDescription: "Spring is the time of year when many things change.",
AlbumNotes: "",
AlbumFilter: "path:\"1990/04\" public:true",
AlbumOrder: "added",
AlbumTemplate: "",
AlbumCountry: "ca",
AlbumYear: 1990,
AlbumMonth: 4,
AlbumDay: 11,
AlbumFavorite: false,
AlbumPrivate: false,
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,
AlbumUID: "at6axuzitogaaiax",
AlbumSlug: "import",
AlbumPath: "",
AlbumType: AlbumDefault,
AlbumTitle: "Import Album",
AlbumLocation: "",
AlbumCategory: "",
AlbumCaption: "",
AlbumDescription: "",
AlbumNotes: "",
AlbumFilter: "",
AlbumOrder: "name",
AlbumTemplate: "",
AlbumCountry: "ca",
AlbumYear: 0,
AlbumMonth: 0,
AlbumDay: 0,
AlbumFavorite: false,
AlbumPrivate: false,
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,
},
"emptyMoment": {
ID: 1000005,
AlbumUID: "at7axuzitogaaiax",
AlbumSlug: "empty-moment",
AlbumPath: "",
AlbumType: AlbumMoment,
AlbumTitle: "Empty Moment",
AlbumLocation: "Favorite Park",
AlbumCategory: "Fun",
AlbumCaption: "",
AlbumDescription: "",
AlbumNotes: "",
AlbumFilter: "public:true country:at year:2016",
AlbumOrder: "oldest",
AlbumTemplate: "",
AlbumCountry: "at",
AlbumYear: 2016,
AlbumMonth: 0,
AlbumDay: 0,
AlbumFavorite: false,
AlbumPrivate: false,
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,
},
"2016-04": {
ID: 1000006,
AlbumUID: "at1lxuqipogaabj8",
AlbumSlug: "2016-04",
AlbumPath: "2016/04",
AlbumType: AlbumFolder,
AlbumTitle: "April 2016",
AlbumLocation: "",
AlbumCategory: "Fun",
AlbumCaption: "",
AlbumDescription: "",
AlbumNotes: "",
AlbumFilter: "path:\"2016/04\" public:true",
AlbumOrder: "added",
AlbumTemplate: "",
AlbumCountry: UnknownID,
AlbumYear: 0,
AlbumMonth: 0,
AlbumDay: 0,
AlbumFavorite: false,
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,
},
}
// CreateAlbumFixtures inserts known entities into the database for testing.
func CreateAlbumFixtures() {
for _, entity := range AlbumFixtures {
Db().Create(&entity)
}
}