From 9b0d8a9d643e290249bc9a5d56f28df6785e2d85 Mon Sep 17 00:00:00 2001 From: "fazri.is" Date: Tue, 16 Dec 2025 21:38:16 +0700 Subject: [PATCH] update --- src/entity/trx_sms_logs.ts | 70 ++++++++++++++++++++++++++++++++++++++ src/schema/public.ts | 1 + src/schema/trx.ts | 1 + src/types/sms.ts | 13 +++++++ src/types/trx.ts | 14 ++++++-- 5 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 src/entity/trx_sms_logs.ts create mode 100644 src/types/sms.ts diff --git a/src/entity/trx_sms_logs.ts b/src/entity/trx_sms_logs.ts new file mode 100644 index 0000000..7bef867 --- /dev/null +++ b/src/entity/trx_sms_logs.ts @@ -0,0 +1,70 @@ +import { Column, CreateDateColumn, DeleteDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm"; +import { TrxSmsStatus, TrxSmsType } from "../types/trx"; + +@Entity("trx_sms_logs", { schema: "trx" }) +export class TrxSmsLog { + @PrimaryGeneratedColumn("uuid") + id: string; + + @Column({ + nullable: false, + length: 4096, + }) + type: TrxSmsType; + + @Column({ + nullable: false, + length: 4096, + }) + phone: string; + + @Column({ + nullable: false, + type: "text", + }) + content: string; + + @Column({ + nullable: false, + }) + request_at: Date; + + @Column({ + nullable: true, + type: "text", + }) + response: string; + + @Column({ + nullable: true, + }) + response_at: Date; + + @Column({ + nullable: false, + length: 64, + default: TrxSmsStatus.process, + }) + status: TrxSmsStatus; + + @Column() + @CreateDateColumn() + created_at: Date; + + @Column({ nullable: true, length: 256 }) + created_by: string; + + @Column({ nullable: true }) + @UpdateDateColumn() + updated_at: Date; + + @Column({ nullable: true, length: 256 }) + updated_by: string; + + @Column({ nullable: true }) + @DeleteDateColumn() + deleted_at: Date; + + @Column({ nullable: true, length: 256 }) + deleted_by: string; +} diff --git a/src/schema/public.ts b/src/schema/public.ts index 585cf00..d7a732e 100644 --- a/src/schema/public.ts +++ b/src/schema/public.ts @@ -41,6 +41,7 @@ export * from "../types/paging"; export * from "../types/role"; export * from "../types/status"; export * from "../types/email"; +export * from "../types/sms"; export * from "../types/pull"; export * from "../types/category_source"; export * from "../types/category"; diff --git a/src/schema/trx.ts b/src/schema/trx.ts index a1677de..cc8dc61 100644 --- a/src/schema/trx.ts +++ b/src/schema/trx.ts @@ -22,6 +22,7 @@ export * from "../entity/trx_transaction_slas"; export * from "../entity/trx_transaction_amls"; export * from "../entity/trx_transaction_signatures"; export * from "../entity/trx_email_logs"; +export * from "../entity/trx_sms_logs"; export * from "../entity/trx_maintenances"; export * from "../entity/trx_maintenance_details"; export * from "../entity/trx_maintenance_slas"; diff --git a/src/types/sms.ts b/src/types/sms.ts new file mode 100644 index 0000000..8abcccc --- /dev/null +++ b/src/types/sms.ts @@ -0,0 +1,13 @@ +export class SmsBody { + application: string; + to: string; + message: string; +} + +export enum SmsTrxFrom { + "non_reply" = "non_reply", + "registration" = "registration", + "verification" = "verification", + "transaction" = "transaction", + "info" = "info", +} diff --git a/src/types/trx.ts b/src/types/trx.ts index 958d3cf..32df089 100644 --- a/src/types/trx.ts +++ b/src/types/trx.ts @@ -104,6 +104,18 @@ export enum TrxTransactionRemark { "cancel" = "Cancel", } +export enum TrxSmsType { + "verification" = "verification", + "registration" = "registration", + "transaction" = "transaction", +} + +export enum TrxSmsStatus { + "process" = "process", + "success" = "success", + "fail" = "fail", +} + export enum TrxEmailType { "verification" = "verification", "registration" = "registration", @@ -149,5 +161,3 @@ export enum TrxMaintenanceActionType { "update" = "update", "delete" = "delete", } - -////