Skip to content

Instantly share code, notes, and snippets.

@kasir-barati
Last active January 3, 2021 11:11
Show Gist options
  • Save kasir-barati/61ea22100a56855ad6396e0fbd89c6ca to your computer and use it in GitHub Desktop.
Save kasir-barati/61ea22100a56855ad6396e0fbd89c6ca to your computer and use it in GitHub Desktop.
const { DataTypes, Model } = require("sequelize");
const sequelize = require("../sequelize");
class Order extends Model {
static col = {
id: "id",
name: "name",
};
static alias = {
payment: "OrderPayment",
};
}
Order.init(
{
[Order.col.id]: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
},
[Order.col.name]: DataTypes.STRING,
},
{
sequelize: sequelize.getSeq(),
}
);
module.exports = Order;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment