Skip to content

Commit

Permalink
feat: Add "Has Favourite Actor" Scene Filter Attribute (xbapps#1438)
Browse files Browse the repository at this point in the history
  • Loading branch information
toshski authored Nov 5, 2023
1 parent ef6f065 commit da4773f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/api/scenes.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ func (i SceneResource) getFilters(req *restful.Request, resp *restful.Response)
outAttributes = append(outAttributes, "Has Script Download")
outAttributes = append(outAttributes, "Has AI Generated Script")
outAttributes = append(outAttributes, "Has Human Generated Script")
outAttributes = append(outAttributes, "Has Favourite Actor")
type Results struct {
Result string
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/models/model_scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,8 @@ func queryScenes(db *gorm.DB, r RequestSceneList) (*gorm.DB, *gorm.DB) {
where = "scenes.ai_script = 1"
case "Has Human Generated Script":
where = "scenes.human_script = 1"
case "Has Favourite Actor":
where = "exists (select * from scene_cast join actors on actors.id=scene_cast.actor_id where actors.favourite=1 and scene_cast.scene_id=scenes.id)"
}

if negate {
Expand Down

0 comments on commit da4773f

Please sign in to comment.