Spiel erweitert

This commit is contained in:
Torsten Schulz
2025-06-02 11:26:45 +02:00
parent a9e6c82275
commit 5029be81e9
56 changed files with 4549 additions and 436 deletions

View File

@@ -0,0 +1,30 @@
// falukant/data/candidate.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class Candidate extends Model {}
Candidate.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
sequelize,
modelName: 'Candidate',
tableName: 'candidate',
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
export default Candidate;

View File

@@ -0,0 +1,45 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class ChildRelation extends Model {}
ChildRelation.init(
{
fatherCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
motherCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
childCharacterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
fatherName: {
type: DataTypes.STRING,
allowNull: false,
},
motherName: {
type: DataTypes.STRING,
allowNull: false,
},
nameSet: {
type: DataTypes.BOOLEAN,
allowNull: false,
default: false,
},
},
{
sequelize,
modelName: 'ChildRelation',
tableName: 'child_relation', // exakter Tabellenname
schema: 'falukant_data', // exaktes Schema
freezeTableName: true, // keine Pluralisierung
timestamps: true,
underscored: true,
}
);
export default ChildRelation;

View File

@@ -0,0 +1,37 @@
// models/falukant/data/credit.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class Credit extends Model {}
Credit.init({
// aufgenommener Kredit-Betrag
amount: {
type: DataTypes.DECIMAL(14,2),
allowNull: false,
},
// noch offener Kreditbetrag
remainingAmount: {
type: DataTypes.DECIMAL(14,2),
allowNull: false,
},
// Zinssatz als Prozentsatz (z.B. 3.5 für 3.5%)
interestRate: {
type: DataTypes.DECIMAL(5,2),
allowNull: false,
},
// Verknüpfung auf FalukantUser
falukantUserId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
sequelize,
modelName: 'Credit',
tableName: 'credit',
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
export default Credit;

View File

@@ -0,0 +1,21 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class DebtorsPrism extends Model {}
DebtorsPrism.init({
// Verknüpfung auf FalukantCharacter
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
sequelize,
modelName: 'DebtorsPrism',
tableName: 'debtors_prism',
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
export default DebtorsPrism;

View File

@@ -0,0 +1,34 @@
// falukant/data/election.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class Election extends Model {}
Election.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
political_office_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
date: {
type: DataTypes.DATE,
allowNull: false,
},
posts_to_fill: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
sequelize,
modelName: 'Election',
tableName: 'election',
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
export default Election;

View File

@@ -0,0 +1,34 @@
// falukant/data/election_result.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class ElectionResult extends Model {}
ElectionResult.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidate_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
votes_received: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
sequelize,
modelName: 'ElectionResult',
tableName: 'election_result',
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
export default ElectionResult;

View File

@@ -0,0 +1,48 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class Learning extends Model {}
Learning.init(
{
learningRecipientId: {
type: DataTypes.INTEGER,
allowNull: false,
},
productId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
learnAllProducts: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
associatedFalukantUserId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
associatedLearningCharacterId: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
},
learningIsExecuted: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
}
},
{
sequelize,
modelName: 'Learning',
tableName: 'learning',
schema: 'falukant_data',
timestamps: true,
underscored: true,
}
);
export default Learning;

View File

@@ -0,0 +1,30 @@
// falukant/data/occupied_political_office.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class OccupiedPoliticalOffice extends Model {}
OccupiedPoliticalOffice.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
political_office_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
sequelize,
modelName: 'OccupiedPoliticalOffice',
tableName: 'occupied_political_office',
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
export default OccupiedPoliticalOffice;

View File

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

View File

@@ -0,0 +1,26 @@
import { Model, DataTypes } from 'sequelize'
import { sequelize } from '../../../utils/sequelize.js'
class PartyInvitedNobility extends Model {}
PartyInvitedNobility.init({
partyId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'party_id'
},
titleOfNobilityId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'title_of_nobility_id'
}
}, {
sequelize,
modelName: 'PartyInvitedNobility',
tableName: 'party_invited_nobility',
schema: 'falukant_data',
timestamps: false,
underscored: true
})
export default PartyInvitedNobility

View File

@@ -0,0 +1,34 @@
// backend/models/falukant/data/political_office.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class PoliticalOffice extends Model {}
PoliticalOffice.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
officeTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
regionId: {
type: DataTypes.INTEGER,
allowNull: false,
},
}, {
sequelize,
modelName: 'PoliticalOffice',
tableName: 'political_office',
schema: 'falukant_data',
timestamps: true,
underscored: true,
});
export default PoliticalOffice;

View File

@@ -0,0 +1,39 @@
// falukant/data/vote.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class Vote extends Model {}
Vote.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
election_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
voter_character_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
candidate_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
timestamp: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
},
}, {
sequelize,
modelName: 'Vote',
tableName: 'vote',
schema: 'falukant_data',
timestamps: false,
underscored: true,
});
export default Vote;