photoprism/internal/entity/subject_fixtures.go
Michael Mayer f5a8c5a45d Auth: Session and ACL enhancements #98 #1746
Signed-off-by: Michael Mayer <michael@photoprism.app>
2022-09-28 09:01:17 +02:00

125 lines
2.8 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",
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: "",
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: "",
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: "",
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: "",
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: "",
CreatedAt: TimeStamp(),
UpdatedAt: TimeStamp(),
DeletedAt: nil,
},
}
// CreateSubjectFixtures inserts known entities into the database for testing.
func CreateSubjectFixtures() {
for _, entity := range SubjectFixtures {
Db().Create(&entity)
}
}