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-08-16 00:29:36 +02:00
|
|
|
SubjectUID: "jqu0xs11qekk9jx8",
|
|
|
|
SubjectSlug: "john-doe",
|
|
|
|
SubjectName: "John Doe",
|
2021-08-21 16:36:00 +02:00
|
|
|
SubjectType: SubjectPerson,
|
2021-08-19 21:12:38 +02:00
|
|
|
SubjectSrc: SrcManual,
|
2021-08-16 00:29:36 +02:00
|
|
|
Favorite: true,
|
|
|
|
Private: false,
|
|
|
|
Hidden: false,
|
|
|
|
SubjectDescription: "Subject Description",
|
|
|
|
SubjectNotes: "Short Note",
|
2021-08-16 01:45:36 +02:00
|
|
|
MetadataJSON: []byte(""),
|
2021-08-16 00:29:36 +02:00
|
|
|
PhotoCount: 1,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2021-08-16 00:29:36 +02:00
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
2021-08-21 16:36:00 +02:00
|
|
|
"joe-biden": Subject{
|
|
|
|
SubjectUID: "jqy3y652h8njw0sx",
|
|
|
|
SubjectSlug: "joe-biden",
|
|
|
|
SubjectName: "Joe Biden",
|
|
|
|
SubjectType: SubjectPerson,
|
|
|
|
SubjectSrc: SrcMarker,
|
|
|
|
Favorite: false,
|
|
|
|
Private: false,
|
|
|
|
Hidden: false,
|
|
|
|
SubjectDescription: "",
|
|
|
|
SubjectNotes: "",
|
|
|
|
MetadataJSON: []byte(""),
|
|
|
|
PhotoCount: 1,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2021-08-21 16:36:00 +02:00
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
2021-08-22 16:14:34 +02:00
|
|
|
"dangling": Subject{
|
|
|
|
SubjectUID: "jqy1y111h1njaaaa",
|
|
|
|
SubjectSlug: "dangling-subject",
|
|
|
|
SubjectName: "Dangling Subject",
|
|
|
|
SubjectType: SubjectPerson,
|
|
|
|
SubjectSrc: SrcMarker,
|
|
|
|
Favorite: false,
|
|
|
|
Private: false,
|
|
|
|
Hidden: false,
|
|
|
|
SubjectDescription: "",
|
|
|
|
SubjectNotes: "",
|
|
|
|
MetadataJSON: []byte(""),
|
|
|
|
PhotoCount: 0,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2021-08-22 16:14:34 +02:00
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
2021-08-26 11:58:28 +02:00
|
|
|
"jane-doe": Subject{
|
|
|
|
SubjectUID: "jqy1y111h1njaaab",
|
|
|
|
SubjectSlug: "jane-doe",
|
|
|
|
SubjectName: "Jane Doe",
|
|
|
|
SubjectType: SubjectPerson,
|
|
|
|
SubjectSrc: SrcMarker,
|
|
|
|
Favorite: false,
|
|
|
|
Private: false,
|
|
|
|
Hidden: false,
|
|
|
|
SubjectDescription: "",
|
|
|
|
SubjectNotes: "",
|
|
|
|
MetadataJSON: []byte(""),
|
|
|
|
PhotoCount: 3,
|
2021-08-29 13:26:05 +02:00
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
2021-08-26 11:58:28 +02:00
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
2021-08-30 13:39:53 +02:00
|
|
|
"actress-1": Subject{
|
|
|
|
SubjectUID: "jqy1y111h1njaaac",
|
|
|
|
SubjectSlug: "actress-a",
|
|
|
|
SubjectName: "Actress A",
|
|
|
|
SubjectType: SubjectPerson,
|
|
|
|
SubjectSrc: SrcMarker,
|
|
|
|
Favorite: false,
|
|
|
|
Private: false,
|
|
|
|
Hidden: false,
|
|
|
|
SubjectDescription: "",
|
|
|
|
SubjectNotes: "",
|
|
|
|
MetadataJSON: []byte(""),
|
|
|
|
PhotoCount: 3,
|
|
|
|
CreatedAt: TimeStamp(),
|
|
|
|
UpdatedAt: TimeStamp(),
|
|
|
|
DeletedAt: nil,
|
|
|
|
},
|
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)
|
|
|
|
}
|
|
|
|
}
|