Skip to content

Commit

Permalink
Use instance.set
Browse files Browse the repository at this point in the history
  • Loading branch information
DaddyWarbucks committed Mar 14, 2024
1 parent f933f4c commit a55ac55
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [];

Expand Down Expand Up @@ -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)) {
Expand Down

0 comments on commit a55ac55

Please sign in to comment.