Migración desde workspace-v2/projects/template-saas/apps/backend Este repositorio es parte del estándar multi-repo v2 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
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;
|
|
}
|