Spaces:
Runtime error
Runtime error
| import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm'; | |
| import { DateTransformer } from '../../../common/transformers/date.transformer'; | |
| import { jsonColumnType, dateColumnType } from '../../../common/utils/column-types'; | |
| export enum SessionStatus { | |
| CREATED = 'created', | |
| INITIALIZING = 'initializing', | |
| QR_READY = 'qr_ready', | |
| AUTHENTICATING = 'authenticating', | |
| READY = 'ready', | |
| DISCONNECTED = 'disconnected', | |
| FAILED = 'failed', | |
| } | |
| ('sessions') | |
| export class Session { | |
| ('uuid') | |
| id: string; | |
| ({ type: 'varchar', length: 100, unique: true }) | |
| name: string; | |
| ({ | |
| type: 'varchar', | |
| length: 50, | |
| default: SessionStatus.CREATED, | |
| }) | |
| status: SessionStatus; | |
| ({ type: 'varchar', length: 20, nullable: true }) | |
| phone: string | null; | |
| ({ type: 'varchar', length: 100, nullable: true }) | |
| pushName: string | null; | |
| ({ type: jsonColumnType(), default: '{}' }) | |
| config: Record<string, unknown>; | |
| // Phase 3: Proxy per session | |
| ({ type: 'varchar', length: 255, nullable: true }) | |
| proxyUrl: string | null; | |
| ({ type: 'varchar', length: 10, nullable: true }) | |
| proxyType: 'http' | 'https' | 'socks4' | 'socks5' | null; | |
| ({ type: dateColumnType(), nullable: true, transformer: DateTransformer }) | |
| connectedAt: Date | null; | |
| ({ type: dateColumnType(), nullable: true, transformer: DateTransformer }) | |
| lastActiveAt: Date | null; | |
| () | |
| createdAt: Date; | |
| () | |
| updatedAt: Date; | |
| /** | |
| * Transient (non-persisted) human-readable reason for the most recent terminal | |
| * engine failure. Populated at read time from the in-memory error map so the | |
| * dashboard can explain a FAILED status; intentionally not a column because it | |
| * is runtime state that resets when the engine re-initializes. | |
| */ | |
| lastError?: string; | |
| } | |