import { DataTypes, Model, Optional } from 'sequelize'; import sequelize from '../db/config'; interface UserAttributes { id: number; email: string; password: string; } // Optional fields for creating a new user interface UserCreationAttributes extends Optional { } class User extends Model implements UserAttributes { public id!: number; public email!: string; public password!: string; } User.init( { id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, }, email: { type: DataTypes.STRING, allowNull: false, unique: true, validate: { isEmail: true, }, }, password: { type: DataTypes.STRING, allowNull: false, }, }, { sequelize, tableName: 'user', } ); export default User;