@zodic/shared 0.0.3 → 0.0.5

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.
@@ -0,0 +1,79 @@
1
+ ALTER TABLE `users_table` RENAME TO `users`;--> statement-breakpoint
2
+ ALTER TABLE `users` RENAME COLUMN "birth_time" TO "birth_date_time";--> statement-breakpoint
3
+ CREATE TABLE `astrological_data` (
4
+ `id` text PRIMARY KEY NOT NULL,
5
+ `user_id` text NOT NULL,
6
+ `planet` text NOT NULL,
7
+ `sign` text NOT NULL,
8
+ `house` integer NOT NULL,
9
+ `full_degree` real NOT NULL,
10
+ `norm_degree` real NOT NULL,
11
+ `speed` real NOT NULL,
12
+ `is_retro` integer NOT NULL,
13
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
14
+ );
15
+ --> statement-breakpoint
16
+ CREATE INDEX `astrological_data_user_id_idx` ON `astrological_data` (`user_id`);--> statement-breakpoint
17
+ CREATE TABLE `generations` (
18
+ `id` text PRIMARY KEY NOT NULL,
19
+ `user_id` text NOT NULL,
20
+ `product_id` text NOT NULL,
21
+ `type` text NOT NULL,
22
+ `image_id` text,
23
+ `image_url` text,
24
+ `report_content` text,
25
+ `external_source_url` text,
26
+ `created_at` text DEFAULT 'CURRENT_TIMESTAMP',
27
+ `metadata` text,
28
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
29
+ FOREIGN KEY (`product_id`) REFERENCES `products`(`id`) ON UPDATE no action ON DELETE set null
30
+ );
31
+ --> statement-breakpoint
32
+ CREATE INDEX `generations_user_id_idx` ON `generations` (`user_id`);--> statement-breakpoint
33
+ CREATE INDEX `generations_product_id_idx` ON `generations` (`product_id`);--> statement-breakpoint
34
+ CREATE INDEX `generations_user_id_product_id_idx` ON `generations` (`user_id`,`product_id`);--> statement-breakpoint
35
+ CREATE TABLE `products` (
36
+ `id` text PRIMARY KEY NOT NULL,
37
+ `name` text NOT NULL,
38
+ `description` text,
39
+ `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
40
+ );
41
+ --> statement-breakpoint
42
+ CREATE UNIQUE INDEX `products_name_unique` ON `products` (`name`);--> statement-breakpoint
43
+ CREATE INDEX `products_name_idx` ON `products` (`name`);--> statement-breakpoint
44
+ DROP INDEX `users_table_email_unique`;--> statement-breakpoint
45
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
46
+ CREATE TABLE `__new_users` (
47
+ `id` text PRIMARY KEY NOT NULL,
48
+ `email` text NOT NULL,
49
+ `name` text NOT NULL,
50
+ `profile_image` text,
51
+ `user_photo_id` text,
52
+ `user_photo_url` text,
53
+ `gender` text,
54
+ `birth_date_time` text NOT NULL,
55
+ `latitude` real NOT NULL,
56
+ `longitude` real NOT NULL,
57
+ `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
58
+ );
59
+ --> statement-breakpoint
60
+ INSERT INTO `__new_users`("id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at") SELECT "id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at" FROM `users`;--> statement-breakpoint
61
+ DROP TABLE `users`;--> statement-breakpoint
62
+ ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
63
+ PRAGMA foreign_keys=ON;--> statement-breakpoint
64
+ CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
65
+ CREATE INDEX `users_email_idx` ON `users` (`email`);--> statement-breakpoint
66
+ CREATE TABLE `__new_tokens` (
67
+ `id` text PRIMARY KEY NOT NULL,
68
+ `user_id` text NOT NULL,
69
+ `refresh_token` text NOT NULL,
70
+ `expires_at` text NOT NULL,
71
+ `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
72
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
73
+ );
74
+ --> statement-breakpoint
75
+ INSERT INTO `__new_tokens`("id", "user_id", "refresh_token", "expires_at", "created_at") SELECT "id", "user_id", "refresh_token", "expires_at", "created_at" FROM `tokens`;--> statement-breakpoint
76
+ DROP TABLE `tokens`;--> statement-breakpoint
77
+ ALTER TABLE `__new_tokens` RENAME TO `tokens`;--> statement-breakpoint
78
+ CREATE UNIQUE INDEX `tokens_refresh_token_unique` ON `tokens` (`refresh_token`);--> statement-breakpoint
79
+ CREATE INDEX `tokens_user_id_idx` ON `tokens` (`user_id`);
@@ -0,0 +1,21 @@
1
+ PRAGMA foreign_keys=OFF;--> statement-breakpoint
2
+ CREATE TABLE `__new_users` (
3
+ `id` text PRIMARY KEY NOT NULL,
4
+ `email` text NOT NULL,
5
+ `name` text NOT NULL,
6
+ `profile_image` text,
7
+ `user_photo_id` text,
8
+ `user_photo_url` text,
9
+ `gender` text,
10
+ `birth_date_time` text,
11
+ `latitude` real,
12
+ `longitude` real,
13
+ `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
14
+ );
15
+ --> statement-breakpoint
16
+ INSERT INTO `__new_users`("id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at") SELECT "id", "email", "name", "profile_image", "user_photo_id", "user_photo_url", "gender", "birth_date_time", "latitude", "longitude", "created_at" FROM `users`;--> statement-breakpoint
17
+ DROP TABLE `users`;--> statement-breakpoint
18
+ ALTER TABLE `__new_users` RENAME TO `users`;--> statement-breakpoint
19
+ PRAGMA foreign_keys=ON;--> statement-breakpoint
20
+ CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
21
+ CREATE INDEX `users_email_idx` ON `users` (`email`);
@@ -0,0 +1,480 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "410a1786-702f-44bf-97da-28c75550b90f",
5
+ "prevId": "ebd56564-96c0-4785-a419-40258282dbc0",
6
+ "tables": {
7
+ "astrological_data": {
8
+ "name": "astrological_data",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "user_id": {
18
+ "name": "user_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "planet": {
25
+ "name": "planet",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "sign": {
32
+ "name": "sign",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "house": {
39
+ "name": "house",
40
+ "type": "integer",
41
+ "primaryKey": false,
42
+ "notNull": true,
43
+ "autoincrement": false
44
+ },
45
+ "full_degree": {
46
+ "name": "full_degree",
47
+ "type": "real",
48
+ "primaryKey": false,
49
+ "notNull": true,
50
+ "autoincrement": false
51
+ },
52
+ "norm_degree": {
53
+ "name": "norm_degree",
54
+ "type": "real",
55
+ "primaryKey": false,
56
+ "notNull": true,
57
+ "autoincrement": false
58
+ },
59
+ "speed": {
60
+ "name": "speed",
61
+ "type": "real",
62
+ "primaryKey": false,
63
+ "notNull": true,
64
+ "autoincrement": false
65
+ },
66
+ "is_retro": {
67
+ "name": "is_retro",
68
+ "type": "integer",
69
+ "primaryKey": false,
70
+ "notNull": true,
71
+ "autoincrement": false
72
+ }
73
+ },
74
+ "indexes": {
75
+ "astrological_data_user_id_idx": {
76
+ "name": "astrological_data_user_id_idx",
77
+ "columns": [
78
+ "user_id"
79
+ ],
80
+ "isUnique": false
81
+ }
82
+ },
83
+ "foreignKeys": {
84
+ "astrological_data_user_id_users_id_fk": {
85
+ "name": "astrological_data_user_id_users_id_fk",
86
+ "tableFrom": "astrological_data",
87
+ "tableTo": "users",
88
+ "columnsFrom": [
89
+ "user_id"
90
+ ],
91
+ "columnsTo": [
92
+ "id"
93
+ ],
94
+ "onDelete": "cascade",
95
+ "onUpdate": "no action"
96
+ }
97
+ },
98
+ "compositePrimaryKeys": {},
99
+ "uniqueConstraints": {},
100
+ "checkConstraints": {}
101
+ },
102
+ "generations": {
103
+ "name": "generations",
104
+ "columns": {
105
+ "id": {
106
+ "name": "id",
107
+ "type": "text",
108
+ "primaryKey": true,
109
+ "notNull": true,
110
+ "autoincrement": false
111
+ },
112
+ "user_id": {
113
+ "name": "user_id",
114
+ "type": "text",
115
+ "primaryKey": false,
116
+ "notNull": true,
117
+ "autoincrement": false
118
+ },
119
+ "product_id": {
120
+ "name": "product_id",
121
+ "type": "text",
122
+ "primaryKey": false,
123
+ "notNull": true,
124
+ "autoincrement": false
125
+ },
126
+ "type": {
127
+ "name": "type",
128
+ "type": "text",
129
+ "primaryKey": false,
130
+ "notNull": true,
131
+ "autoincrement": false
132
+ },
133
+ "image_id": {
134
+ "name": "image_id",
135
+ "type": "text",
136
+ "primaryKey": false,
137
+ "notNull": false,
138
+ "autoincrement": false
139
+ },
140
+ "image_url": {
141
+ "name": "image_url",
142
+ "type": "text",
143
+ "primaryKey": false,
144
+ "notNull": false,
145
+ "autoincrement": false
146
+ },
147
+ "report_content": {
148
+ "name": "report_content",
149
+ "type": "text",
150
+ "primaryKey": false,
151
+ "notNull": false,
152
+ "autoincrement": false
153
+ },
154
+ "external_source_url": {
155
+ "name": "external_source_url",
156
+ "type": "text",
157
+ "primaryKey": false,
158
+ "notNull": false,
159
+ "autoincrement": false
160
+ },
161
+ "created_at": {
162
+ "name": "created_at",
163
+ "type": "text",
164
+ "primaryKey": false,
165
+ "notNull": false,
166
+ "autoincrement": false,
167
+ "default": "'CURRENT_TIMESTAMP'"
168
+ },
169
+ "metadata": {
170
+ "name": "metadata",
171
+ "type": "text",
172
+ "primaryKey": false,
173
+ "notNull": false,
174
+ "autoincrement": false
175
+ }
176
+ },
177
+ "indexes": {
178
+ "generations_user_id_idx": {
179
+ "name": "generations_user_id_idx",
180
+ "columns": [
181
+ "user_id"
182
+ ],
183
+ "isUnique": false
184
+ },
185
+ "generations_product_id_idx": {
186
+ "name": "generations_product_id_idx",
187
+ "columns": [
188
+ "product_id"
189
+ ],
190
+ "isUnique": false
191
+ },
192
+ "generations_user_id_product_id_idx": {
193
+ "name": "generations_user_id_product_id_idx",
194
+ "columns": [
195
+ "user_id",
196
+ "product_id"
197
+ ],
198
+ "isUnique": false
199
+ }
200
+ },
201
+ "foreignKeys": {
202
+ "generations_user_id_users_id_fk": {
203
+ "name": "generations_user_id_users_id_fk",
204
+ "tableFrom": "generations",
205
+ "tableTo": "users",
206
+ "columnsFrom": [
207
+ "user_id"
208
+ ],
209
+ "columnsTo": [
210
+ "id"
211
+ ],
212
+ "onDelete": "cascade",
213
+ "onUpdate": "no action"
214
+ },
215
+ "generations_product_id_products_id_fk": {
216
+ "name": "generations_product_id_products_id_fk",
217
+ "tableFrom": "generations",
218
+ "tableTo": "products",
219
+ "columnsFrom": [
220
+ "product_id"
221
+ ],
222
+ "columnsTo": [
223
+ "id"
224
+ ],
225
+ "onDelete": "set null",
226
+ "onUpdate": "no action"
227
+ }
228
+ },
229
+ "compositePrimaryKeys": {},
230
+ "uniqueConstraints": {},
231
+ "checkConstraints": {}
232
+ },
233
+ "products": {
234
+ "name": "products",
235
+ "columns": {
236
+ "id": {
237
+ "name": "id",
238
+ "type": "text",
239
+ "primaryKey": true,
240
+ "notNull": true,
241
+ "autoincrement": false
242
+ },
243
+ "name": {
244
+ "name": "name",
245
+ "type": "text",
246
+ "primaryKey": false,
247
+ "notNull": true,
248
+ "autoincrement": false
249
+ },
250
+ "description": {
251
+ "name": "description",
252
+ "type": "text",
253
+ "primaryKey": false,
254
+ "notNull": false,
255
+ "autoincrement": false
256
+ },
257
+ "created_at": {
258
+ "name": "created_at",
259
+ "type": "text",
260
+ "primaryKey": false,
261
+ "notNull": true,
262
+ "autoincrement": false,
263
+ "default": "CURRENT_TIMESTAMP"
264
+ }
265
+ },
266
+ "indexes": {
267
+ "products_name_unique": {
268
+ "name": "products_name_unique",
269
+ "columns": [
270
+ "name"
271
+ ],
272
+ "isUnique": true
273
+ },
274
+ "products_name_idx": {
275
+ "name": "products_name_idx",
276
+ "columns": [
277
+ "name"
278
+ ],
279
+ "isUnique": false
280
+ }
281
+ },
282
+ "foreignKeys": {},
283
+ "compositePrimaryKeys": {},
284
+ "uniqueConstraints": {},
285
+ "checkConstraints": {}
286
+ },
287
+ "tokens": {
288
+ "name": "tokens",
289
+ "columns": {
290
+ "id": {
291
+ "name": "id",
292
+ "type": "text",
293
+ "primaryKey": true,
294
+ "notNull": true,
295
+ "autoincrement": false
296
+ },
297
+ "user_id": {
298
+ "name": "user_id",
299
+ "type": "text",
300
+ "primaryKey": false,
301
+ "notNull": true,
302
+ "autoincrement": false
303
+ },
304
+ "refresh_token": {
305
+ "name": "refresh_token",
306
+ "type": "text",
307
+ "primaryKey": false,
308
+ "notNull": true,
309
+ "autoincrement": false
310
+ },
311
+ "expires_at": {
312
+ "name": "expires_at",
313
+ "type": "text",
314
+ "primaryKey": false,
315
+ "notNull": true,
316
+ "autoincrement": false
317
+ },
318
+ "created_at": {
319
+ "name": "created_at",
320
+ "type": "text",
321
+ "primaryKey": false,
322
+ "notNull": true,
323
+ "autoincrement": false,
324
+ "default": "CURRENT_TIMESTAMP"
325
+ }
326
+ },
327
+ "indexes": {
328
+ "tokens_refresh_token_unique": {
329
+ "name": "tokens_refresh_token_unique",
330
+ "columns": [
331
+ "refresh_token"
332
+ ],
333
+ "isUnique": true
334
+ },
335
+ "tokens_user_id_idx": {
336
+ "name": "tokens_user_id_idx",
337
+ "columns": [
338
+ "user_id"
339
+ ],
340
+ "isUnique": false
341
+ }
342
+ },
343
+ "foreignKeys": {
344
+ "tokens_user_id_users_id_fk": {
345
+ "name": "tokens_user_id_users_id_fk",
346
+ "tableFrom": "tokens",
347
+ "tableTo": "users",
348
+ "columnsFrom": [
349
+ "user_id"
350
+ ],
351
+ "columnsTo": [
352
+ "id"
353
+ ],
354
+ "onDelete": "cascade",
355
+ "onUpdate": "no action"
356
+ }
357
+ },
358
+ "compositePrimaryKeys": {},
359
+ "uniqueConstraints": {},
360
+ "checkConstraints": {}
361
+ },
362
+ "users": {
363
+ "name": "users",
364
+ "columns": {
365
+ "id": {
366
+ "name": "id",
367
+ "type": "text",
368
+ "primaryKey": true,
369
+ "notNull": true,
370
+ "autoincrement": false
371
+ },
372
+ "email": {
373
+ "name": "email",
374
+ "type": "text",
375
+ "primaryKey": false,
376
+ "notNull": true,
377
+ "autoincrement": false
378
+ },
379
+ "name": {
380
+ "name": "name",
381
+ "type": "text",
382
+ "primaryKey": false,
383
+ "notNull": true,
384
+ "autoincrement": false
385
+ },
386
+ "profile_image": {
387
+ "name": "profile_image",
388
+ "type": "text",
389
+ "primaryKey": false,
390
+ "notNull": false,
391
+ "autoincrement": false
392
+ },
393
+ "user_photo_id": {
394
+ "name": "user_photo_id",
395
+ "type": "text",
396
+ "primaryKey": false,
397
+ "notNull": false,
398
+ "autoincrement": false
399
+ },
400
+ "user_photo_url": {
401
+ "name": "user_photo_url",
402
+ "type": "text",
403
+ "primaryKey": false,
404
+ "notNull": false,
405
+ "autoincrement": false
406
+ },
407
+ "gender": {
408
+ "name": "gender",
409
+ "type": "text",
410
+ "primaryKey": false,
411
+ "notNull": false,
412
+ "autoincrement": false
413
+ },
414
+ "birth_date_time": {
415
+ "name": "birth_date_time",
416
+ "type": "text",
417
+ "primaryKey": false,
418
+ "notNull": true,
419
+ "autoincrement": false
420
+ },
421
+ "latitude": {
422
+ "name": "latitude",
423
+ "type": "real",
424
+ "primaryKey": false,
425
+ "notNull": true,
426
+ "autoincrement": false
427
+ },
428
+ "longitude": {
429
+ "name": "longitude",
430
+ "type": "real",
431
+ "primaryKey": false,
432
+ "notNull": true,
433
+ "autoincrement": false
434
+ },
435
+ "created_at": {
436
+ "name": "created_at",
437
+ "type": "text",
438
+ "primaryKey": false,
439
+ "notNull": true,
440
+ "autoincrement": false,
441
+ "default": "CURRENT_TIMESTAMP"
442
+ }
443
+ },
444
+ "indexes": {
445
+ "users_email_unique": {
446
+ "name": "users_email_unique",
447
+ "columns": [
448
+ "email"
449
+ ],
450
+ "isUnique": true
451
+ },
452
+ "users_email_idx": {
453
+ "name": "users_email_idx",
454
+ "columns": [
455
+ "email"
456
+ ],
457
+ "isUnique": false
458
+ }
459
+ },
460
+ "foreignKeys": {},
461
+ "compositePrimaryKeys": {},
462
+ "uniqueConstraints": {},
463
+ "checkConstraints": {}
464
+ }
465
+ },
466
+ "views": {},
467
+ "enums": {},
468
+ "_meta": {
469
+ "schemas": {},
470
+ "tables": {
471
+ "\"users_table\"": "\"users\""
472
+ },
473
+ "columns": {
474
+ "\"users\".\"birth_time\"": "\"users\".\"birth_date_time\""
475
+ }
476
+ },
477
+ "internal": {
478
+ "indexes": {}
479
+ }
480
+ }
@@ -0,0 +1,476 @@
1
+ {
2
+ "version": "6",
3
+ "dialect": "sqlite",
4
+ "id": "bc424dbf-1267-4416-b160-dbfb94f0667b",
5
+ "prevId": "410a1786-702f-44bf-97da-28c75550b90f",
6
+ "tables": {
7
+ "astrological_data": {
8
+ "name": "astrological_data",
9
+ "columns": {
10
+ "id": {
11
+ "name": "id",
12
+ "type": "text",
13
+ "primaryKey": true,
14
+ "notNull": true,
15
+ "autoincrement": false
16
+ },
17
+ "user_id": {
18
+ "name": "user_id",
19
+ "type": "text",
20
+ "primaryKey": false,
21
+ "notNull": true,
22
+ "autoincrement": false
23
+ },
24
+ "planet": {
25
+ "name": "planet",
26
+ "type": "text",
27
+ "primaryKey": false,
28
+ "notNull": true,
29
+ "autoincrement": false
30
+ },
31
+ "sign": {
32
+ "name": "sign",
33
+ "type": "text",
34
+ "primaryKey": false,
35
+ "notNull": true,
36
+ "autoincrement": false
37
+ },
38
+ "house": {
39
+ "name": "house",
40
+ "type": "integer",
41
+ "primaryKey": false,
42
+ "notNull": true,
43
+ "autoincrement": false
44
+ },
45
+ "full_degree": {
46
+ "name": "full_degree",
47
+ "type": "real",
48
+ "primaryKey": false,
49
+ "notNull": true,
50
+ "autoincrement": false
51
+ },
52
+ "norm_degree": {
53
+ "name": "norm_degree",
54
+ "type": "real",
55
+ "primaryKey": false,
56
+ "notNull": true,
57
+ "autoincrement": false
58
+ },
59
+ "speed": {
60
+ "name": "speed",
61
+ "type": "real",
62
+ "primaryKey": false,
63
+ "notNull": true,
64
+ "autoincrement": false
65
+ },
66
+ "is_retro": {
67
+ "name": "is_retro",
68
+ "type": "integer",
69
+ "primaryKey": false,
70
+ "notNull": true,
71
+ "autoincrement": false
72
+ }
73
+ },
74
+ "indexes": {
75
+ "astrological_data_user_id_idx": {
76
+ "name": "astrological_data_user_id_idx",
77
+ "columns": [
78
+ "user_id"
79
+ ],
80
+ "isUnique": false
81
+ }
82
+ },
83
+ "foreignKeys": {
84
+ "astrological_data_user_id_users_id_fk": {
85
+ "name": "astrological_data_user_id_users_id_fk",
86
+ "tableFrom": "astrological_data",
87
+ "tableTo": "users",
88
+ "columnsFrom": [
89
+ "user_id"
90
+ ],
91
+ "columnsTo": [
92
+ "id"
93
+ ],
94
+ "onDelete": "cascade",
95
+ "onUpdate": "no action"
96
+ }
97
+ },
98
+ "compositePrimaryKeys": {},
99
+ "uniqueConstraints": {},
100
+ "checkConstraints": {}
101
+ },
102
+ "generations": {
103
+ "name": "generations",
104
+ "columns": {
105
+ "id": {
106
+ "name": "id",
107
+ "type": "text",
108
+ "primaryKey": true,
109
+ "notNull": true,
110
+ "autoincrement": false
111
+ },
112
+ "user_id": {
113
+ "name": "user_id",
114
+ "type": "text",
115
+ "primaryKey": false,
116
+ "notNull": true,
117
+ "autoincrement": false
118
+ },
119
+ "product_id": {
120
+ "name": "product_id",
121
+ "type": "text",
122
+ "primaryKey": false,
123
+ "notNull": true,
124
+ "autoincrement": false
125
+ },
126
+ "type": {
127
+ "name": "type",
128
+ "type": "text",
129
+ "primaryKey": false,
130
+ "notNull": true,
131
+ "autoincrement": false
132
+ },
133
+ "image_id": {
134
+ "name": "image_id",
135
+ "type": "text",
136
+ "primaryKey": false,
137
+ "notNull": false,
138
+ "autoincrement": false
139
+ },
140
+ "image_url": {
141
+ "name": "image_url",
142
+ "type": "text",
143
+ "primaryKey": false,
144
+ "notNull": false,
145
+ "autoincrement": false
146
+ },
147
+ "report_content": {
148
+ "name": "report_content",
149
+ "type": "text",
150
+ "primaryKey": false,
151
+ "notNull": false,
152
+ "autoincrement": false
153
+ },
154
+ "external_source_url": {
155
+ "name": "external_source_url",
156
+ "type": "text",
157
+ "primaryKey": false,
158
+ "notNull": false,
159
+ "autoincrement": false
160
+ },
161
+ "created_at": {
162
+ "name": "created_at",
163
+ "type": "text",
164
+ "primaryKey": false,
165
+ "notNull": false,
166
+ "autoincrement": false,
167
+ "default": "'CURRENT_TIMESTAMP'"
168
+ },
169
+ "metadata": {
170
+ "name": "metadata",
171
+ "type": "text",
172
+ "primaryKey": false,
173
+ "notNull": false,
174
+ "autoincrement": false
175
+ }
176
+ },
177
+ "indexes": {
178
+ "generations_user_id_idx": {
179
+ "name": "generations_user_id_idx",
180
+ "columns": [
181
+ "user_id"
182
+ ],
183
+ "isUnique": false
184
+ },
185
+ "generations_product_id_idx": {
186
+ "name": "generations_product_id_idx",
187
+ "columns": [
188
+ "product_id"
189
+ ],
190
+ "isUnique": false
191
+ },
192
+ "generations_user_id_product_id_idx": {
193
+ "name": "generations_user_id_product_id_idx",
194
+ "columns": [
195
+ "user_id",
196
+ "product_id"
197
+ ],
198
+ "isUnique": false
199
+ }
200
+ },
201
+ "foreignKeys": {
202
+ "generations_user_id_users_id_fk": {
203
+ "name": "generations_user_id_users_id_fk",
204
+ "tableFrom": "generations",
205
+ "tableTo": "users",
206
+ "columnsFrom": [
207
+ "user_id"
208
+ ],
209
+ "columnsTo": [
210
+ "id"
211
+ ],
212
+ "onDelete": "cascade",
213
+ "onUpdate": "no action"
214
+ },
215
+ "generations_product_id_products_id_fk": {
216
+ "name": "generations_product_id_products_id_fk",
217
+ "tableFrom": "generations",
218
+ "tableTo": "products",
219
+ "columnsFrom": [
220
+ "product_id"
221
+ ],
222
+ "columnsTo": [
223
+ "id"
224
+ ],
225
+ "onDelete": "set null",
226
+ "onUpdate": "no action"
227
+ }
228
+ },
229
+ "compositePrimaryKeys": {},
230
+ "uniqueConstraints": {},
231
+ "checkConstraints": {}
232
+ },
233
+ "products": {
234
+ "name": "products",
235
+ "columns": {
236
+ "id": {
237
+ "name": "id",
238
+ "type": "text",
239
+ "primaryKey": true,
240
+ "notNull": true,
241
+ "autoincrement": false
242
+ },
243
+ "name": {
244
+ "name": "name",
245
+ "type": "text",
246
+ "primaryKey": false,
247
+ "notNull": true,
248
+ "autoincrement": false
249
+ },
250
+ "description": {
251
+ "name": "description",
252
+ "type": "text",
253
+ "primaryKey": false,
254
+ "notNull": false,
255
+ "autoincrement": false
256
+ },
257
+ "created_at": {
258
+ "name": "created_at",
259
+ "type": "text",
260
+ "primaryKey": false,
261
+ "notNull": true,
262
+ "autoincrement": false,
263
+ "default": "CURRENT_TIMESTAMP"
264
+ }
265
+ },
266
+ "indexes": {
267
+ "products_name_unique": {
268
+ "name": "products_name_unique",
269
+ "columns": [
270
+ "name"
271
+ ],
272
+ "isUnique": true
273
+ },
274
+ "products_name_idx": {
275
+ "name": "products_name_idx",
276
+ "columns": [
277
+ "name"
278
+ ],
279
+ "isUnique": false
280
+ }
281
+ },
282
+ "foreignKeys": {},
283
+ "compositePrimaryKeys": {},
284
+ "uniqueConstraints": {},
285
+ "checkConstraints": {}
286
+ },
287
+ "tokens": {
288
+ "name": "tokens",
289
+ "columns": {
290
+ "id": {
291
+ "name": "id",
292
+ "type": "text",
293
+ "primaryKey": true,
294
+ "notNull": true,
295
+ "autoincrement": false
296
+ },
297
+ "user_id": {
298
+ "name": "user_id",
299
+ "type": "text",
300
+ "primaryKey": false,
301
+ "notNull": true,
302
+ "autoincrement": false
303
+ },
304
+ "refresh_token": {
305
+ "name": "refresh_token",
306
+ "type": "text",
307
+ "primaryKey": false,
308
+ "notNull": true,
309
+ "autoincrement": false
310
+ },
311
+ "expires_at": {
312
+ "name": "expires_at",
313
+ "type": "text",
314
+ "primaryKey": false,
315
+ "notNull": true,
316
+ "autoincrement": false
317
+ },
318
+ "created_at": {
319
+ "name": "created_at",
320
+ "type": "text",
321
+ "primaryKey": false,
322
+ "notNull": true,
323
+ "autoincrement": false,
324
+ "default": "CURRENT_TIMESTAMP"
325
+ }
326
+ },
327
+ "indexes": {
328
+ "tokens_refresh_token_unique": {
329
+ "name": "tokens_refresh_token_unique",
330
+ "columns": [
331
+ "refresh_token"
332
+ ],
333
+ "isUnique": true
334
+ },
335
+ "tokens_user_id_idx": {
336
+ "name": "tokens_user_id_idx",
337
+ "columns": [
338
+ "user_id"
339
+ ],
340
+ "isUnique": false
341
+ }
342
+ },
343
+ "foreignKeys": {
344
+ "tokens_user_id_users_id_fk": {
345
+ "name": "tokens_user_id_users_id_fk",
346
+ "tableFrom": "tokens",
347
+ "tableTo": "users",
348
+ "columnsFrom": [
349
+ "user_id"
350
+ ],
351
+ "columnsTo": [
352
+ "id"
353
+ ],
354
+ "onDelete": "cascade",
355
+ "onUpdate": "no action"
356
+ }
357
+ },
358
+ "compositePrimaryKeys": {},
359
+ "uniqueConstraints": {},
360
+ "checkConstraints": {}
361
+ },
362
+ "users": {
363
+ "name": "users",
364
+ "columns": {
365
+ "id": {
366
+ "name": "id",
367
+ "type": "text",
368
+ "primaryKey": true,
369
+ "notNull": true,
370
+ "autoincrement": false
371
+ },
372
+ "email": {
373
+ "name": "email",
374
+ "type": "text",
375
+ "primaryKey": false,
376
+ "notNull": true,
377
+ "autoincrement": false
378
+ },
379
+ "name": {
380
+ "name": "name",
381
+ "type": "text",
382
+ "primaryKey": false,
383
+ "notNull": true,
384
+ "autoincrement": false
385
+ },
386
+ "profile_image": {
387
+ "name": "profile_image",
388
+ "type": "text",
389
+ "primaryKey": false,
390
+ "notNull": false,
391
+ "autoincrement": false
392
+ },
393
+ "user_photo_id": {
394
+ "name": "user_photo_id",
395
+ "type": "text",
396
+ "primaryKey": false,
397
+ "notNull": false,
398
+ "autoincrement": false
399
+ },
400
+ "user_photo_url": {
401
+ "name": "user_photo_url",
402
+ "type": "text",
403
+ "primaryKey": false,
404
+ "notNull": false,
405
+ "autoincrement": false
406
+ },
407
+ "gender": {
408
+ "name": "gender",
409
+ "type": "text",
410
+ "primaryKey": false,
411
+ "notNull": false,
412
+ "autoincrement": false
413
+ },
414
+ "birth_date_time": {
415
+ "name": "birth_date_time",
416
+ "type": "text",
417
+ "primaryKey": false,
418
+ "notNull": false,
419
+ "autoincrement": false
420
+ },
421
+ "latitude": {
422
+ "name": "latitude",
423
+ "type": "real",
424
+ "primaryKey": false,
425
+ "notNull": false,
426
+ "autoincrement": false
427
+ },
428
+ "longitude": {
429
+ "name": "longitude",
430
+ "type": "real",
431
+ "primaryKey": false,
432
+ "notNull": false,
433
+ "autoincrement": false
434
+ },
435
+ "created_at": {
436
+ "name": "created_at",
437
+ "type": "text",
438
+ "primaryKey": false,
439
+ "notNull": true,
440
+ "autoincrement": false,
441
+ "default": "CURRENT_TIMESTAMP"
442
+ }
443
+ },
444
+ "indexes": {
445
+ "users_email_unique": {
446
+ "name": "users_email_unique",
447
+ "columns": [
448
+ "email"
449
+ ],
450
+ "isUnique": true
451
+ },
452
+ "users_email_idx": {
453
+ "name": "users_email_idx",
454
+ "columns": [
455
+ "email"
456
+ ],
457
+ "isUnique": false
458
+ }
459
+ },
460
+ "foreignKeys": {},
461
+ "compositePrimaryKeys": {},
462
+ "uniqueConstraints": {},
463
+ "checkConstraints": {}
464
+ }
465
+ },
466
+ "views": {},
467
+ "enums": {},
468
+ "_meta": {
469
+ "schemas": {},
470
+ "tables": {},
471
+ "columns": {}
472
+ },
473
+ "internal": {
474
+ "indexes": {}
475
+ }
476
+ }
@@ -8,6 +8,20 @@
8
8
  "when": 1733941526291,
9
9
  "tag": "0000_flowery_meggan",
10
10
  "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "6",
15
+ "when": 1734826111680,
16
+ "tag": "0001_equal_aaron_stack",
17
+ "breakpoints": true
18
+ },
19
+ {
20
+ "idx": 2,
21
+ "version": "6",
22
+ "when": 1734826298520,
23
+ "tag": "0002_past_sunspot",
24
+ "breakpoints": true
11
25
  }
12
26
  ]
13
27
  }
package/db/schema.ts CHANGED
@@ -17,9 +17,9 @@ export const users = sqliteTable(
17
17
  userPhotoId: text('user_photo_id'),
18
18
  userPhotoUrl: text('user_photo_url'),
19
19
  gender: text('gender'),
20
- birthDateTime: text('birth_date_time').notNull(),
21
- latitude: real('latitude').notNull(),
22
- longitude: real('longitude').notNull(),
20
+ birthDateTime: text('birth_date_time'),
21
+ latitude: real('latitude'),
22
+ longitude: real('longitude'),
23
23
  createdAt: text('created_at')
24
24
  .default(sql`CURRENT_TIMESTAMP`)
25
25
  .notNull(),
@@ -5,28 +5,34 @@ import { verifyToken } from '../utils';
5
5
  export const jwtMiddleware = async (c: AuthCtx, next: () => Promise<void>) => {
6
6
  let token: string | undefined = undefined;
7
7
 
8
- // Check for the Authorization header
9
8
  const authHeader = c.req.header('Authorization');
10
9
  if (authHeader && authHeader.startsWith('Bearer ')) {
11
- token = authHeader.substring(7); // Remove 'Bearer ' prefix
10
+ token = authHeader.substring(7);
11
+ console.log('Token extracted from Authorization header:', token);
12
12
  }
13
13
 
14
14
  if (!token) {
15
- token = getCookie(c, 'accessToken');
15
+ token = getCookie(c, 'authToken');
16
+ if (token) {
17
+ console.log('Token extracted from cookie:', token);
18
+ }
16
19
  }
17
20
 
18
21
  if (!token) {
22
+ console.warn('Unauthorized: No token provided');
19
23
  return c.json({ error: 'Unauthorized: No token provided' }, 401);
20
24
  }
21
25
 
22
26
  try {
27
+ console.log('Verifying token...');
23
28
  const payload = await verifyToken(c, token);
24
29
 
30
+ console.log('Token verified successfully. Payload:', payload);
25
31
  c.set('jwtPayload', payload);
26
32
 
27
33
  await next(); // Proceed to the next middleware or route handler
28
34
  } catch (err: any) {
29
- console.error(err.message);
35
+ console.error('Token verification failed:', err.message);
30
36
  return c.json({ error: 'Unauthorized: Invalid or expired token' }, 401);
31
37
  }
32
- };
38
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zodic/shared",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -8,13 +8,15 @@
8
8
  },
9
9
  "scripts": {
10
10
  "migrate-latest-test": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1)",
11
- "migrate-latest": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1) --remote"
11
+ "migrate-latest": "wrangler d1 execute DB --file=$(ls -t ./db/migrations/*.sql | head -n 1) --remote",
12
+ "db:generate": "drizzle-kit generate",
13
+ "db:up": "drizzle-kit up"
12
14
  },
13
15
  "devDependencies": {
14
- "@cloudflare/workers-types": "^4.20241205.0",
15
16
  "bun-types": "latest"
16
17
  },
17
18
  "peerDependencies": {
19
+ "@cloudflare/workers-types": "^4.20241205.0",
18
20
  "typescript": "^5.0.0"
19
21
  },
20
22
  "dependencies": {
@@ -23,4 +25,4 @@
23
25
  "hono": "^4.6.13",
24
26
  "jose": "^5.9.6"
25
27
  }
26
- }
28
+ }