import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, Index, } from 'typeorm'; @Entity({ schema: 'auth', name: 'sessions' }) export class Session { @PrimaryGeneratedColumn('uuid') id: string; @Column({ type: 'uuid' }) @Index() user_id: string; @Column({ type: 'uuid' }) @Index() tenant_id: string; @Column({ type: 'varchar', length: 64 }) @Index({ unique: true }) session_token: string; @Column({ type: 'varchar', length: 64, nullable: true }) refresh_token_hash: string | null; @Column({ type: 'varchar', length: 45, nullable: true }) ip_address: string | null; @Column({ type: 'text', nullable: true }) user_agent: string | null; @Column({ type: 'varchar', length: 50, nullable: true }) device_type: string | null; @Column({ type: 'timestamp with time zone' }) expires_at: Date; @Column({ type: 'timestamp with time zone', nullable: true }) last_activity_at: Date | null; @Column({ type: 'boolean', default: true }) is_active: boolean; @CreateDateColumn({ type: 'timestamp with time zone' }) created_at: Date; }