Compare commits

...

2 Commits

Author SHA1 Message Date
dc00c3d58a 1.2.9 2024-11-03 03:28:10 +01:00
721f5b91d8 Fixed entity ID inherited from profile. 2024-11-03 03:28:08 +01:00
3 changed files with 5 additions and 5 deletions

View File

@@ -80,6 +80,7 @@ function mergeMainProfile(profile, mainProfile) {
export async function interpolateProfiles(actorIdsOrNames, context, options = {}) {
const profiles = await fetchProfiles(actorIdsOrNames, context);
const columns = await context.knex.table('actors').columnInfo().then((table) => Object.keys(table));
const preservedKeys = ['id', 'name', 'slug', 'entity_id', 'entry_id'];
const profilesByActorId = profiles.reduce((acc, profile) => ({
...acc,
@@ -176,7 +177,7 @@ export async function interpolateProfiles(actorIdsOrNames, context, options = {}
columns.forEach((key) => {
// generic handling for remaining properties
if (Object.hasOwn(valuesByProperty, key) && !Object.hasOwn(profile, key)) {
if (Object.hasOwn(valuesByProperty, key) && !Object.hasOwn(profile, key) && !preservedKeys.includes(key)) {
profile[key] = getMostFrequent(valuesByProperty[key], context);
}
});
@@ -187,7 +188,6 @@ export async function interpolateProfiles(actorIdsOrNames, context, options = {}
const transaction = await context.knex.transaction();
// clear existing interpolated data
const preservedKeys = ['id', 'name', 'slug', 'entity_id', 'entry_id'];
const emptyProfile = Object.fromEntries(columns.filter((key) => !preservedKeys.includes(key)).map((key) => [key, null]));
await context.knex('actors')

4
package-lock.json generated
View File

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

View File

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