photoprism/internal/entity/subject_fixtures.go
Michael Mayer f6c18f7767 People: Count the number of photos for each subject #22
Also fixes issues with older versions of MariaDB, see #1544
2021-10-01 16:34:29 +02:00

131 lines
3 KiB
Go

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{
"john-doe": Subject{
SubjUID: "jqu0xs11qekk9jx8",
SubjSlug: "john-doe",
SubjName: "John Doe",
SubjType: SubjPerson,
SubjSrc: SrcManual,
SubjFavorite: true,
SubjPrivate: false,
SubjExcluded: false,
SubjBio: "Subject Description",
SubjNotes: "Short Note",
MetadataJSON: []byte(""),
FileCount: 1,
PhotoCount: 1,
CreatedAt: TimeStamp(),
UpdatedAt: TimeStamp(),
DeletedAt: nil,
},
"joe-biden": Subject{
SubjUID: "jqy3y652h8njw0sx",
SubjSlug: "joe-biden",
SubjName: "Joe Biden",
SubjType: SubjPerson,
SubjSrc: SrcMarker,
SubjFavorite: false,
SubjPrivate: false,
SubjExcluded: false,
SubjBio: "",
SubjNotes: "",
MetadataJSON: []byte(""),
FileCount: 1,
PhotoCount: 1,
CreatedAt: TimeStamp(),
UpdatedAt: TimeStamp(),
DeletedAt: nil,
},
"dangling": Subject{
SubjUID: "jqy1y111h1njaaaa",
SubjSlug: "dangling-subject",
SubjName: "Dangling Subject",
SubjAlias: "Powell",
SubjType: SubjPerson,
SubjSrc: SrcMarker,
SubjFavorite: false,
SubjPrivate: false,
SubjExcluded: false,
SubjBio: "",
SubjNotes: "",
MetadataJSON: []byte(""),
Thumb: "2cad9168fa6acc5c5c2965ddf6ec465ca42fd818",
FileCount: 0,
PhotoCount: 0,
CreatedAt: TimeStamp(),
UpdatedAt: TimeStamp(),
DeletedAt: nil,
},
"jane-doe": Subject{
SubjUID: "jqy1y111h1njaaab",
SubjSlug: "jane-doe",
SubjName: "Jane Doe",
SubjType: SubjPerson,
SubjSrc: SrcMarker,
SubjFavorite: false,
SubjPrivate: false,
SubjExcluded: false,
SubjBio: "",
SubjNotes: "",
MetadataJSON: []byte(""),
FileCount: 3,
PhotoCount: 2,
CreatedAt: TimeStamp().AddDate(0, 0, 1),
UpdatedAt: TimeStamp(),
DeletedAt: nil,
},
"actress-1": Subject{
SubjUID: "jqy1y111h1njaaac",
SubjSlug: "actress-a",
SubjName: "Actress A",
SubjType: SubjPerson,
SubjSrc: SrcMarker,
SubjFavorite: false,
SubjPrivate: false,
SubjNotes: "",
MetadataJSON: []byte(""),
CreatedAt: TimeStamp(),
UpdatedAt: TimeStamp(),
DeletedAt: nil,
},
"actor-1": Subject{
SubjUID: "jqy1y111h1njaaad",
SubjSlug: "actor-a",
SubjName: "Actor A",
SubjType: SubjPerson,
SubjSrc: SrcMarker,
SubjFavorite: false,
SubjPrivate: false,
SubjNotes: "",
MetadataJSON: []byte(""),
CreatedAt: TimeStamp(),
UpdatedAt: TimeStamp(),
DeletedAt: nil,
},
}
// CreateSubjectFixtures inserts known entities into the database for testing.
func CreateSubjectFixtures() {
for _, entity := range SubjectFixtures {
Db().Create(&entity)
}
}