rule engine and configration and fix booking for custoemr

This commit is contained in:
marshal
2026-06-01 23:15:11 +03:00
parent b9ca0b8a82
commit 452ebdbc0a
52 changed files with 3355 additions and 3358 deletions

View File

@@ -0,0 +1,25 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
/**
* Align weight_limit_rules.trade_direction with app code: IMPORT, EXPORT, BOTH (not ANY).
*/
export class NormalizeWeightLimitTradeDirectionBoth1749000000000
implements MigrationInterface
{
name = 'NormalizeWeightLimitTradeDirectionBoth1749000000000';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
DO $$ BEGIN
UPDATE freight.weight_limit_rules
SET trade_direction = 'BOTH'
WHERE trade_direction::text = 'ANY';
EXCEPTION WHEN undefined_table OR undefined_column THEN NULL;
END $$;
`);
}
public async down(_queryRunner: QueryRunner): Promise<void> {
// No-op: ANY is not a valid enum value in PostgreSQL.
}
}