Spaces:
Runtime error
Runtime error
File size: 1,932 Bytes
46252cd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 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',
}
@Entity('sessions')
export class Session {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({ type: 'varchar', length: 100, unique: true })
name: string;
@Column({
type: 'varchar',
length: 50,
default: SessionStatus.CREATED,
})
status: SessionStatus;
@Column({ type: 'varchar', length: 20, nullable: true })
phone: string | null;
@Column({ type: 'varchar', length: 100, nullable: true })
pushName: string | null;
@Column({ type: jsonColumnType(), default: '{}' })
config: Record<string, unknown>;
// Phase 3: Proxy per session
@Column({ type: 'varchar', length: 255, nullable: true })
proxyUrl: string | null;
@Column({ type: 'varchar', length: 10, nullable: true })
proxyType: 'http' | 'https' | 'socks4' | 'socks5' | null;
@Column({ type: dateColumnType(), nullable: true, transformer: DateTransformer })
connectedAt: Date | null;
@Column({ type: dateColumnType(), nullable: true, transformer: DateTransformer })
lastActiveAt: Date | null;
@CreateDateColumn()
createdAt: Date;
@UpdateDateColumn()
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;
}
|