From a55ac55fbf3064cd2bf73307d971baf72101c746 Mon Sep 17 00:00:00 2001 From: DaddyWarbucks Date: Thu, 14 Mar 2024 13:51:52 -0500 Subject: [PATCH] Use instance.set --- src/adapter.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/adapter.ts b/src/adapter.ts index 849c0c7..4b29d02 100644 --- a/src/adapter.ts +++ b/src/adapter.ts @@ -395,7 +395,7 @@ export class SequelizeAdapter< const selected = isPresent(sequelize.attributes); if (instances) { - if (isPresent(params?.query?.$sort)) { + if (isPresent(params.query?.$sort)) { const sortedInstances: Model[] = []; const unsortedInstances: Model[] = []; @@ -453,8 +453,12 @@ export class SequelizeAdapter< sequelize: { ...params.sequelize, raw: false } }) as Model; + Object.keys(values).forEach(key => { + instance.set(key, values[key]); + }); + await instance - .update(values, sequelize) + .save(sequelize) .catch(errorHandler); if (isPresent(sequelize.include)) {