ch panel statistik
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
2026-10-01 18:14:20 +05:00
parent ebedeba009
commit 29867561d1
9 changed files with 1436 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
DROP TABLE IF EXISTS payment_texts;
DROP TABLE IF EXISTS rbac_version;
DROP FUNCTION IF EXISTS rbac_bump_version() CASCADE;

View File

@@ -644,6 +644,30 @@ CREATE TABLE IF NOT EXISTS visa_master_payment_logs (
CREATE INDEX IF NOT EXISTS visa_master_payment_logs_order_id_idx ON visa_master_payment_logs (order_id);
-- Admin-editable texts shown to clients around a visa/master/sber payout
-- (e.g. the warning before paying). Clients look a text up by its fixed
-- code, so codes are seeded here and never created/deleted from the admin
-- UI - only name/text/is_active are editable. text is {"tm","ru","en"}.
CREATE TABLE IF NOT EXISTS payment_texts (
id bigserial PRIMARY KEY,
code character varying(64) NOT NULL,
name character varying(255) NOT NULL,
text jsonb NOT NULL DEFAULT '{"tm":"","ru":"","en":""}'::jsonb,
is_active boolean NOT NULL DEFAULT true,
updated_by bigint,
updated_at TIMESTAMP DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
CONSTRAINT payment_texts_code_key UNIQUE (code),
CONSTRAINT payment_texts_updated_by_fkey
FOREIGN KEY (updated_by) REFERENCES users(id) ON DELETE SET NULL
);
INSERT INTO payment_texts (code, name, text) VALUES
('payment_warning_text', 'Visa/Master töleg duýduryş',
'{"tm":"Dogry töleg aýyny saýlamagyňyzy haýyş edýäris","ru":"","en":""}'::jsonb),
('sber_payment_warning', 'Sber töleg duýduryş',
'{"tm":"Sber töleg duýduryş","ru":"","en":""}'::jsonb)
ON CONFLICT (code) DO NOTHING;
-- Indexes for hot filter/join columns: users.role_id and branch_user are
-- queried on every authenticated request (RBAC role and branch resolution),
-- and every order table below is list-filtered by user_id/branch_id.