42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
|
import {
|
|
OTP_ACTION_TYPE,
|
|
OTP_SOURCE,
|
|
OtpVerificationEntity,
|
|
} from '../../domain/entities/otp-verification.entity';
|
|
import { Column, Entity } from 'typeorm';
|
|
import { BaseModel } from 'src/core/modules/data/model/base.model';
|
|
|
|
@Entity(TABLE_NAME.OTP_VERIFICATIONS)
|
|
export class OtpVerificationModel
|
|
extends BaseModel<OtpVerificationEntity>
|
|
implements OtpVerificationEntity
|
|
{
|
|
@Column({ type: 'varchar', nullable: false })
|
|
otp_code: string;
|
|
|
|
@Column({ type: 'enum', enum: OTP_ACTION_TYPE })
|
|
action_type: OTP_ACTION_TYPE;
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
target_id: string;
|
|
|
|
@Column({ type: 'varchar', nullable: true })
|
|
reference: string;
|
|
|
|
@Column({ type: 'enum', enum: OTP_SOURCE })
|
|
source: OTP_SOURCE;
|
|
|
|
@Column({ default: false })
|
|
is_used: boolean;
|
|
|
|
@Column({ default: false })
|
|
is_replaced: boolean;
|
|
|
|
@Column({ type: 'bigint', nullable: false })
|
|
expired_at: number; // UNIX timestamp
|
|
|
|
@Column({ type: 'bigint', nullable: true })
|
|
verified_at: number; // UNIX timestamp or null
|
|
}
|