Skip to content

Commit

Permalink
feat: ✨ add easy way to track all properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgbn committed Nov 8, 2023
1 parent 048243d commit 758cc2c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/runtime/server/helpers/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ export default class Model<T extends keyof OaModels & string> extends Hookable<M
const props = new Set(schema.trackedProperties)
props.add('updatedAt')
this.trackedProps = [...props]
} else if (schema.trackedProperties === true) { // track all
for (const key in schema.properties) {
if (!schema.properties[key].readOnly) { // expect readOnly properties
this.trackedProps.push(key)
}
}
this.trackedProps.push('updatedAt')
}
this.timestamps = typeof schema.timestamps === 'object'
? schema.timestamps
Expand Down

0 comments on commit 758cc2c

Please sign in to comment.