@zodic/shared 0.0.19 → 0.0.20

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.
@@ -22,6 +22,20 @@
22
22
  "when": 1737480263536,
23
23
  "tag": "0002_condemned_turbo",
24
24
  "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "6",
29
+ "when": 1737649237207,
30
+ "tag": "0003_cynical_frog_thor",
31
+ "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "6",
36
+ "when": 1737649768416,
37
+ "tag": "0004_light_masked_marvel",
38
+ "breakpoints": true
25
39
  }
26
40
  ]
27
41
  }
package/db/schema.ts CHANGED
@@ -7,6 +7,15 @@ import {
7
7
  text,
8
8
  } from 'drizzle-orm/sqlite-core';
9
9
 
10
+ export const timestampFields = {
11
+ createdAt: integer('created_at', { mode: 'timestamp' })
12
+ .default(sql`CURRENT_TIMESTAMP`)
13
+ .notNull(),
14
+ updatedAt: integer('updated_at', { mode: 'timestamp' })
15
+ .default(sql`CURRENT_TIMESTAMP`)
16
+ .notNull(),
17
+ };
18
+
10
19
  export const users = sqliteTable(
11
20
  'users',
12
21
  {
@@ -30,10 +39,7 @@ export const users = sqliteTable(
30
39
  credits_balance: integer('credits_balance'),
31
40
  totalCreditsEarned: integer('total_credits_earned').default(0),
32
41
  lastTransactionAt: integer('last_transaction_at', { mode: 'timestamp' }),
33
- createdAt: text('created_at')
34
- .default(sql`CURRENT_TIMESTAMP`)
35
- .notNull(),
36
- updatedAt: text('updated_at').default(sql`CURRENT_TIMESTAMP`),
42
+ ...timestampFields,
37
43
  },
38
44
  (t) => [index('users_email_idx').on(t.email)]
39
45
  );
@@ -51,9 +57,7 @@ export const creditsTransactions = sqliteTable(
51
57
  productType: text('product_type'), // e.g., "concept", "artifact", "astrology_report"
52
58
  productId: text('product_id'), // Corresponding ID for the product (concept_id, artifact_id, etc.)
53
59
  paymentId: text('payment_id'), // References the payment for purchases
54
- createdAt: integer('created_at', { mode: 'timestamp' }).default(
55
- sql`CURRENT_TIMESTAMP`
56
- ),
60
+ ...timestampFields,
57
61
  },
58
62
  (t) => [index('credits_transactions_user_id_idx').on(t.userId)]
59
63
  );
@@ -157,12 +161,7 @@ export const userConcepts = sqliteTable(
157
161
  conceptCombinationId: text('concept_combination_id')
158
162
  .notNull()
159
163
  .references(() => conceptCombinations.id, { onDelete: 'cascade' }),
160
- createdAt: integer('created_at', { mode: 'timestamp' }).default(
161
- sql`CURRENT_TIMESTAMP`
162
- ),
163
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
164
- sql`CURRENT_TIMESTAMP`
165
- ),
164
+ ...timestampFields,
166
165
  },
167
166
  (t) => [
168
167
  index('user_concepts_user_id_idx').on(t.userId),
@@ -213,12 +212,7 @@ export const userArtifacts = sqliteTable(
213
212
  status: text('status')
214
213
  .default('pending') // Possible statuses: 'pending', 'post_ready', 'reel_ready', 'completed'
215
214
  .notNull(),
216
- createdAt: integer('created_at', { mode: 'timestamp' }).default(
217
- sql`CURRENT_TIMESTAMP`
218
- ),
219
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
220
- sql`CURRENT_TIMESTAMP`
221
- ),
215
+ ...timestampFields,
222
216
  },
223
217
  (t) => [
224
218
  index('user_artifacts_user_id_idx').on(t.userId),
@@ -249,12 +243,7 @@ export const generations = sqliteTable(
249
243
  type: text('type').notNull(), // e.g., "concept_image"
250
244
  status: text('status').default('pending').notNull(), // "pending", "completed", "failed"
251
245
  url: text('url'), // URL for the generated image
252
- createdAt: integer('created_at', { mode: 'timestamp' }).default(
253
- sql`CURRENT_TIMESTAMP`
254
- ),
255
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
256
- sql`CURRENT_TIMESTAMP`
257
- ),
246
+ ...timestampFields,
258
247
  },
259
248
  (t) => [
260
249
  index('generations_user_id_idx').on(t.userId),
@@ -270,12 +259,7 @@ export const artifactFaceswap = sqliteTable(
270
259
  .notNull()
271
260
  .references(() => userArtifacts.id, { onDelete: 'cascade' }),
272
261
  faceSwappedImageUrl: text('face_swapped_image_url'), // Final URL of the face-swapped image
273
- createdAt: integer('created_at', { mode: 'timestamp' }).default(
274
- sql`CURRENT_TIMESTAMP`
275
- ),
276
- updatedAt: integer('updated_at', { mode: 'timestamp' }).default(
277
- sql`CURRENT_TIMESTAMP`
278
- ),
262
+ ...timestampFields,
279
263
  },
280
264
  () => []
281
265
  );
@@ -291,6 +275,7 @@ export const artifactVideoGeneration = sqliteTable(
291
275
  videoUrl: text('video_url'), // URL of the final video
292
276
  description: text('description'), // Optional description for the video
293
277
  duration: integer('duration'), // Duration of the video in seconds
278
+ ...timestampFields,
294
279
  },
295
280
  (t) => [index('artifact_video_generation_status_idx').on(t.videoStatus)]
296
281
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.19",
3
+ "version": "0.0.20",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {