mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Added various missing filters to performer page (#438)
This commit is contained in:
@@ -48,6 +48,8 @@ input PerformerFilterType {
|
|||||||
aliases: StringCriterionInput
|
aliases: StringCriterionInput
|
||||||
"""Filter by gender"""
|
"""Filter by gender"""
|
||||||
gender: GenderCriterionInput
|
gender: GenderCriterionInput
|
||||||
|
"""Filter to only include performers missing this property"""
|
||||||
|
is_missing: String
|
||||||
}
|
}
|
||||||
|
|
||||||
input SceneMarkerFilterType {
|
input SceneMarkerFilterType {
|
||||||
|
|||||||
@@ -158,6 +158,15 @@ func (qb *PerformerQueryBuilder) Query(performerFilter *PerformerFilterType, fin
|
|||||||
query.addArg(gender.Value.String())
|
query.addArg(gender.Value.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isMissingFilter := performerFilter.IsMissing; isMissingFilter != nil && *isMissingFilter != "" {
|
||||||
|
switch *isMissingFilter {
|
||||||
|
case "scenes":
|
||||||
|
query.addWhere("scenes_join.scene_id IS NULL")
|
||||||
|
default:
|
||||||
|
query.addWhere("performers." + *isMissingFilter + " IS NULL")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleStringCriterion(tableName+".ethnicity", performerFilter.Ethnicity, &query)
|
handleStringCriterion(tableName+".ethnicity", performerFilter.Ethnicity, &query)
|
||||||
handleStringCriterion(tableName+".country", performerFilter.Country, &query)
|
handleStringCriterion(tableName+".country", performerFilter.Country, &query)
|
||||||
handleStringCriterion(tableName+".eye_color", performerFilter.EyeColor, &query)
|
handleStringCriterion(tableName+".eye_color", performerFilter.EyeColor, &query)
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ export type CriterionType =
|
|||||||
| "duration"
|
| "duration"
|
||||||
| "favorite"
|
| "favorite"
|
||||||
| "hasMarkers"
|
| "hasMarkers"
|
||||||
| "isMissing"
|
| "sceneIsMissing"
|
||||||
|
| "performerIsMissing"
|
||||||
| "tags"
|
| "tags"
|
||||||
| "sceneTags"
|
| "sceneTags"
|
||||||
| "performers"
|
| "performers"
|
||||||
@@ -52,7 +53,9 @@ export abstract class Criterion {
|
|||||||
return "Favorite";
|
return "Favorite";
|
||||||
case "hasMarkers":
|
case "hasMarkers":
|
||||||
return "Has Markers";
|
return "Has Markers";
|
||||||
case "isMissing":
|
case "sceneIsMissing":
|
||||||
|
return "Is Missing";
|
||||||
|
case "performerIsMissing":
|
||||||
return "Is Missing";
|
return "Is Missing";
|
||||||
case "tags":
|
case "tags":
|
||||||
return "Tags";
|
return "Tags";
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import { CriterionModifier } from "src/core/generated-graphql";
|
import { CriterionModifier } from "src/core/generated-graphql";
|
||||||
import { Criterion, CriterionType, ICriterionOption } from "./criterion";
|
import { Criterion, CriterionType, ICriterionOption } from "./criterion";
|
||||||
|
|
||||||
export class IsMissingCriterion extends Criterion {
|
export abstract class IsMissingCriterion extends Criterion {
|
||||||
public type: CriterionType = "isMissing";
|
|
||||||
public parameterName: string = "is_missing";
|
public parameterName: string = "is_missing";
|
||||||
public modifier = CriterionModifier.Equals;
|
|
||||||
public modifierOptions = [];
|
public modifierOptions = [];
|
||||||
|
public modifier = CriterionModifier.Equals;
|
||||||
|
public value: string = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SceneIsMissingCriterion extends IsMissingCriterion {
|
||||||
|
public type: CriterionType = "sceneIsMissing";
|
||||||
public options: string[] = [
|
public options: string[] = [
|
||||||
"title",
|
"title",
|
||||||
"url",
|
"url",
|
||||||
@@ -15,10 +19,35 @@ export class IsMissingCriterion extends Criterion {
|
|||||||
"movie",
|
"movie",
|
||||||
"performers",
|
"performers",
|
||||||
];
|
];
|
||||||
public value: string = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class IsMissingCriterionOption implements ICriterionOption {
|
export class SceneIsMissingCriterionOption implements ICriterionOption {
|
||||||
public label: string = Criterion.getLabel("isMissing");
|
public label: string = Criterion.getLabel("sceneIsMissing");
|
||||||
public value: CriterionType = "isMissing";
|
public value: CriterionType = "sceneIsMissing";
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PerformerIsMissingCriterion extends IsMissingCriterion {
|
||||||
|
public type: CriterionType = "performerIsMissing";
|
||||||
|
public options: string[] = [
|
||||||
|
"url",
|
||||||
|
"twitter",
|
||||||
|
"instagram",
|
||||||
|
"ethnicity",
|
||||||
|
"country",
|
||||||
|
"eye_color",
|
||||||
|
"height",
|
||||||
|
"measurements",
|
||||||
|
"fake_tits",
|
||||||
|
"career_length",
|
||||||
|
"tattoos",
|
||||||
|
"piercings",
|
||||||
|
"aliases",
|
||||||
|
"gender",
|
||||||
|
"scenes"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class PerformerIsMissingCriterionOption implements ICriterionOption {
|
||||||
|
public label: string = Criterion.getLabel("performerIsMissing");
|
||||||
|
public value: CriterionType = "performerIsMissing";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
} from "./criterion";
|
} from "./criterion";
|
||||||
import { FavoriteCriterion } from "./favorite";
|
import { FavoriteCriterion } from "./favorite";
|
||||||
import { HasMarkersCriterion } from "./has-markers";
|
import { HasMarkersCriterion } from "./has-markers";
|
||||||
import { IsMissingCriterion } from "./is-missing";
|
import {PerformerIsMissingCriterion, SceneIsMissingCriterion} from "./is-missing";
|
||||||
import { NoneCriterion } from "./none";
|
import { NoneCriterion } from "./none";
|
||||||
import { PerformersCriterion } from "./performers";
|
import { PerformersCriterion } from "./performers";
|
||||||
import { RatingCriterion } from "./rating";
|
import { RatingCriterion } from "./rating";
|
||||||
@@ -35,8 +35,10 @@ export function makeCriteria(type: CriterionType = "none") {
|
|||||||
return new FavoriteCriterion();
|
return new FavoriteCriterion();
|
||||||
case "hasMarkers":
|
case "hasMarkers":
|
||||||
return new HasMarkersCriterion();
|
return new HasMarkersCriterion();
|
||||||
case "isMissing":
|
case "sceneIsMissing":
|
||||||
return new IsMissingCriterion();
|
return new SceneIsMissingCriterion();
|
||||||
|
case "performerIsMissing":
|
||||||
|
return new PerformerIsMissingCriterion();
|
||||||
case "tags":
|
case "tags":
|
||||||
return new TagsCriterion("tags");
|
return new TagsCriterion("tags");
|
||||||
case "sceneTags":
|
case "sceneTags":
|
||||||
@@ -47,7 +49,6 @@ export function makeCriteria(type: CriterionType = "none") {
|
|||||||
return new StudiosCriterion();
|
return new StudiosCriterion();
|
||||||
case "movies":
|
case "movies":
|
||||||
return new MoviesCriterion();
|
return new MoviesCriterion();
|
||||||
|
|
||||||
case "birth_year":
|
case "birth_year":
|
||||||
return new NumberCriterion(type, type);
|
return new NumberCriterion(type, type);
|
||||||
case "age": {
|
case "age": {
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ import {
|
|||||||
} from "./criteria/has-markers";
|
} from "./criteria/has-markers";
|
||||||
import {
|
import {
|
||||||
IsMissingCriterion,
|
IsMissingCriterion,
|
||||||
IsMissingCriterionOption,
|
PerformerIsMissingCriterionOption,
|
||||||
|
SceneIsMissingCriterionOption
|
||||||
} from "./criteria/is-missing";
|
} from "./criteria/is-missing";
|
||||||
import { NoneCriterionOption } from "./criteria/none";
|
import { NoneCriterionOption } from "./criteria/none";
|
||||||
import {
|
import {
|
||||||
@@ -115,7 +116,7 @@ export class ListFilterModel {
|
|||||||
new ResolutionCriterionOption(),
|
new ResolutionCriterionOption(),
|
||||||
ListFilterModel.createCriterionOption("duration"),
|
ListFilterModel.createCriterionOption("duration"),
|
||||||
new HasMarkersCriterionOption(),
|
new HasMarkersCriterionOption(),
|
||||||
new IsMissingCriterionOption(),
|
new SceneIsMissingCriterionOption(),
|
||||||
new TagsCriterionOption(),
|
new TagsCriterionOption(),
|
||||||
new PerformersCriterionOption(),
|
new PerformersCriterionOption(),
|
||||||
new StudiosCriterionOption(),
|
new StudiosCriterionOption(),
|
||||||
@@ -145,13 +146,10 @@ export class ListFilterModel {
|
|||||||
new NoneCriterionOption(),
|
new NoneCriterionOption(),
|
||||||
new FavoriteCriterionOption(),
|
new FavoriteCriterionOption(),
|
||||||
new GenderCriterionOption(),
|
new GenderCriterionOption(),
|
||||||
|
new PerformerIsMissingCriterionOption(),
|
||||||
|
...numberCriteria.concat(stringCriteria).map(c => ListFilterModel.createCriterionOption(c))
|
||||||
];
|
];
|
||||||
|
|
||||||
this.criterionOptions = this.criterionOptions.concat(
|
|
||||||
numberCriteria.concat(stringCriteria).map((c) => {
|
|
||||||
return ListFilterModel.createCriterionOption(c);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FilterMode.Studios:
|
case FilterMode.Studios:
|
||||||
@@ -381,7 +379,7 @@ export class ListFilterModel {
|
|||||||
case "hasMarkers":
|
case "hasMarkers":
|
||||||
result.has_markers = (criterion as HasMarkersCriterion).value;
|
result.has_markers = (criterion as HasMarkersCriterion).value;
|
||||||
break;
|
break;
|
||||||
case "isMissing":
|
case "sceneIsMissing":
|
||||||
result.is_missing = (criterion as IsMissingCriterion).value;
|
result.is_missing = (criterion as IsMissingCriterion).value;
|
||||||
break;
|
break;
|
||||||
case "tags": {
|
case "tags": {
|
||||||
@@ -513,6 +511,8 @@ export class ListFilterModel {
|
|||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "performerIsMissing":
|
||||||
|
result.is_missing = (criterion as IsMissingCriterion).value;
|
||||||
// no default
|
// no default
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user