feat: Einführung von Umgebungsvariablen und Startskripten für die Backend-Anwendung

- Hinzufügen eines zentralen Skripts zum Laden von Umgebungsvariablen aus einer .env-Datei.
- Implementierung von Start- und Entwicklungs-Skripten in der package.json für eine vereinfachte Ausführung der Anwendung.
- Bereinigung und Entfernung nicht mehr benötigter Minigame-Modelle und -Services zur Verbesserung der Codebasis.
- Anpassungen an den Datenbankmodellen zur Unterstützung von neuen Assoziationen und zur Verbesserung der Lesbarkeit.
This commit is contained in:
Torsten Schulz (local)
2025-08-23 22:27:19 +02:00
parent 66818cc728
commit 6da849ca3c
128 changed files with 1054 additions and 1611 deletions

View File

@@ -4,19 +4,15 @@ import { sequelize } from '../../../utils/sequelize.js';
class Branch extends Model { }
Branch.init({
branch_type_id: {
branchTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
region_id: {
allowNull: false},
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
falukant_user_id: {
allowNull: false},
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'Branch',
tableName: 'branch',
@@ -26,10 +22,8 @@ Branch.init({
indexes: [
{
unique: true,
fields: ['region_id', 'falukant_user_id']
,
freezeTableName: true}
],
});
fields: ['regionId', 'falukantUserId']
}
]});
export default Branch;

View File

@@ -4,38 +4,35 @@ import { sequelize } from '../../../utils/sequelize.js';
class BuyableHouse extends Model { }
BuyableHouse.init({
roof_condition: {
roofCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
floor_condition: {
floorCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
wall_condition: {
wallCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
window_condition: {
windowCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
house_type_id: {
houseTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
}
allowNull: false}
}, {
sequelize,
modelName: 'BuyableHouse',
tableName: 'buyable_house',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default BuyableHouse;

View File

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

View File

@@ -8,24 +8,18 @@ Candidate.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
autoIncrement: true},
electionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'Candidate',
tableName: 'candidate',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Candidate;

View File

@@ -5,44 +5,35 @@ class FalukantCharacter extends Model {}
FalukantCharacter.init(
{
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: true,
},
region_id: {
allowNull: true},
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
first_name: {
allowNull: false},
firstName: {
type: DataTypes.INTEGER,
allowNull: false,
},
last_name: {
allowNull: false},
lastName: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
birthdate: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
defaultValue: DataTypes.NOW},
gender: {
type: DataTypes.STRING,
},
type: DataTypes.STRING},
health: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100,
},
title_of_nobility: {
defaultValue: 100},
titleOfNobility: {
type: DataTypes.INTEGER,
allowNull: false},
moodId: {
type: DataTypes.INTEGER,
allowNull: false,
},
mood_id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
}
defaultValue: 1}
},
{
sequelize,
@@ -50,9 +41,7 @@ FalukantCharacter.init(
tableName: 'character',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default FalukantCharacter;

View File

@@ -5,46 +5,38 @@ class ChildRelation extends Model {}
ChildRelation.init(
{
father_character_id: {
fatherCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
mother_character_id: {
allowNull: false},
motherCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
child_character_id: {
allowNull: false},
childCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
father_name: {
allowNull: false},
fatherName: {
type: DataTypes.STRING,
allowNull: false,
},
mother_name: {
allowNull: false},
motherName: {
type: DataTypes.STRING,
allowNull: false,
},
name_set: {
allowNull: false},
nameSet: {
type: DataTypes.BOOLEAN,
allowNull: false,
default: false,
},
is_heir: {
default: false},
isHeir: {
type: DataTypes.BOOLEAN,
allowNull: true,
default: false,
}
default: false}
},
{
sequelize,
modelName: 'ChildRelation',
tableName: 'child_relation', // exakter Tabellenname
schema: 'falukant_data', // exaktes Schema
freezeTableName: true, // keine Pluralisierung
// keine Pluralisierung
timestamps: true,
underscored: true,
}
underscored: true}
);
export default ChildRelation;

View File

@@ -8,31 +8,24 @@ Credit.init({
// aufgenommener Kredit-Betrag
amount: {
type: DataTypes.DECIMAL(14,2),
allowNull: false,
},
allowNull: false},
// noch offener Kreditbetrag
remaining_amount: {
remainingAmount: {
type: DataTypes.DECIMAL(14,2),
allowNull: false,
},
allowNull: false},
// Zinssatz als Prozentsatz (z.B. 3.5 für 3.5%)
interest_rate: {
interestRate: {
type: DataTypes.DECIMAL(5,2),
allowNull: false,
},
allowNull: false},
// Verknüpfung auf FalukantUser
falukant_user_id: {
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'Credit',
tableName: 'credit',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Credit;

View File

@@ -5,18 +5,14 @@ class DebtorsPrism extends Model {}
DebtorsPrism.init({
// Verknüpfung auf FalukantCharacter
character_id: {
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'DebtorsPrism',
tableName: 'debtors_prism',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default DebtorsPrism;

View File

@@ -4,39 +4,32 @@ import { sequelize } from '../../../utils/sequelize.js';
class Director extends Model { }
Director.init({
director_character_id: {
directorCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
employer_user_id: {
allowNull: false},
employerUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
income: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
satisfaction: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100,
},
may_produce: {
defaultValue: 100},
mayProduce: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
may_sell: {
defaultValue: true},
maySell: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
may_start_transport: {
defaultValue: true},
mayStartTransport: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true,
},
last_salary_payout: {
defaultValue: true},
lastSalaryPayout: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: new Date(0)
@@ -47,8 +40,6 @@ Director.init({
tableName: 'director',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Director;

View File

@@ -4,26 +4,20 @@ import { sequelize } from '../../../utils/sequelize.js';
class DirectorProposal extends Model { }
DirectorProposal.init({
director_character_id: {
directorCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
employer_user_id: {
allowNull: false},
employerUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
proposed_income: {
allowNull: false},
proposedIncome: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'DirectorProposal',
tableName: 'director_proposal',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default DirectorProposal;

View File

@@ -8,32 +8,25 @@ Election.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
office_type_id: {
autoIncrement: true},
officeTypeId: {
type: DataTypes.INTEGER,
allowNull: true,
},
region_id: {
allowNull: true},
regionId: {
type: DataTypes.INTEGER,
allowNull: false
},
date: {
type: DataTypes.DATE,
allowNull: false,
},
posts_to_fill: {
allowNull: false},
postsToFill: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'Election',
tableName: 'election',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Election;

View File

@@ -8,28 +8,21 @@ ElectionResult.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
autoIncrement: true},
electionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidate_id: {
allowNull: false},
candidateId: {
type: DataTypes.INTEGER,
allowNull: false,
},
votes_received: {
allowNull: false},
votesReceived: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'ElectionResult',
tableName: 'election_result',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default ElectionResult;

View File

@@ -5,24 +5,19 @@ class FalukantCharacterTrait extends Model {}
FalukantCharacterTrait.init(
{
character_id: {
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
trait_id: {
allowNull: false},
traitId: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'FalukantCharacterTrait',
tableName: 'falukant_character_trait',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default FalukantCharacterTrait;

View File

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

View File

@@ -5,35 +5,29 @@ class Learning extends Model {}
Learning.init(
{
learning_recipient_id: {
learningRecipientId: {
type: DataTypes.INTEGER,
allowNull: false,
},
product_id: {
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
learn_all_products: {
defaultValue: null},
learnAllProducts: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
associated_falukant_user_id: {
defaultValue: false},
associatedFalukantUserId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
associated_learning_character_id: {
defaultValue: null},
associatedLearningCharacterId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
learning_is_executed: {
defaultValue: null},
learningIsExecuted: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
}
defaultValue: false}
},
{
sequelize,
@@ -41,9 +35,7 @@ Learning.init(
tableName: 'learning',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default Learning;

View File

@@ -5,31 +5,25 @@ class MarriageProposal extends Model {}
MarriageProposal.init(
{
requester_character_id: {
requesterCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
},
proposed_character_id: {
onDelete: 'CASCADE'},
proposedCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
},
onDelete: 'CASCADE'},
cost: {
type: DataTypes.FLOAT,
allowNull: false,
defaultValue: 0,
},
},
defaultValue: 0}},
{
sequelize,
modelName: 'MarriageProposal',
tableName: 'marriage_proposals',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default MarriageProposal;

View File

@@ -8,24 +8,18 @@ OccupiedPoliticalOffice.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
political_office_id: {
autoIncrement: true},
politicalOfficeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'OccupiedPoliticalOffice',
tableName: 'occupied_political_office',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default OccupiedPoliticalOffice;

View File

@@ -4,27 +4,27 @@ import { sequelize } from '../../../utils/sequelize.js';
class Party extends Model {}
Party.init({
party_type_id: {
partyTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'party_type_id'
},
falukant_user_id: {
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'falukant_user_id'
},
music_type_id: {
musicTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'music_type'
},
banquette_type_id: {
banquetteTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'banquette_type'
},
servant_ratio: {
servantRatio: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'servant_ratio'
@@ -33,15 +33,12 @@ Party.init({
type: DataTypes.FLOAT,
allowNull: false,
defaultValue: 0
},
}, {
}}, {
sequelize,
modelName: 'Party',
tableName: 'party',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Party;

View File

@@ -4,12 +4,12 @@ import { sequelize } from '../../../utils/sequelize.js'
class PartyInvitedNobility extends Model {}
PartyInvitedNobility.init({
party_id: {
partyId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'party_id'
},
title_of_nobility_id: {
titleOfNobilityId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'title_of_nobility_id'
@@ -21,7 +21,6 @@ PartyInvitedNobility.init({
schema: 'falukant_data',
timestamps: false,
underscored: true
,
freezeTableName: true})
})
export default PartyInvitedNobility

View File

@@ -8,28 +8,21 @@ PoliticalOffice.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
office_type_id: {
autoIncrement: true},
officeTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
region_id: {
allowNull: false},
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'PoliticalOffice',
tableName: 'political_office',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default PoliticalOffice;

View File

@@ -4,19 +4,16 @@ import { sequelize } from '../../../utils/sequelize.js';
class Knowledge extends Model { }
Knowledge.init({
product_id: {
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
allowNull: false},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
knowledge: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
}
defaultValue: 0}
}, {
sequelize,
modelName: 'Knowledge',
@@ -27,8 +24,7 @@ Knowledge.init({
hooks: {
beforeCreate: (knowledge) => {
knowledge.knowledge = Math.floor(Math.random() * 61) + 20;
,
freezeTableName: true}
}
}
});

View File

@@ -4,31 +4,25 @@ import { sequelize } from '../../../utils/sequelize.js';
class Production extends Model { }
Production.init({
branch_id: {
branchId: {
type: DataTypes.INTEGER,
allowNull: false,
},
product_id: {
allowNull: false},
productId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
start_timestamp: {
allowNull: false},
startTimestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
}
defaultValue: sequelize.literal('CURRENT_TIMESTAMP')}
}, {
sequelize,
modelName: 'Production',
tableName: 'production',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Production;

View File

@@ -7,9 +7,8 @@ class RegionData extends Model { }
RegionData.init({
name: {
type: DataTypes.STRING,
allowNull: false,
},
region_type_id: {
allowNull: false},
regionTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -18,14 +17,13 @@ RegionData.init({
schema: 'falukant_type'
}
},
parent_id: {
parentId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
model: 'region',
key: 'id',
schema: 'falukant_data',
}
schema: 'falukant_data'}
},
map: {
type: DataTypes.JSONB,
@@ -38,8 +36,6 @@ RegionData.init({
tableName: 'region',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default RegionData;

View File

@@ -11,47 +11,36 @@ Relationship.init(
allowNull: false,
references: {
model: FalukantCharacter,
key: 'id',
},
onDelete: 'CASCADE',
},
key: 'id'},
onDelete: 'CASCADE'},
character2Id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: FalukantCharacter,
key: 'id',
},
onDelete: 'CASCADE',
},
relationship_type_id: {
key: 'id'},
onDelete: 'CASCADE'},
relationshipTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
},
onDelete: 'CASCADE'},
widowFirstName1: {
type: DataTypes.STRING,
allowNull: true,
},
allowNull: true},
widowFirstName2: {
type: DataTypes.STRING,
allowNull: true,
},
next_step_progress: {
allowNull: true},
nextStepProgress: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0,
},
},
defaultValue: 0}},
{
sequelize,
modelName: 'Relationship',
tableName: 'relationship',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true}
underscored: true}
);
export default Relationship;

View File

@@ -4,27 +4,22 @@ import { sequelize } from '../../../utils/sequelize.js';
class FalukantStock extends Model { }
FalukantStock.init({
branch_id: {
branchId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
stock_type_id: {
stockTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
quantity: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
allowNull: false}}, {
sequelize,
modelName: 'StockData',
tableName: 'stock',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default FalukantStock;

View File

@@ -4,19 +4,16 @@ import { sequelize } from '../../../utils/sequelize.js';
class TownProductWorth extends Model { }
TownProductWorth.init({
product_id: {
productId: {
type: DataTypes.INTEGER,
allowNull: false},
regionId: {
type: DataTypes.INTEGER,
allowNull: false},
worthPercent: {
type: DataTypes.INTEGER,
allowNull: false,
},
region_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
worth_percent: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
}
defaultValue: 0}
}, {
sequelize,
modelName: 'TownProductWorth',
@@ -27,8 +24,7 @@ TownProductWorth.init({
hooks: {
beforeCreate: (worthPercent) => {
worthPercent.worthPercent = Math.floor(Math.random() * 20) + 40;
,
freezeTableName: true}
}
}
});

View File

@@ -4,34 +4,27 @@ import { sequelize } from '../../../utils/sequelize.js';
class Underground extends Model { }
Underground.init({
underground_type_id: {
undergroundTypeId: {
type: DataTypes.STRING,
allowNull: false,
},
performer_id: {
allowNull: false},
performerId: {
type: DataTypes.INTEGER,
allowNull: false,
},
victim_id: {
allowNull: false},
victimId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
parameters: {
type: DataTypes.JSON,
allowNull: true,
},
allowNull: true},
result: {
type: DataTypes.JSON,
allowNull: true,
}
allowNull: true}
}, {
sequelize,
modelName: 'Underground',
tableName: 'underground',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default Underground;

View File

@@ -5,7 +5,7 @@ import RegionData from './region.js';
class FalukantUser extends Model { }
FalukantUser.init({
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
@@ -15,34 +15,28 @@ FalukantUser.init({
},
key: 'id'
},
unique: true,
},
unique: true},
money: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
credit_amount: {
defaultValue: 0.00},
creditAmount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
today_credit_taken: {
defaultValue: 0.00},
todayCreditTaken: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00,
},
credit_interest_rate: {
defaultValue: 0.00},
creditInterestRate: {
type: DataTypes.DECIMAL(5, 2),
allowNull: false,
defaultValue: 0.00,
},
defaultValue: 0.00},
certificate: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
},
main_branch_region_id: {
defaultValue: 1},
mainBranchRegionId: {
type: DataTypes.INTEGER,
allowNull: true,
references: {
@@ -57,8 +51,6 @@ FalukantUser.init({
tableName: 'falukant_user',
schema: 'falukant_data',
timestamps: true,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default FalukantUser;

View File

@@ -4,32 +4,32 @@ import { sequelize } from '../../../utils/sequelize.js';
class UserHouse extends Model { }
UserHouse.init({
roof_condition: {
roofCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
floor_condition: {
floorCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
wall_condition: {
wallCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
window_condition: {
windowCondition: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 100
},
house_type_id: {
houseTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
},
user_id: {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1
@@ -40,8 +40,6 @@ UserHouse.init({
tableName: 'user_house',
schema: 'falukant_data',
timestamps: false,
underscored: true,
,
freezeTableName: true});
underscored: true});
export default UserHouse;

View File

@@ -9,26 +9,20 @@ Vote.init(
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
autoIncrement: true},
electionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidate_id: {
allowNull: false},
candidateId: {
type: DataTypes.INTEGER,
allowNull: false,
},
allowNull: false},
timestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
falukant_user_id: {
defaultValue: DataTypes.NOW},
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
allowNull: false}},
{
sequelize,
modelName: 'Vote',
@@ -39,11 +33,8 @@ Vote.init(
indexes: [
{
unique: true,
fields: ['election_id', 'candidate_id'],
,
freezeTableName: true},
],
}
fields: ['electionId', 'candidateId']},
]}
);
export default Vote;