Added stashes with experimental row security policies. Added tag photos.

This commit is contained in:
DebaucheryLibrarian
2021-03-14 04:54:43 +01:00
parent 816529b0ca
commit e371e9725a
58 changed files with 610 additions and 172 deletions

View File

@@ -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,
};

View File

@@ -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: {

View 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;

View File

@@ -0,0 +1 @@
export default {};

View 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;

View File

@@ -0,0 +1 @@
export default {};

View File

@@ -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;
}

View 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;

View File

@@ -0,0 +1 @@
export default {};

1
assets/js/users/state.js Normal file
View File

@@ -0,0 +1 @@
export default {};

13
assets/js/users/users.js Normal file
View 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;