Minor change around save properties method prototype
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 28s
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 28s
This commit is contained in:
parent
c658fa3822
commit
c029f3200a
1 changed files with 3 additions and 4 deletions
|
|
@ -68,6 +68,7 @@ export function createPolyglotRepository<TEntity extends IPolyglotEntity<TProps>
|
||||||
}
|
}
|
||||||
|
|
||||||
const entityProps = await (adapterInstance as Record<string, any>)[retrieveMethodName](partitionValue, rowValue);
|
const entityProps = await (adapterInstance as Record<string, any>)[retrieveMethodName](partitionValue, rowValue);
|
||||||
|
|
||||||
return entityProps !== null ? entityProps : (entity.properties as TProps);
|
return entityProps !== null ? entityProps : (entity.properties as TProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,9 +88,6 @@ export function createPolyglotRepository<TEntity extends IPolyglotEntity<TProps>
|
||||||
}
|
}
|
||||||
|
|
||||||
async saveProperties(entity: TEntity, properties: TProps): Promise<TProps> {
|
async saveProperties(entity: TEntity, properties: TProps): Promise<TProps> {
|
||||||
const partitionValue = String(entity[this.partitionProp as keyof TEntity]);
|
|
||||||
const rowValue = String(entity[this.rowProp as keyof TEntity]);
|
|
||||||
|
|
||||||
const adapterInstance = this.getNoSQL();
|
const adapterInstance = this.getNoSQL();
|
||||||
const AdapterClass = adapterInstance.constructor as any;
|
const AdapterClass = adapterInstance.constructor as any;
|
||||||
|
|
||||||
|
|
@ -100,7 +98,8 @@ export function createPolyglotRepository<TEntity extends IPolyglotEntity<TProps>
|
||||||
throw new Error(`Polyglot setup failed: ${AdapterClass.name} must have methods decorated with @NoSQLRetrieve and @NoSQLSave`);
|
throw new Error(`Polyglot setup failed: ${AdapterClass.name} must have methods decorated with @NoSQLRetrieve and @NoSQLSave`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await (adapterInstance as Record<string, any>)[saveMethodName](partitionValue, rowValue, properties, entity);
|
await (adapterInstance as Record<string, any>)[saveMethodName](entity);
|
||||||
|
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue