qwen_2.5_model / src /modules /session /entities /session.entity.ts
Muhammad Noman
Deploy OpenWA to Hugging Face Spaces
46252cd
Raw
History Blame Contribute Delete
1.93 kB
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;
}