diff --git a/src/entity/trx_verifications.ts b/src/entity/trx_verifications.ts new file mode 100644 index 0000000..ea1e375 --- /dev/null +++ b/src/entity/trx_verifications.ts @@ -0,0 +1,60 @@ +import bcrypt from "bcryptjs"; +import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn } from "typeorm"; +import { TrxVerificationPurposeType, TrxVerificationStatus, TrxVerificationType } from "../types/trx"; + +@Entity("trx_verifications", { schema: "trx" }) +export class TrxVerification { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + length: 64, + }) + purpose: TrxVerificationPurposeType; + + @Column({ + nullable: false, + length: 64, + }) + type: TrxVerificationType; + + @Column({ + nullable: false, + length: 64, + }) + target: string; + + @Column({ + nullable: false, + length: 256, + }) + token: string; + + @Column({ + default: false, + }) + status: TrxVerificationStatus; + + @Column({ + nullable: false, + }) + expired_at: Date; + + @Column({ + nullable: false, + }) + verified_at: Date; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; +} diff --git a/src/schema/trx.ts b/src/schema/trx.ts index 5cd264f..6e41e81 100644 --- a/src/schema/trx.ts +++ b/src/schema/trx.ts @@ -43,6 +43,7 @@ export * from "../entity/trx_partner_user_activities"; export * from "../entity/trx_partner_user_refresh_tokens"; export * from "../entity/trx_partner_users"; +export * from "../entity/trx_verifications"; export * from "../entity/trx_customers"; export * from "../entity/trx_customer_accounts"; export * from "../entity/trx_customer_users"; diff --git a/src/types/trx.ts b/src/types/trx.ts index c3f4984..60579d6 100644 --- a/src/types/trx.ts +++ b/src/types/trx.ts @@ -1,3 +1,18 @@ +export enum TrxVerificationType { + "phone" = "phone", + "email" = "email", +} + +export enum TrxVerificationPurposeType { + "register" = "register", + "transaction" = "transaction", +} + +export enum TrxVerificationStatus { + "unverify" = "unverify", + "verify" = "verify", +} + export enum TrxCustomerType { "personal" = "personal", "business" = "business",