Compare commits

...

7 Commits

3 changed files with 15 additions and 5 deletions

View File

@@ -83,12 +83,14 @@ function curateProfileEntry(profile) {
boobs_volume: profile.boobsVolume,
boobs_implant: profile.boobsImplant,
boobs_placement: profile.boobsPlacement,
boobs_incision: profile.boobsIncision,
boobs_surgeon: profile.boobsSurgeon,
natural_butt: profile.naturalButt,
butt_volume: profile.buttVolume,
butt_implant: profile.buttImplant,
natural_lips: profile.naturalLips,
lips_volume: profile.lipsVolume,
natural_labia: profile.naturalLabia,
height: profile.height,
weight: profile.weight,
shoe_size: profile.shoeSize,
@@ -126,6 +128,10 @@ async function fetchProfiles(actorIdsOrNames, { knex }) {
}
function mergeMainProfile(profile, mainProfile) {
if (!mainProfile) {
return profile;
}
const preservedKeys = ['id'];
const mergedProfile = Object.fromEntries(Object.entries(profile).map(([key, value]) => [key, mainProfile[key] === null || preservedKeys.includes(key)
@@ -135,7 +141,7 @@ function mergeMainProfile(profile, mainProfile) {
return mergedProfile;
}
export async function interpolateProfiles(actorIdsOrNames, context) {
export async function interpolateProfiles(actorIdsOrNames, context, options = {}) {
const profiles = await fetchProfiles(actorIdsOrNames, context);
const profilesByActorId = profiles.reduce((acc, profile) => ({
@@ -192,6 +198,7 @@ export async function interpolateProfiles(actorIdsOrNames, context) {
'natural_boobs',
'boobs_volume',
'boobs_implant',
'boobs_incision',
'boobs_placement',
'boobs_surgeon',
'natural_butt',
@@ -199,6 +206,7 @@ export async function interpolateProfiles(actorIdsOrNames, context) {
'butt_implant',
'natural_lips',
'lips_volume',
'natural_labia',
'hair_color',
'eyes',
'has_tattoos',
@@ -295,5 +303,7 @@ export async function interpolateProfiles(actorIdsOrNames, context) {
.then(transaction.commit)
.catch(transaction.rollback);
await context.knex.schema.refreshMaterializedView('actors_meta');
if (options.refreshView) {
await context.knex.schema.refreshMaterializedView('actors_meta');
}
}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "traxxx-utils",
"version": "1.2.3",
"version": "1.2.6",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "traxxx-utils",
"version": "1.2.3",
"version": "1.2.6",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.25.7",

View File

@@ -1,6 +1,6 @@
{
"name": "traxxx-common",
"version": "1.2.3",
"version": "1.2.6",
"description": "Common utilities for traxxx core and web.",
"main": "src/app.js",
"scripts": {