photoprism/internal/entity/place_fixtures.go

58 lines
1.1 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{
2020-05-08 11:46:09 +02:00
"teotihuacan": {
ID: "85d1ea7d382c",
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": {
ID: "1ef744d1e28c",
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(),
},
}
// CreatePlaceFixtures inserts known entities into the database for testing.
func CreatePlaceFixtures() {
for _, entity := range PlaceFixtures {
Db().Create(&entity)
}
}