24 lines
553 B
TypeScript
24 lines
553 B
TypeScript
import { Column, Entity } from 'typeorm';
|
|
import { BaseEntity } from 'src/common/entities/base.entity';
|
|
import { OtpStatus } from '../enums/otp-status.enum';
|
|
|
|
@Entity('otps')
|
|
export class OTP extends BaseEntity {
|
|
@Column({ type: 'varchar', length: 6 })
|
|
code: string;
|
|
|
|
@Column({ type: 'timestamptz' })
|
|
expirationDate: Date;
|
|
|
|
@Column({type: 'enum', enum: OtpStatus, default: OtpStatus.PENDING})
|
|
status: OtpStatus;
|
|
|
|
@Column({ type: 'smallint', default: 0 })
|
|
numberOfTries: number;
|
|
|
|
@Column({
|
|
length: 11,
|
|
})
|
|
phoneNumber: string;
|
|
}
|