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-05-23 20:58:58 +02:00
|
|
|
return *NewAlbum(name, TypeDefault)
|
2020-05-11 14:41:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m AlbumMap) Pointer(name string) *Album {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return &result
|
|
|
|
}
|
|
|
|
|
2020-05-23 20:58:58 +02:00
|
|
|
return NewAlbum(name, TypeDefault)
|
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
|
|
|
CoverUID: "",
|
|
|
|
AlbumUID: "at9lxuqxpogaaba7",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumSlug: "christmas2030",
|
2020-05-23 20:58:58 +02:00
|
|
|
AlbumType: TypeDefault,
|
2020-05-26 09:02:19 +02:00
|
|
|
AlbumTitle: "Christmas2030",
|
2020-04-30 17:39:31 +02:00
|
|
|
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,
|
2020-05-23 20:58:58 +02:00
|
|
|
CoverUID: "",
|
|
|
|
AlbumUID: "at9lxuqxpogaaba8",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumSlug: "holiday-2030",
|
2020-05-23 20:58:58 +02:00
|
|
|
AlbumType: TypeDefault,
|
2020-05-26 09:02:19 +02:00
|
|
|
AlbumTitle: "Holiday2030",
|
2020-04-30 17:39:31 +02:00
|
|
|
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,
|
2020-05-23 20:58:58 +02:00
|
|
|
CoverUID: "",
|
|
|
|
AlbumUID: "at9lxuqxpogaaba9",
|
2020-04-30 17:39:31 +02:00
|
|
|
AlbumSlug: "berlin-2019",
|
2020-05-23 20:58:58 +02:00
|
|
|
AlbumType: TypeDefault,
|
2020-05-26 09:02:19 +02:00
|
|
|
AlbumTitle: "Berlin2019",
|
2020-04-30 17:39:31 +02:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
}
|
|
|
|
}
|