feat(political-benefits): implement political powers and benefits system
All checks were successful
Deploy to production / deploy (push) Successful in 3m3s
All checks were successful
Deploy to production / deploy (push) Successful in 3m3s
- Added new political powers and benefits functionalities, including reputation ticks, tax jurisdiction management, and appointment capabilities. - Introduced a new job for periodic reputation updates and created necessary database tables for tracking political benefits. - Enhanced the FalukantController and services to support new endpoints for managing political powers and appointments. - Updated localization files to reflect new features and improve user experience across multiple languages. - Modified the UI to display new political powers and benefits, ensuring accurate representation in the PoliticsView.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
'use strict';
|
||||
|
||||
/** @param {import('sequelize').QueryInterface} queryInterface */
|
||||
module.exports = {
|
||||
async up(queryInterface) {
|
||||
await queryInterface.sequelize.query(`
|
||||
CREATE TABLE IF NOT EXISTS falukant_data.political_benefit_last_tick (
|
||||
id serial PRIMARY KEY,
|
||||
character_id integer NOT NULL
|
||||
REFERENCES falukant_data."character"(id) ON DELETE CASCADE,
|
||||
political_office_benefit_id integer NOT NULL
|
||||
REFERENCES falukant_predefine.political_office_benefit(id) ON DELETE CASCADE,
|
||||
last_tick_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ticks_count integer NOT NULL DEFAULT 0,
|
||||
CONSTRAINT political_benefit_last_tick_unique UNIQUE (character_id, political_office_benefit_id)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS political_benefit_last_tick_character_idx
|
||||
ON falukant_data.political_benefit_last_tick (character_id);
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(`
|
||||
CREATE TABLE IF NOT EXISTS falukant_data.region_tax_history (
|
||||
id serial PRIMARY KEY,
|
||||
region_id integer NOT NULL REFERENCES falukant_data.region(id) ON DELETE CASCADE,
|
||||
old_tax_percent numeric(12,4) NOT NULL,
|
||||
new_tax_percent numeric(12,4) NOT NULL,
|
||||
setter_character_id integer NOT NULL REFERENCES falukant_data."character"(id) ON DELETE CASCADE,
|
||||
political_office_id integer NULL REFERENCES falukant_data.political_office(id) ON DELETE SET NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS region_tax_history_region_idx
|
||||
ON falukant_data.region_tax_history (region_id, created_at DESC);
|
||||
`);
|
||||
|
||||
await queryInterface.sequelize.query(`
|
||||
CREATE TABLE IF NOT EXISTS falukant_data.political_appointment (
|
||||
id serial PRIMARY KEY,
|
||||
appointer_character_id integer NOT NULL REFERENCES falukant_data."character"(id) ON DELETE CASCADE,
|
||||
target_character_id integer NOT NULL REFERENCES falukant_data."character"(id) ON DELETE CASCADE,
|
||||
office_type_id integer NOT NULL REFERENCES falukant_type.political_office_type(id) ON DELETE CASCADE,
|
||||
region_id integer NOT NULL REFERENCES falukant_data.region(id) ON DELETE CASCADE,
|
||||
status varchar(32) NOT NULL DEFAULT 'completed',
|
||||
created_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
expires_at timestamptz NULL,
|
||||
completed_political_office_id integer NULL REFERENCES falukant_data.political_office(id) ON DELETE SET NULL
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS political_appointment_appointer_idx
|
||||
ON falukant_data.political_appointment (appointer_character_id, created_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS political_appointment_target_idx
|
||||
ON falukant_data.political_appointment (target_character_id);
|
||||
`);
|
||||
},
|
||||
|
||||
async down(queryInterface) {
|
||||
await queryInterface.sequelize.query(`
|
||||
DROP TABLE IF EXISTS falukant_data.political_appointment;
|
||||
DROP TABLE IF EXISTS falukant_data.region_tax_history;
|
||||
DROP TABLE IF EXISTS falukant_data.political_benefit_last_tick;
|
||||
`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user