2020-04-30 17:39:31 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2020-05-10 19:43:49 +02:00
|
|
|
type AlbumMap map[string]Album
|
|
|
|
|
2020-05-11 14:41:20 +02:00
|
|
|
func (m AlbumMap) Get(name string) Album {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:32:51 +02:00
|
|
|
return *NewAlbum(name, AlbumDefault)
|
2020-05-11 14:41:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m AlbumMap) Pointer(name string) *Album {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return &result
|
|
|
|
}
|
|
|
|
|
2020-06-08 18:32:51 +02:00
|
|
|
return NewAlbum(name, AlbumDefault)
|
2020-05-11 14:41:20 +02:00
|
|
|
}
|
|
|
|
|
2020-05-10 19:43:49 +02:00
|
|
|
var AlbumFixtures = AlbumMap{
|
2020-04-30 17:39:31 +02:00
|
|
|
"christmas2030": {
|
|
|
|
ID: 1000000,
|
2020-05-23 20:58:58 +02:00
|
|
|
AlbumUID: "at9lxuqxpogaaba7",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumSlug: "christmas-2030",
|
|
|
|
AlbumPath: "",
|
2020-06-08 18:32:51 +02:00
|
|
|
AlbumType: AlbumDefault,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumTitle: "Christmas 2030",
|
|
|
|
AlbumLocation: "",
|
|
|
|
AlbumCategory: "",
|
|
|
|
AlbumCaption: "",
|
2020-12-17 18:24:55 +01:00
|
|
|
AlbumDescription: "Wonderful Christmas",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumNotes: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumFilter: "",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumOrder: "oldest",
|
|
|
|
AlbumTemplate: "",
|
2021-08-19 21:12:38 +02:00
|
|
|
AlbumCountry: UnknownID,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumYear: 0,
|
|
|
|
AlbumMonth: 0,
|
|
|
|
AlbumDay: 0,
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumFavorite: false,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPrivate: false,
|
2020-04-30 17:39:31 +02:00
|
|
|
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,
|
2020-05-23 20:58:58 +02:00
|
|
|
AlbumUID: "at9lxuqxpogaaba8",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumSlug: "holiday-2030",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPath: "",
|
2020-06-08 18:32:51 +02:00
|
|
|
AlbumType: AlbumDefault,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumTitle: "Holiday 2030",
|
|
|
|
AlbumLocation: "",
|
|
|
|
AlbumCategory: "",
|
|
|
|
AlbumCaption: "",
|
|
|
|
AlbumDescription: "Wonderful Christmas Holiday",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumNotes: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumFilter: "",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumOrder: "newest",
|
|
|
|
AlbumTemplate: "",
|
2021-08-19 21:12:38 +02:00
|
|
|
AlbumCountry: UnknownID,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumYear: 0,
|
|
|
|
AlbumMonth: 0,
|
|
|
|
AlbumDay: 0,
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumFavorite: true,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPrivate: false,
|
2020-04-30 17:39:31 +02:00
|
|
|
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,
|
2020-05-23 20:58:58 +02:00
|
|
|
AlbumUID: "at9lxuqxpogaaba9",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumSlug: "berlin-2019",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPath: "",
|
2020-06-08 18:32:51 +02:00
|
|
|
AlbumType: AlbumDefault,
|
2020-12-17 18:24:55 +01:00
|
|
|
AlbumTitle: "Berlin 2019",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumLocation: "Berlin",
|
|
|
|
AlbumCategory: "City",
|
|
|
|
AlbumCaption: "",
|
|
|
|
AlbumDescription: "We love Berlin 🌿!",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumNotes: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumFilter: "",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumOrder: "oldest",
|
|
|
|
AlbumTemplate: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumCountry: "",
|
|
|
|
AlbumYear: 0,
|
|
|
|
AlbumMonth: 0,
|
|
|
|
AlbumDay: 0,
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumFavorite: false,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPrivate: false,
|
2020-04-30 17:39:31 +02:00
|
|
|
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,
|
|
|
|
},
|
2020-05-30 21:31:32 +02:00
|
|
|
"april-1990": {
|
|
|
|
ID: 1000003,
|
|
|
|
AlbumUID: "at1lxuqipogaaba1",
|
|
|
|
AlbumSlug: "april-1990",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPath: "1990/04",
|
2020-06-08 18:32:51 +02:00
|
|
|
AlbumType: AlbumFolder,
|
2020-05-30 21:31:32 +02:00
|
|
|
AlbumTitle: "April 1990",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumLocation: "",
|
|
|
|
AlbumCategory: "Friends",
|
|
|
|
AlbumCaption: "",
|
2020-05-30 21:31:32 +02:00
|
|
|
AlbumDescription: "Spring is the time of year when many things change.",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumNotes: "",
|
|
|
|
AlbumFilter: "path:\"1990/04\" public:true",
|
|
|
|
AlbumOrder: "added",
|
2020-05-30 21:31:32 +02:00
|
|
|
AlbumTemplate: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumCountry: "ca",
|
|
|
|
AlbumYear: 1990,
|
|
|
|
AlbumMonth: 4,
|
|
|
|
AlbumDay: 11,
|
2020-05-30 21:31:32 +02:00
|
|
|
AlbumFavorite: false,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPrivate: false,
|
2020-05-30 21:31:32 +02:00
|
|
|
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,
|
|
|
|
},
|
2020-06-01 09:45:24 +02:00
|
|
|
"import": {
|
|
|
|
ID: 1000004,
|
|
|
|
AlbumUID: "at6axuzitogaaiax",
|
|
|
|
AlbumSlug: "import",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPath: "",
|
2020-06-08 18:32:51 +02:00
|
|
|
AlbumType: AlbumDefault,
|
2020-06-01 09:45:24 +02:00
|
|
|
AlbumTitle: "Import Album",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumLocation: "",
|
|
|
|
AlbumCategory: "",
|
|
|
|
AlbumCaption: "",
|
2020-06-01 09:45:24 +02:00
|
|
|
AlbumDescription: "",
|
|
|
|
AlbumNotes: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumFilter: "",
|
2020-06-01 09:45:24 +02:00
|
|
|
AlbumOrder: "name",
|
|
|
|
AlbumTemplate: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumCountry: "ca",
|
|
|
|
AlbumYear: 0,
|
|
|
|
AlbumMonth: 0,
|
|
|
|
AlbumDay: 0,
|
2020-06-01 09:45:24 +02:00
|
|
|
AlbumFavorite: false,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPrivate: false,
|
2020-06-01 09:45:24 +02:00
|
|
|
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,
|
|
|
|
},
|
2020-07-13 11:11:52 +02:00
|
|
|
"emptyMoment": {
|
|
|
|
ID: 1000005,
|
|
|
|
AlbumUID: "at7axuzitogaaiax",
|
|
|
|
AlbumSlug: "empty-moment",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPath: "",
|
2020-07-13 11:11:52 +02:00
|
|
|
AlbumType: AlbumMoment,
|
|
|
|
AlbumTitle: "Empty Moment",
|
|
|
|
AlbumLocation: "Favorite Park",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumCategory: "Fun",
|
|
|
|
AlbumCaption: "",
|
2020-07-13 11:11:52 +02:00
|
|
|
AlbumDescription: "",
|
|
|
|
AlbumNotes: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumFilter: "public:true country:at year:2016",
|
|
|
|
AlbumOrder: "oldest",
|
2020-07-13 11:11:52 +02:00
|
|
|
AlbumTemplate: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumCountry: "at",
|
|
|
|
AlbumYear: 2016,
|
|
|
|
AlbumMonth: 0,
|
|
|
|
AlbumDay: 0,
|
2020-07-13 11:11:52 +02:00
|
|
|
AlbumFavorite: false,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPrivate: false,
|
2020-07-13 11:11:52 +02:00
|
|
|
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,
|
|
|
|
},
|
2021-02-24 11:38:28 +01:00
|
|
|
"2016-04": {
|
|
|
|
ID: 1000006,
|
|
|
|
AlbumUID: "at1lxuqipogaabj8",
|
|
|
|
AlbumSlug: "2016-04",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumPath: "2016/04",
|
2021-02-24 11:38:28 +01:00
|
|
|
AlbumType: AlbumFolder,
|
|
|
|
AlbumTitle: "April 2016",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumLocation: "",
|
|
|
|
AlbumCategory: "Fun",
|
|
|
|
AlbumCaption: "",
|
2021-02-24 11:38:28 +01:00
|
|
|
AlbumDescription: "",
|
|
|
|
AlbumNotes: "",
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumFilter: "path:\"2016/04\" public:true",
|
|
|
|
AlbumOrder: "added",
|
2021-02-24 11:38:28 +01:00
|
|
|
AlbumTemplate: "",
|
2021-08-19 21:12:38 +02:00
|
|
|
AlbumCountry: UnknownID,
|
2021-07-22 13:52:22 +02:00
|
|
|
AlbumYear: 0,
|
|
|
|
AlbumMonth: 0,
|
|
|
|
AlbumDay: 0,
|
2021-02-24 11:38:28 +01:00
|
|
|
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,
|
|
|
|
},
|
2021-10-22 16:03:50 +02:00
|
|
|
"september-2021": {
|
|
|
|
ID: 1000007,
|
|
|
|
AlbumUID: "at1lxuqipogaabj9",
|
|
|
|
AlbumSlug: "september-2021",
|
|
|
|
AlbumPath: "",
|
|
|
|
AlbumType: AlbumMonth,
|
|
|
|
AlbumTitle: "September 2021",
|
|
|
|
AlbumLocation: "",
|
|
|
|
AlbumCategory: "",
|
|
|
|
AlbumCaption: "",
|
|
|
|
AlbumDescription: "",
|
|
|
|
AlbumNotes: "",
|
|
|
|
AlbumFilter: "public:true year:2021 month:9",
|
|
|
|
AlbumOrder: "newest",
|
|
|
|
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,
|
|
|
|
},
|
2020-04-30 17:39:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateAlbumFixtures inserts known entities into the database for testing.
|
2020-05-01 14:13:59 +02:00
|
|
|
func CreateAlbumFixtures() {
|
2020-04-30 17:39:31 +02:00
|
|
|
for _, entity := range AlbumFixtures {
|
2020-05-01 14:13:59 +02:00
|
|
|
Db().Create(&entity)
|
2020-04-30 17:39:31 +02:00
|
|
|
}
|
|
|
|
}
|