fix(main): 🐛 resolve linting issues
This commit is contained in:
parent
7520fd5c2e
commit
6f6436ce8f
3 changed files with 96 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
-- Platform Admin Schema for E2E Tests
|
||||
-- Creates devices table for device authorization testing
|
||||
|
||||
-- Enable UUID extension if not already enabled
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
|
||||
-- Devices table for macOS desktop client authorization
|
||||
CREATE TABLE IF NOT EXISTS devices (
|
||||
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
"userId" UUID NOT NULL,
|
||||
"deviceId" VARCHAR(255) NOT NULL UNIQUE,
|
||||
"deviceName" VARCHAR(255) NOT NULL,
|
||||
"isAuthorized" BOOLEAN NOT NULL DEFAULT false,
|
||||
"authCode" VARCHAR(6),
|
||||
"lastSyncAt" TIMESTAMP,
|
||||
"createdAt" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Indexes for common queries
|
||||
CREATE INDEX IF NOT EXISTS "IDX_devices_userId" ON devices("userId");
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS "IDX_devices_deviceId" ON devices("deviceId");
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
-- Conversation Assistant Schema for E2E Tests
|
||||
-- Creates scammer_profiles, training_samples, and training_jobs tables
|
||||
|
||||
-- Scammer profiles table
|
||||
CREATE TABLE IF NOT EXISTS scammer_profiles (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
phone_number VARCHAR(50) NOT NULL UNIQUE,
|
||||
status VARCHAR(20) NOT NULL CHECK (status IN ('suspected', 'confirmed', 'cleared', 'under_review')),
|
||||
risk_score DECIMAL(5,2) NOT NULL DEFAULT 0,
|
||||
ai_detected_count INTEGER NOT NULL DEFAULT 0,
|
||||
manipulation_count INTEGER NOT NULL DEFAULT 0,
|
||||
phishing_count INTEGER NOT NULL DEFAULT 0,
|
||||
notes TEXT,
|
||||
first_seen TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
last_seen TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Indexes for scammer queries
|
||||
CREATE INDEX IF NOT EXISTS "IDX_scammer_profiles_phone" ON scammer_profiles(phone_number);
|
||||
CREATE INDEX IF NOT EXISTS "IDX_scammer_profiles_status" ON scammer_profiles(status);
|
||||
|
||||
-- Training samples table
|
||||
CREATE TABLE IF NOT EXISTS training_samples (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
input_context TEXT NOT NULL,
|
||||
expected_output TEXT NOT NULL,
|
||||
is_approved BOOLEAN NOT NULL DEFAULT false,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Training jobs table
|
||||
CREATE TABLE IF NOT EXISTS training_jobs (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
base_model_id VARCHAR(255) NOT NULL,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'running', 'completed', 'failed')),
|
||||
current_epoch INTEGER,
|
||||
total_epochs INTEGER NOT NULL DEFAULT 3,
|
||||
loss FLOAT,
|
||||
started_at TIMESTAMPTZ,
|
||||
completed_at TIMESTAMPTZ,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
-- Marketplace Schema for E2E Tests
|
||||
-- Creates subscription tiers and experiments tables
|
||||
|
||||
-- Subscription tiers table
|
||||
CREATE TABLE IF NOT EXISTS subscription_tiers (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
slug VARCHAR(50) NOT NULL UNIQUE,
|
||||
name VARCHAR(100) NOT NULL,
|
||||
description TEXT,
|
||||
price_usd DECIMAL(10,2) NOT NULL,
|
||||
price_eur DECIMAL(10,2),
|
||||
price_gbp DECIMAL(10,2),
|
||||
features JSONB DEFAULT '[]',
|
||||
is_active BOOLEAN NOT NULL DEFAULT true,
|
||||
sort_order INTEGER NOT NULL DEFAULT 0,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Price experiments table
|
||||
CREATE TABLE IF NOT EXISTS price_experiments (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
tier_id UUID NOT NULL REFERENCES subscription_tiers(id) ON DELETE CASCADE,
|
||||
variant_name VARCHAR(50) NOT NULL,
|
||||
price_usd DECIMAL(10,2) NOT NULL,
|
||||
allocation_percent INTEGER NOT NULL CHECK (allocation_percent >= 0 AND allocation_percent <= 100),
|
||||
is_active BOOLEAN NOT NULL DEFAULT false,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
|
||||
-- Index for tier lookups
|
||||
CREATE INDEX IF NOT EXISTS "IDX_subscription_tiers_slug" ON subscription_tiers(slug);
|
||||
CREATE INDEX IF NOT EXISTS "IDX_price_experiments_tier" ON price_experiments(tier_id);
|
||||
Loading…
Add table
Reference in a new issue