feat: setup module otp verifications
parent
5e328fda1e
commit
5f08b4be66
|
@ -30,4 +30,5 @@ export enum MODULE_NAME {
|
||||||
QUEUE = 'queue',
|
QUEUE = 'queue',
|
||||||
|
|
||||||
TIME_GROUPS = 'time-groups',
|
TIME_GROUPS = 'time-groups',
|
||||||
|
OTP_VERIFICATIONS = 'otp-verification',
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,4 +45,5 @@ export enum TABLE_NAME {
|
||||||
QUEUE_BUCKET = 'queue_bucket',
|
QUEUE_BUCKET = 'queue_bucket',
|
||||||
|
|
||||||
TIME_GROUPS = 'time_groups',
|
TIME_GROUPS = 'time_groups',
|
||||||
|
OTP_VERIFICATIONS = 'otp_verifications',
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
||||||
|
import {
|
||||||
|
OPT_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: OPT_ACTION_TYPE })
|
||||||
|
action_type: OPT_ACTION_TYPE;
|
||||||
|
|
||||||
|
@Column({ type: 'varchar', nullable: true })
|
||||||
|
target_id: string;
|
||||||
|
|
||||||
|
@Column({ type: 'enum', enum: OTP_SOURCE })
|
||||||
|
source: OTP_SOURCE;
|
||||||
|
|
||||||
|
@Column({ default: false })
|
||||||
|
is_used: boolean;
|
||||||
|
|
||||||
|
@Column({ type: 'bigint', nullable: false })
|
||||||
|
expired_at: number; // UNIX timestamp
|
||||||
|
|
||||||
|
@Column({ type: 'bigint', nullable: true })
|
||||||
|
verified_at: number; // UNIX timestamp or null
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { BaseEntity } from 'src/core/modules/domain/entities//base.entity';
|
||||||
|
|
||||||
|
export enum OPT_ACTION_TYPE {
|
||||||
|
CREATE_DISCOUNT = 'CREATE_DISCOUNT',
|
||||||
|
CANCEL_TRANSACTION = 'CANCEL_TRANSACTION',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum OTP_SOURCE {
|
||||||
|
POS = 'POS',
|
||||||
|
WEB = 'WEB',
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OtpVerificationEntity extends BaseEntity {
|
||||||
|
otp_code: string;
|
||||||
|
action_type: OPT_ACTION_TYPE;
|
||||||
|
target_id: string;
|
||||||
|
source: OTP_SOURCE;
|
||||||
|
is_used: boolean;
|
||||||
|
expired_at: number;
|
||||||
|
verified_at: number;
|
||||||
|
}
|
Loading…
Reference in New Issue