Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbbf370a

Browse files
authored
feat: Gender filter for actors (#1812)
1 parentbe866da commitbbf370a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

‎pkg/api/actors.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ func (i ActorResource) getFilters(req *restful.Request, resp *restful.Response)
194194
outAttributes=append(outAttributes,"Breast Type "+r.Result)
195195
}
196196

197+
db.Table("actors").
198+
Where("IFNULL(gender,'') <> ''").
199+
Select("distinct gender as result").
200+
Order("gender").
201+
Find(&results)
202+
for_,r:=rangeresults {
203+
outAttributes=append(outAttributes,"Gender "+r.Result)
204+
}
205+
197206
resp.WriteHeaderAndEntity(http.StatusOK,ResponseGetActorFilters{
198207
Attributes:outAttributes,
199208
Cast:outCast,

‎pkg/models/model_actor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ func QueryActors(r RequestActorList, enablePreload bool) ResponseActorList {
204204
where:=""
205205

206206
countries:=GetCountryList()
207-
attributes:= [][2]string{{"Cup Size ","cup_size"}, {"Hair Color ","hair_color"}, {"Eye Color ","eye_color"}, {"Nationality ","nationality"}, {"Ethnicity ","ethnicity"}, {"Breast Type ","breast_type"}}
207+
attributes:= [][2]string{{"Cup Size ","cup_size"}, {"Hair Color ","hair_color"}, {"Eye Color ","eye_color"}, {"Nationality ","nationality"}, {"Gender ","gender"}, {"Ethnicity ","ethnicity"}, {"Breast Type ","breast_type"}}
208208
for_,attribute:=rangeattributes {
209209
ifstrings.HasPrefix(fieldName,attribute[0]) {
210210
value=fieldName[len(attribute[0]):]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp