2024-03-20 22:02:51 +01:00
|
|
|
import { UserEntity } from 'src/entities/user.entity';
|
2023-01-27 21:50:07 +01:00
|
|
|
import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
|
|
|
|
2024-04-19 12:47:29 +02:00
|
|
|
@Entity('sessions')
|
|
|
|
export class SessionEntity {
|
2023-01-27 21:50:07 +01:00
|
|
|
@PrimaryGeneratedColumn('uuid')
|
|
|
|
id!: string;
|
|
|
|
|
|
|
|
@Column({ select: false })
|
|
|
|
token!: string;
|
|
|
|
|
2023-04-26 04:19:23 +02:00
|
|
|
@Column()
|
|
|
|
userId!: string;
|
|
|
|
|
2023-05-23 22:40:04 +02:00
|
|
|
@ManyToOne(() => UserEntity, { onUpdate: 'CASCADE', onDelete: 'CASCADE' })
|
2023-01-27 21:50:07 +01:00
|
|
|
user!: UserEntity;
|
|
|
|
|
|
|
|
@CreateDateColumn({ type: 'timestamptz' })
|
2023-04-26 04:19:23 +02:00
|
|
|
createdAt!: Date;
|
2023-01-27 21:50:07 +01:00
|
|
|
|
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
2023-04-26 04:19:23 +02:00
|
|
|
updatedAt!: Date;
|
|
|
|
|
|
|
|
@Column({ default: '' })
|
|
|
|
deviceType!: string;
|
|
|
|
|
|
|
|
@Column({ default: '' })
|
|
|
|
deviceOS!: string;
|
2023-01-27 21:50:07 +01:00
|
|
|
}
|