Add TitleBenefit model and integrate benefits into FalukantService: Introduced TitleBenefit for managing title-related advantages, including tax exemptions and office eligibility. Updated service methods to utilize these benefits for character reputation, tax distribution, and allowed office types, enhancing gameplay mechanics and user experience.
This commit is contained in:
41
backend/models/falukant/type/title_benefit.js
Normal file
41
backend/models/falukant/type/title_benefit.js
Normal file
@@ -0,0 +1,41 @@
|
||||
import { Model, DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../../utils/sequelize.js';
|
||||
|
||||
/**
|
||||
* Vorteile pro Stand (Adelstitel).
|
||||
* benefit_type: 'tax_share' | 'tax_exempt' | 'office_eligibility' | 'free_party_type' | 'reputation_bonus'
|
||||
* parameters: JSONB, z.B. { officeTypeNames: [] }, { partyTypeIds: [] }, { minPercent: 5, maxPercent: 15 }
|
||||
*/
|
||||
class TitleBenefit extends Model {}
|
||||
|
||||
TitleBenefit.init({
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true
|
||||
},
|
||||
titleId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
field: 'title_id'
|
||||
},
|
||||
benefitType: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
field: 'benefit_type'
|
||||
},
|
||||
parameters: {
|
||||
type: DataTypes.JSONB,
|
||||
allowNull: true,
|
||||
defaultValue: {}
|
||||
}
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'TitleBenefit',
|
||||
tableName: 'title_benefit',
|
||||
schema: 'falukant_type',
|
||||
timestamps: false,
|
||||
underscored: true
|
||||
});
|
||||
|
||||
export default TitleBenefit;
|
||||
Reference in New Issue
Block a user