2020-05-01 13:11:24 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
import "time"
|
|
|
|
|
2020-05-11 14:41:20 +02:00
|
|
|
type PhotoAlbumMap map[string]PhotoAlbum
|
|
|
|
|
2020-05-23 20:58:58 +02:00
|
|
|
func (m PhotoAlbumMap) Get(name, photoUID, albumUID string) PhotoAlbum {
|
2020-05-11 14:41:20 +02:00
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
2020-05-23 20:58:58 +02:00
|
|
|
return *NewPhotoAlbum(photoUID, albumUID)
|
2020-05-11 14:41:20 +02:00
|
|
|
}
|
|
|
|
|
2020-05-23 20:58:58 +02:00
|
|
|
func (m PhotoAlbumMap) Pointer(name, photoUID, albumUID string) *PhotoAlbum {
|
2020-05-11 14:41:20 +02:00
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return &result
|
|
|
|
}
|
|
|
|
|
2020-05-23 20:58:58 +02:00
|
|
|
return NewPhotoAlbum(photoUID, albumUID)
|
2020-05-11 14:41:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var PhotoAlbumFixtures = PhotoAlbumMap{
|
2020-05-01 13:11:24 +02:00
|
|
|
"1": {
|
2020-05-23 20:58:58 +02:00
|
|
|
PhotoUID: "pt9jtdre2lvl0yh7",
|
|
|
|
AlbumUID: "at9lxuqxpogaaba8",
|
2020-12-17 18:24:55 +01:00
|
|
|
Hidden: false,
|
2020-12-27 13:11:08 +01:00
|
|
|
Missing: false,
|
2020-05-01 13:11:24 +02:00
|
|
|
Order: 0,
|
|
|
|
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2020, 3, 28, 14, 6, 0, 0, time.UTC),
|
2020-05-10 19:43:49 +02:00
|
|
|
Photo: PhotoFixtures.Pointer("19800101_000002_D640C559"),
|
2020-05-11 14:41:20 +02:00
|
|
|
Album: AlbumFixtures.Pointer("holiday-2030"),
|
2020-05-01 13:11:24 +02:00
|
|
|
},
|
|
|
|
"2": {
|
2020-05-23 20:58:58 +02:00
|
|
|
PhotoUID: "pt9jtdre2lvl0y11",
|
|
|
|
AlbumUID: "at9lxuqxpogaaba9",
|
2020-12-17 18:24:55 +01:00
|
|
|
Hidden: false,
|
2020-12-27 13:11:08 +01:00
|
|
|
Missing: false,
|
2020-05-01 13:11:24 +02:00
|
|
|
Order: 0,
|
|
|
|
CreatedAt: time.Date(2020, 2, 6, 2, 6, 51, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2020, 4, 28, 14, 6, 0, 0, time.UTC),
|
2020-05-10 19:43:49 +02:00
|
|
|
Photo: PhotoFixtures.Pointer("Photo04"),
|
2020-05-11 14:41:20 +02:00
|
|
|
Album: AlbumFixtures.Pointer("berlin-2019"),
|
2020-05-01 13:11:24 +02:00
|
|
|
},
|
2020-05-11 17:01:05 +02:00
|
|
|
"3": {
|
2020-05-23 20:58:58 +02:00
|
|
|
PhotoUID: "pt9jtdre2lvl0yh8",
|
|
|
|
AlbumUID: "at9lxuqxpogaaba9",
|
2020-12-17 18:24:55 +01:00
|
|
|
Hidden: false,
|
2020-12-27 13:11:08 +01:00
|
|
|
Missing: false,
|
2020-05-11 17:01:05 +02:00
|
|
|
Order: 0,
|
|
|
|
CreatedAt: time.Date(2020, 2, 6, 2, 6, 51, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2020, 4, 28, 14, 6, 0, 0, time.UTC),
|
|
|
|
Photo: PhotoFixtures.Pointer("Photo01"),
|
|
|
|
Album: AlbumFixtures.Pointer("berlin-2019"),
|
|
|
|
},
|
2020-12-27 13:11:08 +01:00
|
|
|
"4": {
|
|
|
|
PhotoUID: "pt9jtxrexxvl0yh0",
|
|
|
|
AlbumUID: "at9lxuqxpogaaba9",
|
|
|
|
Hidden: false,
|
|
|
|
Missing: false,
|
|
|
|
Order: 0,
|
|
|
|
CreatedAt: time.Date(2020, 2, 6, 2, 6, 51, 0, time.UTC),
|
|
|
|
UpdatedAt: time.Date(2020, 4, 28, 14, 6, 0, 0, time.UTC),
|
|
|
|
Photo: PhotoFixtures.Pointer("Photo19"),
|
|
|
|
Album: AlbumFixtures.Pointer("april-1990"),
|
|
|
|
},
|
2020-05-01 13:11:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreatePhotoAlbumFixtures inserts known entities into the database for testing.
|
|
|
|
func CreatePhotoAlbumFixtures() {
|
|
|
|
for _, entity := range PhotoAlbumFixtures {
|
|
|
|
Db().Create(&entity)
|
|
|
|
}
|
|
|
|
}
|