Added favorite stash heart to scene tiles.

This commit is contained in:
DebaucheryLibrarian
2021-03-19 03:27:48 +01:00
parent f3d55806d1
commit 731a2792c5
15 changed files with 146 additions and 28 deletions

View File

@@ -26,6 +26,8 @@ function initEntitiesActions(store, router) {
$beforeTime: Datetime = "2100-01-01",
$orderBy: [ReleasesOrderBy!]
$exclude: [String!]
$hasAuth: Boolean!
$userId: Int
) {
entity: entityBySlugAndType(slug: $entitySlug, type: $entityType) {
id
@@ -160,6 +162,8 @@ function initEntitiesActions(store, router) {
afterTime: store.getters.after,
beforeTime: store.getters.before,
exclude: store.state.ui.tagFilter,
hasAuth: !!store.state.auth.user,
userId: store.state.auth.user?.id,
});
if (!entity) {

View File

@@ -228,6 +228,22 @@ const releaseFields = `
url
}
isNew
isStashed
stashes: stashesScenesBySceneId(
filter: {
stash: {
userId: {
equalTo: $userId
}
}
}
) @include(if: $hasAuth) {
stash {
id
name
slug
}
}
`;
const releasesFragment = `
@@ -352,6 +368,7 @@ const releaseFragment = `
}
}
}
isStashed
stashes: stashesScenesBySceneId(
filter: {
stash: {

View File

@@ -9,6 +9,8 @@ function initReleasesActions(store, router) {
const { connection: { releases, totalCount } } = await graphql(`
query Releases(
$hasAuth: Boolean!
$userId: Int
$limit:Int = 1000,
$offset:Int = 0,
$after:Datetime = "1900-01-01 00:00:00",
@@ -19,6 +21,8 @@ function initReleasesActions(store, router) {
${releasesFragment}
}
`, {
hasAuth: !!store.state.auth.user,
userId: store.state.auth.user?.id,
limit,
offset: Math.max(0, (pageNumber - 1)) * limit,
after,

View File

@@ -2,11 +2,13 @@ import { graphql, post, del } from '../api';
import { releaseFields } from '../fragments';
import { curateStash } from '../curate';
function initStashesActions(_store, _router) {
function initStashesActions(store, _router) {
async function fetchStash(context, stashId) {
const { stash } = await graphql(`
query Stash(
$stashId: Int!
$hasAuth: Boolean!
$userId: Int
) {
stash(id: $stashId) {
id
@@ -52,6 +54,8 @@ function initStashesActions(_store, _router) {
}
`, {
stashId: Number(stashId),
hasAuth: !!store.state.auth.user,
userId: store.state.auth.user?.id,
});
return curateStash(stash);

View File

@@ -23,6 +23,8 @@ function initTagsActions(store, _router) {
$before:Datetime = "2100-01-01",
$orderBy: [ReleasesOrderBy!],
$exclude: [String!]
$hasAuth: Boolean!
$userId: Int
) {
tagBySlug(slug:$tagSlug) {
id
@@ -136,6 +138,8 @@ function initTagsActions(store, _router) {
orderBy,
offset: Math.max(0, (pageNumber - 1)) * limit,
exclude: store.state.ui.tagFilter.filter(tagFilter => tagFilter !== tagSlug),
hasAuth: !!store.state.auth.user,
userId: store.state.auth.user?.id,
});
return {

View File

@@ -2,10 +2,12 @@ import { graphql } from '../api';
import { releaseFields } from '../fragments';
import { curateUser } from '../curate';
function initUsersActions(_store, _router) {
function initUsersActions(store, _router) {
async function fetchUser(context, username) {
const { user } = await graphql(`
query User(
$hasAuth: Boolean!
$userId: Int
$username: String!
) {
user: userByUsername(username: $username) {
@@ -52,6 +54,8 @@ function initUsersActions(_store, _router) {
}
}
`, {
hasAuth: !!store.state.auth.user,
userId: store.state.auth.user?.id,
username,
});