713593da4e
You can now run "photoprism auth add" to create new client access tokens that allow external applications to use the built-in REST API. Signed-off-by: Michael Mayer <michael@photoprism.app>
339 lines
10 KiB
Go
339 lines
10 KiB
Go
package entity
|
|
|
|
import "time"
|
|
|
|
type PhotoAlbumMap map[string]PhotoAlbum
|
|
|
|
func (m PhotoAlbumMap) Get(name, photoUid, albumUid string) PhotoAlbum {
|
|
if result, ok := m[name]; ok {
|
|
return result
|
|
}
|
|
|
|
return *NewPhotoAlbum(photoUid, albumUid)
|
|
}
|
|
|
|
func (m PhotoAlbumMap) Pointer(name, photoUid, albumUid string) *PhotoAlbum {
|
|
if result, ok := m[name]; ok {
|
|
return &result
|
|
}
|
|
|
|
return NewPhotoAlbum(photoUid, albumUid)
|
|
}
|
|
|
|
var PhotoAlbumFixtures = PhotoAlbumMap{
|
|
"1": {
|
|
PhotoUID: "ps6sg6be2lvl0yh7",
|
|
AlbumUID: "as6sg6bxpogaaba8",
|
|
Hidden: false,
|
|
Missing: false,
|
|
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),
|
|
Photo: PhotoFixtures.Pointer("19800101_000002_D640C559"),
|
|
Album: AlbumFixtures.Pointer("holiday-2030"),
|
|
},
|
|
"2": {
|
|
PhotoUID: "ps6sg6be2lvl0y11",
|
|
AlbumUID: "as6sg6bxpogaaba9",
|
|
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("Photo04"),
|
|
Album: AlbumFixtures.Pointer("berlin-2019"),
|
|
},
|
|
"3": {
|
|
PhotoUID: "ps6sg6be2lvl0yh8",
|
|
AlbumUID: "as6sg6bxpogaaba9",
|
|
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("Photo01"),
|
|
Album: AlbumFixtures.Pointer("berlin-2019"),
|
|
},
|
|
"4": {
|
|
PhotoUID: "ps6sg6bexxvl0yh0",
|
|
AlbumUID: "as6sg6bxpogaaba9",
|
|
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"),
|
|
},
|
|
"5": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bxpogaaba9",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("berlin-2019"),
|
|
},
|
|
"6": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bxpogaaba8",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("berlin-2019"),
|
|
},
|
|
"7": {
|
|
PhotoUID: "ps6sg6be2lvl0y21",
|
|
AlbumUID: "as6sg6bxpogaaba7",
|
|
Hidden: false,
|
|
Missing: false,
|
|
Order: 1,
|
|
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
|
|
UpdatedAt: time.Date(2020, 5, 28, 14, 6, 0, 0, time.UTC),
|
|
Photo: PhotoFixtures.Pointer("Photo14"),
|
|
Album: AlbumFixtures.Pointer("berlin-2019"),
|
|
},
|
|
"8": {
|
|
PhotoUID: "ps6sg6be2lvl0y21",
|
|
AlbumUID: "as6sg6bxpogaaba8",
|
|
Hidden: false,
|
|
Missing: false,
|
|
Order: 1,
|
|
CreatedAt: time.Date(2020, 3, 6, 2, 6, 51, 0, time.UTC),
|
|
UpdatedAt: time.Date(2020, 5, 28, 14, 6, 0, 0, time.UTC),
|
|
Photo: PhotoFixtures.Pointer("Photo14"),
|
|
Album: AlbumFixtures.Pointer("berlin-2019"),
|
|
},
|
|
"9": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab24",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("light&"),
|
|
},
|
|
"10": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab23",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("pets&dogs"),
|
|
},
|
|
"11": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab19",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("&ilikefood"),
|
|
},
|
|
"12": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab22",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("sale%"),
|
|
},
|
|
"13": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab21",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("%gold"),
|
|
},
|
|
"14": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab20",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("i-love-%-dog"),
|
|
},
|
|
"15": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab25",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("'family"),
|
|
},
|
|
"16": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab26",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("father's-day"),
|
|
},
|
|
"17": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab27",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("ice-cream'"),
|
|
},
|
|
"18": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab28",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("*forrest"),
|
|
},
|
|
"19": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab29",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("my*kids"),
|
|
},
|
|
"20": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab30",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("yoga***"),
|
|
},
|
|
"21": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab31",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("|banana"),
|
|
},
|
|
"22": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab32",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("red|green"),
|
|
},
|
|
"23": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab33",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("blue|"),
|
|
},
|
|
"24": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab34",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("345-shirt"),
|
|
},
|
|
"25": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab35",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("color-555-blue"),
|
|
},
|
|
"26": {
|
|
PhotoUID: "ps6sg6be2lvl0yh0",
|
|
AlbumUID: "as6sg6bipotaab36",
|
|
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("Photo03"),
|
|
Album: AlbumFixtures.Pointer("route-66"),
|
|
},
|
|
"27": {
|
|
PhotoUID: "ps6sg6be2lvl0yh9",
|
|
AlbumUID: "as6sg6bipotaab26",
|
|
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("Photo02"),
|
|
Album: AlbumFixtures.Pointer("father's-day"),
|
|
},
|
|
"28": {
|
|
PhotoUID: "ps6sg6be2lvl0yh9",
|
|
AlbumUID: "as6sg6bipotaab24",
|
|
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("Photo02"),
|
|
Album: AlbumFixtures.Pointer("light&"),
|
|
},
|
|
}
|
|
|
|
// CreatePhotoAlbumFixtures inserts known entities into the database for testing.
|
|
func CreatePhotoAlbumFixtures() {
|
|
for _, entity := range PhotoAlbumFixtures {
|
|
Db().Create(&entity)
|
|
}
|
|
}
|