@zodic/shared 0.0.28 → 0.0.30

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,13 @@
22
22
  "when": 1737680017244,
23
23
  "tag": "0002_exotic_maria_hill",
24
24
  "breakpoints": true
25
+ },
26
+ {
27
+ "idx": 3,
28
+ "version": "6",
29
+ "when": 1737680440619,
30
+ "tag": "0003_fearless_giant_girl",
31
+ "breakpoints": true
25
32
  }
26
33
  ]
27
34
  }
package/db/schema.ts CHANGED
@@ -21,6 +21,7 @@ export const users = sqliteTable(
21
21
  {
22
22
  id: text('id').primaryKey(),
23
23
  email: text('email').notNull().unique(),
24
+ passwordHash: text('password_hash'), // For password-based login, nullable if using only OAuth
24
25
  name: text('name').notNull(),
25
26
  profileImage: text('profile_image'),
26
27
  userPhotoId: text('user_photo_id'),
@@ -36,12 +37,17 @@ export const users = sqliteTable(
36
37
  tzone: real('tzone'), // Nullable for inferred timezone
37
38
  instagramUsername: text('instagram_username').unique(), // Nullable for optional social media
38
39
  tiktokUsername: text('tiktok_username').unique(), // Fix typo
40
+ oauthProvider: text('oauth_provider'), // e.g., "google", "facebook", "apple", nullable for password-based login
41
+ oauthProviderId: text('oauth_provider_id').unique(), // Unique identifier from the provider
39
42
  credits_balance: integer('credits_balance').default(0).notNull(),
40
43
  totalCreditsEarned: integer('total_credits_earned').default(0).notNull(),
41
44
  lastTransactionAt: integer('last_transaction_at', { mode: 'timestamp' }), // Nullable for no transactions
42
45
  ...timestampFields,
43
46
  },
44
- (t) => [index('users_email_idx').on(t.email)]
47
+ (t) => [
48
+ index('users_email_idx').on(t.email),
49
+ index('users_oauth_provider_idx').on(t.oauthProvider, t.oauthProviderId), // Index for efficient OAuth lookups
50
+ ]
45
51
  );
46
52
 
47
53
  export const creditsTransactions = sqliteTable(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.28",
3
+ "version": "0.0.30",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -4,6 +4,7 @@ import {
4
4
  KVNamespace,
5
5
  R2Bucket,
6
6
  } from '@cloudflare/workers-types';
7
+ import { DrizzleD1Database } from 'drizzle-orm/d1';
7
8
  import { Context, Env } from 'hono';
8
9
  import type { Container } from 'inversify';
9
10
 
@@ -65,6 +66,7 @@ export type Variables = {
65
66
  roles?: string[];
66
67
  };
67
68
  container: Container;
69
+ drizzle: DrizzleD1Database;
68
70
  };
69
71
 
70
72
  export type BackendBindings = Env &