No longer using meta table for avatar so edits are reflected immediately.
This commit is contained in:
@@ -22,6 +22,35 @@ import { interpolateProfiles } from '../common/actors.mjs'; // eslint-disable-li
|
||||
const logger = initLogger();
|
||||
const mj = new MerkleJson();
|
||||
|
||||
const keyMap = {
|
||||
avatar: 'avatar_media_id',
|
||||
dateOfBirth: 'date_of_birth',
|
||||
dateOfDeath: 'date_of_death',
|
||||
originCountry: 'birth_country_alpha2',
|
||||
originState: 'birth_state',
|
||||
originCity: 'birth_city',
|
||||
residenceCountry: 'residence_country_alpha2',
|
||||
residenceState: 'residence_state',
|
||||
residenceCity: 'residence_city',
|
||||
hairColor: 'hair_color',
|
||||
naturalBoobs: 'natural_boobs',
|
||||
boobsVolume: 'boobs_volume',
|
||||
boobsImplant: 'boobs_implant',
|
||||
boobsPlacement: 'boobs_placement',
|
||||
boobsIncision: 'boobs_incision',
|
||||
boobsSurgeon: 'boobs_surgeon',
|
||||
naturalButt: 'natural_butt',
|
||||
buttVolume: 'butt_volume',
|
||||
buttImplant: 'butt_implant',
|
||||
naturalLips: 'natural_lips',
|
||||
lipsVolume: 'lips_volume',
|
||||
naturalLabia: 'natural_labia',
|
||||
penisLength: 'penis_length',
|
||||
penisGirth: 'penis_girth',
|
||||
hasTattoos: 'has_tattoos',
|
||||
hasPiercings: 'has_piercings',
|
||||
};
|
||||
|
||||
export function curateActor(actor, context = {}) {
|
||||
return {
|
||||
id: actor.id,
|
||||
@@ -29,25 +58,14 @@ export function curateActor(actor, context = {}) {
|
||||
name: actor.name,
|
||||
gender: actor.gender,
|
||||
age: actor.age,
|
||||
dateOfBirth: actor.date_of_birth,
|
||||
...Object.fromEntries(Object.entries(keyMap).map(([key, entryKey]) => [key, actor[entryKey]])),
|
||||
ageFromBirth: actor.date_of_birth && differenceInYears(Date.now(), actor.date_of_birth),
|
||||
ageThen: context.sceneDate && actor.date_of_birth && differenceInYears(context.sceneDate, actor.date_of_birth),
|
||||
dateOfDeath: actor.date_of_death,
|
||||
bust: actor.bust,
|
||||
cup: actor.cup,
|
||||
waist: actor.waist,
|
||||
hip: actor.hip,
|
||||
naturalBoobs: actor.natural_boobs,
|
||||
boobsVolume: actor.boobs_volume,
|
||||
boobsImplant: actor.boobs_implant,
|
||||
boobsPlacement: actor.boobs_placement,
|
||||
boobsSurgeon: actor.boobs_surgeon,
|
||||
naturalButt: actor.natural_butt,
|
||||
buttVolume: actor.butt_volume,
|
||||
buttImplant: actor.butt_implant,
|
||||
penisLength: actor.penis_length,
|
||||
penisGirth: actor.penis_girth,
|
||||
isCircumcised: actor.is_circumcised,
|
||||
circumcised: actor.circumcised,
|
||||
height: actor.height && {
|
||||
metric: actor.height,
|
||||
imperial: unit(actor.height, 'cm').splitUnit(['ft', 'in']).map((value) => Math.round(value.toNumber())),
|
||||
@@ -57,10 +75,7 @@ export function curateActor(actor, context = {}) {
|
||||
imperial: Math.round(unit(actor.weight, 'kg').toNumeric('lbs')),
|
||||
},
|
||||
eyes: actor.eyes,
|
||||
hairColor: actor.hair_color,
|
||||
hasTattoos: actor.has_tattoos,
|
||||
tattoos: actor.tattoos,
|
||||
hasPiercings: actor.has_piercings,
|
||||
piercings: actor.piercings,
|
||||
origin: actor.birth_country_alpha2 && {
|
||||
country: actor.birth_country_alpha2 && {
|
||||
@@ -130,7 +145,8 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
||||
knex('actors')
|
||||
.select(
|
||||
'actors.*',
|
||||
'actors_meta.*',
|
||||
'actors_meta.stashed',
|
||||
knex.raw('row_to_json(avatars) as avatar'),
|
||||
'birth_countries.alpha2 as birth_country_alpha2',
|
||||
knex.raw('COALESCE(birth_countries.alias, birth_countries.name) as birth_country_name'),
|
||||
'residence_countries.alpha2 as residence_country_alpha2',
|
||||
@@ -139,6 +155,7 @@ export async function fetchActorsById(actorIds, options = {}, reqUser) {
|
||||
.leftJoin('actors_meta', 'actors_meta.actor_id', 'actors.id')
|
||||
.leftJoin('countries as birth_countries', 'birth_countries.alpha2', 'actors.birth_country_alpha2')
|
||||
.leftJoin('countries as residence_countries', 'residence_countries.alpha2', 'actors.residence_country_alpha2')
|
||||
.leftJoin('media as avatars', 'avatars.id', 'actors.avatar_media_id')
|
||||
.whereIn('actors.id', actorIds)
|
||||
.modify((builder) => {
|
||||
if (options.order) {
|
||||
@@ -459,32 +476,6 @@ export async function fetchActorRevisions(revisionId, filters = {}, reqUser) {
|
||||
};
|
||||
}
|
||||
|
||||
const keyMap = {
|
||||
avatar: 'avatar_media_id',
|
||||
dateOfBirth: 'date_of_birth',
|
||||
dateOfDeath: 'date_of_death',
|
||||
originCountry: 'birth_country_alpha2',
|
||||
originState: 'birth_state',
|
||||
originCity: 'birth_city',
|
||||
residenceCountry: 'residence_country_alpha2',
|
||||
residenceState: 'residence_state',
|
||||
residenceCity: 'residence_city',
|
||||
hairColor: 'hair_color',
|
||||
naturalBoobs: 'natural_boobs',
|
||||
boobsVolume: 'boobs_volume',
|
||||
boobsImplant: 'boobs_implant',
|
||||
boobsPlacement: 'boobs_placement',
|
||||
boobsSurgeon: 'boobs_surgeon',
|
||||
naturalButt: 'natural_butt',
|
||||
buttVolume: 'butt_volume',
|
||||
buttImplant: 'butt_implant',
|
||||
penisLength: 'penis_length',
|
||||
penisGirth: 'penis_girth',
|
||||
isCircumcised: 'circumcised',
|
||||
hasTattoos: 'has_tattoos',
|
||||
hasPiercings: 'has_piercings',
|
||||
};
|
||||
|
||||
async function applyActorValueDelta(profileId, delta, trx) {
|
||||
return knex('actors_profiles')
|
||||
.where('id', profileId)
|
||||
@@ -587,10 +578,14 @@ async function applyActorRevision(revisionIds, reqUser) {
|
||||
'boobsVolume',
|
||||
'boobsImplant',
|
||||
'boobsPlacement',
|
||||
'boobsIncision',
|
||||
'boobsSurgeon',
|
||||
'naturalButt',
|
||||
'buttVolume',
|
||||
'buttImplant',
|
||||
'naturalLips',
|
||||
'lipsVolume',
|
||||
'naturalLabia',
|
||||
'penisLength',
|
||||
'penisGirth',
|
||||
'isCircumcised',
|
||||
@@ -631,7 +626,7 @@ async function applyActorRevision(revisionIds, reqUser) {
|
||||
moment,
|
||||
slugify,
|
||||
omit,
|
||||
});
|
||||
}, { refreshView: false });
|
||||
}
|
||||
|
||||
export async function reviewActorRevision(revisionId, isApproved, { feedback }, reqUser) {
|
||||
|
||||
Reference in New Issue
Block a user