mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 19:59:20 +00:00
finished user store in typscript
This commit is contained in:
26
backend/src/models/Setting.ts
Normal file
26
backend/src/models/Setting.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import {
|
||||
Table,
|
||||
Column,
|
||||
CreatedAt,
|
||||
UpdatedAt,
|
||||
Model,
|
||||
PrimaryKey
|
||||
} from "sequelize-typescript";
|
||||
|
||||
@Table
|
||||
class Setting extends Model<Setting> {
|
||||
@PrimaryKey
|
||||
@Column
|
||||
key: string;
|
||||
|
||||
@Column
|
||||
value: string;
|
||||
|
||||
@CreatedAt
|
||||
createdAt: Date;
|
||||
|
||||
@UpdatedAt
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export default Setting;
|
||||
@@ -15,7 +15,7 @@ class User extends Model<User> {
|
||||
@Column
|
||||
name: string;
|
||||
|
||||
@Column
|
||||
@Column(DataType.STRING)
|
||||
email: string;
|
||||
|
||||
@Column(DataType.VIRTUAL)
|
||||
@@ -43,12 +43,12 @@ class User extends Model<User> {
|
||||
}
|
||||
};
|
||||
|
||||
// static checkPassword = async ( // maybe not work like this.
|
||||
// instance: User,
|
||||
// password: string
|
||||
// ): Promise<boolean> => {
|
||||
// return compare(password, instance.passwordHash);
|
||||
// };
|
||||
public checkPassword = async (
|
||||
// maybe not work like this.
|
||||
password: string
|
||||
): Promise<boolean> => {
|
||||
return compare(password, this.getDataValue("passwordHash"));
|
||||
};
|
||||
}
|
||||
|
||||
export default User;
|
||||
|
||||
Reference in New Issue
Block a user