@zodic/shared 0.0.395 → 0.0.397
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/migrations/0020_smiling_blob.sql +1 -0
- package/db/migrations/0021_flawless_wallflower.sql +1 -0
- package/db/migrations/meta/0020_snapshot.json +3252 -0
- package/db/migrations/meta/0021_snapshot.json +3254 -0
- package/db/migrations/meta/_journal.json +14 -0
- package/db/schema.ts +12 -4
- package/package.json +1 -1
|
@@ -141,6 +141,20 @@
|
|
|
141
141
|
"when": 1747277149960,
|
|
142
142
|
"tag": "0019_abandoned_orphan",
|
|
143
143
|
"breakpoints": true
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"idx": 20,
|
|
147
|
+
"version": "6",
|
|
148
|
+
"when": 1747599943965,
|
|
149
|
+
"tag": "0020_smiling_blob",
|
|
150
|
+
"breakpoints": true
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"idx": 21,
|
|
154
|
+
"version": "6",
|
|
155
|
+
"when": 1747600243276,
|
|
156
|
+
"tag": "0021_flawless_wallflower",
|
|
157
|
+
"breakpoints": true
|
|
144
158
|
}
|
|
145
159
|
]
|
|
146
160
|
}
|
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)]
|
|
@@ -472,7 +480,7 @@ export const userArtifacts = sqliteTable(
|
|
|
472
480
|
reelImages: text('reel_images'), // Stringified JSON array of { id: string, url: string } for up to 6 reel images (if used)
|
|
473
481
|
chosenImageUrl: text('chosen_image_url'), // URL of the single image chosen by the user
|
|
474
482
|
upscaledImage: text('upscaled_image'), // { id: string, url: string }
|
|
475
|
-
|
|
483
|
+
framedImageUrl: text('framed_image_url'),
|
|
476
484
|
status: text('status')
|
|
477
485
|
.default('pending') // Possible statuses: 'pending', 'post_ready', 'reel_ready', 'completed', 'revealed'
|
|
478
486
|
.notNull(),
|