Compare commits
2 Commits
97d7e9cfd0
...
dc00c3d58a
| Author | SHA1 | Date | |
|---|---|---|---|
| dc00c3d58a | |||
| 721f5b91d8 |
@@ -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
4
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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": {
|
||||
|
||||
Reference in New Issue
Block a user