forked from DebaucheryLibrarian/traxxx
Added stashes with experimental row security policies. Added tag photos.
This commit is contained in:
@@ -125,9 +125,32 @@ function curateTag(tag) {
|
||||
return curatedTag;
|
||||
}
|
||||
|
||||
function curateStash(stash) {
|
||||
const curatedStash = {
|
||||
...stash,
|
||||
};
|
||||
|
||||
if (stash.scenes) {
|
||||
curatedStash.scenes = stash.scenes.map(item => ({
|
||||
...item,
|
||||
scene: curateRelease(item.scene),
|
||||
}));
|
||||
}
|
||||
|
||||
if (stash.actors) {
|
||||
curatedStash.actors = stash.actors.map(item => ({
|
||||
...item,
|
||||
actor: curateActor(item.actor),
|
||||
}));
|
||||
}
|
||||
|
||||
return curatedStash;
|
||||
}
|
||||
|
||||
export {
|
||||
curateActor,
|
||||
curateEntity,
|
||||
curateRelease,
|
||||
curateTag,
|
||||
curateStash,
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ import { createRouter, createWebHistory } from 'vue-router';
|
||||
import Home from '../components/home/home.vue';
|
||||
import Login from '../components/auth/login.vue';
|
||||
import Signup from '../components/auth/signup.vue';
|
||||
import User from '../components/users/user.vue';
|
||||
import Release from '../components/releases/release.vue';
|
||||
import Entity from '../components/entities/entity.vue';
|
||||
import Networks from '../components/networks/networks.vue';
|
||||
@@ -38,6 +39,11 @@ const routes = [
|
||||
name: 'singup',
|
||||
component: Signup,
|
||||
},
|
||||
{
|
||||
path: '/user/:username',
|
||||
name: 'user',
|
||||
component: User,
|
||||
},
|
||||
{
|
||||
path: '/updates',
|
||||
redirect: {
|
||||
|
||||
102
assets/js/stashes/actions.js
Normal file
102
assets/js/stashes/actions.js
Normal file
@@ -0,0 +1,102 @@
|
||||
import { graphql } from '../api';
|
||||
import { curateStash } from '../curate';
|
||||
|
||||
function initStashesActions(_store, _router) {
|
||||
async function fetchUserStashes(context, userId) {
|
||||
const { stashes } = await graphql(`
|
||||
query Stashes(
|
||||
$userId: Int!
|
||||
) {
|
||||
stashes(
|
||||
filter: {
|
||||
userId: {
|
||||
equalTo: $userId
|
||||
}
|
||||
}
|
||||
) {
|
||||
id
|
||||
name
|
||||
actors: stashesActors {
|
||||
comment
|
||||
actor {
|
||||
id
|
||||
name
|
||||
slug
|
||||
gender
|
||||
age
|
||||
ageFromBirth
|
||||
dateOfBirth
|
||||
birthCity
|
||||
birthState
|
||||
birthCountry: countryByBirthCountryAlpha2 {
|
||||
alpha2
|
||||
name
|
||||
alias
|
||||
}
|
||||
avatar: avatarMedia {
|
||||
id
|
||||
path
|
||||
thumbnail
|
||||
lazy
|
||||
}
|
||||
}
|
||||
}
|
||||
scenes: stashesScenes {
|
||||
comment
|
||||
scene {
|
||||
id
|
||||
title
|
||||
slug
|
||||
url
|
||||
date
|
||||
actors: releasesActors {
|
||||
actor {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
}
|
||||
tags: releasesTags {
|
||||
tag {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
}
|
||||
entity {
|
||||
id
|
||||
name
|
||||
slug
|
||||
independent
|
||||
parent {
|
||||
id
|
||||
name
|
||||
slug
|
||||
independent
|
||||
}
|
||||
}
|
||||
poster: releasesPosterByReleaseId {
|
||||
media {
|
||||
path
|
||||
thumbnail
|
||||
lazy
|
||||
isS3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`, {
|
||||
userId,
|
||||
});
|
||||
|
||||
return stashes.map(stash => curateStash(stash));
|
||||
}
|
||||
|
||||
return {
|
||||
fetchUserStashes,
|
||||
};
|
||||
}
|
||||
|
||||
export default initStashesActions;
|
||||
1
assets/js/stashes/mutations.js
Normal file
1
assets/js/stashes/mutations.js
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
13
assets/js/stashes/stashes.js
Normal file
13
assets/js/stashes/stashes.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import state from './state';
|
||||
import mutations from './mutations';
|
||||
import actions from './actions';
|
||||
|
||||
function initStashesStore(store, router) {
|
||||
return {
|
||||
state,
|
||||
mutations,
|
||||
actions: actions(store, router),
|
||||
};
|
||||
}
|
||||
|
||||
export default initStashesStore;
|
||||
1
assets/js/stashes/state.js
Normal file
1
assets/js/stashes/state.js
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
@@ -2,20 +2,24 @@ import Vuex from 'vuex';
|
||||
|
||||
import initUiStore from './ui/ui';
|
||||
import initAuthStore from './auth/auth';
|
||||
import initUsersStore from './users/users';
|
||||
import initReleasesStore from './releases/releases';
|
||||
import initEntitiesStore from './entities/entities';
|
||||
import initActorsStore from './actors/actors';
|
||||
import initTagsStore from './tags/tags';
|
||||
import initStashesStore from './stashes/stashes';
|
||||
|
||||
function initStore(router) {
|
||||
const store = new Vuex.Store();
|
||||
|
||||
store.registerModule('ui', initUiStore(store, router));
|
||||
store.registerModule('auth', initAuthStore(store, router));
|
||||
store.registerModule('users', initUsersStore(store, router));
|
||||
store.registerModule('releases', initReleasesStore(store, router));
|
||||
store.registerModule('entities', initEntitiesStore(store, router));
|
||||
store.registerModule('actors', initActorsStore(store, router));
|
||||
store.registerModule('tags', initTagsStore(store, router));
|
||||
store.registerModule('stashes', initStashesStore(store, router));
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
15
assets/js/users/actions.js
Normal file
15
assets/js/users/actions.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { get } from '../api';
|
||||
|
||||
function initUsersActions(_store, _router) {
|
||||
async function fetchUser(context, username) {
|
||||
const user = await get(`/users/${username}`);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
return {
|
||||
fetchUser,
|
||||
};
|
||||
}
|
||||
|
||||
export default initUsersActions;
|
||||
1
assets/js/users/mutations.js
Normal file
1
assets/js/users/mutations.js
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
1
assets/js/users/state.js
Normal file
1
assets/js/users/state.js
Normal file
@@ -0,0 +1 @@
|
||||
export default {};
|
||||
13
assets/js/users/users.js
Normal file
13
assets/js/users/users.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import state from './state';
|
||||
import mutations from './mutations';
|
||||
import actions from './actions';
|
||||
|
||||
function initUsersStore(store, router) {
|
||||
return {
|
||||
state,
|
||||
mutations,
|
||||
actions: actions(store, router),
|
||||
};
|
||||
}
|
||||
|
||||
export default initUsersStore;
|
||||
Reference in New Issue
Block a user