@zodic/shared 0.0.394 → 0.0.396
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/db/schema.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
real,
|
|
6
6
|
sqliteTable,
|
|
7
7
|
text,
|
|
8
|
+
uniqueIndex,
|
|
8
9
|
} from 'drizzle-orm/sqlite-core';
|
|
9
10
|
|
|
10
11
|
export const timestampFields = {
|
|
@@ -86,7 +87,7 @@ export const userProducts = sqliteTable(
|
|
|
86
87
|
})
|
|
87
88
|
.notNull()
|
|
88
89
|
.default('locked'),
|
|
89
|
-
|
|
90
|
+
|
|
90
91
|
...timestampFields,
|
|
91
92
|
},
|
|
92
93
|
(t) => [
|
|
@@ -94,6 +95,7 @@ export const userProducts = sqliteTable(
|
|
|
94
95
|
index('user_products_product_id_idx').on(t.productId),
|
|
95
96
|
index('user_products_payment_id_idx').on(t.paymentId),
|
|
96
97
|
index('user_products_checkout_id_idx').on(t.checkoutId),
|
|
98
|
+
uniqueIndex('user_product_unique').on(t.userId, t.productId), // Enforce uniqueness
|
|
97
99
|
]
|
|
98
100
|
);
|
|
99
101
|
|
|
@@ -106,7 +108,11 @@ export const payments = sqliteTable(
|
|
|
106
108
|
.references(() => users.id, { onDelete: 'cascade' }),
|
|
107
109
|
checkoutId: text('checkout_id').notNull().unique(), // Asaas checkout ID
|
|
108
110
|
amount: real('amount').notNull(), // Total amount in BRL
|
|
109
|
-
status: text('status', {
|
|
111
|
+
status: text('status', {
|
|
112
|
+
enum: ['pending', 'completed', 'failed', 'expired', 'canceled'],
|
|
113
|
+
})
|
|
114
|
+
.notNull()
|
|
115
|
+
.default('pending'),
|
|
110
116
|
...timestampFields,
|
|
111
117
|
},
|
|
112
118
|
(t) => [
|
|
@@ -121,7 +127,9 @@ export const asaasEvents = sqliteTable(
|
|
|
121
127
|
id: text('id').primaryKey(), // Unique event ID (can use Asaas event ID or generate your own)
|
|
122
128
|
asaasEventId: text('asaas_event_id').notNull().unique(), // Asaas event ID (e.g., "evt_37260be8159d4472b4458d3de13efc2d&15370")
|
|
123
129
|
payload: text('payload').notNull(), // JSON string of the webhook payload
|
|
124
|
-
status: text('status', { enum: ['pending', 'done'] })
|
|
130
|
+
status: text('status', { enum: ['pending', 'done'] })
|
|
131
|
+
.notNull()
|
|
132
|
+
.default('pending'),
|
|
125
133
|
...timestampFields,
|
|
126
134
|
},
|
|
127
135
|
(t) => [index('asaas_events_asaas_event_id_idx').on(t.asaasEventId)]
|
package/package.json
CHANGED
|
@@ -45,6 +45,7 @@ export type CentralBindings = {
|
|
|
45
45
|
ORB_QUEUE: Queue;
|
|
46
46
|
ARCHETYPE_POPULATION_QUEUE: Queue;
|
|
47
47
|
FACESWAP_QUEUE: Queue;
|
|
48
|
+
PAYMENT_QUEUE: Queue;
|
|
48
49
|
|
|
49
50
|
PROMPT_IMAGE_DESCRIBER: string;
|
|
50
51
|
PROMPT_GENERATE_ARCHETYPE_BASIC_INFO: string;
|
|
@@ -154,6 +155,7 @@ export type BackendBindings = Env &
|
|
|
154
155
|
| 'FACESWAP_QUEUE'
|
|
155
156
|
| 'ASAAS_API_KEY'
|
|
156
157
|
| 'ASAAS_API_URL'
|
|
158
|
+
| 'PAYMENT_QUEUE'
|
|
157
159
|
>;
|
|
158
160
|
|
|
159
161
|
export type BackendCtx = Context<
|