Update: 2026-05-08 05:09:43
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
-- Gamification Tables for Musadaq
|
||||
-- Run this migration on your production database
|
||||
|
||||
-- Points tracking
|
||||
CREATE TABLE IF NOT EXISTS user_points (
|
||||
@@ -26,6 +25,7 @@ CREATE TABLE IF NOT EXISTS user_badges (
|
||||
INDEX idx_user_badges_tenant (tenant_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- WhatsApp link code column (add to users table)
|
||||
ALTER TABLE users ADD COLUMN IF NOT EXISTS whatsapp_link_code VARCHAR(10) DEFAULT NULL;
|
||||
ALTER TABLE users ADD COLUMN IF NOT EXISTS whatsapp_linked TINYINT(1) DEFAULT 0;
|
||||
-- WhatsApp columns on users table
|
||||
-- Run these one at a time. If column already exists, it will error — just skip it.
|
||||
ALTER TABLE users ADD COLUMN whatsapp_link_code VARCHAR(10) DEFAULT NULL;
|
||||
ALTER TABLE users ADD COLUMN whatsapp_linked TINYINT(1) DEFAULT 0;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
-- SMS Bank Integration Tables
|
||||
-- Run this migration on your production database
|
||||
|
||||
CREATE TABLE IF NOT EXISTS raw_sms_log (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
@@ -16,6 +15,7 @@ CREATE TABLE IF NOT EXISTS raw_sms_log (
|
||||
INDEX idx_sms_date (received_at)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- Add sms_log_id to payment_requests if not exists
|
||||
ALTER TABLE payment_requests ADD COLUMN IF NOT EXISTS sms_log_id VARCHAR(36) DEFAULT NULL;
|
||||
ALTER TABLE payment_requests ADD COLUMN IF NOT EXISTS confirmed_at DATETIME DEFAULT NULL;
|
||||
-- Add columns to payment_requests
|
||||
-- Run these one at a time. If column already exists, just skip the error.
|
||||
ALTER TABLE payment_requests ADD COLUMN sms_log_id VARCHAR(36) DEFAULT NULL;
|
||||
ALTER TABLE payment_requests ADD COLUMN confirmed_at DATETIME DEFAULT NULL;
|
||||
|
||||
@@ -2313,8 +2313,14 @@
|
||||
} : { total: 0, pending: 0, approved: 0 };
|
||||
this.companies = await this.apiRequest('v1/companies') || [];
|
||||
this.subscription = await this.apiRequest('v1/subscriptions/current');
|
||||
if (this.page === 'users') this.users = await this.apiRequest('v1/users') || [];
|
||||
if (this.page === 'invoices') this.invoices = await this.apiRequest('v1/invoices') || [];
|
||||
if (this.page === 'users') {
|
||||
const usersRes = await this.apiRequest('v1/users');
|
||||
this.users = usersRes?.items || usersRes || [];
|
||||
}
|
||||
if (this.page === 'invoices') {
|
||||
const invRes = await this.apiRequest('v1/invoices');
|
||||
this.invoices = invRes?.items || invRes || [];
|
||||
}
|
||||
if (this.page === 'subscription') this.plans = await this.apiRequest('v1/subscriptions/plans') || [];
|
||||
if (this.user.role === 'super_admin') this.tenants = await this.apiRequest('v1/tenants') || [];
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user