Files
Inventory-Manager/Models/Inventory.ts
T
Miles 45cb9fac99 Lots of updates and added functionality.
Added TODO list to readme as well as instructions.
2025-01-23 10:02:08 +00:00

53 lines
1.1 KiB
TypeScript

const { DataTypes } = require('sequelize');
const sequelize = require('../db.ts');
const Boxes = require('./Boxes.ts');
const Inventory = sequelize.define('Inventory', {
sku: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
},
name: {
type: DataTypes.STRING,
allowNull: false,
},
inStock: {
type: DataTypes.INTEGER,
allowNull: false,
},
trueQuantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
websiteQuantity: {
type: DataTypes.INTEGER,
allowNull: true
},
ebayQuantity: {
type: DataTypes.INTEGER,
allowNull: true
},
image: {
type: DataTypes.STRING,
allowNull: true,
},
ebayPrice: {
type: DataTypes.FLOAT,
allowNull: true
},
wooCommercePrice: {
type: DataTypes.FLOAT,
allowNull: true
},
total_sold: {
type: DataTypes.INTEGER,
allowNull: true
}
});
Inventory.hasMany(Boxes, { foreignKey: 'product_sku' });
Boxes.belongsTo(Inventory, { foreignKey: 'product_sku', onDelete: '' });
module.exports = Inventory;