@headless-lms/adapter-db 0.2.0 → 0.3.0
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/dist/index.d.ts +7 -6
- package/dist/index.js +7 -6
- package/dist/repositories/admin.d.ts +23 -0
- package/dist/repositories/admin.js +393 -0
- package/dist/repositories/admin.js.map +1 -0
- package/dist/repositories/assets.d.ts +6 -2
- package/dist/repositories/assets.js +50 -9
- package/dist/repositories/assets.js.map +1 -1
- package/dist/repositories/automations.d.ts +6 -2
- package/dist/repositories/automations.js +45 -2
- package/dist/repositories/automations.js.map +1 -1
- package/dist/repositories/chats.d.ts +55 -0
- package/dist/repositories/chats.js +454 -0
- package/dist/repositories/chats.js.map +1 -0
- package/dist/repositories/content.d.ts +24 -1
- package/dist/repositories/content.js +293 -9
- package/dist/repositories/content.js.map +1 -1
- package/dist/repositories/discussion.d.ts +10 -3
- package/dist/repositories/discussion.js +70 -15
- package/dist/repositories/discussion.js.map +1 -1
- package/dist/repositories/entitlements.d.ts +29 -9
- package/dist/repositories/entitlements.js +207 -17
- package/dist/repositories/entitlements.js.map +1 -1
- package/dist/repositories/grant-covers.d.ts +20 -0
- package/dist/repositories/grant-covers.js +55 -0
- package/dist/repositories/grant-covers.js.map +1 -0
- package/dist/repositories/identity.d.ts +4 -2
- package/dist/repositories/identity.js +32 -1
- package/dist/repositories/identity.js.map +1 -1
- package/dist/repositories/member.d.ts +16 -0
- package/dist/repositories/member.js +63 -0
- package/dist/repositories/member.js.map +1 -0
- package/dist/repositories/members.js +2 -2
- package/dist/repositories/members.js.map +1 -1
- package/dist/repositories/notifications.d.ts +23 -0
- package/dist/repositories/notifications.js +70 -0
- package/dist/repositories/notifications.js.map +1 -0
- package/dist/repositories/org-user-profile.d.ts +214 -1
- package/dist/repositories/org-user-profile.js +23 -2
- package/dist/repositories/org-user-profile.js.map +1 -1
- package/dist/repositories/organizations.d.ts +3 -2
- package/dist/repositories/organizations.js +20 -8
- package/dist/repositories/organizations.js.map +1 -1
- package/dist/repositories/pg-errors.js +3 -1
- package/dist/repositories/pg-errors.js.map +1 -1
- package/dist/repositories/posts.d.ts +39 -0
- package/dist/repositories/posts.js +255 -0
- package/dist/repositories/posts.js.map +1 -0
- package/dist/schema/assets.d.ts +19 -2
- package/dist/schema/assets.js +10 -4
- package/dist/schema/assets.js.map +1 -1
- package/dist/schema/automations.d.ts +38 -0
- package/dist/schema/automations.js +5 -1
- package/dist/schema/automations.js.map +1 -1
- package/dist/schema/better-auth.d.ts +1613 -238
- package/dist/schema/better-auth.js +107 -22
- package/dist/schema/better-auth.js.map +1 -1
- package/dist/schema/content.d.ts +642 -5
- package/dist/schema/content.js +119 -10
- package/dist/schema/content.js.map +1 -1
- package/dist/schema/discussion.d.ts +2045 -55
- package/dist/schema/discussion.js +426 -11
- package/dist/schema/discussion.js.map +1 -1
- package/dist/schema/entitlements.d.ts +432 -1
- package/dist/schema/entitlements.js +109 -4
- package/dist/schema/entitlements.js.map +1 -1
- package/dist/schema/identity.d.ts +517 -1
- package/dist/schema/identity.js +118 -2
- package/dist/schema/identity.js.map +1 -1
- package/dist/schema/index.d.ts +6 -6
- package/dist/schema/index.js +30 -7
- package/dist/schema/organizations.d.ts +4 -4
- package/dist/schema/organizations.js +2 -0
- package/dist/schema/organizations.js.map +1 -1
- package/drizzle/0003_community.sql +340 -0
- package/drizzle/0004_assets_sources.sql +1 -0
- package/drizzle/0005_notices_and_seed_index.sql +12 -0
- package/drizzle/0006_community_review_fixes.sql +24 -0
- package/drizzle/0007_notifications.sql +37 -0
- package/drizzle/0008_content_access.sql +13 -0
- package/drizzle/0009_community_indexes.sql +56 -0
- package/drizzle/0010_mcp_access.sql +114 -0
- package/drizzle/meta/0003_snapshot.json +7061 -0
- package/drizzle/meta/0004_snapshot.json +7068 -0
- package/drizzle/meta/0005_snapshot.json +7180 -0
- package/drizzle/meta/0006_snapshot.json +7298 -0
- package/drizzle/meta/0007_snapshot.json +7620 -0
- package/drizzle/meta/0008_snapshot.json +7666 -0
- package/drizzle/meta/0009_snapshot.json +8185 -0
- package/drizzle/meta/0010_snapshot.json +8813 -0
- package/drizzle/meta/_journal.json +57 -1
- package/package.json +2 -2
- package/dist/repositories/course-analytics.d.ts +0 -15
- package/dist/repositories/course-analytics.js +0 -137
- package/dist/repositories/course-analytics.js.map +0 -1
- package/dist/repositories/dashboard.d.ts +0 -14
- package/dist/repositories/dashboard.js +0 -57
- package/dist/repositories/dashboard.js.map +0 -1
- package/dist/repositories/learn.d.ts +0 -19
- package/dist/repositories/learn.js +0 -56
- package/dist/repositories/learn.js.map +0 -1
- package/dist/repositories/students.d.ts +0 -16
- package/dist/repositories/students.js +0 -160
- package/dist/repositories/students.js.map +0 -1
|
@@ -125,6 +125,522 @@ declare const users: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
125
125
|
};
|
|
126
126
|
dialect: "pg";
|
|
127
127
|
}>;
|
|
128
|
+
declare const userProfiles: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
129
|
+
name: "user_profiles";
|
|
130
|
+
schema: undefined;
|
|
131
|
+
columns: {
|
|
132
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
133
|
+
name: "user_id";
|
|
134
|
+
tableName: "user_profiles";
|
|
135
|
+
dataType: "string";
|
|
136
|
+
columnType: "PgText";
|
|
137
|
+
data: string;
|
|
138
|
+
driverParam: string;
|
|
139
|
+
notNull: true;
|
|
140
|
+
hasDefault: false;
|
|
141
|
+
isPrimaryKey: true;
|
|
142
|
+
isAutoincrement: false;
|
|
143
|
+
hasRuntimeDefault: false;
|
|
144
|
+
enumValues: [string, ...string[]];
|
|
145
|
+
baseColumn: never;
|
|
146
|
+
identity: undefined;
|
|
147
|
+
generated: undefined;
|
|
148
|
+
}, {}, {}>;
|
|
149
|
+
displayName: import("drizzle-orm/pg-core").PgColumn<{
|
|
150
|
+
name: "display_name";
|
|
151
|
+
tableName: "user_profiles";
|
|
152
|
+
dataType: "string";
|
|
153
|
+
columnType: "PgText";
|
|
154
|
+
data: string;
|
|
155
|
+
driverParam: string;
|
|
156
|
+
notNull: false;
|
|
157
|
+
hasDefault: false;
|
|
158
|
+
isPrimaryKey: false;
|
|
159
|
+
isAutoincrement: false;
|
|
160
|
+
hasRuntimeDefault: false;
|
|
161
|
+
enumValues: [string, ...string[]];
|
|
162
|
+
baseColumn: never;
|
|
163
|
+
identity: undefined;
|
|
164
|
+
generated: undefined;
|
|
165
|
+
}, {}, {}>;
|
|
166
|
+
headline: import("drizzle-orm/pg-core").PgColumn<{
|
|
167
|
+
name: "headline";
|
|
168
|
+
tableName: "user_profiles";
|
|
169
|
+
dataType: "string";
|
|
170
|
+
columnType: "PgText";
|
|
171
|
+
data: string;
|
|
172
|
+
driverParam: string;
|
|
173
|
+
notNull: false;
|
|
174
|
+
hasDefault: false;
|
|
175
|
+
isPrimaryKey: false;
|
|
176
|
+
isAutoincrement: false;
|
|
177
|
+
hasRuntimeDefault: false;
|
|
178
|
+
enumValues: [string, ...string[]];
|
|
179
|
+
baseColumn: never;
|
|
180
|
+
identity: undefined;
|
|
181
|
+
generated: undefined;
|
|
182
|
+
}, {}, {}>;
|
|
183
|
+
bio: import("drizzle-orm/pg-core").PgColumn<{
|
|
184
|
+
name: "bio";
|
|
185
|
+
tableName: "user_profiles";
|
|
186
|
+
dataType: "string";
|
|
187
|
+
columnType: "PgText";
|
|
188
|
+
data: string;
|
|
189
|
+
driverParam: string;
|
|
190
|
+
notNull: false;
|
|
191
|
+
hasDefault: false;
|
|
192
|
+
isPrimaryKey: false;
|
|
193
|
+
isAutoincrement: false;
|
|
194
|
+
hasRuntimeDefault: false;
|
|
195
|
+
enumValues: [string, ...string[]];
|
|
196
|
+
baseColumn: never;
|
|
197
|
+
identity: undefined;
|
|
198
|
+
generated: undefined;
|
|
199
|
+
}, {}, {}>;
|
|
200
|
+
imageAssetOrgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
201
|
+
name: "image_asset_org_id";
|
|
202
|
+
tableName: "user_profiles";
|
|
203
|
+
dataType: "string";
|
|
204
|
+
columnType: "PgText";
|
|
205
|
+
data: string;
|
|
206
|
+
driverParam: string;
|
|
207
|
+
notNull: false;
|
|
208
|
+
hasDefault: false;
|
|
209
|
+
isPrimaryKey: false;
|
|
210
|
+
isAutoincrement: false;
|
|
211
|
+
hasRuntimeDefault: false;
|
|
212
|
+
enumValues: [string, ...string[]];
|
|
213
|
+
baseColumn: never;
|
|
214
|
+
identity: undefined;
|
|
215
|
+
generated: undefined;
|
|
216
|
+
}, {}, {}>;
|
|
217
|
+
imageAssetId: import("drizzle-orm/pg-core").PgColumn<{
|
|
218
|
+
name: "image_asset_id";
|
|
219
|
+
tableName: "user_profiles";
|
|
220
|
+
dataType: "string";
|
|
221
|
+
columnType: "PgText";
|
|
222
|
+
data: string;
|
|
223
|
+
driverParam: string;
|
|
224
|
+
notNull: false;
|
|
225
|
+
hasDefault: false;
|
|
226
|
+
isPrimaryKey: false;
|
|
227
|
+
isAutoincrement: false;
|
|
228
|
+
hasRuntimeDefault: false;
|
|
229
|
+
enumValues: [string, ...string[]];
|
|
230
|
+
baseColumn: never;
|
|
231
|
+
identity: undefined;
|
|
232
|
+
generated: undefined;
|
|
233
|
+
}, {}, {}>;
|
|
234
|
+
extra: import("drizzle-orm/pg-core").PgColumn<{
|
|
235
|
+
name: "extra";
|
|
236
|
+
tableName: "user_profiles";
|
|
237
|
+
dataType: "json";
|
|
238
|
+
columnType: "PgJsonb";
|
|
239
|
+
data: import("@headless-lms/core/types").JsonValue;
|
|
240
|
+
driverParam: unknown;
|
|
241
|
+
notNull: true;
|
|
242
|
+
hasDefault: true;
|
|
243
|
+
isPrimaryKey: false;
|
|
244
|
+
isAutoincrement: false;
|
|
245
|
+
hasRuntimeDefault: false;
|
|
246
|
+
enumValues: undefined;
|
|
247
|
+
baseColumn: never;
|
|
248
|
+
identity: undefined;
|
|
249
|
+
generated: undefined;
|
|
250
|
+
}, {}, {
|
|
251
|
+
$type: import("@headless-lms/core/types").JsonValue;
|
|
252
|
+
}>;
|
|
253
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
254
|
+
name: "created_at";
|
|
255
|
+
tableName: "user_profiles";
|
|
256
|
+
dataType: "date";
|
|
257
|
+
columnType: "PgTimestamp";
|
|
258
|
+
data: Date;
|
|
259
|
+
driverParam: string;
|
|
260
|
+
notNull: true;
|
|
261
|
+
hasDefault: true;
|
|
262
|
+
isPrimaryKey: false;
|
|
263
|
+
isAutoincrement: false;
|
|
264
|
+
hasRuntimeDefault: false;
|
|
265
|
+
enumValues: undefined;
|
|
266
|
+
baseColumn: never;
|
|
267
|
+
identity: undefined;
|
|
268
|
+
generated: undefined;
|
|
269
|
+
}, {}, {}>;
|
|
270
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
271
|
+
name: "updated_at";
|
|
272
|
+
tableName: "user_profiles";
|
|
273
|
+
dataType: "date";
|
|
274
|
+
columnType: "PgTimestamp";
|
|
275
|
+
data: Date;
|
|
276
|
+
driverParam: string;
|
|
277
|
+
notNull: true;
|
|
278
|
+
hasDefault: true;
|
|
279
|
+
isPrimaryKey: false;
|
|
280
|
+
isAutoincrement: false;
|
|
281
|
+
hasRuntimeDefault: false;
|
|
282
|
+
enumValues: undefined;
|
|
283
|
+
baseColumn: never;
|
|
284
|
+
identity: undefined;
|
|
285
|
+
generated: undefined;
|
|
286
|
+
}, {}, {}>;
|
|
287
|
+
};
|
|
288
|
+
dialect: "pg";
|
|
289
|
+
}>;
|
|
290
|
+
declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
291
|
+
name: "notifications";
|
|
292
|
+
schema: undefined;
|
|
293
|
+
columns: {
|
|
294
|
+
orgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
295
|
+
name: "org_id";
|
|
296
|
+
tableName: "notifications";
|
|
297
|
+
dataType: "string";
|
|
298
|
+
columnType: "PgText";
|
|
299
|
+
data: string;
|
|
300
|
+
driverParam: string;
|
|
301
|
+
notNull: true;
|
|
302
|
+
hasDefault: false;
|
|
303
|
+
isPrimaryKey: false;
|
|
304
|
+
isAutoincrement: false;
|
|
305
|
+
hasRuntimeDefault: false;
|
|
306
|
+
enumValues: [string, ...string[]];
|
|
307
|
+
baseColumn: never;
|
|
308
|
+
identity: undefined;
|
|
309
|
+
generated: undefined;
|
|
310
|
+
}, {}, {}>;
|
|
311
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
312
|
+
name: "id";
|
|
313
|
+
tableName: "notifications";
|
|
314
|
+
dataType: "string";
|
|
315
|
+
columnType: "PgText";
|
|
316
|
+
data: string;
|
|
317
|
+
driverParam: string;
|
|
318
|
+
notNull: true;
|
|
319
|
+
hasDefault: true;
|
|
320
|
+
isPrimaryKey: false;
|
|
321
|
+
isAutoincrement: false;
|
|
322
|
+
hasRuntimeDefault: true;
|
|
323
|
+
enumValues: [string, ...string[]];
|
|
324
|
+
baseColumn: never;
|
|
325
|
+
identity: undefined;
|
|
326
|
+
generated: undefined;
|
|
327
|
+
}, {}, {}>;
|
|
328
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
329
|
+
name: "user_id";
|
|
330
|
+
tableName: "notifications";
|
|
331
|
+
dataType: "string";
|
|
332
|
+
columnType: "PgText";
|
|
333
|
+
data: string;
|
|
334
|
+
driverParam: string;
|
|
335
|
+
notNull: true;
|
|
336
|
+
hasDefault: false;
|
|
337
|
+
isPrimaryKey: false;
|
|
338
|
+
isAutoincrement: false;
|
|
339
|
+
hasRuntimeDefault: false;
|
|
340
|
+
enumValues: [string, ...string[]];
|
|
341
|
+
baseColumn: never;
|
|
342
|
+
identity: undefined;
|
|
343
|
+
generated: undefined;
|
|
344
|
+
}, {}, {}>;
|
|
345
|
+
kind: import("drizzle-orm/pg-core").PgColumn<{
|
|
346
|
+
name: "kind";
|
|
347
|
+
tableName: "notifications";
|
|
348
|
+
dataType: "string";
|
|
349
|
+
columnType: "PgText";
|
|
350
|
+
data: "newPostInSpace" | "newCommentOnPost" | "replyToYourComment" | "yourPostWasPublished" | "yourPostWasRemoved" | "yourCommentWasRemoved" | "requestApproved" | "requestDeclined" | "invitedToSpace" | "newMessage" | "messageRequest" | "addedToGroupChat" | "youAreNowAModerator" | "membershipEndingSoon" | "welcomeToCommunity" | "postAwaitingReview" | "joinRequest" | "somethingWasFlagged" | "messageWasFlagged";
|
|
351
|
+
driverParam: string;
|
|
352
|
+
notNull: true;
|
|
353
|
+
hasDefault: false;
|
|
354
|
+
isPrimaryKey: false;
|
|
355
|
+
isAutoincrement: false;
|
|
356
|
+
hasRuntimeDefault: false;
|
|
357
|
+
enumValues: ["newPostInSpace", "newCommentOnPost", "replyToYourComment", "yourPostWasPublished", "yourPostWasRemoved", "yourCommentWasRemoved", "requestApproved", "requestDeclined", "invitedToSpace", "newMessage", "messageRequest", "addedToGroupChat", "youAreNowAModerator", "membershipEndingSoon", "welcomeToCommunity", "postAwaitingReview", "joinRequest", "somethingWasFlagged", "messageWasFlagged"];
|
|
358
|
+
baseColumn: never;
|
|
359
|
+
identity: undefined;
|
|
360
|
+
generated: undefined;
|
|
361
|
+
}, {}, {}>;
|
|
362
|
+
actorOrgUserId: import("drizzle-orm/pg-core").PgColumn<{
|
|
363
|
+
name: "actor_org_user_id";
|
|
364
|
+
tableName: "notifications";
|
|
365
|
+
dataType: "string";
|
|
366
|
+
columnType: "PgText";
|
|
367
|
+
data: string;
|
|
368
|
+
driverParam: string;
|
|
369
|
+
notNull: false;
|
|
370
|
+
hasDefault: false;
|
|
371
|
+
isPrimaryKey: false;
|
|
372
|
+
isAutoincrement: false;
|
|
373
|
+
hasRuntimeDefault: false;
|
|
374
|
+
enumValues: [string, ...string[]];
|
|
375
|
+
baseColumn: never;
|
|
376
|
+
identity: undefined;
|
|
377
|
+
generated: undefined;
|
|
378
|
+
}, {}, {}>;
|
|
379
|
+
communityId: import("drizzle-orm/pg-core").PgColumn<{
|
|
380
|
+
name: "community_id";
|
|
381
|
+
tableName: "notifications";
|
|
382
|
+
dataType: "string";
|
|
383
|
+
columnType: "PgText";
|
|
384
|
+
data: string;
|
|
385
|
+
driverParam: string;
|
|
386
|
+
notNull: false;
|
|
387
|
+
hasDefault: false;
|
|
388
|
+
isPrimaryKey: false;
|
|
389
|
+
isAutoincrement: false;
|
|
390
|
+
hasRuntimeDefault: false;
|
|
391
|
+
enumValues: [string, ...string[]];
|
|
392
|
+
baseColumn: never;
|
|
393
|
+
identity: undefined;
|
|
394
|
+
generated: undefined;
|
|
395
|
+
}, {}, {}>;
|
|
396
|
+
spaceId: import("drizzle-orm/pg-core").PgColumn<{
|
|
397
|
+
name: "space_id";
|
|
398
|
+
tableName: "notifications";
|
|
399
|
+
dataType: "string";
|
|
400
|
+
columnType: "PgText";
|
|
401
|
+
data: string;
|
|
402
|
+
driverParam: string;
|
|
403
|
+
notNull: false;
|
|
404
|
+
hasDefault: false;
|
|
405
|
+
isPrimaryKey: false;
|
|
406
|
+
isAutoincrement: false;
|
|
407
|
+
hasRuntimeDefault: false;
|
|
408
|
+
enumValues: [string, ...string[]];
|
|
409
|
+
baseColumn: never;
|
|
410
|
+
identity: undefined;
|
|
411
|
+
generated: undefined;
|
|
412
|
+
}, {}, {}>;
|
|
413
|
+
postId: import("drizzle-orm/pg-core").PgColumn<{
|
|
414
|
+
name: "post_id";
|
|
415
|
+
tableName: "notifications";
|
|
416
|
+
dataType: "string";
|
|
417
|
+
columnType: "PgText";
|
|
418
|
+
data: string;
|
|
419
|
+
driverParam: string;
|
|
420
|
+
notNull: false;
|
|
421
|
+
hasDefault: false;
|
|
422
|
+
isPrimaryKey: false;
|
|
423
|
+
isAutoincrement: false;
|
|
424
|
+
hasRuntimeDefault: false;
|
|
425
|
+
enumValues: [string, ...string[]];
|
|
426
|
+
baseColumn: never;
|
|
427
|
+
identity: undefined;
|
|
428
|
+
generated: undefined;
|
|
429
|
+
}, {}, {}>;
|
|
430
|
+
commentId: import("drizzle-orm/pg-core").PgColumn<{
|
|
431
|
+
name: "comment_id";
|
|
432
|
+
tableName: "notifications";
|
|
433
|
+
dataType: "string";
|
|
434
|
+
columnType: "PgText";
|
|
435
|
+
data: string;
|
|
436
|
+
driverParam: string;
|
|
437
|
+
notNull: false;
|
|
438
|
+
hasDefault: false;
|
|
439
|
+
isPrimaryKey: false;
|
|
440
|
+
isAutoincrement: false;
|
|
441
|
+
hasRuntimeDefault: false;
|
|
442
|
+
enumValues: [string, ...string[]];
|
|
443
|
+
baseColumn: never;
|
|
444
|
+
identity: undefined;
|
|
445
|
+
generated: undefined;
|
|
446
|
+
}, {}, {}>;
|
|
447
|
+
chatId: import("drizzle-orm/pg-core").PgColumn<{
|
|
448
|
+
name: "chat_id";
|
|
449
|
+
tableName: "notifications";
|
|
450
|
+
dataType: "string";
|
|
451
|
+
columnType: "PgText";
|
|
452
|
+
data: string;
|
|
453
|
+
driverParam: string;
|
|
454
|
+
notNull: false;
|
|
455
|
+
hasDefault: false;
|
|
456
|
+
isPrimaryKey: false;
|
|
457
|
+
isAutoincrement: false;
|
|
458
|
+
hasRuntimeDefault: false;
|
|
459
|
+
enumValues: [string, ...string[]];
|
|
460
|
+
baseColumn: never;
|
|
461
|
+
identity: undefined;
|
|
462
|
+
generated: undefined;
|
|
463
|
+
}, {}, {}>;
|
|
464
|
+
messageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
465
|
+
name: "message_id";
|
|
466
|
+
tableName: "notifications";
|
|
467
|
+
dataType: "string";
|
|
468
|
+
columnType: "PgText";
|
|
469
|
+
data: string;
|
|
470
|
+
driverParam: string;
|
|
471
|
+
notNull: false;
|
|
472
|
+
hasDefault: false;
|
|
473
|
+
isPrimaryKey: false;
|
|
474
|
+
isAutoincrement: false;
|
|
475
|
+
hasRuntimeDefault: false;
|
|
476
|
+
enumValues: [string, ...string[]];
|
|
477
|
+
baseColumn: never;
|
|
478
|
+
identity: undefined;
|
|
479
|
+
generated: undefined;
|
|
480
|
+
}, {}, {}>;
|
|
481
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
482
|
+
name: "created_at";
|
|
483
|
+
tableName: "notifications";
|
|
484
|
+
dataType: "date";
|
|
485
|
+
columnType: "PgTimestamp";
|
|
486
|
+
data: Date;
|
|
487
|
+
driverParam: string;
|
|
488
|
+
notNull: true;
|
|
489
|
+
hasDefault: true;
|
|
490
|
+
isPrimaryKey: false;
|
|
491
|
+
isAutoincrement: false;
|
|
492
|
+
hasRuntimeDefault: false;
|
|
493
|
+
enumValues: undefined;
|
|
494
|
+
baseColumn: never;
|
|
495
|
+
identity: undefined;
|
|
496
|
+
generated: undefined;
|
|
497
|
+
}, {}, {}>;
|
|
498
|
+
readAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
499
|
+
name: "read_at";
|
|
500
|
+
tableName: "notifications";
|
|
501
|
+
dataType: "date";
|
|
502
|
+
columnType: "PgTimestamp";
|
|
503
|
+
data: Date;
|
|
504
|
+
driverParam: string;
|
|
505
|
+
notNull: false;
|
|
506
|
+
hasDefault: false;
|
|
507
|
+
isPrimaryKey: false;
|
|
508
|
+
isAutoincrement: false;
|
|
509
|
+
hasRuntimeDefault: false;
|
|
510
|
+
enumValues: undefined;
|
|
511
|
+
baseColumn: never;
|
|
512
|
+
identity: undefined;
|
|
513
|
+
generated: undefined;
|
|
514
|
+
}, {}, {}>;
|
|
515
|
+
};
|
|
516
|
+
dialect: "pg";
|
|
517
|
+
}>;
|
|
518
|
+
declare const notificationPreferences: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
519
|
+
name: "notification_preferences";
|
|
520
|
+
schema: undefined;
|
|
521
|
+
columns: {
|
|
522
|
+
orgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
523
|
+
name: "org_id";
|
|
524
|
+
tableName: "notification_preferences";
|
|
525
|
+
dataType: "string";
|
|
526
|
+
columnType: "PgText";
|
|
527
|
+
data: string;
|
|
528
|
+
driverParam: string;
|
|
529
|
+
notNull: true;
|
|
530
|
+
hasDefault: false;
|
|
531
|
+
isPrimaryKey: false;
|
|
532
|
+
isAutoincrement: false;
|
|
533
|
+
hasRuntimeDefault: false;
|
|
534
|
+
enumValues: [string, ...string[]];
|
|
535
|
+
baseColumn: never;
|
|
536
|
+
identity: undefined;
|
|
537
|
+
generated: undefined;
|
|
538
|
+
}, {}, {}>;
|
|
539
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
540
|
+
name: "user_id";
|
|
541
|
+
tableName: "notification_preferences";
|
|
542
|
+
dataType: "string";
|
|
543
|
+
columnType: "PgText";
|
|
544
|
+
data: string;
|
|
545
|
+
driverParam: string;
|
|
546
|
+
notNull: true;
|
|
547
|
+
hasDefault: false;
|
|
548
|
+
isPrimaryKey: false;
|
|
549
|
+
isAutoincrement: false;
|
|
550
|
+
hasRuntimeDefault: false;
|
|
551
|
+
enumValues: [string, ...string[]];
|
|
552
|
+
baseColumn: never;
|
|
553
|
+
identity: undefined;
|
|
554
|
+
generated: undefined;
|
|
555
|
+
}, {}, {}>;
|
|
556
|
+
kind: import("drizzle-orm/pg-core").PgColumn<{
|
|
557
|
+
name: "kind";
|
|
558
|
+
tableName: "notification_preferences";
|
|
559
|
+
dataType: "string";
|
|
560
|
+
columnType: "PgText";
|
|
561
|
+
data: "newPostInSpace" | "newCommentOnPost" | "replyToYourComment" | "yourPostWasPublished" | "yourPostWasRemoved" | "yourCommentWasRemoved" | "requestApproved" | "requestDeclined" | "invitedToSpace" | "newMessage" | "messageRequest" | "addedToGroupChat" | "youAreNowAModerator" | "membershipEndingSoon" | "welcomeToCommunity" | "postAwaitingReview" | "joinRequest" | "somethingWasFlagged" | "messageWasFlagged";
|
|
562
|
+
driverParam: string;
|
|
563
|
+
notNull: true;
|
|
564
|
+
hasDefault: false;
|
|
565
|
+
isPrimaryKey: false;
|
|
566
|
+
isAutoincrement: false;
|
|
567
|
+
hasRuntimeDefault: false;
|
|
568
|
+
enumValues: ["newPostInSpace", "newCommentOnPost", "replyToYourComment", "yourPostWasPublished", "yourPostWasRemoved", "yourCommentWasRemoved", "requestApproved", "requestDeclined", "invitedToSpace", "newMessage", "messageRequest", "addedToGroupChat", "youAreNowAModerator", "membershipEndingSoon", "welcomeToCommunity", "postAwaitingReview", "joinRequest", "somethingWasFlagged", "messageWasFlagged"];
|
|
569
|
+
baseColumn: never;
|
|
570
|
+
identity: undefined;
|
|
571
|
+
generated: undefined;
|
|
572
|
+
}, {}, {}>;
|
|
573
|
+
inApp: import("drizzle-orm/pg-core").PgColumn<{
|
|
574
|
+
name: "in_app";
|
|
575
|
+
tableName: "notification_preferences";
|
|
576
|
+
dataType: "boolean";
|
|
577
|
+
columnType: "PgBoolean";
|
|
578
|
+
data: boolean;
|
|
579
|
+
driverParam: boolean;
|
|
580
|
+
notNull: true;
|
|
581
|
+
hasDefault: false;
|
|
582
|
+
isPrimaryKey: false;
|
|
583
|
+
isAutoincrement: false;
|
|
584
|
+
hasRuntimeDefault: false;
|
|
585
|
+
enumValues: undefined;
|
|
586
|
+
baseColumn: never;
|
|
587
|
+
identity: undefined;
|
|
588
|
+
generated: undefined;
|
|
589
|
+
}, {}, {}>;
|
|
590
|
+
email: import("drizzle-orm/pg-core").PgColumn<{
|
|
591
|
+
name: "email";
|
|
592
|
+
tableName: "notification_preferences";
|
|
593
|
+
dataType: "boolean";
|
|
594
|
+
columnType: "PgBoolean";
|
|
595
|
+
data: boolean;
|
|
596
|
+
driverParam: boolean;
|
|
597
|
+
notNull: true;
|
|
598
|
+
hasDefault: false;
|
|
599
|
+
isPrimaryKey: false;
|
|
600
|
+
isAutoincrement: false;
|
|
601
|
+
hasRuntimeDefault: false;
|
|
602
|
+
enumValues: undefined;
|
|
603
|
+
baseColumn: never;
|
|
604
|
+
identity: undefined;
|
|
605
|
+
generated: undefined;
|
|
606
|
+
}, {}, {}>;
|
|
607
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
608
|
+
name: "created_at";
|
|
609
|
+
tableName: "notification_preferences";
|
|
610
|
+
dataType: "date";
|
|
611
|
+
columnType: "PgTimestamp";
|
|
612
|
+
data: Date;
|
|
613
|
+
driverParam: string;
|
|
614
|
+
notNull: true;
|
|
615
|
+
hasDefault: true;
|
|
616
|
+
isPrimaryKey: false;
|
|
617
|
+
isAutoincrement: false;
|
|
618
|
+
hasRuntimeDefault: false;
|
|
619
|
+
enumValues: undefined;
|
|
620
|
+
baseColumn: never;
|
|
621
|
+
identity: undefined;
|
|
622
|
+
generated: undefined;
|
|
623
|
+
}, {}, {}>;
|
|
624
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
625
|
+
name: "updated_at";
|
|
626
|
+
tableName: "notification_preferences";
|
|
627
|
+
dataType: "date";
|
|
628
|
+
columnType: "PgTimestamp";
|
|
629
|
+
data: Date;
|
|
630
|
+
driverParam: string;
|
|
631
|
+
notNull: true;
|
|
632
|
+
hasDefault: true;
|
|
633
|
+
isPrimaryKey: false;
|
|
634
|
+
isAutoincrement: false;
|
|
635
|
+
hasRuntimeDefault: false;
|
|
636
|
+
enumValues: undefined;
|
|
637
|
+
baseColumn: never;
|
|
638
|
+
identity: undefined;
|
|
639
|
+
generated: undefined;
|
|
640
|
+
}, {}, {}>;
|
|
641
|
+
};
|
|
642
|
+
dialect: "pg";
|
|
643
|
+
}>;
|
|
128
644
|
//#endregion
|
|
129
|
-
export { users };
|
|
645
|
+
export { notificationPreferences, notifications, userProfiles, users };
|
|
130
646
|
//# sourceMappingURL=identity.d.ts.map
|
package/dist/schema/identity.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { assets } from "./assets.js";
|
|
2
|
+
import { communities, spaces } from "./content.js";
|
|
3
|
+
import { chats, comments, messages, posts } from "./discussion.js";
|
|
4
|
+
import { orgUsers } from "./organizations.js";
|
|
5
|
+
import { desc, sql } from "drizzle-orm";
|
|
6
|
+
import { boolean, check, foreignKey, index, jsonb, pgTable, primaryKey, text, timestamp } from "drizzle-orm/pg-core";
|
|
2
7
|
import { genId } from "@headless-lms/core/shared/id";
|
|
3
8
|
//#region src/schema/identity.ts
|
|
4
9
|
const users = pgTable("users", {
|
|
@@ -10,7 +15,118 @@ const users = pgTable("users", {
|
|
|
10
15
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
11
16
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date())
|
|
12
17
|
});
|
|
18
|
+
const userProfiles = pgTable("user_profiles", {
|
|
19
|
+
userId: text("user_id").primaryKey().references(() => users.id, { onDelete: "cascade" }),
|
|
20
|
+
displayName: text("display_name"),
|
|
21
|
+
headline: text("headline"),
|
|
22
|
+
bio: text("bio"),
|
|
23
|
+
imageAssetOrgId: text("image_asset_org_id"),
|
|
24
|
+
imageAssetId: text("image_asset_id"),
|
|
25
|
+
extra: jsonb("extra").$type().notNull().default({}),
|
|
26
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
27
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date())
|
|
28
|
+
}, (t) => ({
|
|
29
|
+
imageFk: foreignKey({
|
|
30
|
+
columns: [t.imageAssetOrgId, t.imageAssetId],
|
|
31
|
+
foreignColumns: [assets.orgId, assets.id]
|
|
32
|
+
}),
|
|
33
|
+
imageCk: check("user_profiles_image_check", sql`(${t.imageAssetOrgId} is null) = (${t.imageAssetId} is null)`),
|
|
34
|
+
imageIdx: index("user_profiles_image_idx").on(t.imageAssetOrgId, t.imageAssetId)
|
|
35
|
+
}));
|
|
36
|
+
const NOTIFICATION_KINDS = [
|
|
37
|
+
"newPostInSpace",
|
|
38
|
+
"newCommentOnPost",
|
|
39
|
+
"replyToYourComment",
|
|
40
|
+
"yourPostWasPublished",
|
|
41
|
+
"yourPostWasRemoved",
|
|
42
|
+
"yourCommentWasRemoved",
|
|
43
|
+
"requestApproved",
|
|
44
|
+
"requestDeclined",
|
|
45
|
+
"invitedToSpace",
|
|
46
|
+
"newMessage",
|
|
47
|
+
"messageRequest",
|
|
48
|
+
"addedToGroupChat",
|
|
49
|
+
"youAreNowAModerator",
|
|
50
|
+
"membershipEndingSoon",
|
|
51
|
+
"welcomeToCommunity",
|
|
52
|
+
"postAwaitingReview",
|
|
53
|
+
"joinRequest",
|
|
54
|
+
"somethingWasFlagged",
|
|
55
|
+
"messageWasFlagged"
|
|
56
|
+
];
|
|
57
|
+
const notifications = pgTable("notifications", {
|
|
58
|
+
orgId: text("org_id").notNull(),
|
|
59
|
+
id: text("id").notNull().$defaultFn(() => genId("notification")),
|
|
60
|
+
userId: text("user_id").notNull(),
|
|
61
|
+
kind: text("kind", { enum: NOTIFICATION_KINDS }).notNull(),
|
|
62
|
+
actorOrgUserId: text("actor_org_user_id"),
|
|
63
|
+
communityId: text("community_id"),
|
|
64
|
+
spaceId: text("space_id"),
|
|
65
|
+
postId: text("post_id"),
|
|
66
|
+
commentId: text("comment_id"),
|
|
67
|
+
chatId: text("chat_id"),
|
|
68
|
+
messageId: text("message_id"),
|
|
69
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
70
|
+
readAt: timestamp("read_at", { withTimezone: true })
|
|
71
|
+
}, (t) => ({
|
|
72
|
+
pk: primaryKey({ columns: [t.orgId, t.id] }),
|
|
73
|
+
userFk: foreignKey({
|
|
74
|
+
columns: [t.orgId, t.userId],
|
|
75
|
+
foreignColumns: [orgUsers.orgId, orgUsers.userId]
|
|
76
|
+
}).onDelete("cascade"),
|
|
77
|
+
communityFk: foreignKey({
|
|
78
|
+
columns: [t.orgId, t.communityId],
|
|
79
|
+
foreignColumns: [communities.orgId, communities.id]
|
|
80
|
+
}).onDelete("cascade"),
|
|
81
|
+
spaceFk: foreignKey({
|
|
82
|
+
columns: [t.orgId, t.spaceId],
|
|
83
|
+
foreignColumns: [spaces.orgId, spaces.id]
|
|
84
|
+
}).onDelete("cascade"),
|
|
85
|
+
postFk: foreignKey({
|
|
86
|
+
columns: [t.orgId, t.postId],
|
|
87
|
+
foreignColumns: [posts.orgId, posts.id]
|
|
88
|
+
}).onDelete("cascade"),
|
|
89
|
+
commentFk: foreignKey({
|
|
90
|
+
columns: [t.orgId, t.commentId],
|
|
91
|
+
foreignColumns: [comments.orgId, comments.id]
|
|
92
|
+
}).onDelete("cascade"),
|
|
93
|
+
chatFk: foreignKey({
|
|
94
|
+
columns: [t.orgId, t.chatId],
|
|
95
|
+
foreignColumns: [chats.orgId, chats.id]
|
|
96
|
+
}).onDelete("cascade"),
|
|
97
|
+
messageFk: foreignKey({
|
|
98
|
+
columns: [t.orgId, t.messageId],
|
|
99
|
+
foreignColumns: [messages.orgId, messages.id]
|
|
100
|
+
}).onDelete("cascade"),
|
|
101
|
+
listIdx: index("notifications_list_idx").on(t.orgId, t.userId, t.readAt, desc(t.createdAt)),
|
|
102
|
+
feedIdx: index("notifications_feed_idx").on(t.orgId, t.userId, desc(t.createdAt), desc(t.id)),
|
|
103
|
+
communityIdx: index("notifications_community_idx").on(t.orgId, t.communityId),
|
|
104
|
+
spaceIdx: index("notifications_space_idx").on(t.orgId, t.spaceId),
|
|
105
|
+
postIdx: index("notifications_post_idx").on(t.orgId, t.postId),
|
|
106
|
+
commentIdx: index("notifications_comment_idx").on(t.orgId, t.commentId),
|
|
107
|
+
chatIdx: index("notifications_chat_idx").on(t.orgId, t.chatId),
|
|
108
|
+
messageIdx: index("notifications_message_idx").on(t.orgId, t.messageId)
|
|
109
|
+
}));
|
|
110
|
+
const notificationPreferences = pgTable("notification_preferences", {
|
|
111
|
+
orgId: text("org_id").notNull(),
|
|
112
|
+
userId: text("user_id").notNull(),
|
|
113
|
+
kind: text("kind", { enum: NOTIFICATION_KINDS }).notNull(),
|
|
114
|
+
inApp: boolean("in_app").notNull(),
|
|
115
|
+
email: boolean("email").notNull(),
|
|
116
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
117
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow().$onUpdate(() => /* @__PURE__ */ new Date())
|
|
118
|
+
}, (t) => ({
|
|
119
|
+
pk: primaryKey({ columns: [
|
|
120
|
+
t.orgId,
|
|
121
|
+
t.userId,
|
|
122
|
+
t.kind
|
|
123
|
+
] }),
|
|
124
|
+
userFk: foreignKey({
|
|
125
|
+
columns: [t.orgId, t.userId],
|
|
126
|
+
foreignColumns: [orgUsers.orgId, orgUsers.userId]
|
|
127
|
+
}).onDelete("cascade")
|
|
128
|
+
}));
|
|
13
129
|
//#endregion
|
|
14
|
-
export { users };
|
|
130
|
+
export { notificationPreferences, notifications, userProfiles, users };
|
|
15
131
|
|
|
16
132
|
//# sourceMappingURL=identity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.js","names":[],"sources":["../../src/schema/identity.ts"],"sourcesContent":["// identity tables — the person.\n//\n// One row per human, global, storing auth ID in `external_id`.\nimport { pgTable, text, timestamp } from \"drizzle-orm/pg-core\";\nimport type { User } from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport type { Expect, NoDrift } from \"./drift.js\";\n\nexport const users = pgTable(\"users\", {\n id: text(\"id\")\n .primaryKey()\n .$defaultFn(() => genId(\"user\")),\n // auth engine's ID - e.g. better-auth.\n externalId: text(\"external_id\").unique(),\n email: text(\"email\").notNull().unique(),\n firstName: text(\"first_name\"),\n lastName: text(\"last_name\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true })\n .notNull()\n .defaultNow()\n .$onUpdate(() => new Date()),\n});\n\ntype _UsersDrift = Expect<NoDrift<typeof users.$inferSelect, User>>;\n"],"mappings":";;;AAQA,MAAa,QAAQ,QAAQ,SAAS;CACpC,IAAI,KAAK,IAAI,CAAC,CACX,WAAW,CAAC,CACZ,iBAAiB,MAAM,MAAM,CAAC;CAEjC,YAAY,KAAK,aAAa,CAAC,CAAC,OAAO;CACvC,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;CACtC,WAAW,KAAK,YAAY;CAC5B,UAAU,KAAK,WAAW;CAC1B,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW;CAChF,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CACvD,QAAQ,CAAC,CACT,WAAW,CAAC,CACZ,gCAAgB,IAAI,KAAK,CAAC;AAC/B,CAAC"}
|
|
1
|
+
{"version":3,"file":"identity.js","names":[],"sources":["../../src/schema/identity.ts"],"sourcesContent":["// identity tables — the person.\n//\n// One row per human, global, storing auth ID in `external_id`.\nimport { desc, sql } from \"drizzle-orm\";\nimport {\n pgTable,\n text,\n jsonb,\n timestamp,\n boolean,\n foreignKey,\n check,\n index,\n primaryKey,\n} from \"drizzle-orm/pg-core\";\nimport type { Notification, User, UserProfile } from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { assets } from \"./assets.js\";\nimport { orgUsers } from \"./organizations.js\";\nimport { communities, spaces } from \"./content.js\";\nimport { chats, comments, messages, posts } from \"./discussion.js\";\nimport type { Expect, NoDrift } from \"./drift.js\";\n\nexport const users = pgTable(\"users\", {\n id: text(\"id\")\n .primaryKey()\n .$defaultFn(() => genId(\"user\")),\n // auth engine's ID - e.g. better-auth.\n externalId: text(\"external_id\").unique(),\n email: text(\"email\").notNull().unique(),\n firstName: text(\"first_name\"),\n lastName: text(\"last_name\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true })\n .notNull()\n .defaultNow()\n .$onUpdate(() => new Date()),\n});\n\nexport const userProfiles = pgTable(\n \"user_profiles\",\n {\n userId: text(\"user_id\")\n .primaryKey()\n .references(() => users.id, { onDelete: \"cascade\" }),\n displayName: text(\"display_name\"),\n headline: text(\"headline\"),\n bio: text(\"bio\"),\n imageAssetOrgId: text(\"image_asset_org_id\"),\n imageAssetId: text(\"image_asset_id\"),\n extra: jsonb(\"extra\").$type<UserProfile[\"extra\"]>().notNull().default({}),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true })\n .notNull()\n .defaultNow()\n .$onUpdate(() => new Date()),\n },\n (t) => ({\n imageFk: foreignKey({\n columns: [t.imageAssetOrgId, t.imageAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n imageCk: check(\n \"user_profiles_image_check\",\n sql`(${t.imageAssetOrgId} is null) = (${t.imageAssetId} is null)`,\n ),\n imageIdx: index(\"user_profiles_image_idx\").on(t.imageAssetOrgId, t.imageAssetId),\n }),\n);\n\nconst NOTIFICATION_KINDS = [\n \"newPostInSpace\",\n \"newCommentOnPost\",\n \"replyToYourComment\",\n \"yourPostWasPublished\",\n \"yourPostWasRemoved\",\n \"yourCommentWasRemoved\",\n \"requestApproved\",\n \"requestDeclined\",\n \"invitedToSpace\",\n \"newMessage\",\n \"messageRequest\",\n \"addedToGroupChat\",\n \"youAreNowAModerator\",\n \"membershipEndingSoon\",\n \"welcomeToCommunity\",\n \"postAwaitingReview\",\n \"joinRequest\",\n \"somethingWasFlagged\",\n \"messageWasFlagged\",\n] as const;\n\nexport const notifications = pgTable(\n \"notifications\",\n {\n orgId: text(\"org_id\").notNull(),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"notification\")),\n userId: text(\"user_id\").notNull(),\n kind: text(\"kind\", { enum: NOTIFICATION_KINDS }).notNull(),\n actorOrgUserId: text(\"actor_org_user_id\"),\n communityId: text(\"community_id\"),\n spaceId: text(\"space_id\"),\n postId: text(\"post_id\"),\n commentId: text(\"comment_id\"),\n chatId: text(\"chat_id\"),\n messageId: text(\"message_id\"),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n readAt: timestamp(\"read_at\", { withTimezone: true }),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n userFk: foreignKey({\n columns: [t.orgId, t.userId],\n foreignColumns: [orgUsers.orgId, orgUsers.userId],\n }).onDelete(\"cascade\"),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId],\n foreignColumns: [spaces.orgId, spaces.id],\n }).onDelete(\"cascade\"),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n commentFk: foreignKey({\n columns: [t.orgId, t.commentId],\n foreignColumns: [comments.orgId, comments.id],\n }).onDelete(\"cascade\"),\n chatFk: foreignKey({\n columns: [t.orgId, t.chatId],\n foreignColumns: [chats.orgId, chats.id],\n }).onDelete(\"cascade\"),\n messageFk: foreignKey({\n columns: [t.orgId, t.messageId],\n foreignColumns: [messages.orgId, messages.id],\n }).onDelete(\"cascade\"),\n listIdx: index(\"notifications_list_idx\").on(t.orgId, t.userId, t.readAt, desc(t.createdAt)),\n feedIdx: index(\"notifications_feed_idx\").on(t.orgId, t.userId, desc(t.createdAt), desc(t.id)),\n communityIdx: index(\"notifications_community_idx\").on(t.orgId, t.communityId),\n spaceIdx: index(\"notifications_space_idx\").on(t.orgId, t.spaceId),\n postIdx: index(\"notifications_post_idx\").on(t.orgId, t.postId),\n commentIdx: index(\"notifications_comment_idx\").on(t.orgId, t.commentId),\n chatIdx: index(\"notifications_chat_idx\").on(t.orgId, t.chatId),\n messageIdx: index(\"notifications_message_idx\").on(t.orgId, t.messageId),\n }),\n);\n\nexport const notificationPreferences = pgTable(\n \"notification_preferences\",\n {\n orgId: text(\"org_id\").notNull(),\n userId: text(\"user_id\").notNull(),\n kind: text(\"kind\", { enum: NOTIFICATION_KINDS }).notNull(),\n inApp: boolean(\"in_app\").notNull(),\n email: boolean(\"email\").notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n updatedAt: timestamp(\"updated_at\", { withTimezone: true })\n .notNull()\n .defaultNow()\n .$onUpdate(() => new Date()),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.userId, t.kind] }),\n userFk: foreignKey({\n columns: [t.orgId, t.userId],\n foreignColumns: [orgUsers.orgId, orgUsers.userId],\n }).onDelete(\"cascade\"),\n }),\n);\n\ntype _UsersDrift = Expect<NoDrift<typeof users.$inferSelect, User>>;\ntype _UserProfilesDrift = Expect<NoDrift<typeof userProfiles.$inferSelect, UserProfile>>;\ntype _NotificationsDrift = Expect<NoDrift<typeof notifications.$inferSelect, Notification>>;\n"],"mappings":";;;;;;;;AAuBA,MAAa,QAAQ,QAAQ,SAAS;CACpC,IAAI,KAAK,IAAI,CAAC,CACX,WAAW,CAAC,CACZ,iBAAiB,MAAM,MAAM,CAAC;CAEjC,YAAY,KAAK,aAAa,CAAC,CAAC,OAAO;CACvC,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO;CACtC,WAAW,KAAK,YAAY;CAC5B,UAAU,KAAK,WAAW;CAC1B,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW;CAChF,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CACvD,QAAQ,CAAC,CACT,WAAW,CAAC,CACZ,gCAAgB,IAAI,KAAK,CAAC;AAC/B,CAAC;AAED,MAAa,eAAe,QAC1B,iBACA;CACE,QAAQ,KAAK,SAAS,CAAC,CACpB,WAAW,CAAC,CACZ,iBAAiB,MAAM,IAAI,EAAE,UAAU,UAAU,CAAC;CACrD,aAAa,KAAK,cAAc;CAChC,UAAU,KAAK,UAAU;CACzB,KAAK,KAAK,KAAK;CACf,iBAAiB,KAAK,oBAAoB;CAC1C,cAAc,KAAK,gBAAgB;CACnC,OAAO,MAAM,OAAO,CAAC,CAAC,MAA4B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