2021-08-16 00:29:36 +02:00
|
|
|
package entity
|
|
|
|
|
|
|
|
type SubjectMap map[string]Subject
|
|
|
|
|
|
|
|
func (m SubjectMap) Get(name string) Subject {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
return Subject{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m SubjectMap) Pointer(name string) *Subject {
|
|
|
|
if result, ok := m[name]; ok {
|
|
|
|
return &result
|
|
|
|
}
|
|
|
|
|
|
|
|
return &Subject{}
|
|
|
|
}
|
|
|
|
|
|
|
|
var SubjectFixtures = SubjectMap{
|
2021-08-21 16:36:00 +02:00
|
|
|
"john-doe": Subject{
|
2021-09-17 14:26:12 +02:00
|
|
|
SubjUID: "jqu0xs11qekk9jx8",
|
|
|
|
SubjSlug: "john-doe",
|
|
|
|
SubjName: "John Doe",
|
|
|
|
SubjType: SubjPerson,
|
|
|
|
SubjSrc: SrcManual,
|
|
|
|
SubjFavorite: true,
|
|
|
|
SubjPrivate: false,
|
|
|
|
SubjExcluded: false,
|
|
|
|
SubjBio: "Subject Description",
|
|
|
|
SubjNotes: "Short Note",
|
2021-08-30 18:58:27 +02:00
|
|
|
FileCount: 1,
|
2021-10-01 16:34:29 +02:00
|
|
|
PhotoCount: 1,
|
2021-08-30 18:58:27 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
|
|
|
DeletedAt: nil,
|
2021-08-16 00:29:36 +02:00
|
|
|
},
|
2021-08-21 16:36:00 +02:00
|
|
|
"joe-biden": Subject{
|
2021-09-17 14:26:12 +02:00
|
|
|
SubjUID: "jqy3y652h8njw0sx",
|
|
|
|
SubjSlug: "joe-biden",
|
|
|
|
SubjName: "Joe Biden",
|
|
|
|
SubjType: SubjPerson,
|
|
|
|
SubjSrc: SrcMarker,
|
|
|
|
SubjFavorite: false,
|
|
|
|
SubjPrivate: false,
|
|
|
|
SubjExcluded: false,
|
|
|
|
SubjBio: "",
|
|
|
|
SubjNotes: "",
|
2021-08-30 18:58:27 +02:00
|
|
|
FileCount: 1,
|
2021-10-01 16:34:29 +02:00
|
|
|
PhotoCount: 1,
|
2021-08-30 18:58:27 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
|
|
|
DeletedAt: nil,
|
2021-08-21 16:36:00 +02:00
|
|
|
},
|
2021-08-22 16:14:34 +02:00
|
|
|
"dangling": Subject{
|
2021-09-17 14:26:12 +02:00
|
|
|
SubjUID: "jqy1y111h1njaaaa",
|
|
|
|
SubjSlug: "dangling-subject",
|
|
|
|
SubjName: "Dangling Subject",
|
|
|
|
SubjAlias: "Powell",
|
|
|
|
SubjType: SubjPerson,
|
|
|
|
SubjSrc: SrcMarker,
|
|
|
|
SubjFavorite: false,
|
|
|
|
SubjPrivate: false,
|
|
|
|
SubjExcluded: false,
|
|
|
|
SubjBio: "",
|
|
|
|
SubjNotes: "",
|
2021-09-24 13:13:59 +02:00
|
|
|
Thumb: "2cad9168fa6acc5c5c2965ddf6ec465ca42fd818",
|
2021-08-30 18:58:27 +02:00
|
|
|
FileCount: 0,
|
2021-10-01 16:34:29 +02:00
|
|
|
PhotoCount: 0,
|
2021-08-30 18:58:27 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
|
|
|
DeletedAt: nil,
|
2021-08-22 16:14:34 +02:00
|
|
|
},
|
2021-08-26 11:58:28 +02:00
|
|
|
"jane-doe": Subject{
|
2021-09-17 14:26:12 +02:00
|
|
|
SubjUID: "jqy1y111h1njaaab",
|
|
|
|
SubjSlug: "jane-doe",
|
|
|
|
SubjName: "Jane Doe",
|
|
|
|
SubjType: SubjPerson,
|
|
|
|
SubjSrc: SrcMarker,
|
|
|
|
SubjFavorite: false,
|
|
|
|
SubjPrivate: false,
|
|
|
|
SubjExcluded: false,
|
|
|
|
SubjBio: "",
|
|
|
|
SubjNotes: "",
|
2021-08-30 18:58:27 +02:00
|
|
|
FileCount: 3,
|
2021-10-01 16:34:29 +02:00
|
|
|
PhotoCount: 2,
|
2021-09-20 13:12:28 +02:00
|
|
|
CreatedAt: TimeStamp().AddDate(0, 0, 1),
|
2021-08-30 18:58:27 +02:00
|
|
|
UpdatedAt: TimeStamp(),
|
|
|
|
DeletedAt: nil,
|
2021-08-26 11:58:28 +02:00
|
|
|
},
|
2021-08-30 13:39:53 +02:00
|
|
|
"actress-1": Subject{
|
2021-09-17 14:26:12 +02:00
|
|
|
SubjUID: "jqy1y111h1njaaac",
|
|
|
|
SubjSlug: "actress-a",
|
|
|
|
SubjName: "Actress A",
|
|
|
|
SubjType: SubjPerson,
|
|
|
|
SubjSrc: SrcMarker,
|
|
|
|
SubjFavorite: false,
|
|
|
|
SubjPrivate: false,
|
|
|
|
SubjNotes: "",
|
2021-08-30 18:58:27 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
|
|
|
DeletedAt: nil,
|
2021-08-30 13:39:53 +02:00
|
|
|
},
|
2021-08-30 17:20:39 +02:00
|
|
|
"actor-1": Subject{
|
2021-09-17 14:26:12 +02:00
|
|
|
SubjUID: "jqy1y111h1njaaad",
|
|
|
|
SubjSlug: "actor-a",
|
|
|
|
SubjName: "Actor A",
|
|
|
|
SubjType: SubjPerson,
|
|
|
|
SubjSrc: SrcMarker,
|
|
|
|
SubjFavorite: false,
|
|
|
|
SubjPrivate: false,
|
|
|
|
SubjNotes: "",
|
2021-08-30 18:58:27 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
|
|
|
DeletedAt: nil,
|
2021-08-30 17:20:39 +02:00
|
|
|
},
|
2021-08-16 00:29:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// CreateSubjectFixtures inserts known entities into the database for testing.
|
|
|
|
func CreateSubjectFixtures() {
|
|
|
|
for _, entity := range SubjectFixtures {
|
|
|
|
Db().Create(&entity)
|
|
|
|
}
|
|
|
|
}
|