Implement verified curriculum, video review, watch sessions, ledger safeguards, and remove demo data

This commit is contained in:
Hamza-Ayed
2026-09-09 17:04:08 +03:00
parent 0dc5df7b5e
commit 5af684a892
49 changed files with 1809 additions and 3005 deletions
@@ -0,0 +1,40 @@
-- Payment safety hold: apply this migration before deploying the P0 payment changes.
-- No balance is created or reconciled by this migration. Existing records remain
-- historical evidence and must be reconciled against a real provider later.
CREATE TABLE IF NOT EXISTS `cliq_payments` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`uuid` CHAR(36) NOT NULL UNIQUE,
`student_id` BIGINT UNSIGNED NOT NULL,
`course_id` BIGINT UNSIGNED NOT NULL,
`amount_jod` DECIMAL(8,2) NOT NULL,
`cliq_alias` VARCHAR(100) NOT NULL,
`reference_code` VARCHAR(50) NOT NULL UNIQUE,
`bank_transaction_id` VARCHAR(100) DEFAULT NULL UNIQUE,
`receipt_image_path` VARCHAR(500) DEFAULT NULL,
`verification_status` ENUM('pending','verified','rejected','manual_review') NOT NULL DEFAULT 'pending',
`ai_extracted_json` JSON DEFAULT NULL,
`verified_at` TIMESTAMP NULL DEFAULT NULL,
`created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_cliq_student` (`student_id`),
KEY `idx_cliq_ref` (`reference_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `payout_queue` (
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
`uuid` CHAR(36) NOT NULL UNIQUE,
`teacher_id` BIGINT UNSIGNED NOT NULL,
`amount_jod` DECIMAL(8,2) NOT NULL,
`teacher_cliq_alias` VARCHAR(150) NOT NULL,
`status` ENUM('queued','processing','completed','failed','cancelled') NOT NULL DEFAULT 'queued',
`transaction_reference` VARCHAR(100) DEFAULT NULL,
`failure_reason` TEXT DEFAULT NULL,
`processed_at` TIMESTAMP NULL DEFAULT NULL,
`created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_payout_teacher` (`teacher_id`),
KEY `idx_payout_status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Rollback: do not drop either table. They may contain financial evidence.