2020-05-08 11:46:09 +02:00
|
|
|
package entity
|
|
|
|
|
2020-06-05 16:49:32 +02:00
|
|
|
import (
|
|
|
|
"github.com/photoprism/photoprism/pkg/s2"
|
|
|
|
)
|
2020-05-08 11:46:09 +02:00
|
|
|
|
2020-05-10 19:43:49 +02:00
|
|
|
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-25 19:10:44 +02:00
|
|
|
"mexico": {
|
2020-06-05 17:03:07 +02:00
|
|
|
ID: s2.TokenPrefix + "85d1ea7d3278",
|
2020-05-08 11:46:09 +02:00
|
|
|
LocLabel: "Teotihuacán, Mexico, Mexico",
|
|
|
|
LocCity: "Teotihuacán",
|
2020-05-29 12:21:17 +02:00
|
|
|
LocState: "State of Mexico",
|
2020-05-08 11:46:09 +02:00
|
|
|
LocCountry: "mx",
|
|
|
|
LocKeywords: "ancient, pyramid",
|
|
|
|
LocNotes: "",
|
|
|
|
LocFavorite: false,
|
2020-05-10 19:43:49 +02:00
|
|
|
PhotoCount: 1,
|
2020-06-26 12:16:13 +02:00
|
|
|
CreatedAt: Timestamp(),
|
|
|
|
UpdatedAt: Timestamp(),
|
2020-05-08 11:46:09 +02:00
|
|
|
},
|
|
|
|
"zinkwazi": {
|
2020-06-05 17:03:07 +02:00
|
|
|
ID: s2.TokenPrefix + "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,
|
2020-05-10 19:43:49 +02:00
|
|
|
PhotoCount: 2,
|
2020-06-26 12:16:13 +02:00
|
|
|
CreatedAt: Timestamp(),
|
|
|
|
UpdatedAt: Timestamp(),
|
2020-05-08 11:46:09 +02:00
|
|
|
},
|
2020-05-11 17:01:05 +02:00
|
|
|
"holidaypark": {
|
2020-06-05 17:03:07 +02:00
|
|
|
ID: s2.TokenPrefix + "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,
|
2020-06-26 12:16:13 +02:00
|
|
|
CreatedAt: Timestamp(),
|
|
|
|
UpdatedAt: Timestamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
|
|
|
"emptyNameLongCity": {
|
2020-06-05 17:03:07 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e281",
|
2020-05-18 10:05:14 +02:00
|
|
|
LocLabel: "labelEmptyNameLongCity",
|
2020-05-11 17:01:05 +02:00
|
|
|
LocCity: "longlonglonglonglongcity",
|
|
|
|
LocState: "Rheinland-Pfalz",
|
|
|
|
LocCountry: "de",
|
|
|
|
LocKeywords: "",
|
|
|
|
LocNotes: "germany",
|
|
|
|
LocFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2020-06-26 12:16:13 +02:00
|
|
|
CreatedAt: Timestamp(),
|
|
|
|
UpdatedAt: Timestamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
|
|
|
"emptyNameShortCity": {
|
2020-06-05 17:03:07 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e282",
|
2020-05-18 10:05:14 +02:00
|
|
|
LocLabel: "labelEmptyNameShortCity",
|
2020-05-11 17:01:05 +02:00
|
|
|
LocCity: "shortcity",
|
|
|
|
LocState: "Rheinland-Pfalz",
|
|
|
|
LocCountry: "de",
|
|
|
|
LocKeywords: "",
|
|
|
|
LocNotes: "germany",
|
|
|
|
LocFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2020-06-26 12:16:13 +02:00
|
|
|
CreatedAt: Timestamp(),
|
|
|
|
UpdatedAt: Timestamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
|
|
|
"veryLongLocName": {
|
2020-06-05 17:03:07 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e283",
|
2020-05-18 10:05:14 +02:00
|
|
|
LocLabel: "labelVeryLongLocName",
|
2020-05-11 17:01:05 +02:00
|
|
|
LocCity: "Mainz",
|
|
|
|
LocState: "Rheinland-Pfalz",
|
|
|
|
LocCountry: "de",
|
|
|
|
LocKeywords: "",
|
|
|
|
LocNotes: "germany",
|
|
|
|
LocFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2020-06-26 12:16:13 +02:00
|
|
|
CreatedAt: Timestamp(),
|
|
|
|
UpdatedAt: Timestamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
|
|
|
"mediumLongLocName": {
|
2020-06-05 17:03:07 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e284",
|
2020-05-18 10:05:14 +02:00
|
|
|
LocLabel: "labelMediumLongLocName",
|
2020-05-11 17:01:05 +02:00
|
|
|
LocCity: "New york",
|
|
|
|
LocState: "New york",
|
|
|
|
LocCountry: "us",
|
|
|
|
LocKeywords: "",
|
|
|
|
LocNotes: "",
|
|
|
|
LocFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2020-06-26 12:16:13 +02:00
|
|
|
CreatedAt: Timestamp(),
|
|
|
|
UpdatedAt: Timestamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
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)
|
|
|
|
}
|
|
|
|
}
|