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-07-12 08:27:05 +02:00
|
|
|
ID: s2.TokenPrefix + "85d1ea7d3278",
|
|
|
|
PlaceLabel: "Teotihuacán, Mexico, Mexico",
|
|
|
|
PlaceCity: "Teotihuacán",
|
|
|
|
PlaceState: "State of Mexico",
|
|
|
|
PlaceCountry: "mx",
|
|
|
|
PlaceKeywords: "ancient, pyramid",
|
|
|
|
PlaceFavorite: false,
|
|
|
|
PhotoCount: 1,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2020-05-08 11:46:09 +02:00
|
|
|
},
|
|
|
|
"zinkwazi": {
|
2020-07-12 08:27:05 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e279",
|
|
|
|
PlaceLabel: "KwaDukuza, KwaZulu-Natal, South Africa",
|
|
|
|
PlaceCity: "KwaDukuza",
|
|
|
|
PlaceState: "KwaZulu-Natal",
|
|
|
|
PlaceCountry: "za",
|
|
|
|
PlaceKeywords: "",
|
|
|
|
PlaceFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2020-05-08 11:46:09 +02:00
|
|
|
},
|
2020-05-11 17:01:05 +02:00
|
|
|
"holidaypark": {
|
2020-07-12 08:27:05 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e280",
|
|
|
|
PlaceLabel: "Holiday Park, Amusement",
|
|
|
|
PlaceCity: "",
|
|
|
|
PlaceState: "Rheinland-Pfalz",
|
|
|
|
PlaceCountry: "de",
|
|
|
|
PlaceKeywords: "",
|
|
|
|
PlaceFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
|
|
|
"emptyNameLongCity": {
|
2020-07-12 08:27:05 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e281",
|
|
|
|
PlaceLabel: "labelEmptyNameLongCity",
|
|
|
|
PlaceCity: "longlonglonglonglongcity",
|
|
|
|
PlaceState: "Rheinland-Pfalz",
|
|
|
|
PlaceCountry: "de",
|
|
|
|
PlaceKeywords: "",
|
|
|
|
PlaceFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
|
|
|
"emptyNameShortCity": {
|
2020-07-12 08:27:05 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e282",
|
|
|
|
PlaceLabel: "labelEmptyNameShortCity",
|
|
|
|
PlaceCity: "shortcity",
|
|
|
|
PlaceState: "Rheinland-Pfalz",
|
|
|
|
PlaceCountry: "de",
|
|
|
|
PlaceKeywords: "",
|
|
|
|
PlaceFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
|
|
|
"veryLongLocName": {
|
2020-07-12 08:27:05 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e283",
|
|
|
|
PlaceLabel: "labelVeryLongLocName",
|
|
|
|
PlaceCity: "Mainz",
|
|
|
|
PlaceState: "Rheinland-Pfalz",
|
|
|
|
PlaceCountry: "de",
|
|
|
|
PlaceKeywords: "",
|
|
|
|
PlaceFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
|
|
|
"mediumLongLocName": {
|
2020-07-12 08:27:05 +02:00
|
|
|
ID: s2.TokenPrefix + "1ef744d1e284",
|
|
|
|
PlaceLabel: "labelMediumLongLocName",
|
|
|
|
PlaceCity: "New york",
|
|
|
|
PlaceState: "New york",
|
|
|
|
PlaceCountry: "us",
|
|
|
|
PlaceKeywords: "",
|
|
|
|
PlaceFavorite: true,
|
|
|
|
PhotoCount: 2,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2020-05-11 17:01:05 +02:00
|
|
|
},
|
2021-08-16 15:18:30 +02:00
|
|
|
"Germany": {
|
|
|
|
ID: s2.TokenPrefix + "1ef744d1e285",
|
|
|
|
PlaceLabel: "Germany",
|
|
|
|
PlaceCity: "",
|
|
|
|
PlaceState: "",
|
|
|
|
PlaceCountry: "de",
|
|
|
|
PlaceKeywords: "",
|
|
|
|
PlaceFavorite: false,
|
|
|
|
PhotoCount: 1,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2021-08-16 15:18:30 +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)
|
|
|
|
}
|
|
|
|
}
|