不要怂,就是干,撸起袖子干!

Commit beeff96f by Todd Bealmear Committed by Sushant

fix(types): add isSoftDeleted to Model (#11628)

1 parent 06a0d26c
Showing with 12 additions and 0 deletions
......@@ -2728,6 +2728,15 @@ export abstract class Model<T = any, T2 = any> extends Hooks {
* values gotten from the DB, and apply all custom getters.
*/
public toJSON(): object;
/**
* Helper method to determine if a instance is "soft deleted". This is
* particularly useful if the implementer renamed the deletedAt attribute to
* something different. This method requires paranoid to be enabled.
*
* Throws an error if paranoid is not enabled.
*/
public isSoftDeleted(): boolean;
}
export type ModelType = typeof Model;
......
......@@ -119,3 +119,6 @@ User.scope([
'custom2',
{ method: [ 'custom', 32 ] }
])
const instance = new User({ username: 'foo', firstName: 'bar', lastName: 'baz' });
instance.isSoftDeleted()
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!