36 lines
671 B
TypeScript
36 lines
671 B
TypeScript
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn,
|
|
} from 'typeorm';
|
|
import { User } from './user.entity';
|
|
|
|
@Entity()
|
|
export class UserTOTPToken {
|
|
@PrimaryGeneratedColumn()
|
|
id: number;
|
|
|
|
@Column({ nullable: false, type: 'text' })
|
|
token: string;
|
|
|
|
@Column({ nullable: false, type: 'text' })
|
|
recovery_token: string;
|
|
|
|
@Column({ default: false, nullable: false })
|
|
activated: boolean;
|
|
|
|
@Column({ type: 'timestamp', nullable: true })
|
|
public expires_at: Date;
|
|
|
|
@CreateDateColumn({
|
|
type: 'timestamp',
|
|
default: () => 'CURRENT_TIMESTAMP(6)',
|
|
})
|
|
public created_at: Date;
|
|
|
|
@ManyToOne(() => User)
|
|
user: User;
|
|
}
|