Skip to content
Snippets Groups Projects
Commit 49bfb826 authored by elit04's avatar elit04
Browse files

Customer table deleted

parent 2c007464
No related branches found
No related tags found
No related merge requests found
import { DataTypes, Model, Optional, Sequelize } from "sequelize";
interface CustomerAttributes {
id: string;
firstName: string;
lastName: string;
email: string;
}
export interface CustomerInput extends Optional<CustomerAttributes, "id"> { }
class Customer extends Model<CustomerAttributes, CustomerInput> implements CustomerAttributes {
declare id: string;
declare firstName: string;
declare lastName: string;
declare email: string;
declare readonly createdAt: Date;
declare readonly updatedAt: Date;
}
export const initCustomer = async (sequelizeConnection: Sequelize) => {
Customer.init(
{
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true,
allowNull: false,
},
firstName: {
type: new DataTypes.STRING(),
allowNull: false,
},
lastName: {
type: new DataTypes.STRING(),
allowNull: false,
},
email: {
type: new DataTypes.STRING(),
allowNull: false,
unique: true,
},
},
{
tableName: "customer",
sequelize: sequelizeConnection,
}
);
}
export default Customer;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment