diff --git a/src/repos/PolyglotRepository.ts b/src/repos/PolyglotRepository.ts index f078e84..46c3632 100644 --- a/src/repos/PolyglotRepository.ts +++ b/src/repos/PolyglotRepository.ts @@ -68,6 +68,7 @@ export function createPolyglotRepository } const entityProps = await (adapterInstance as Record)[retrieveMethodName](partitionValue, rowValue); + return entityProps !== null ? entityProps : (entity.properties as TProps); } @@ -87,9 +88,6 @@ export function createPolyglotRepository } async saveProperties(entity: TEntity, properties: TProps): Promise { - const partitionValue = String(entity[this.partitionProp as keyof TEntity]); - const rowValue = String(entity[this.rowProp as keyof TEntity]); - const adapterInstance = this.getNoSQL(); const AdapterClass = adapterInstance.constructor as any; @@ -100,7 +98,8 @@ export function createPolyglotRepository throw new Error(`Polyglot setup failed: ${AdapterClass.name} must have methods decorated with @NoSQLRetrieve and @NoSQLSave`); } - await (adapterInstance as Record)[saveMethodName](partitionValue, rowValue, properties, entity); + await (adapterInstance as Record)[saveMethodName](entity); + return properties; }