photoprism/internal/entity/place_fixtures.go

123 lines
2.7 KiB
Go
Raw Normal View History

2020-05-08 11:46:09 +02:00
package entity
import "time"
type PlacesMap map[string]Place
func (m PlacesMap) Get(name string) Place {
if result, ok := m[name]; ok {
return result
}
return UnknownPlace
}
func (m PlacesMap) Pointer(name string) *Place {
if result, ok := m[name]; ok {
return &result
}
return &UnknownPlace
}
var PlaceFixtures = PlacesMap{
"mexico": {
PlaceUID: "85d1ea7d3278",
2020-05-08 11:46:09 +02:00
LocLabel: "Teotihuacán, Mexico, Mexico",
LocCity: "Teotihuacán",
LocState: "Mexico",
LocCountry: "mx",
LocKeywords: "ancient, pyramid",
LocNotes: "",
LocFavorite: false,
PhotoCount: 1,
2020-05-08 11:46:09 +02:00
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"zinkwazi": {
PlaceUID: "1ef744d1e279",
2020-05-08 11:46:09 +02:00
LocLabel: "KwaDukuza, KwaZulu-Natal, South Africa",
LocCity: "KwaDukuza",
LocState: "KwaZulu-Natal",
LocCountry: "za",
LocKeywords: "",
LocNotes: "africa",
LocFavorite: true,
PhotoCount: 2,
2020-05-08 11:46:09 +02:00
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
2020-05-11 17:01:05 +02:00
"holidaypark": {
PlaceUID: "1ef744d1e280",
2020-05-11 17:01:05 +02:00
LocLabel: "Holiday Park, Amusement",
LocCity: "",
LocState: "Rheinland-Pfalz",
LocCountry: "de",
LocKeywords: "",
LocNotes: "germany",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"emptyNameLongCity": {
PlaceUID: "1ef744d1e281",
LocLabel: "labelEmptyNameLongCity",
2020-05-11 17:01:05 +02:00
LocCity: "longlonglonglonglongcity",
LocState: "Rheinland-Pfalz",
LocCountry: "de",
LocKeywords: "",
LocNotes: "germany",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"emptyNameShortCity": {
PlaceUID: "1ef744d1e282",
LocLabel: "labelEmptyNameShortCity",
2020-05-11 17:01:05 +02:00
LocCity: "shortcity",
LocState: "Rheinland-Pfalz",
LocCountry: "de",
LocKeywords: "",
LocNotes: "germany",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"veryLongLocName": {
PlaceUID: "1ef744d1e283",
LocLabel: "labelVeryLongLocName",
2020-05-11 17:01:05 +02:00
LocCity: "Mainz",
LocState: "Rheinland-Pfalz",
LocCountry: "de",
LocKeywords: "",
LocNotes: "germany",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
"mediumLongLocName": {
PlaceUID: "1ef744d1e284",
LocLabel: "labelMediumLongLocName",
2020-05-11 17:01:05 +02:00
LocCity: "New york",
LocState: "New york",
LocCountry: "us",
LocKeywords: "",
LocNotes: "",
LocFavorite: true,
PhotoCount: 2,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
},
2020-05-08 11:46:09 +02:00
}
// CreatePlaceFixtures inserts known entities into the database for testing.
func CreatePlaceFixtures() {
for _, entity := range PlaceFixtures {
Db().Create(&entity)
}
}