-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
subject_fixtures.go
125 lines (118 loc) Β· 2.83 KB
/
subject_fixtures.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
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: "js6sg6b1qekk9jx8",
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: "js6sg6b2h8njw0sx",
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: "js6sg6b1h1njaaaa",
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: "js6sg6b1h1njaaab",
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: "js6sg6b1h1njaaac",
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: "js6sg6b1h1njaaad",
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)
}
}