Added dedicated movie photo table, renamed scene photo function.
This commit is contained in:
parent
295573c1ef
commit
15c9af8057
|
@ -164,8 +164,8 @@ function poster() {
|
||||||
function photos() {
|
function photos() {
|
||||||
const clips = this.release.clips || [];
|
const clips = this.release.clips || [];
|
||||||
const clipPostersById = clips.reduce((acc, clip) => ({ ...acc, [clip.poster.id]: clip.poster }), {});
|
const clipPostersById = clips.reduce((acc, clip) => ({ ...acc, [clip.poster.id]: clip.poster }), {});
|
||||||
const uniqueClipPosters = Array.from(new Set(clips.map(clip => clip.poster.id) || [])).map(posterId => clipPostersById[posterId]);
|
const uniqueClipPosters = Array.from(new Set(clips.map((clip) => clip.poster.id) || [])).map((posterId) => clipPostersById[posterId]);
|
||||||
const photosWithClipPosters = (this.release.photos || []).concat(uniqueClipPosters);
|
const photosWithClipPosters = (this.release.photos || []).concat(this.release.scenesPhotos || []).concat(uniqueClipPosters);
|
||||||
|
|
||||||
if (this.release.trailer || (this.release.teaser && this.release.teaser.mime !== 'image/gif')) {
|
if (this.release.trailer || (this.release.teaser && this.release.teaser.mime !== 'image/gif')) {
|
||||||
// poster will be on trailer video
|
// poster will be on trailer video
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
<Album
|
<Album
|
||||||
v-if="showAlbum"
|
v-if="showAlbum"
|
||||||
:items="[release.poster, ...release.photos]"
|
:items="[release.poster, ...release.photos, ...release.scenesPhotos]"
|
||||||
:title="release.title"
|
:title="release.title"
|
||||||
:path="config.media.mediaPath"
|
:path="config.media.mediaPath"
|
||||||
@close="$router.replace({ hash: undefined })"
|
@close="$router.replace({ hash: undefined })"
|
||||||
|
|
|
@ -79,6 +79,7 @@ function curateRelease(release, type = 'scene') {
|
||||||
if (release.series) curatedRelease.series = release.series.filter(Boolean).map(({ serie }) => curateRelease(serie, 'serie'));
|
if (release.series) curatedRelease.series = release.series.filter(Boolean).map(({ serie }) => curateRelease(serie, 'serie'));
|
||||||
if (release.chapters) curatedRelease.chapters = release.chapters.filter(Boolean).map((chapter) => curateRelease(chapter));
|
if (release.chapters) curatedRelease.chapters = release.chapters.filter(Boolean).map((chapter) => curateRelease(chapter));
|
||||||
if (release.photos) curatedRelease.photos = release.photos.filter(Boolean).map((photo) => photo.media || photo);
|
if (release.photos) curatedRelease.photos = release.photos.filter(Boolean).map((photo) => photo.media || photo);
|
||||||
|
if (release.scenesPhotos) curatedRelease.scenesPhotos = release.scenesPhotos.filter(Boolean).map((photo) => photo.media || photo);
|
||||||
if (release.covers) curatedRelease.covers = release.covers.filter(Boolean).map(({ media }) => media);
|
if (release.covers) curatedRelease.covers = release.covers.filter(Boolean).map(({ media }) => media);
|
||||||
if (release.trailer) curatedRelease.trailer = release.trailer.media;
|
if (release.trailer) curatedRelease.trailer = release.trailer.media;
|
||||||
if (release.teaser) curatedRelease.teaser = release.teaser.media;
|
if (release.teaser) curatedRelease.teaser = release.teaser.media;
|
||||||
|
|
|
@ -442,22 +442,26 @@ const releasesFragment = `
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const mediaFragment = `
|
const mediaFields = `
|
||||||
media {
|
id
|
||||||
|
index
|
||||||
|
path
|
||||||
|
thumbnail
|
||||||
|
lazy
|
||||||
|
isS3
|
||||||
|
comment
|
||||||
|
sfw: sfwMedia {
|
||||||
id
|
id
|
||||||
index
|
|
||||||
path
|
|
||||||
thumbnail
|
thumbnail
|
||||||
lazy
|
lazy
|
||||||
isS3
|
path
|
||||||
comment
|
comment
|
||||||
sfw: sfwMedia {
|
}
|
||||||
id
|
`;
|
||||||
thumbnail
|
|
||||||
lazy
|
const mediaFragment = `
|
||||||
path
|
media {
|
||||||
comment
|
${mediaFields}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -656,6 +660,8 @@ export {
|
||||||
actorFields,
|
actorFields,
|
||||||
actorStashesFields,
|
actorStashesFields,
|
||||||
campaignsFragment,
|
campaignsFragment,
|
||||||
|
mediaFields,
|
||||||
|
mediaFragment,
|
||||||
movieFields,
|
movieFields,
|
||||||
releaseActorsFragment,
|
releaseActorsFragment,
|
||||||
releaseFields,
|
releaseFields,
|
||||||
|
|
|
@ -4,6 +4,8 @@ import {
|
||||||
releaseFragment,
|
releaseFragment,
|
||||||
releaseFields,
|
releaseFields,
|
||||||
movieFields,
|
movieFields,
|
||||||
|
mediaFragment,
|
||||||
|
mediaFields,
|
||||||
} from '../fragments';
|
} from '../fragments';
|
||||||
import { curateRelease } from '../curate';
|
import { curateRelease } from '../curate';
|
||||||
import getDateRange from '../get-date-range';
|
import getDateRange from '../get-date-range';
|
||||||
|
@ -225,25 +227,11 @@ function initReleasesActions(store, router) {
|
||||||
slug
|
slug
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
photos {
|
photos: moviesPhotos {
|
||||||
id
|
${mediaFragment}
|
||||||
index
|
}
|
||||||
path
|
scenesPhotos {
|
||||||
thumbnail
|
${mediaFields}
|
||||||
lazy
|
|
||||||
width
|
|
||||||
height
|
|
||||||
thumbnailWidth
|
|
||||||
thumbnailHeight
|
|
||||||
isS3
|
|
||||||
comment
|
|
||||||
sfw: sfwMedia {
|
|
||||||
id
|
|
||||||
thumbnail
|
|
||||||
lazy
|
|
||||||
path
|
|
||||||
comment
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
entity {
|
entity {
|
||||||
id
|
id
|
||||||
|
|
|
@ -183,8 +183,6 @@ exports.up = async (knex) => Promise.resolve()
|
||||||
ORDER BY media.index ASC
|
ORDER BY media.index ASC
|
||||||
$$ LANGUAGE SQL STABLE;
|
$$ LANGUAGE SQL STABLE;
|
||||||
|
|
||||||
COMMENT ON FUNCTION search_movies IS E'@sortable';
|
|
||||||
|
|
||||||
GRANT ALL ON ALL TABLES IN SCHEMA public TO :visitor;
|
GRANT ALL ON ALL TABLES IN SCHEMA public TO :visitor;
|
||||||
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO :visitor;
|
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO :visitor;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
const config = require('config');
|
||||||
|
|
||||||
|
exports.up = async (knex) => Promise.resolve()
|
||||||
|
.then(() => knex.raw(`
|
||||||
|
ALTER FUNCTION movies_photos(movie movies) RENAME TO movies_scenes_photos;
|
||||||
|
`))
|
||||||
|
.then(() => knex.schema.createTable('movies_photos', (table) => {
|
||||||
|
table.integer('movie_id', 16)
|
||||||
|
.notNullable()
|
||||||
|
.references('id')
|
||||||
|
.inTable('movies')
|
||||||
|
.onDelete('cascade');
|
||||||
|
|
||||||
|
table.text('media_id', 21)
|
||||||
|
.notNullable()
|
||||||
|
.references('id')
|
||||||
|
.inTable('media');
|
||||||
|
|
||||||
|
table.unique(['movie_id', 'media_id']);
|
||||||
|
}))
|
||||||
|
.then(() => knex.raw(`
|
||||||
|
GRANT ALL ON ALL TABLES IN SCHEMA public TO :visitor;
|
||||||
|
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO :visitor;
|
||||||
|
`, {
|
||||||
|
visitor: knex.raw(config.database.query.user),
|
||||||
|
}));
|
||||||
|
|
||||||
|
exports.down = async (knex) => knex.raw(`
|
||||||
|
DROP TABLE IF EXISTS movies_photos CASCADE;
|
||||||
|
ALTER FUNCTION movies_scenes_photos(movie movies) RENAME TO movies_photos;
|
||||||
|
`);
|
|
@ -238,6 +238,7 @@ const { argv } = yargs
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
.option('level', {
|
.option('level', {
|
||||||
|
alias: 'log-level',
|
||||||
describe: 'Log level',
|
describe: 'Log level',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
default: process.env.NODE_ENV === 'development' ? 'silly' : 'info',
|
default: process.env.NODE_ENV === 'development' ? 'silly' : 'info',
|
||||||
|
|
Loading…
Reference in New Issue