fet: reduce LOC by reducing comments

This commit is contained in:
2026-03-28 18:05:29 +04:00
parent 005f635fab
commit 8e554498f0
20 changed files with 2 additions and 246 deletions
-4
View File
@@ -1,7 +1,6 @@
export async function migrate(sql: any) {
await sql`CREATE EXTENSION IF NOT EXISTS pgcrypto`;
// ── Core tables ─────────────────────────────────────────────────
await sql`
CREATE TABLE IF NOT EXISTS accounts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
@@ -61,7 +60,6 @@ export async function migrate(sql: any) {
)
`;
// ── Column migrations ──────────────────────────────────────────
await sql`ALTER TABLE pings ADD COLUMN IF NOT EXISTS scheduled_at TIMESTAMPTZ`;
await sql`ALTER TABLE pings ADD COLUMN IF NOT EXISTS jitter_ms INTEGER`;
await sql`ALTER TABLE monitors ADD COLUMN IF NOT EXISTS regions TEXT[] NOT NULL DEFAULT '{}'`;
@@ -71,11 +69,9 @@ export async function migrate(sql: any) {
await sql`ALTER TABLE accounts ADD COLUMN IF NOT EXISTS plan_expires_at TIMESTAMPTZ`;
await sql`ALTER TABLE accounts ADD COLUMN IF NOT EXISTS plan_stack JSONB NOT NULL DEFAULT '[]'`;
// ── Indexes ────────────────────────────────────────────────────
await sql`CREATE INDEX IF NOT EXISTS idx_pings_monitor ON pings(monitor_id, checked_at DESC)`;
await sql`CREATE INDEX IF NOT EXISTS idx_pings_checked_at ON pings(checked_at)`;
// ── Payment tables ─────────────────────────────────────────────
await sql`
CREATE TABLE IF NOT EXISTS payments (
id BIGSERIAL PRIMARY KEY,
-6
View File
@@ -1,4 +1,3 @@
// ── Types ─────────────────────────────────────────────────────────
export type Plan = "free" | "pro" | "pro2x" | "pro4x" | "lifetime";
export interface PlanLimits {
@@ -7,7 +6,6 @@ export interface PlanLimits {
maxRegions: number;
}
// ── Limits ────────────────────────────────────────────────────────
const PLAN_LIMITS: Record<Plan, PlanLimits> = {
free: { maxMonitors: 10, minIntervalS: 30, maxRegions: 1 },
pro: { maxMonitors: 200, minIntervalS: 5, maxRegions: 99 },
@@ -20,12 +18,10 @@ export function getPlanLimits(plan: string): PlanLimits {
return PLAN_LIMITS[plan as Plan] || PLAN_LIMITS.free;
}
// ── Display ───────────────────────────────────────────────────────
export const PLAN_LABELS: Record<string, string> = {
free: "Free", pro: "Pro", pro2x: "Pro 2x", pro4x: "Pro 4x", lifetime: "Lifetime",
};
// ── Pricing ───────────────────────────────────────────────────────
export const PRO_MONTHLY_USD = 12;
export const LIFETIME_USD = 140;
@@ -45,7 +41,6 @@ export const COINS: Record<string, { label: string; ticker: string; confirmation
xec: { label: "eCash", ticker: "XEC", confirmations: 0, uri: "ecash" },
};
// ── Tier ranking (for plan stacking) ──────────────────────────────
const PLAN_RANK: Record<string, number> = {
free: 0, pro: 1, lifetime: 1, pro2x: 2, pro4x: 3,
};
@@ -54,7 +49,6 @@ export function planTier(plan: string): number {
return PLAN_RANK[plan] ?? 0;
}
// ── Regions ───────────────────────────────────────────────────────
export const REGION_COLORS: Record<string, string> = {
"eu-central": "#3b82f6",
"us-west": "#f59e0b",