7b3fd1298d
- 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.
44 lines
1.1 KiB
JavaScript
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;
|
|
};
|