feat : add slipok and switcher to switch between slip2go and slipok
This commit is contained in:
+4
-1
@@ -170,8 +170,9 @@ export const commissionSettings = commissionSchema.table("settings", {
|
||||
id: integer("id").primaryKey(),
|
||||
isOpen: boolean("is_open").default(true).notNull(),
|
||||
closureMessage: text("closure_message").default("").notNull(),
|
||||
slipProvider: varchar("slip_provider", { length: 16 }).$type<"slip2go" | "slipok">().default("slip2go").notNull(),
|
||||
updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(),
|
||||
});
|
||||
}, (table) => [check("commission_settings_slip_provider_check", sql`${table.slipProvider} in ('slip2go', 'slipok')`)]);
|
||||
|
||||
export const commissionTickets = commissionSchema.table("ticket", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
@@ -191,6 +192,7 @@ export const commissionPayments = commissionSchema.table("payment", {
|
||||
id: uuid("id").defaultRandom().primaryKey(),
|
||||
checkoutId: uuid("checkout_id").notNull().references(() => commissionCheckouts.id),
|
||||
ticketId: uuid("ticket_id").notNull().references(() => commissionTickets.id),
|
||||
provider: varchar("provider", { length: 16 }).$type<"slip2go" | "slipok">().default("slip2go").notNull(),
|
||||
referenceId: text("reference_id").notNull(),
|
||||
transRef: text("trans_ref").notNull(),
|
||||
amountBaht: integer("amount_baht").notNull(),
|
||||
@@ -200,6 +202,7 @@ export const commissionPayments = commissionSchema.table("payment", {
|
||||
providerData: jsonb("provider_data").$type<Record<string, unknown>>().notNull(),
|
||||
createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),
|
||||
}, (table) => [
|
||||
check("commission_payment_provider_check", sql`${table.provider} in ('slip2go', 'slipok')`),
|
||||
uniqueIndex("commission_payment_checkout_unique").on(table.checkoutId),
|
||||
uniqueIndex("commission_payment_reference_unique").on(table.referenceId),
|
||||
uniqueIndex("commission_payment_trans_ref_unique").on(table.transRef),
|
||||
|
||||
Reference in New Issue
Block a user