-
Notifications
You must be signed in to change notification settings - Fork 62
/
subject.go
182 lines (164 loc) · 6.46 KB
/
subject.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
// SPDX-License-Identifier: AGPL-3.0-only
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>
package res
import (
"time"
"github.com/bangumi/server/internal/compat"
"github.com/bangumi/server/internal/model"
"github.com/bangumi/server/pkg/wiki"
)
type v0wiki = []interface{}
type SubjectV0 struct {
Date *string `json:"date"`
Platform *string `json:"platform"`
Image SubjectImages `json:"images"`
Summary string `json:"summary"`
Name string `json:"name"`
NameCN string `json:"name_cn"`
Tags []compat.Tag `json:"tags"`
Infobox v0wiki `json:"infobox"`
Rating Rating `json:"rating"`
TotalEpisodes int64 `json:"total_episodes"`
Collection SubjectCollectionStat `json:"collection"`
ID uint32 `json:"id"`
Eps uint32 `json:"eps"`
Volumes uint32 `json:"volumes"`
Redirect uint32 `json:"-"`
Locked bool `json:"locked"`
NSFW bool `json:"nsfw"`
TypeID model.SubjectType `json:"type"`
}
type Subject struct {
Image SubjectImages `json:"images"`
Infobox string `json:"infobox"`
Name string `json:"name"`
NameCN string `json:"name_cn"`
Summary string `json:"summary"`
PlatformText string `json:"platform_text"`
TypeText string `json:"type_text"`
Wiki wiki.Wiki `json:"wiki"`
Tags []compat.Tag `json:"tags"`
Rating Rating `json:"rating"`
Collection SubjectCollectionStat `json:"collection"`
Volumes uint32 `json:"volumes"`
Eps uint32 `json:"eps"`
ID uint32 `json:"id"`
Redirect uint32 `json:"-"`
Platform uint16 `json:"platform_id"`
Airtime uint8 `json:"air_time"`
Locked bool `json:"locked"`
NSFW bool `json:"nsfw"`
TypeID model.SubjectType `json:"type_id"`
}
type SubjectCollectionStat struct {
OnHold uint32 `json:"on_hold"`
Dropped uint32 `json:"dropped"`
Wish uint32 `json:"wish"`
Collect uint32 `json:"collect"`
Doing uint32 `json:"doing"`
}
type Count struct {
Field1 uint32 `json:"1"`
Field2 uint32 `json:"2"`
Field3 uint32 `json:"3"`
Field4 uint32 `json:"4"`
Field5 uint32 `json:"5"`
Field6 uint32 `json:"6"`
Field7 uint32 `json:"7"`
Field8 uint32 `json:"8"`
Field9 uint32 `json:"9"`
Field10 uint32 `json:"10"`
}
type Rating struct {
Rank uint32 `json:"rank"`
Total uint32 `json:"total"`
Count Count `json:"count"`
Score float64 `json:"score"`
}
type PersonRelatedSubject struct {
Staff string `json:"staff"`
Name string `json:"name"`
NameCn string `json:"name_cn"`
Image string `json:"image"`
SubjectID model.SubjectIDType `json:"id"`
}
type PersonRelatedCharacter struct {
Images PersonImages `json:"images"`
Name string `json:"name"`
SubjectName string `json:"subject_name"`
SubjectNameCn string `json:"subject_name_cn"`
SubjectID model.SubjectIDType `json:"subject_id"`
ID model.CharacterIDType `json:"id"`
Type uint8 `json:"type" doc:"character type"`
}
type CharacterRelatedPerson struct {
Images PersonImages `json:"images"`
Name string
SubjectName string `json:"subject_name"`
SubjectNameCn string `json:"subject_name_cn"`
SubjectID model.SubjectIDType `json:"subject_id"`
ID model.CharacterIDType `json:"id"`
Type uint8 `json:"type" doc:"person type"`
}
type CharacterRelatedSubject struct {
Staff string `json:"staff"`
Name string `json:"name"`
NameCn string `json:"name_cn"`
Image string `json:"image"`
ID model.SubjectIDType `json:"id"`
}
type SubjectRelatedSubject struct {
Images SubjectImages `json:"images"`
Name string `json:"name"`
NameCn string `json:"name_cn"`
Relation string `json:"relation"`
Type model.SubjectType `json:"type"`
SubjectID model.SubjectIDType `json:"id"`
}
type SubjectRelatedCharacter struct {
Images PersonImages `json:"images"`
Name string `json:"name"`
Relation string `json:"relation"`
Actors []Actor `json:"actors"`
Type uint8 `json:"type"`
ID model.PersonIDType `json:"id"`
}
type SubjectRelatedPerson struct {
Images PersonImages `json:"images"`
Name string `json:"name" doc:"person name"`
Relation string `json:"relation"`
Career []string `json:"career"`
Type uint8 `json:"type"`
ID model.PersonIDType `json:"id" doc:"person ID"`
}
type Actor struct {
Images PersonImages `json:"images"`
Name string `json:"name"`
ShortSummary string `json:"short_summary"`
Career []string `json:"career"`
ID model.PersonIDType `json:"id"`
Type uint8 `json:"type"`
Locked bool `json:"locked"`
}
type SlimSubjectV0 struct {
AddedAt time.Time `json:"added_at"`
Date *string `json:"date"`
Image SubjectImages `json:"images"`
Name string `json:"name"`
NameCN string `json:"name_cn"`
Comment string `json:"comment"`
Infobox v0wiki `json:"infobox"`
ID uint32 `json:"id"`
TypeID model.SubjectType `json:"type"`
}