@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.
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) => [
|
|
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
|
@@ -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 &
|