-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing override of the default SequelizeModel.toJSON() method
- Loading branch information
Davide Caroselli
committed
Apr 20, 2024
1 parent
afb46aa
commit ca2ed69
Showing
2 changed files
with
9 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,20 +299,20 @@ export class User extends Model<InferAttributes<User>, InferCreationAttributes<U | |
declare password: string; | ||
} | ||
|
||
const jsonthis = new Jsonthis({sequelize}); | ||
const jsonthis = new Jsonthis({case: "snake", sequelize}); | ||
|
||
const user = await User.create({ | ||
id: 1, | ||
email: "[email protected]", | ||
password: "s3cret" | ||
}); | ||
|
||
console.log(user.toJSON()); | ||
console.log(user.toJSON()); // or jsonthis.toJson(user) | ||
// { | ||
// id: 1, | ||
// email: 'j******[email protected]', | ||
// updatedAt: 2024-04-13T18:00:20.909Z, | ||
// createdAt: 2024-04-13T18:00:20.909Z | ||
// updated_at: 2024-04-20T12:58:10.229Z, | ||
// created_at: 2024-04-20T12:58:10.229Z | ||
// } | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters