Files
bolade 7b3fd1298d Add order, shipping dock, and transaction routes with CRUD operations and Swagger documentation
- Implemented GET, POST, PUT, and DELETE endpoints for orders, shipping docks, and transactions.
- Added Swagger annotations for API documentation.
- Included error handling for database operations.
- Configured pnpm workspace to ignore built dependencies for sqlite3.
2025-11-12 11:12:05 +01:00

46 lines
1.2 KiB
JavaScript

module.exports = (sequelize, DataTypes) => {
const order = sequelize.define(
"order",
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
amount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
},
tax: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
},
notes: {
type: DataTypes.TEXT,
allowNull: true,
},
status: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
comment: "1: paid, 0: not paid",
},
created_at: DataTypes.DATE,
updated_at: DataTypes.DATE,
},
{
timestamps: true,
freezeTableName: true,
tableName: "order",
createdAt: "created_at",
updatedAt: "updated_at",
}
);
return order;
};