Füge neue Modelle für Produktion, Inventar und kaufbare Bestände hinzu; aktualisiere bestehende Modelle und Routen

This commit is contained in:
Torsten Schulz
2024-12-23 10:37:43 +01:00
parent 1bb2bd49d5
commit 6f7d97672e
15 changed files with 1143 additions and 44 deletions

View File

@@ -0,0 +1,28 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class BuyableStock extends Model { }
BuyableStock.init({
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
stockTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
sequelize,
modelName: 'BuyableStock',
tableName: 'buyable_stock',
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
export default BuyableStock;

View File

@@ -0,0 +1,37 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class Inventory extends Model { }
Inventory.init({
stockId: {
type: DataTypes.INTEGER,
allowNull: false,
},
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
quality: {
type: DataTypes.INTEGER,
allowNull: false,
},
producedAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
}
}, {
sequelize,
modelName: 'Inventory',
tableName: 'inventory',
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
export default Inventory;

View File

@@ -0,0 +1,33 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class Production extends Model { }
Production.init({
branchId: {
type: DataTypes.INTEGER,
allowNull: false,
},
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
startTimestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
}
}, {
sequelize,
modelName: 'Production',
tableName: 'production',
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
export default Production;

View File

@@ -4,13 +4,10 @@ import { sequelize } from '../../../utils/sequelize.js';
class FalukantStock extends Model { }
FalukantStock.init({
userId: {
type: DataTypes.INTEGER,
allowNull: false,
},
regionId: {
branchId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
stockTypeId: {
type: DataTypes.INTEGER,

View File

@@ -37,6 +37,11 @@ FalukantUser.init({
allowNull: false,
defaultValue: 0.00,
},
certificate: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
},
mainBranchRegionId: {
type: DataTypes.INTEGER,
allowNull: true,