Fixed entity ID inherited from profile.
This commit is contained in:
		
							parent
							
								
									97d7e9cfd0
								
							
						
					
					
						commit
						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') | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue