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;

View File

@@ -0,0 +1,37 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class HealthActivity extends Model { }
HealthActivity.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
characterId: {
type: DataTypes.INTEGER,
allowNull: false,
},
activityTr: {
type: DataTypes.STRING,
allowNull: false,
},
cost: {
type: DataTypes.FLOAT,
allowNull: false,
},
successPercentage: {
type: DataTypes.INTEGER,
allowNull: false
}
}, {
sequelize,
modelName: 'health_activity',
tableName: 'health_activity',
schema: 'falukant_log',
timestamps: true,
underscored: true,
});
export default HealthActivity;

View File

@@ -0,0 +1,45 @@
// falukant/predefine/political_office_benefit.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import PoliticalOfficeBenefitType from '../type/political_office_benefit_type.js';
class PoliticalOfficeBenefit extends Model {}
PoliticalOfficeBenefit.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
political_office_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
benefit_type_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
value: {
type: DataTypes.JSONB,
allowNull: false,
},
}, {
sequelize,
modelName: 'PoliticalOfficeBenefit',
tableName: 'political_office_benefit',
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
});
// Association
PoliticalOfficeBenefit.belongsTo(PoliticalOfficeBenefitType, {
foreignKey: 'benefit_type_id',
as: 'benefitType'
});
PoliticalOfficeBenefitType.hasMany(PoliticalOfficeBenefit, {
foreignKey: 'benefit_type_id',
as: 'benefits'
});
export default PoliticalOfficeBenefit;

View File

@@ -0,0 +1,30 @@
// falukant/predefine/political_office_prerequisite.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class PoliticalOfficePrerequisite extends Model {}
PoliticalOfficePrerequisite.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
political_office_id: {
type: DataTypes.INTEGER,
allowNull: false,
},
prerequisite: {
type: DataTypes.JSONB,
allowNull: false,
},
}, {
sequelize,
modelName: 'PoliticalOfficePrerequisite',
tableName: 'political_office_prerequisite',
schema: 'falukant_predefine',
timestamps: false,
underscored: true,
});
export default PoliticalOfficePrerequisite;

View File

@@ -0,0 +1,31 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class BanquetteType extends Model {}
BanquetteType.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
},
reputationGrowth: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
{
sequelize,
modelName: 'BanquetteType',
tableName: 'banquette',
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
);
export default BanquetteType;

View File

@@ -0,0 +1,23 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class LearnRecipient extends Model {}
LearnRecipient.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
},
{
sequelize,
modelName: 'LearnRecipient',
tableName: 'learn_recipient',
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
);
export default LearnRecipient;

View File

@@ -0,0 +1,31 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class MusicType extends Model {}
MusicType.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
},
reputationGrowth: {
type: DataTypes.INTEGER,
allowNull: false,
},
},
{
sequelize,
modelName: 'MusicType',
tableName: 'music',
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
);
export default MusicType;

View File

@@ -0,0 +1,36 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class PartyType extends Model {}
PartyType.init(
{
tr: {
type: DataTypes.STRING,
allowNull: false,
},
cost: {
type: DataTypes.INTEGER,
allowNull: false,
},
forMarriage: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
reputationGrowth: {
type: DataTypes.INTEGER,
allowNull: false,
}
},
{
sequelize,
modelName: 'PartyType',
tableName: 'party',
schema: 'falukant_type',
timestamps: false,
underscored: true,
}
);
export default PartyType;

View File

@@ -0,0 +1,26 @@
// falukant/type/political_office_benefit_type.js
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class PoliticalOfficeBenefitType extends Model {}
PoliticalOfficeBenefitType.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
tr: {
type: DataTypes.STRING,
allowNull: false,
},
}, {
sequelize,
modelName: 'PoliticalOfficeBenefitType',
tableName: 'political_office_benefit_type',
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
export default PoliticalOfficeBenefitType;

View File

@@ -0,0 +1,38 @@
import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
class PoliticalOfficeType extends Model {}
PoliticalOfficeType.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
},
name: {
type: DataTypes.STRING,
allowNull: false,
},
seatsPerRegion: {
type: DataTypes.INTEGER,
allowNull: false,
},
regionType: {
type: DataTypes.STRING,
allowNull: false,
},
termLength: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
},
}, {
sequelize,
modelName: 'PoliticalOfficeType',
tableName: 'political_office_type',
schema: 'falukant_type',
timestamps: false,
underscored: true,
});
export default PoliticalOfficeType;

View File

@@ -8,6 +8,11 @@ TitleOfNobility.init({
type: DataTypes.STRING,
allowNull: false,
},
level: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
},
}, {
sequelize,
modelName: 'Title',

View File

@@ -4,12 +4,16 @@ import { sequelize } from '../../../utils/sequelize.js';
class TitleRequirement extends Model { }
TitleRequirement.init({
titleId: {
id : {
type: DataTypes.INTEGER,
allowNull: false,
primaryKey: true,
autoIncrement: true,
},
titleId: {
type: DataTypes.INTEGER,
allowNull: false,
},
requirementType: {
type: DataTypes.STRING,
allowNull: false,
@@ -19,12 +23,19 @@ TitleRequirement.init({
allowNull: false,
},
}, {
sequelize,
modelName: 'TitleRequirement',
sequelize,
modelName: 'TitleRequirement',
tableName: 'title_requirement',
schema: 'falukant_type',
timestamps: false,
underscored: true,
indexes: [
{
unique: true,
fields: ['title_id', 'requirement_type'],
name: 'title_requirement_titleid_reqtype_unique'
}
]
});
export default TitleRequirement;