Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] Add findUpdatedScenes API endpoint #878

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions frontend/src/graphql/queries/UpdatedScenes.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
query UpdatedScenes($input: [QueryUpdatedScenesInput!]!) {
findUpdatedScenes(input: $input) {
id
updated
deleted
scene {
...QuerySceneFragment
}
}
}
278 changes: 278 additions & 0 deletions frontend/src/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,8 @@ export type Query = {
findTagCategory?: Maybe<TagCategory>;
/** Find a tag with a matching name or alias */
findTagOrAlias?: Maybe<Tag>;
/** Find Updated Scenes */
findUpdatedScenes: Array<QueryUpdatedScenesResult>;
/** Find user by ID or username */
findUser?: Maybe<User>;
getConfig: StashBoxConfig;
Expand Down Expand Up @@ -1301,6 +1303,11 @@ export type QueryFindTagOrAliasArgs = {
name: Scalars["String"]["input"];
};

/** The query root for this schema */
export type QueryFindUpdatedScenesArgs = {
input: Array<QueryUpdatedScenesInput>;
};

/** The query root for this schema */
export type QueryFindUserArgs = {
id?: InputMaybe<Scalars["ID"]["input"]>;
Expand Down Expand Up @@ -1455,6 +1462,19 @@ export type QueryTagsResultType = {
tags: Array<Tag>;
};

export type QueryUpdatedScenesInput = {
id: Scalars["ID"]["input"];
last_recorded_update: Scalars["Time"]["input"];
};

export type QueryUpdatedScenesResult = {
__typename: "QueryUpdatedScenesResult";
deleted: Scalars["Boolean"]["output"];
id: Scalars["ID"]["output"];
scene?: Maybe<Scene>;
updated: Scalars["Boolean"]["output"];
};

export type QueryUsersResultType = {
__typename: "QueryUsersResultType";
count: Scalars["Int"]["output"];
Expand Down Expand Up @@ -30447,6 +30467,53 @@ export type UnreadNotificationCountQuery = {
getUnreadNotificationCount: number;
};

export type UpdatedScenesQueryVariables = Exact<{
input: Array<QueryUpdatedScenesInput> | QueryUpdatedScenesInput;
}>;

export type UpdatedScenesQuery = {
__typename: "Query";
findUpdatedScenes: Array<{
__typename: "QueryUpdatedScenesResult";
id: string;
updated: boolean;
deleted: boolean;
scene?: {
__typename: "Scene";
id: string;
release_date?: string | null;
title?: string | null;
duration?: number | null;
urls: Array<{
__typename: "URL";
url: string;
site: { __typename: "Site"; id: string; name: string; icon: string };
}>;
images: Array<{
__typename: "Image";
id: string;
url: string;
width: number;
height: number;
}>;
studio?: { __typename: "Studio"; id: string; name: string } | null;
performers: Array<{
__typename: "PerformerAppearance";
as?: string | null;
performer: {
__typename: "Performer";
id: string;
name: string;
disambiguation?: string | null;
deleted: boolean;
gender?: GenderEnum | null;
aliases: Array<string>;
};
}>;
} | null;
}>;
};

export type UserQueryVariables = Exact<{
name: Scalars["String"]["input"];
}>;
Expand Down Expand Up @@ -67310,6 +67377,217 @@ export const UnreadNotificationCountDocument = {
UnreadNotificationCountQuery,
UnreadNotificationCountQueryVariables
>;
export const UpdatedScenesDocument = {
kind: "Document",
definitions: [
{
kind: "OperationDefinition",
operation: "query",
name: { kind: "Name", value: "UpdatedScenes" },
variableDefinitions: [
{
kind: "VariableDefinition",
variable: {
kind: "Variable",
name: { kind: "Name", value: "input" },
},
type: {
kind: "NonNullType",
type: {
kind: "ListType",
type: {
kind: "NonNullType",
type: {
kind: "NamedType",
name: { kind: "Name", value: "QueryUpdatedScenesInput" },
},
},
},
},
},
],
selectionSet: {
kind: "SelectionSet",
selections: [
{
kind: "Field",
name: { kind: "Name", value: "findUpdatedScenes" },
arguments: [
{
kind: "Argument",
name: { kind: "Name", value: "input" },
value: {
kind: "Variable",
name: { kind: "Name", value: "input" },
},
},
],
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "updated" } },
{ kind: "Field", name: { kind: "Name", value: "deleted" } },
{
kind: "Field",
name: { kind: "Name", value: "scene" },
selectionSet: {
kind: "SelectionSet",
selections: [
{
kind: "FragmentSpread",
name: { kind: "Name", value: "QuerySceneFragment" },
},
],
},
},
],
},
},
],
},
},
{
kind: "FragmentDefinition",
name: { kind: "Name", value: "URLFragment" },
typeCondition: {
kind: "NamedType",
name: { kind: "Name", value: "URL" },
},
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "url" } },
{
kind: "Field",
name: { kind: "Name", value: "site" },
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "name" } },
{ kind: "Field", name: { kind: "Name", value: "icon" } },
],
},
},
],
},
},
{
kind: "FragmentDefinition",
name: { kind: "Name", value: "ImageFragment" },
typeCondition: {
kind: "NamedType",
name: { kind: "Name", value: "Image" },
},
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "url" } },
{ kind: "Field", name: { kind: "Name", value: "width" } },
{ kind: "Field", name: { kind: "Name", value: "height" } },
],
},
},
{
kind: "FragmentDefinition",
name: { kind: "Name", value: "ScenePerformerFragment" },
typeCondition: {
kind: "NamedType",
name: { kind: "Name", value: "Performer" },
},
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "name" } },
{ kind: "Field", name: { kind: "Name", value: "disambiguation" } },
{ kind: "Field", name: { kind: "Name", value: "deleted" } },
{ kind: "Field", name: { kind: "Name", value: "gender" } },
{ kind: "Field", name: { kind: "Name", value: "aliases" } },
],
},
},
{
kind: "FragmentDefinition",
name: { kind: "Name", value: "QuerySceneFragment" },
typeCondition: {
kind: "NamedType",
name: { kind: "Name", value: "Scene" },
},
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "release_date" } },
{ kind: "Field", name: { kind: "Name", value: "title" } },
{ kind: "Field", name: { kind: "Name", value: "duration" } },
{
kind: "Field",
name: { kind: "Name", value: "urls" },
selectionSet: {
kind: "SelectionSet",
selections: [
{
kind: "FragmentSpread",
name: { kind: "Name", value: "URLFragment" },
},
],
},
},
{
kind: "Field",
name: { kind: "Name", value: "images" },
selectionSet: {
kind: "SelectionSet",
selections: [
{
kind: "FragmentSpread",
name: { kind: "Name", value: "ImageFragment" },
},
],
},
},
{
kind: "Field",
name: { kind: "Name", value: "studio" },
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "id" } },
{ kind: "Field", name: { kind: "Name", value: "name" } },
],
},
},
{
kind: "Field",
name: { kind: "Name", value: "performers" },
selectionSet: {
kind: "SelectionSet",
selections: [
{ kind: "Field", name: { kind: "Name", value: "as" } },
{
kind: "Field",
name: { kind: "Name", value: "performer" },
selectionSet: {
kind: "SelectionSet",
selections: [
{
kind: "FragmentSpread",
name: { kind: "Name", value: "ScenePerformerFragment" },
},
],
},
},
],
},
},
],
},
},
],
} as unknown as DocumentNode<UpdatedScenesQuery, UpdatedScenesQueryVariables>;
export const UserDocument = {
kind: "Document",
definitions: [
Expand Down
3 changes: 3 additions & 0 deletions graphql/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ type Query {
findSite(id: ID!): Site @hasRole(role: READ)
querySites: QuerySitesResultType! @hasRole(role: READ)

"""Find Updated Scenes"""
findUpdatedScenes(input: [QueryUpdatedScenesInput!]!): [QueryUpdatedScenesResult!]! @hasRole(role: READ)

#### Edits ####

findEdit(id: ID!): Edit @hasRole(role: READ)
Expand Down
12 changes: 12 additions & 0 deletions graphql/schema/types/scene.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -288,3 +288,15 @@ type QueryExistingSceneResult {
edits: [Edit!]!
scenes: [Scene!]!
}

input QueryUpdatedScenesInput {
id: ID!
last_recorded_update: Time!
}

type QueryUpdatedScenesResult {
id: ID!
updated: Boolean!
deleted: Boolean!
scene: Scene
}
Loading
Loading