Files
cloud-host/backend/src/common/enums.ts
T
keyhan 5239e8aa94 Add prepaid resource credits with prorated deploy billing.
When users delete an app before plan expiry, remaining resources become credits for a new deploy. The deploy calculator shows covered vs additional charges, prices optional services correctly, and prorates extras to days left on the credit.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-15 17:37:44 +03:30

133 lines
3.4 KiB
TypeScript

// Shared enums used across the platform
export enum UserRole {
USER = 'user',
ADMIN = 'admin',
TECHNICAL = 'technical',
SALES = 'sales',
}
export enum TicketDepartment {
TECHNICAL = 'technical',
SALES = 'sales',
}
export enum TicketStatus {
OPEN = 'open',
ANSWERED = 'answered',
WAITING = 'waiting', // waiting for staff reply
CLOSED = 'closed',
}
export enum TicketPriority {
LOW = 'low',
MEDIUM = 'medium',
HIGH = 'high',
}
export enum AppRuntime {
NODEJS = 'nodejs',
LARAVEL = 'laravel',
WORDPRESS = 'wordpress',
GO = 'go',
PHP = 'php',
PYTHON = 'python',
DJANGO = 'django',
DOTNET = 'dotnet',
}
export enum DatabaseType {
MYSQL = 'mysql',
POSTGRESQL = 'postgresql',
MONGODB = 'mongodb',
MARIADB = 'mariadb',
NONE = 'none',
}
// Optional services that can be attached to an application
export enum OptionalService {
REDIS = 'redis',
RABBITMQ = 'rabbitmq',
ELASTICSEARCH = 'elasticsearch',
}
/** Targets for time-limited external access via temporary NodePort */
export enum ServiceAccessTarget {
DATABASE = 'database',
REDIS = 'redis',
RABBITMQ_AMQP = 'rabbitmq_amqp',
RABBITMQ_MANAGEMENT = 'rabbitmq_management',
}
export enum ServiceAccessGrantStatus {
ACTIVE = 'active',
EXPIRED = 'expired',
REVOKED = 'revoked',
}
export enum DeploymentStatus {
PENDING = 'pending',
BUILDING = 'building',
BUILD_FAILED = 'build_failed',
DEPLOYING = 'deploying',
RUNNING = 'running',
FAILED = 'failed',
STOPPED = 'stopped',
DELETING = 'deleting',
}
export enum ClusterStatus {
ACTIVE = 'active',
INACTIVE = 'inactive',
MAINTENANCE = 'maintenance',
}
export enum BuildStatus {
QUEUED = 'queued',
IN_PROGRESS = 'in_progress',
SUCCESS = 'success',
FAILED = 'failed',
}
export enum BillingCycle {
HOURLY = 'hourly',
MONTHLY = 'monthly',
YEARLY = 'yearly',
}
export enum PricingResourceType {
BASE_FEE = 'base_fee', // Base fee per runtime type
CPU_PER_CORE = 'cpu_per_core', // Price per CPU core
MEMORY_PER_GB = 'memory_per_gb', // Price per GB RAM
STORAGE_PER_GB = 'storage_per_gb', // Price per GB disk
DATABASE_ADDON = 'database_addon', // Price for database addon
REDIS_ADDON = 'redis_addon', // Price for Redis addon
RABBITMQ_ADDON = 'rabbitmq_addon', // Price for RabbitMQ addon
ELASTICSEARCH_ADDON = 'elasticsearch_addon', // Price for Elasticsearch addon
CUSTOM_DOMAIN_ADDON = 'custom_domain_addon', // Price for custom domain with SSL
}
export enum TransactionType {
CHARGE = 'charge', // Top-up / deposit
DEDUCTION = 'deduction', // Payment for service
REFUND = 'refund', // Refund
}
// ── Custom Domain ────────────────────────────────────
export enum CustomDomainStatus {
NONE = 'none',
PENDING_DNS = 'pending_dns',
VERIFIED = 'verified',
}
// ── Application Lifecycle ─────────────────────────────
export enum AppLifecycleStatus {
ACTIVE = 'active', // Paid & running
SUSPENDED = 'suspended', // Plan expired, pods scaled to 0, data retained
PENDING_DELETION = 'pending_deletion', // Grace period — will be deleted if no payment
DOCKED = 'docked', // User removed service; data retained until plan expires
DELETED = 'deleted', // Fully removed from K8s and DB
}