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

@@ -42,6 +42,9 @@ import TitleOfNobility from './falukant/type/title_of_nobility.js';
import TitleRequirement from './falukant/type/title_requirement.js';
import Branch from './falukant/data/branch.js';
import BranchType from './falukant/type/branch.js';
import Production from './falukant/data/production.js';
import Inventory from './falukant/data/inventory.js';
import BuyableStock from './falukant/data/buayble_stock.js';
export default function setupAssociations() {
@@ -205,21 +208,15 @@ export default function setupAssociations() {
FalukantCharacter.belongsTo(TitleOfNobility, { foreignKey: 'titleOfNobility', as: 'nobleTitle' });
TitleOfNobility.hasMany(FalukantCharacter, { foreignKey: 'titleOfNobility', as: 'charactersWithNobleTitle' });
FalukantCharacter.belongsTo(RegionData, { foreignKey: 'regionId', as: 'region' });
RegionData.hasMany(FalukantCharacter, { foreignKey: 'regionId', as: 'charactersInRegion' });
FalukantStock.belongsTo(FalukantStockType, { foreignKey: 'stockTypeId', as: 'stockType' });
FalukantStockType.hasMany(FalukantStock, { foreignKey: 'stockTypeId', as: 'stocks' });
FalukantStock.belongsTo(FalukantUser, { foreignKey: 'userId', as: 'user' });
FalukantUser.hasMany(FalukantStock, { foreignKey: 'userId', as: 'stocks' });
FalukantStock.belongsTo(RegionData, { foreignKey: 'regionId', as: 'region' });
RegionData.hasMany(FalukantStock, { foreignKey: 'regionId', as: 'stocksInRegion' });
Knowledge.belongsTo(ProductType, { foreignKey: 'productTypeId', as: 'productType' });
ProductType.hasMany(Knowledge, { foreignKey: 'productTypeId', as: 'knowledges' });
Knowledge.belongsTo(ProductType, { foreignKey: 'productId', as: 'productType' });
ProductType.hasMany(Knowledge, { foreignKey: 'productId', as: 'knowledges' });
Knowledge.belongsTo(FalukantCharacter, { foreignKey: 'characterId', as: 'character' });
FalukantCharacter.hasMany(Knowledge, { foreignKey: 'characterId', as: 'knowledges' });
@@ -235,4 +232,23 @@ export default function setupAssociations() {
Branch.belongsTo(BranchType, { foreignKey: 'branchTypeId', as: 'branchType' });
BranchType.hasMany(Branch, { foreignKey: 'branchTypeId', as: 'branches' });
Production.belongsTo(Branch, { foreignKey: 'branchId', as: 'branch' });
Branch.hasMany(Production, { foreignKey: 'branchId', as: 'productions' });
Production.belongsTo(ProductType, { foreignKey: 'productId', as: 'productType' });
ProductType.hasMany(Production, { foreignKey: 'productId', as: 'productions' });
Inventory.belongsTo(FalukantStock, { foreignKey: 'stockId', as: 'stock' });
FalukantStock.hasMany(Inventory, { foreignKey: 'stockId', as: 'inventories' });
Inventory.belongsTo(ProductType, { foreignKey: 'productId', as: 'productType' });
ProductType.hasMany(Inventory, { foreignKey: 'productId', as: 'inventories' });
BuyableStock.belongsTo(RegionData, { foreignKey: 'regionId', as: 'region' });
RegionData.hasMany(BuyableStock, { foreignKey: 'regionId', as: 'buyableStocks' });
Branch.hasMany(FalukantStock, { foreignKey: 'branchId', as: 'stocks' });
FalukantStock.belongsTo(Branch, { foreignKey: 'branchId', as: 'branch' });
}