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

44 lines
1.1 KiB
JavaScript

module.exports = (sequelize, DataTypes) => {
const transaction = sequelize.define(
"transaction",
{
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
order_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
user_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
shipping_dock_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
amount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
},
notes: {
type: DataTypes.TEXT,
allowNull: true,
},
created_at: DataTypes.DATE,
updated_at: DataTypes.DATE,
},
{
timestamps: true,
freezeTableName: true,
tableName: "transaction",
createdAt: "created_at",
updatedAt: "updated_at",
}
);
return transaction;
};