Set up vouchers base

This commit is contained in:
ZacTohZY
2024-08-11 02:49:14 +08:00
parent 307be23e56
commit b35c74ac68
9 changed files with 712 additions and 28 deletions

44
server/models/Voucher.js Normal file
View File

@@ -0,0 +1,44 @@
const { DataTypes } = require("sequelize");
module.exports = (sequelize, DataTypes) => {
const Voucher = sequelize.define(
"Voucher",
{
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
allowNull: false,
primaryKey: true,
},
brandLogo: {
type: DataTypes.BLOB("long"),
allowNull: true,
},
brand: {
type: DataTypes.STRING,
allowNull: false,
},
description: {
type: DataTypes.STRING,
allowNull: false,
},
expirationDate: {
type: DataTypes.DATE,
allowNull: false,
},
quantityAvailable: {
type: DataTypes.INTEGER,
allowNull: false
},
code: {
type: DataTypes.STRING,
allowNull: false,
},
},
{
tableName: "vouchers",
timestamps: true,
});
return Voucher;
}