customer-dashboard-api/src/models/userPendingEmailChange.ts

45 lines
1.0 KiB
TypeScript

import { DataTypes, Model } from "sequelize";
import sequelize from "../database/database";
interface UserPendingEmailChangeAttributes {
email_verification_id: string; // code that is sent to the user's email
user_id: string;
new_email: string;
}
class UserPendingEmailChange
extends Model<UserPendingEmailChangeAttributes>
implements UserPendingEmailChangeAttributes
{
declare email_verification_id: string;
declare user_id: string;
declare new_email: string;
}
UserPendingEmailChange.init(
{
// Model attributes are defined here
email_verification_id: {
primaryKey: true,
type: DataTypes.STRING,
allowNull: false,
},
user_id: {
type: DataTypes.STRING,
allowNull: false,
},
new_email: {
type: DataTypes.STRING,
allowNull: false,
},
},
{
tableName: "user_pending_email_change",
sequelize, // passing the `sequelize` instance is required
createdAt: "created_at",
updatedAt: "updated_at",
}
);
export default UserPendingEmailChange;