@headless-lms/adapter-db 0.3.0 → 0.4.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 +6 -1
- package/dist/index.js +6 -1
- package/dist/repositories/admin.js +1 -1
- package/dist/repositories/assets.d.ts +1 -2
- package/dist/repositories/assets.js +0 -4
- package/dist/repositories/assets.js.map +1 -1
- package/dist/repositories/automations.d.ts +0 -1
- package/dist/repositories/automations.js +1 -17
- package/dist/repositories/automations.js.map +1 -1
- package/dist/repositories/chats.d.ts +4 -4
- package/dist/repositories/chats.js +33 -18
- package/dist/repositories/chats.js.map +1 -1
- package/dist/repositories/content.d.ts +3 -3
- package/dist/repositories/content.js +35 -12
- package/dist/repositories/content.js.map +1 -1
- package/dist/repositories/devices.d.ts +17 -0
- package/dist/repositories/devices.js +75 -0
- package/dist/repositories/devices.js.map +1 -0
- package/dist/repositories/digest-runs.d.ts +14 -0
- package/dist/repositories/digest-runs.js +39 -0
- package/dist/repositories/digest-runs.js.map +1 -0
- package/dist/repositories/discussion.d.ts +6 -1
- package/dist/repositories/discussion.js +9 -4
- package/dist/repositories/discussion.js.map +1 -1
- package/dist/repositories/entitlements.d.ts +3 -1
- package/dist/repositories/entitlements.js +12 -6
- package/dist/repositories/entitlements.js.map +1 -1
- package/dist/repositories/inserted-row.d.ts +5 -0
- package/dist/repositories/inserted-row.js +7 -0
- package/dist/repositories/inserted-row.js.map +1 -0
- package/dist/repositories/mentions.d.ts +17 -0
- package/dist/repositories/mentions.js +55 -0
- package/dist/repositories/mentions.js.map +1 -0
- package/dist/repositories/notification-settings.d.ts +19 -0
- package/dist/repositories/notification-settings.js +67 -0
- package/dist/repositories/notification-settings.js.map +1 -0
- package/dist/repositories/notifications.d.ts +23 -16
- package/dist/repositories/notifications.js +152 -44
- package/dist/repositories/notifications.js.map +1 -1
- package/dist/repositories/organizations.d.ts +1 -0
- package/dist/repositories/organizations.js +4 -1
- package/dist/repositories/organizations.js.map +1 -1
- package/dist/repositories/posts.d.ts +4 -8
- package/dist/repositories/posts.js +25 -28
- package/dist/repositories/posts.js.map +1 -1
- package/dist/repositories/subscriptions.d.ts +18 -0
- package/dist/repositories/subscriptions.js +72 -0
- package/dist/repositories/subscriptions.js.map +1 -0
- package/dist/schema/automations.d.ts +524 -19
- package/dist/schema/automations.js +73 -7
- package/dist/schema/automations.js.map +1 -1
- package/dist/schema/discussion.d.ts +277 -127
- package/dist/schema/discussion.js +59 -24
- package/dist/schema/discussion.js.map +1 -1
- package/dist/schema/identity.d.ts +109 -109
- package/dist/schema/identity.js +28 -70
- package/dist/schema/identity.js.map +1 -1
- package/dist/schema/index.d.ts +5 -5
- package/dist/schema/index.js +10 -6
- package/drizzle/0011_digest_runs.sql +8 -0
- package/drizzle/0012_subscriptions.sql +16 -0
- package/drizzle/0013_mentions.sql +10 -0
- package/drizzle/0014_notification_settings_devices.sql +36 -0
- package/drizzle/0015_automations_drop_source.sql +2 -0
- package/drizzle/0016_notifications_automations.sql +48 -0
- package/drizzle/meta/0011_snapshot.json +8868 -0
- package/drizzle/meta/0012_snapshot.json +8873 -0
- package/drizzle/meta/0013_snapshot.json +8943 -0
- package/drizzle/meta/0014_snapshot.json +9305 -0
- package/drizzle/meta/0015_snapshot.json +9270 -0
- package/drizzle/meta/0016_snapshot.json +9230 -0
- package/drizzle/meta/_journal.json +42 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discussion.js","names":[],"sources":["../../src/schema/discussion.ts"],"sourcesContent":["// discussion tables — comments on an activity, their reactions and reports.\n// Configuration is not here: the course's comment settings ride on the course's\n// `content` settings row, and an activity's override rides on the activity's\n// own settings blob.\n//\n// The author is always an org user, so one column covers both\n// learners and staff. Staff-ness is NOT stored — it is read from the author's\n// current role. A removed comment keeps its row so replies below it survive;\n// only the body stops being served.\n//\n// No course_id: which course an activity sits in is content's fact and changes\n// when a course is restructured. The staff comment list joins to modules to\n// scope by course.\nimport { desc, sql } from \"drizzle-orm\";\nimport {\n pgTable,\n text,\n integer,\n boolean,\n jsonb,\n timestamp,\n primaryKey,\n foreignKey,\n unique,\n index,\n check,\n} from \"drizzle-orm/pg-core\";\nimport type {\n BlockedUser,\n Chat,\n ChatUser,\n Comment,\n CommentReaction,\n CommentReport,\n Message,\n MessageAttachment,\n MessageFlag,\n MessageReaction,\n Post,\n PostBookmark,\n PostFlag,\n PostFollow,\n PostReaction,\n} from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { organizations, orgUsers } from \"./organizations.js\";\nimport { activities, communities, spaceTopics, spaces } from \"./content.js\";\nimport { assets } from \"./assets.js\";\nimport type { Expect, NoDrift } from \"./drift.js\";\n\nexport const posts = pgTable(\n \"posts\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"post\")),\n communityId: text(\"community_id\").notNull(),\n spaceId: text(\"space_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n topicId: text(\"topic_id\"),\n title: text(\"title\").notNull(),\n body: text(\"body\").notNull(),\n extra: jsonb(\"extra\").$type<Post[\"extra\"]>().notNull().default({}),\n coverAssetId: text(\"cover_asset_id\"),\n status: text(\"status\", {\n enum: [\"draft\", \"scheduled\", \"pending\", \"published\", \"removed\"],\n })\n .notNull()\n .default(\"draft\"),\n scheduledAt: timestamp(\"scheduled_at\", { withTimezone: true }),\n publishedAt: timestamp(\"published_at\", { withTimezone: true }),\n removedBy: text(\"removed_by\"),\n pinned: boolean(\"pinned\").notNull().default(false),\n commentsClosed: boolean(\"comments_closed\"),\n reactionsEnabled: boolean(\"reactions_enabled\"),\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.id] }),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId, t.communityId],\n foreignColumns: [spaces.orgId, spaces.id, spaces.communityId],\n }).onDelete(\"cascade\"),\n authorFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }),\n topicFk: foreignKey({\n columns: [t.orgId, t.spaceId, t.topicId],\n foreignColumns: [spaceTopics.orgId, spaceTopics.spaceId, spaceTopics.id],\n }),\n coverAssetFk: foreignKey({\n columns: [t.orgId, t.coverAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n // SET NULL is narrowed to the nullable column in 0009_community_indexes.sql; drizzle cannot express it.\n removedByFk: foreignKey({\n columns: [t.orgId, t.removedBy],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"set null\"),\n removedCk: check(\n \"posts_removed_by_check\",\n sql`${t.removedBy} is null or ${t.status} = 'removed'`,\n ),\n scheduledCk: check(\n \"posts_scheduled_check\",\n sql`${t.status} <> 'scheduled' or ${t.scheduledAt} is not null`,\n ),\n feedIdx: index(\"posts_feed_idx\").on(\n t.orgId,\n t.spaceId,\n t.status,\n desc(t.pinned),\n desc(t.publishedAt),\n ),\n dueIdx: index(\"posts_due_idx\").on(t.orgId, t.status, t.scheduledAt),\n authorIdx: index(\"posts_author_idx\").on(t.orgId, t.orgUserId, t.createdAt),\n coverAssetIdx: index(\"posts_cover_asset_idx\").on(t.orgId, t.coverAssetId),\n }),\n);\n\nexport const postReactions = pgTable(\n \"post_reactions\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n postId: text(\"post_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n emoji: text(\"emoji\").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.postId, t.orgUserId] }),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const postFollows = pgTable(\n \"post_follows\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n postId: text(\"post_id\").notNull(),\n orgUserId: text(\"org_user_id\").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.postId, t.orgUserId] }),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const postBookmarks = pgTable(\n \"post_bookmarks\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n postId: text(\"post_id\").notNull(),\n orgUserId: text(\"org_user_id\").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.postId, t.orgUserId] }),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n userIdx: index(\"post_bookmarks_user_idx\").on(t.orgId, t.orgUserId, t.createdAt),\n }),\n);\n\nexport const postFlags = pgTable(\n \"post_flags\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"postFlag\")),\n postId: text(\"post_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n reason: text(\"reason\").notNull().default(\"\"),\n resolvedAt: timestamp(\"resolved_at\", { withTimezone: true }),\n resolution: text(\"resolution\", { enum: [\"dismissed\", \"removed\"] }),\n resolvedBy: text(\"resolved_by\"),\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.id] }),\n reporterUq: unique().on(t.orgId, t.postId, t.orgUserId),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n reporterFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n resolvedCk: check(\n \"post_flags_resolved_check\",\n sql`(${t.resolvedAt} is null) = (${t.resolution} is null) and (${t.resolvedAt} is null) = (${t.resolvedBy} is null)`,\n ),\n openIdx: index(\"post_flags_open_idx\").on(t.orgId, t.postId, t.resolvedAt),\n }),\n);\n\nexport const comments = pgTable(\n \"comments\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"comment\")),\n activityId: text(\"activity_id\"),\n postId: text(\"post_id\"),\n communityId: text(\"community_id\"),\n parentId: text(\"parent_id\"),\n orgUserId: text(\"org_user_id\").notNull(),\n body: text(\"body\").notNull(),\n status: text(\"status\", { enum: [\"pending\", \"published\", \"removed\"] })\n .notNull()\n .default(\"published\"),\n removedBy: text(\"removed_by\"),\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.id] }),\n activityFk: foreignKey({\n columns: [t.orgId, t.activityId],\n foreignColumns: [activities.orgId, activities.id],\n }).onDelete(\"cascade\"),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n authorFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }),\n // SET NULL is narrowed to the nullable column in 0009_community_indexes.sql; drizzle cannot express it.\n removedByFk: foreignKey({\n columns: [t.orgId, t.removedBy],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"set null\"),\n parentFk: foreignKey({\n columns: [t.orgId, t.parentId],\n foreignColumns: [t.orgId, t.id],\n }),\n removedCk: check(\n \"comments_removed_by_check\",\n sql`${t.removedBy} is null or ${t.status} = 'removed'`,\n ),\n targetCk: check(\"comments_target_check\", sql`num_nonnulls(${t.activityId}, ${t.postId}) = 1`),\n communityCk: check(\n \"comments_community_check\",\n sql`${t.postId} is null or ${t.communityId} is not null`,\n ),\n activityIdx: index(\"comments_activity_idx\").on(t.orgId, t.activityId, t.status, t.createdAt),\n postIdx: index(\"comments_post_idx\").on(t.orgId, t.postId, t.status, t.createdAt),\n queueIdx: index(\"comments_queue_idx\").on(t.orgId, t.status, t.createdAt),\n communityIdx: index(\"comments_community_idx\").on(t.orgId, t.communityId),\n parentIdx: index(\"comments_parent_idx\").on(t.orgId, t.parentId, t.createdAt),\n }),\n);\n\nexport const commentReactions = pgTable(\n \"comment_reactions\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n commentId: text(\"comment_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n emoji: text(\"emoji\").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.commentId, t.orgUserId] }),\n commentFk: foreignKey({\n columns: [t.orgId, t.commentId],\n foreignColumns: [comments.orgId, comments.id],\n }).onDelete(\"cascade\"),\n authorFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const commentFlags = pgTable(\n \"comment_flags\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"commentReport\")),\n commentId: text(\"comment_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n reason: text(\"reason\").notNull().default(\"\"),\n resolvedAt: timestamp(\"resolved_at\", { withTimezone: true }),\n resolution: text(\"resolution\", { enum: [\"dismissed\", \"removed\"] }),\n resolvedBy: text(\"resolved_by\"),\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.id] }),\n reporterUq: unique().on(t.orgId, t.commentId, t.orgUserId),\n commentFk: foreignKey({\n columns: [t.orgId, t.commentId],\n foreignColumns: [comments.orgId, comments.id],\n }).onDelete(\"cascade\"),\n reporterFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n resolvedCk: check(\n \"comment_flags_resolved_check\",\n sql`(${t.resolvedAt} is null) = (${t.resolution} is null) and (${t.resolvedBy} is null or ${t.resolvedAt} is not null)`,\n ),\n openIdx: index(\"comment_flags_open_idx\").on(t.orgId, t.commentId, t.resolvedAt),\n }),\n);\n\nexport const chats = pgTable(\n \"chats\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"chat\")),\n communityId: text(\"community_id\").notNull(),\n kind: text(\"kind\", { enum: [\"direct\", \"group\"] }).notNull(),\n status: text(\"status\", { enum: [\"pending\", \"open\", \"closed\"] })\n .notNull()\n .default(\"open\"),\n createdBy: text(\"created_by\"),\n lockedAt: timestamp(\"locked_at\", { withTimezone: true }),\n lockedBy: text(\"locked_by\"),\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.id] }),\n communityUq: unique().on(t.orgId, t.id, t.communityId),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n // SET NULL is narrowed to the nullable column in 0009_community_indexes.sql; drizzle cannot express it.\n createdByFk: foreignKey({\n columns: [t.orgId, t.createdBy],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"set null\"),\n lockedByFk: foreignKey({\n columns: [t.orgId, t.lockedBy],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"set null\"),\n lockedCk: check(\"chats_locked_check\", sql`${t.lockedBy} is null or ${t.lockedAt} is not null`),\n }),\n);\n\nexport const chatUsers = pgTable(\n \"chat_users\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n communityId: text(\"community_id\").notNull(),\n chatId: text(\"chat_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n joinedAt: timestamp(\"joined_at\", { withTimezone: true }).notNull().defaultNow(),\n leftAt: timestamp(\"left_at\", { withTimezone: true }),\n lastReadMessageId: text(\"last_read_message_id\"),\n muted: boolean(\"muted\").notNull().default(false),\n mutedUntil: timestamp(\"muted_until\", { withTimezone: true }),\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.chatId, t.orgUserId] }),\n chatFk: foreignKey({\n columns: [t.orgId, t.chatId, t.communityId],\n foreignColumns: [chats.orgId, chats.id, chats.communityId],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n userIdx: index(\"chat_users_user_idx\").on(t.orgId, t.communityId, t.orgUserId),\n }),\n);\n\nexport const messages = pgTable(\n \"messages\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"message\")),\n communityId: text(\"community_id\").notNull(),\n chatId: text(\"chat_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n body: text(\"body\").notNull(),\n replyToId: text(\"reply_to_id\"),\n editedAt: timestamp(\"edited_at\", { withTimezone: true }),\n deletedAt: timestamp(\"deleted_at\", { withTimezone: true }),\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.id] }),\n communityUq: unique().on(t.orgId, t.id, t.communityId),\n chatFk: foreignKey({\n columns: [t.orgId, t.chatId, t.communityId],\n foreignColumns: [chats.orgId, chats.id, chats.communityId],\n }).onDelete(\"cascade\"),\n authorFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }),\n replyFk: foreignKey({\n columns: [t.orgId, t.replyToId],\n foreignColumns: [t.orgId, t.id],\n }),\n chatIdx: index(\"messages_chat_idx\").on(t.orgId, t.chatId, t.createdAt),\n replyIdx: index(\"messages_reply_idx\").on(t.orgId, t.replyToId),\n }),\n);\n\nexport const messageAttachments = pgTable(\n \"message_attachments\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n communityId: text(\"community_id\").notNull(),\n messageId: text(\"message_id\").notNull(),\n assetId: text(\"asset_id\").notNull(),\n seq: integer(\"seq\").notNull().default(0),\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.messageId, t.assetId] }),\n messageFk: foreignKey({\n columns: [t.orgId, t.messageId, t.communityId],\n foreignColumns: [messages.orgId, messages.id, messages.communityId],\n }).onDelete(\"cascade\"),\n assetFk: foreignKey({\n columns: [t.orgId, t.assetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n assetIdx: index(\"message_attachments_asset_idx\").on(t.orgId, t.assetId),\n }),\n);\n\nexport const messageReactions = pgTable(\n \"message_reactions\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n communityId: text(\"community_id\").notNull(),\n messageId: text(\"message_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n emoji: text(\"emoji\").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.messageId, t.orgUserId] }),\n messageFk: foreignKey({\n columns: [t.orgId, t.messageId, t.communityId],\n foreignColumns: [messages.orgId, messages.id, messages.communityId],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const messageFlags = pgTable(\n \"message_flags\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"messageFlag\")),\n communityId: text(\"community_id\").notNull(),\n messageId: text(\"message_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n reason: text(\"reason\").notNull().default(\"\"),\n resolvedAt: timestamp(\"resolved_at\", { withTimezone: true }),\n resolution: text(\"resolution\", { enum: [\"dismissed\", \"deleted\", \"locked\"] }),\n resolvedBy: text(\"resolved_by\"),\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.id] }),\n reporterUq: unique().on(t.orgId, t.messageId, t.orgUserId),\n messageFk: foreignKey({\n columns: [t.orgId, t.messageId, t.communityId],\n foreignColumns: [messages.orgId, messages.id, messages.communityId],\n }).onDelete(\"cascade\"),\n reporterFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n resolvedCk: check(\n \"message_flags_resolved_check\",\n sql`(${t.resolvedAt} is null) = (${t.resolution} is null) and (${t.resolvedAt} is null) = (${t.resolvedBy} is null)`,\n ),\n openIdx: index(\"message_flags_open_idx\").on(t.orgId, t.communityId, t.messageId, t.resolvedAt),\n }),\n);\n\nexport const blockedUsers = pgTable(\n \"blocked_users\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n communityId: text(\"community_id\").notNull(),\n blockerOrgUserId: text(\"blocker_org_user_id\").notNull(),\n blockedOrgUserId: text(\"blocked_org_user_id\").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({\n columns: [t.orgId, t.communityId, t.blockerOrgUserId, t.blockedOrgUserId],\n }),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n blockerFk: foreignKey({\n columns: [t.orgId, t.blockerOrgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n blockedFk: foreignKey({\n columns: [t.orgId, t.blockedOrgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n blockedIdx: index(\"blocked_users_blocked_idx\").on(t.orgId, t.communityId, t.blockedOrgUserId),\n }),\n);\n\ntype _PostsDrift = Expect<NoDrift<typeof posts.$inferSelect, Post>>;\ntype _PostReactionsDrift = Expect<NoDrift<typeof postReactions.$inferSelect, PostReaction>>;\ntype _PostFollowsDrift = Expect<NoDrift<typeof postFollows.$inferSelect, PostFollow>>;\ntype _PostBookmarksDrift = Expect<NoDrift<typeof postBookmarks.$inferSelect, PostBookmark>>;\ntype _PostFlagsDrift = Expect<NoDrift<typeof postFlags.$inferSelect, PostFlag>>;\ntype _CommentsDrift = Expect<NoDrift<typeof comments.$inferSelect, Comment>>;\ntype _CommentReactionsDrift = Expect<\n NoDrift<typeof commentReactions.$inferSelect, CommentReaction>\n>;\ntype _CommentFlagsDrift = Expect<NoDrift<typeof commentFlags.$inferSelect, CommentReport>>;\ntype _ChatsDrift = Expect<NoDrift<typeof chats.$inferSelect, Chat>>;\ntype _ChatUsersDrift = Expect<NoDrift<typeof chatUsers.$inferSelect, ChatUser>>;\ntype _MessagesDrift = Expect<NoDrift<typeof messages.$inferSelect, Message>>;\ntype _MessageAttachmentsDrift = Expect<\n NoDrift<typeof messageAttachments.$inferSelect, MessageAttachment>\n>;\ntype _MessageReactionsDrift = Expect<\n NoDrift<typeof messageReactions.$inferSelect, MessageReaction>\n>;\ntype _MessageFlagsDrift = Expect<NoDrift<typeof messageFlags.$inferSelect, MessageFlag>>;\ntype _BlockedUsersDrift = Expect<NoDrift<typeof blockedUsers.$inferSelect, BlockedUser>>;\n"],"mappings":";;;;;;;AAkDA,MAAa,QAAQ,QACnB,SACA;CACE,OAAO,KAAK,QAAQ,CAAC,CAClB,QAAQ,CAAC,CACT,iBAAiB,cAAc,EAAE;CACpC,IAAI,KAAK,IAAI,CAAC,CACX,QAAQ,CAAC,CACT,iBAAiB,MAAM,MAAM,CAAC;CACjC,aAAa,KAAK,cAAc,CAAC,CAAC,QAAQ;CAC1C,SAAS,KAAK,UAAU,CAAC,CAAC,QAAQ;CAClC,WAAW,KAAK,aAAa,CAAC,CAAC,QAAQ;CACvC,SAAS,KAAK,UAAU;CACxB,OAAO,KAAK,OAAO,CAAC,CAAC,QAAQ;CAC7B,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,OAAO,MAAM,OAAO,CAAC,CAAC,MAAqB,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;CACjE,cAAc,KAAK,gBAAgB;CACnC,QAAQ,KAAK,UAAU,EACrB,MAAM;EAAC;EAAS;EAAa;EAAW;EAAa;CAAS,EAChE,CAAC,CAAC,CACC,QAAQ,CAAC,CACT,QAAQ,OAAO;CAClB,aAAa,UAAU,gBAAgB,EAAE,cAAc,KAAK,CAAC;CAC7D,aAAa,UAAU,gBAAgB,EAAE,cAAc,KAAK,CAAC;CAC7D,WAAW,KAAK,YAAY;CAC5B,QAAQ,QAAQ,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,QAAQ,KAAK;CACjD,gBAAgB,QAAQ,iBAAiB;CACzC,kBAAkB,Q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/F,EACF;AAEA,MAAa,eAAe,QAC1B,iBACA;CACE,OAAO,KAAK,QAAQ,CAAC,CAClB,QAAQ,CAAC,CACT,iBAAiB,cAAc,EAAE;CACpC,aAAa,KAAK,cAAc,CAAC,CAAC,QAAQ;CAC1C,kBAAkB,KAAK,qBAAqB,CAAC,CAAC,QAAQ;CACtD,kBAAkB,KAAK,qBAAqB,CAAC,CAAC,QAAQ;CACtD,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,IACC,OAAO;CACN,IAAI,WAAW,EACb,SAAS;EAAC,EAAE;EAAO,EAAE;EAAa,EAAE;EAAkB,EAAE;CAAgB,EAC1E,CAAC;CACD,aAAa,WAAW;EACtB,SAAS,CAAC,EAAE,OAAO,EAAE,WAAW;EAChC,gBAAgB,CAAC,YAAY,OAAO,YAAY,EAAE;CACpD,CAAC,CAAC,CAAC,SAAS,SAAS;CACrB,WAAW,WAAW;EACpB,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB;EACrC,gBAAgB,CAAC,SAAS,OAAO,SAAS,EAAE;CAC9C,CAAC,CAAC,CAAC,SAAS,SAAS;CACrB,WAAW,WAAW;EACpB,SAAS,CAAC,EAAE,OAAO,EAAE,gBAAgB;EACrC,gBAAgB,CAAC,SAAS,OAAO,SAAS,EAAE;CAC9C,CAAC,CAAC,CAAC,SAAS,SAAS;CACrB,YAAY,MAAM,2BAA2B,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,gBAAgB;AAC9F,EACF"}
|
|
1
|
+
{"version":3,"file":"discussion.js","names":[],"sources":["../../src/schema/discussion.ts"],"sourcesContent":["// discussion tables — comments on an activity, their reactions and reports.\n// Configuration is not here: the course's comment settings ride on the course's\n// `content` settings row, and an activity's override rides on the activity's\n// own settings blob.\n//\n// The author is always an org user, so one column covers both\n// learners and staff. Staff-ness is NOT stored — it is read from the author's\n// current role. A removed comment keeps its row so replies below it survive;\n// only the body stops being served.\n//\n// No course_id: which course an activity sits in is content's fact and changes\n// when a course is restructured. The staff comment list joins to modules to\n// scope by course.\nimport { desc, sql } from \"drizzle-orm\";\nimport {\n pgTable,\n text,\n integer,\n boolean,\n jsonb,\n timestamp,\n primaryKey,\n foreignKey,\n unique,\n index,\n check,\n} from \"drizzle-orm/pg-core\";\nimport type {\n BlockedUser,\n Chat,\n ChatUser,\n Comment,\n CommentReaction,\n CommentReport,\n DigestRun,\n Mention,\n Message,\n MessageAttachment,\n MessageFlag,\n MessageReaction,\n Post,\n PostBookmark,\n PostFlag,\n PostReaction,\n Subscription,\n} from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { organizations, orgUsers } from \"./organizations.js\";\nimport { activities, communities, spaceTopics, spaces } from \"./content.js\";\nimport { assets } from \"./assets.js\";\nimport type { Expect, NoDrift } from \"./drift.js\";\n\nexport const posts = pgTable(\n \"posts\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"post\")),\n communityId: text(\"community_id\").notNull(),\n spaceId: text(\"space_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n topicId: text(\"topic_id\"),\n title: text(\"title\").notNull(),\n body: text(\"body\").notNull(),\n extra: jsonb(\"extra\").$type<Post[\"extra\"]>().notNull().default({}),\n coverAssetId: text(\"cover_asset_id\"),\n status: text(\"status\", {\n enum: [\"draft\", \"scheduled\", \"pending\", \"published\", \"removed\"],\n })\n .notNull()\n .default(\"draft\"),\n scheduledAt: timestamp(\"scheduled_at\", { withTimezone: true }),\n publishedAt: timestamp(\"published_at\", { withTimezone: true }),\n removedBy: text(\"removed_by\"),\n pinned: boolean(\"pinned\").notNull().default(false),\n commentsClosed: boolean(\"comments_closed\"),\n reactionsEnabled: boolean(\"reactions_enabled\"),\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.id] }),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId, t.communityId],\n foreignColumns: [spaces.orgId, spaces.id, spaces.communityId],\n }).onDelete(\"cascade\"),\n authorFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }),\n topicFk: foreignKey({\n columns: [t.orgId, t.spaceId, t.topicId],\n foreignColumns: [spaceTopics.orgId, spaceTopics.spaceId, spaceTopics.id],\n }),\n coverAssetFk: foreignKey({\n columns: [t.orgId, t.coverAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n // SET NULL is narrowed to the nullable column in 0009_community_indexes.sql; drizzle cannot express it.\n removedByFk: foreignKey({\n columns: [t.orgId, t.removedBy],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"set null\"),\n removedCk: check(\n \"posts_removed_by_check\",\n sql`${t.removedBy} is null or ${t.status} = 'removed'`,\n ),\n scheduledCk: check(\n \"posts_scheduled_check\",\n sql`${t.status} <> 'scheduled' or ${t.scheduledAt} is not null`,\n ),\n feedIdx: index(\"posts_feed_idx\").on(\n t.orgId,\n t.spaceId,\n t.status,\n desc(t.pinned),\n desc(t.publishedAt),\n ),\n dueIdx: index(\"posts_due_idx\").on(t.orgId, t.status, t.scheduledAt),\n authorIdx: index(\"posts_author_idx\").on(t.orgId, t.orgUserId, t.createdAt),\n coverAssetIdx: index(\"posts_cover_asset_idx\").on(t.orgId, t.coverAssetId),\n }),\n);\n\nexport const postReactions = pgTable(\n \"post_reactions\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n postId: text(\"post_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n emoji: text(\"emoji\").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.postId, t.orgUserId] }),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const postBookmarks = pgTable(\n \"post_bookmarks\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n postId: text(\"post_id\").notNull(),\n orgUserId: text(\"org_user_id\").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.postId, t.orgUserId] }),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n userIdx: index(\"post_bookmarks_user_idx\").on(t.orgId, t.orgUserId, t.createdAt),\n }),\n);\n\nexport const postFlags = pgTable(\n \"post_flags\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"postFlag\")),\n postId: text(\"post_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n reason: text(\"reason\").notNull().default(\"\"),\n resolvedAt: timestamp(\"resolved_at\", { withTimezone: true }),\n resolution: text(\"resolution\", { enum: [\"dismissed\", \"removed\"] }),\n resolvedBy: text(\"resolved_by\"),\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.id] }),\n reporterUq: unique().on(t.orgId, t.postId, t.orgUserId),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n reporterFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n resolvedCk: check(\n \"post_flags_resolved_check\",\n sql`(${t.resolvedAt} is null) = (${t.resolution} is null) and (${t.resolvedAt} is null) = (${t.resolvedBy} is null)`,\n ),\n openIdx: index(\"post_flags_open_idx\").on(t.orgId, t.postId, t.resolvedAt),\n }),\n);\n\nexport const comments = pgTable(\n \"comments\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"comment\")),\n activityId: text(\"activity_id\"),\n postId: text(\"post_id\"),\n communityId: text(\"community_id\"),\n parentId: text(\"parent_id\"),\n orgUserId: text(\"org_user_id\").notNull(),\n body: text(\"body\").notNull(),\n status: text(\"status\", { enum: [\"pending\", \"published\", \"removed\"] })\n .notNull()\n .default(\"published\"),\n removedBy: text(\"removed_by\"),\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.id] }),\n activityFk: foreignKey({\n columns: [t.orgId, t.activityId],\n foreignColumns: [activities.orgId, activities.id],\n }).onDelete(\"cascade\"),\n postFk: foreignKey({\n columns: [t.orgId, t.postId],\n foreignColumns: [posts.orgId, posts.id],\n }).onDelete(\"cascade\"),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n authorFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }),\n // SET NULL is narrowed to the nullable column in 0009_community_indexes.sql; drizzle cannot express it.\n removedByFk: foreignKey({\n columns: [t.orgId, t.removedBy],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"set null\"),\n parentFk: foreignKey({\n columns: [t.orgId, t.parentId],\n foreignColumns: [t.orgId, t.id],\n }),\n removedCk: check(\n \"comments_removed_by_check\",\n sql`${t.removedBy} is null or ${t.status} = 'removed'`,\n ),\n targetCk: check(\"comments_target_check\", sql`num_nonnulls(${t.activityId}, ${t.postId}) = 1`),\n communityCk: check(\n \"comments_community_check\",\n sql`${t.postId} is null or ${t.communityId} is not null`,\n ),\n activityIdx: index(\"comments_activity_idx\").on(t.orgId, t.activityId, t.status, t.createdAt),\n postIdx: index(\"comments_post_idx\").on(t.orgId, t.postId, t.status, t.createdAt),\n queueIdx: index(\"comments_queue_idx\").on(t.orgId, t.status, t.createdAt),\n communityIdx: index(\"comments_community_idx\").on(t.orgId, t.communityId),\n parentIdx: index(\"comments_parent_idx\").on(t.orgId, t.parentId, t.createdAt),\n }),\n);\n\nexport const commentReactions = pgTable(\n \"comment_reactions\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n commentId: text(\"comment_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n emoji: text(\"emoji\").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.commentId, t.orgUserId] }),\n commentFk: foreignKey({\n columns: [t.orgId, t.commentId],\n foreignColumns: [comments.orgId, comments.id],\n }).onDelete(\"cascade\"),\n authorFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const commentFlags = pgTable(\n \"comment_flags\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"commentReport\")),\n commentId: text(\"comment_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n reason: text(\"reason\").notNull().default(\"\"),\n resolvedAt: timestamp(\"resolved_at\", { withTimezone: true }),\n resolution: text(\"resolution\", { enum: [\"dismissed\", \"removed\"] }),\n resolvedBy: text(\"resolved_by\"),\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.id] }),\n reporterUq: unique().on(t.orgId, t.commentId, t.orgUserId),\n commentFk: foreignKey({\n columns: [t.orgId, t.commentId],\n foreignColumns: [comments.orgId, comments.id],\n }).onDelete(\"cascade\"),\n reporterFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n resolvedCk: check(\n \"comment_flags_resolved_check\",\n sql`(${t.resolvedAt} is null) = (${t.resolution} is null) and (${t.resolvedBy} is null or ${t.resolvedAt} is not null)`,\n ),\n openIdx: index(\"comment_flags_open_idx\").on(t.orgId, t.commentId, t.resolvedAt),\n }),\n);\n\nexport const chats = pgTable(\n \"chats\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"chat\")),\n communityId: text(\"community_id\").notNull(),\n kind: text(\"kind\", { enum: [\"direct\", \"group\"] }).notNull(),\n status: text(\"status\", { enum: [\"pending\", \"open\", \"closed\"] })\n .notNull()\n .default(\"open\"),\n createdBy: text(\"created_by\"),\n lockedAt: timestamp(\"locked_at\", { withTimezone: true }),\n lockedBy: text(\"locked_by\"),\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.id] }),\n communityUq: unique().on(t.orgId, t.id, t.communityId),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n // SET NULL is narrowed to the nullable column in 0009_community_indexes.sql; drizzle cannot express it.\n createdByFk: foreignKey({\n columns: [t.orgId, t.createdBy],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"set null\"),\n lockedByFk: foreignKey({\n columns: [t.orgId, t.lockedBy],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"set null\"),\n lockedCk: check(\"chats_locked_check\", sql`${t.lockedBy} is null or ${t.lockedAt} is not null`),\n }),\n);\n\nexport const chatUsers = pgTable(\n \"chat_users\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n communityId: text(\"community_id\").notNull(),\n chatId: text(\"chat_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n joinedAt: timestamp(\"joined_at\", { withTimezone: true }).notNull().defaultNow(),\n leftAt: timestamp(\"left_at\", { withTimezone: true }),\n lastReadMessageId: text(\"last_read_message_id\"),\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.chatId, t.orgUserId] }),\n chatFk: foreignKey({\n columns: [t.orgId, t.chatId, t.communityId],\n foreignColumns: [chats.orgId, chats.id, chats.communityId],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n userIdx: index(\"chat_users_user_idx\").on(t.orgId, t.communityId, t.orgUserId),\n }),\n);\n\nexport const messages = pgTable(\n \"messages\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"message\")),\n communityId: text(\"community_id\").notNull(),\n chatId: text(\"chat_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n body: text(\"body\").notNull(),\n replyToId: text(\"reply_to_id\"),\n editedAt: timestamp(\"edited_at\", { withTimezone: true }),\n deletedAt: timestamp(\"deleted_at\", { withTimezone: true }),\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.id] }),\n communityUq: unique().on(t.orgId, t.id, t.communityId),\n chatFk: foreignKey({\n columns: [t.orgId, t.chatId, t.communityId],\n foreignColumns: [chats.orgId, chats.id, chats.communityId],\n }).onDelete(\"cascade\"),\n authorFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }),\n replyFk: foreignKey({\n columns: [t.orgId, t.replyToId],\n foreignColumns: [t.orgId, t.id],\n }),\n chatIdx: index(\"messages_chat_idx\").on(t.orgId, t.chatId, t.createdAt),\n replyIdx: index(\"messages_reply_idx\").on(t.orgId, t.replyToId),\n }),\n);\n\nexport const messageAttachments = pgTable(\n \"message_attachments\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n communityId: text(\"community_id\").notNull(),\n messageId: text(\"message_id\").notNull(),\n assetId: text(\"asset_id\").notNull(),\n seq: integer(\"seq\").notNull().default(0),\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.messageId, t.assetId] }),\n messageFk: foreignKey({\n columns: [t.orgId, t.messageId, t.communityId],\n foreignColumns: [messages.orgId, messages.id, messages.communityId],\n }).onDelete(\"cascade\"),\n assetFk: foreignKey({\n columns: [t.orgId, t.assetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n assetIdx: index(\"message_attachments_asset_idx\").on(t.orgId, t.assetId),\n }),\n);\n\nexport const messageReactions = pgTable(\n \"message_reactions\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n communityId: text(\"community_id\").notNull(),\n messageId: text(\"message_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n emoji: text(\"emoji\").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.messageId, t.orgUserId] }),\n messageFk: foreignKey({\n columns: [t.orgId, t.messageId, t.communityId],\n foreignColumns: [messages.orgId, messages.id, messages.communityId],\n }).onDelete(\"cascade\"),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const messageFlags = pgTable(\n \"message_flags\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"messageFlag\")),\n communityId: text(\"community_id\").notNull(),\n messageId: text(\"message_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n reason: text(\"reason\").notNull().default(\"\"),\n resolvedAt: timestamp(\"resolved_at\", { withTimezone: true }),\n resolution: text(\"resolution\", { enum: [\"dismissed\", \"deleted\", \"locked\"] }),\n resolvedBy: text(\"resolved_by\"),\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.id] }),\n reporterUq: unique().on(t.orgId, t.messageId, t.orgUserId),\n messageFk: foreignKey({\n columns: [t.orgId, t.messageId, t.communityId],\n foreignColumns: [messages.orgId, messages.id, messages.communityId],\n }).onDelete(\"cascade\"),\n reporterFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n resolvedCk: check(\n \"message_flags_resolved_check\",\n sql`(${t.resolvedAt} is null) = (${t.resolution} is null) and (${t.resolvedAt} is null) = (${t.resolvedBy} is null)`,\n ),\n openIdx: index(\"message_flags_open_idx\").on(t.orgId, t.communityId, t.messageId, t.resolvedAt),\n }),\n);\n\nexport const blockedUsers = pgTable(\n \"blocked_users\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n communityId: text(\"community_id\").notNull(),\n blockerOrgUserId: text(\"blocker_org_user_id\").notNull(),\n blockedOrgUserId: text(\"blocked_org_user_id\").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({\n columns: [t.orgId, t.communityId, t.blockerOrgUserId, t.blockedOrgUserId],\n }),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n blockerFk: foreignKey({\n columns: [t.orgId, t.blockerOrgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n blockedFk: foreignKey({\n columns: [t.orgId, t.blockedOrgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n blockedIdx: index(\"blocked_users_blocked_idx\").on(t.orgId, t.communityId, t.blockedOrgUserId),\n }),\n);\n\nexport const digestRuns = pgTable(\n \"digest_runs\",\n {\n orgId: text(\"org_id\").notNull(),\n communityId: text(\"community_id\").notNull(),\n lastDueAt: timestamp(\"last_due_at\", { withTimezone: true }).notNull(),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.communityId] }),\n communityFk: foreignKey({\n columns: [t.orgId, t.communityId],\n foreignColumns: [communities.orgId, communities.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const subscriptions = pgTable(\n \"subscriptions\",\n {\n orgId: text(\"org_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n itemType: text(\"item_type\", { enum: [\"post\", \"space\", \"chat\"] }).notNull(),\n itemId: text(\"item_id\").notNull(),\n state: text(\"state\", { enum: [\"following\", \"muted\"] }).notNull(),\n mutedUntil: timestamp(\"muted_until\", { withTimezone: true }),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.orgUserId, t.itemType, t.itemId] }),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n itemIdx: index(\"subscriptions_item_idx\").on(t.orgId, t.itemType, t.itemId, t.state),\n }),\n);\n\nexport const mentions = pgTable(\n \"mentions\",\n {\n orgId: text(\"org_id\").notNull(),\n itemType: text(\"item_type\", { enum: [\"post\", \"comment\", \"message\"] }).notNull(),\n itemId: text(\"item_id\").notNull(),\n orgUserId: text(\"org_user_id\").notNull(),\n createdAt: timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n },\n (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.itemType, t.itemId, t.orgUserId] }),\n orgUserFk: foreignKey({\n columns: [t.orgId, t.orgUserId],\n foreignColumns: [orgUsers.orgId, orgUsers.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\ntype _PostsDrift = Expect<NoDrift<typeof posts.$inferSelect, Post>>;\ntype _PostReactionsDrift = Expect<NoDrift<typeof postReactions.$inferSelect, PostReaction>>;\ntype _PostBookmarksDrift = Expect<NoDrift<typeof postBookmarks.$inferSelect, PostBookmark>>;\ntype _PostFlagsDrift = Expect<NoDrift<typeof postFlags.$inferSelect, PostFlag>>;\ntype _CommentsDrift = Expect<NoDrift<typeof comments.$inferSelect, Comment>>;\ntype _CommentReactionsDrift = Expect<\n NoDrift<typeof commentReactions.$inferSelect, CommentReaction>\n>;\ntype _CommentFlagsDrift = Expect<NoDrift<typeof commentFlags.$inferSelect, CommentReport>>;\ntype _ChatsDrift = Expect<NoDrift<typeof chats.$inferSelect, Chat>>;\ntype _ChatUsersDrift = Expect<NoDrift<typeof chatUsers.$inferSelect, ChatUser>>;\ntype _MessagesDrift = Expect<NoDrift<typeof messages.$inferSelect, Message>>;\ntype _MessageAttachmentsDrift = Expect<\n NoDrift<typeof messageAttachments.$inferSelect, MessageAttachment>\n>;\ntype _MessageReactionsDrift = Expect<\n NoDrift<typeof messageReactions.$inferSelect, MessageReaction>\n>;\ntype _MessageFlagsDrift = Expect<NoDrift<typeof messageFlags.$inferSelect, MessageFlag>>;\ntype _BlockedUsersDrift = Expect<NoDrift<typeof blockedUsers.$inferSelect, BlockedUser>>;\ntype _DigestRunsDrift = Expect<NoDrift<typeof digestRuns.$inferSelect, DigestRun>>;\ntype _SubscriptionsDrift = Expect<NoDrift<typeof subscriptions.$inferSelect, Subscription>>;\ntype _MentionsDrift = Expect<NoDrift<typeof mentions.$inferS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QAAQ;CAC9B,UAAU,KAAK,aAAa,EAAE,MAAM;EAAC;EAAQ;EAAW;CAAS,EAAE,CAAC,CAAC,CAAC,QAAQ;CAC9E,QAAQ,KAAK,SAAS,CAAC,CAAC,QAAQ;CAChC,WAAW,KAAK,aAAa,CAAC,CAAC,QAAQ;CACvC,WAAW,UAAU,cAAc,EAAE,cAAc,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW;AAClF,IACC,OAAO;CACN,IAAI,WAAW,EAAE,SAAS;EAAC,EAAE;EAAO,EAAE;EAAU,EAAE;EAAQ,EAAE;CAAS,EAAE,CAAC;CACxE,WAAW,WAAW;EACpB,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS;EAC9B,gBAAgB,CAAC,SAAS,OAAO,SAAS,EAAE;CAC9C,CAAC,CAAC,CAAC,SAAS,SAAS;AACvB,EACF"}
|
|
@@ -287,13 +287,13 @@ declare const userProfiles: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
287
287
|
};
|
|
288
288
|
dialect: "pg";
|
|
289
289
|
}>;
|
|
290
|
-
declare const
|
|
291
|
-
name: "
|
|
290
|
+
declare const notificationSettings: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
291
|
+
name: "notification_settings";
|
|
292
292
|
schema: undefined;
|
|
293
293
|
columns: {
|
|
294
294
|
orgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
295
295
|
name: "org_id";
|
|
296
|
-
tableName: "
|
|
296
|
+
tableName: "notification_settings";
|
|
297
297
|
dataType: "string";
|
|
298
298
|
columnType: "PgText";
|
|
299
299
|
data: string;
|
|
@@ -310,7 +310,7 @@ declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
310
310
|
}, {}, {}>;
|
|
311
311
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
312
312
|
name: "id";
|
|
313
|
-
tableName: "
|
|
313
|
+
tableName: "notification_settings";
|
|
314
314
|
dataType: "string";
|
|
315
315
|
columnType: "PgText";
|
|
316
316
|
data: string;
|
|
@@ -327,7 +327,7 @@ declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
327
327
|
}, {}, {}>;
|
|
328
328
|
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
329
329
|
name: "user_id";
|
|
330
|
-
tableName: "
|
|
330
|
+
tableName: "notification_settings";
|
|
331
331
|
dataType: "string";
|
|
332
332
|
columnType: "PgText";
|
|
333
333
|
data: string;
|
|
@@ -342,26 +342,26 @@ declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
342
342
|
identity: undefined;
|
|
343
343
|
generated: undefined;
|
|
344
344
|
}, {}, {}>;
|
|
345
|
-
|
|
346
|
-
name: "
|
|
347
|
-
tableName: "
|
|
345
|
+
communityId: import("drizzle-orm/pg-core").PgColumn<{
|
|
346
|
+
name: "community_id";
|
|
347
|
+
tableName: "notification_settings";
|
|
348
348
|
dataType: "string";
|
|
349
349
|
columnType: "PgText";
|
|
350
|
-
data:
|
|
350
|
+
data: string;
|
|
351
351
|
driverParam: string;
|
|
352
|
-
notNull:
|
|
352
|
+
notNull: false;
|
|
353
353
|
hasDefault: false;
|
|
354
354
|
isPrimaryKey: false;
|
|
355
355
|
isAutoincrement: false;
|
|
356
356
|
hasRuntimeDefault: false;
|
|
357
|
-
enumValues: [
|
|
357
|
+
enumValues: [string, ...string[]];
|
|
358
358
|
baseColumn: never;
|
|
359
359
|
identity: undefined;
|
|
360
360
|
generated: undefined;
|
|
361
361
|
}, {}, {}>;
|
|
362
|
-
|
|
363
|
-
name: "
|
|
364
|
-
tableName: "
|
|
362
|
+
spaceId: import("drizzle-orm/pg-core").PgColumn<{
|
|
363
|
+
name: "space_id";
|
|
364
|
+
tableName: "notification_settings";
|
|
365
365
|
dataType: "string";
|
|
366
366
|
columnType: "PgText";
|
|
367
367
|
data: string;
|
|
@@ -376,14 +376,14 @@ declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
376
376
|
identity: undefined;
|
|
377
377
|
generated: undefined;
|
|
378
378
|
}, {}, {}>;
|
|
379
|
-
|
|
380
|
-
name: "
|
|
381
|
-
tableName: "
|
|
379
|
+
category: import("drizzle-orm/pg-core").PgColumn<{
|
|
380
|
+
name: "category";
|
|
381
|
+
tableName: "notification_settings";
|
|
382
382
|
dataType: "string";
|
|
383
383
|
columnType: "PgText";
|
|
384
384
|
data: string;
|
|
385
385
|
driverParam: string;
|
|
386
|
-
notNull:
|
|
386
|
+
notNull: true;
|
|
387
387
|
hasDefault: false;
|
|
388
388
|
isPrimaryKey: false;
|
|
389
389
|
isAutoincrement: false;
|
|
@@ -393,14 +393,14 @@ declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
393
393
|
identity: undefined;
|
|
394
394
|
generated: undefined;
|
|
395
395
|
}, {}, {}>;
|
|
396
|
-
|
|
397
|
-
name: "
|
|
398
|
-
tableName: "
|
|
396
|
+
channel: import("drizzle-orm/pg-core").PgColumn<{
|
|
397
|
+
name: "channel";
|
|
398
|
+
tableName: "notification_settings";
|
|
399
399
|
dataType: "string";
|
|
400
400
|
columnType: "PgText";
|
|
401
401
|
data: string;
|
|
402
402
|
driverParam: string;
|
|
403
|
-
notNull:
|
|
403
|
+
notNull: true;
|
|
404
404
|
hasDefault: false;
|
|
405
405
|
isPrimaryKey: false;
|
|
406
406
|
isAutoincrement: false;
|
|
@@ -410,48 +410,55 @@ declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
410
410
|
identity: undefined;
|
|
411
411
|
generated: undefined;
|
|
412
412
|
}, {}, {}>;
|
|
413
|
-
|
|
414
|
-
name: "
|
|
415
|
-
tableName: "
|
|
416
|
-
dataType: "
|
|
417
|
-
columnType: "
|
|
418
|
-
data:
|
|
419
|
-
driverParam:
|
|
420
|
-
notNull:
|
|
413
|
+
enabled: import("drizzle-orm/pg-core").PgColumn<{
|
|
414
|
+
name: "enabled";
|
|
415
|
+
tableName: "notification_settings";
|
|
416
|
+
dataType: "boolean";
|
|
417
|
+
columnType: "PgBoolean";
|
|
418
|
+
data: boolean;
|
|
419
|
+
driverParam: boolean;
|
|
420
|
+
notNull: true;
|
|
421
421
|
hasDefault: false;
|
|
422
422
|
isPrimaryKey: false;
|
|
423
423
|
isAutoincrement: false;
|
|
424
424
|
hasRuntimeDefault: false;
|
|
425
|
-
enumValues:
|
|
425
|
+
enumValues: undefined;
|
|
426
426
|
baseColumn: never;
|
|
427
427
|
identity: undefined;
|
|
428
428
|
generated: undefined;
|
|
429
429
|
}, {}, {}>;
|
|
430
|
-
|
|
431
|
-
name: "
|
|
432
|
-
tableName: "
|
|
433
|
-
dataType: "
|
|
434
|
-
columnType: "
|
|
435
|
-
data:
|
|
430
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
431
|
+
name: "updated_at";
|
|
432
|
+
tableName: "notification_settings";
|
|
433
|
+
dataType: "date";
|
|
434
|
+
columnType: "PgTimestamp";
|
|
435
|
+
data: Date;
|
|
436
436
|
driverParam: string;
|
|
437
|
-
notNull:
|
|
438
|
-
hasDefault:
|
|
437
|
+
notNull: true;
|
|
438
|
+
hasDefault: true;
|
|
439
439
|
isPrimaryKey: false;
|
|
440
440
|
isAutoincrement: false;
|
|
441
441
|
hasRuntimeDefault: false;
|
|
442
|
-
enumValues:
|
|
442
|
+
enumValues: undefined;
|
|
443
443
|
baseColumn: never;
|
|
444
444
|
identity: undefined;
|
|
445
445
|
generated: undefined;
|
|
446
446
|
}, {}, {}>;
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
};
|
|
448
|
+
dialect: "pg";
|
|
449
|
+
}>;
|
|
450
|
+
declare const devices: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
451
|
+
name: "devices";
|
|
452
|
+
schema: undefined;
|
|
453
|
+
columns: {
|
|
454
|
+
orgId: import("drizzle-orm/pg-core").PgColumn<{
|
|
455
|
+
name: "org_id";
|
|
456
|
+
tableName: "devices";
|
|
450
457
|
dataType: "string";
|
|
451
458
|
columnType: "PgText";
|
|
452
459
|
data: string;
|
|
453
460
|
driverParam: string;
|
|
454
|
-
notNull:
|
|
461
|
+
notNull: true;
|
|
455
462
|
hasDefault: false;
|
|
456
463
|
isPrimaryKey: false;
|
|
457
464
|
isAutoincrement: false;
|
|
@@ -461,67 +468,60 @@ declare const notifications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
461
468
|
identity: undefined;
|
|
462
469
|
generated: undefined;
|
|
463
470
|
}, {}, {}>;
|
|
464
|
-
|
|
465
|
-
name: "
|
|
466
|
-
tableName: "
|
|
471
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
472
|
+
name: "id";
|
|
473
|
+
tableName: "devices";
|
|
467
474
|
dataType: "string";
|
|
468
475
|
columnType: "PgText";
|
|
469
476
|
data: string;
|
|
470
477
|
driverParam: string;
|
|
471
|
-
notNull:
|
|
472
|
-
hasDefault:
|
|
478
|
+
notNull: true;
|
|
479
|
+
hasDefault: true;
|
|
473
480
|
isPrimaryKey: false;
|
|
474
481
|
isAutoincrement: false;
|
|
475
|
-
hasRuntimeDefault:
|
|
482
|
+
hasRuntimeDefault: true;
|
|
476
483
|
enumValues: [string, ...string[]];
|
|
477
484
|
baseColumn: never;
|
|
478
485
|
identity: undefined;
|
|
479
486
|
generated: undefined;
|
|
480
487
|
}, {}, {}>;
|
|
481
|
-
|
|
482
|
-
name: "
|
|
483
|
-
tableName: "
|
|
484
|
-
dataType: "
|
|
485
|
-
columnType: "
|
|
486
|
-
data:
|
|
488
|
+
userId: import("drizzle-orm/pg-core").PgColumn<{
|
|
489
|
+
name: "user_id";
|
|
490
|
+
tableName: "devices";
|
|
491
|
+
dataType: "string";
|
|
492
|
+
columnType: "PgText";
|
|
493
|
+
data: string;
|
|
487
494
|
driverParam: string;
|
|
488
495
|
notNull: true;
|
|
489
|
-
hasDefault:
|
|
496
|
+
hasDefault: false;
|
|
490
497
|
isPrimaryKey: false;
|
|
491
498
|
isAutoincrement: false;
|
|
492
499
|
hasRuntimeDefault: false;
|
|
493
|
-
enumValues:
|
|
500
|
+
enumValues: [string, ...string[]];
|
|
494
501
|
baseColumn: never;
|
|
495
502
|
identity: undefined;
|
|
496
503
|
generated: undefined;
|
|
497
504
|
}, {}, {}>;
|
|
498
|
-
|
|
499
|
-
name: "
|
|
500
|
-
tableName: "
|
|
501
|
-
dataType: "
|
|
502
|
-
columnType: "
|
|
503
|
-
data:
|
|
505
|
+
provider: import("drizzle-orm/pg-core").PgColumn<{
|
|
506
|
+
name: "provider";
|
|
507
|
+
tableName: "devices";
|
|
508
|
+
dataType: "string";
|
|
509
|
+
columnType: "PgText";
|
|
510
|
+
data: "apns" | "fcm" | "webpush";
|
|
504
511
|
driverParam: string;
|
|
505
|
-
notNull:
|
|
512
|
+
notNull: true;
|
|
506
513
|
hasDefault: false;
|
|
507
514
|
isPrimaryKey: false;
|
|
508
515
|
isAutoincrement: false;
|
|
509
516
|
hasRuntimeDefault: false;
|
|
510
|
-
enumValues:
|
|
517
|
+
enumValues: ["apns", "fcm", "webpush"];
|
|
511
518
|
baseColumn: never;
|
|
512
519
|
identity: undefined;
|
|
513
520
|
generated: undefined;
|
|
514
521
|
}, {}, {}>;
|
|
515
|
-
|
|
516
|
-
|
|
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";
|
|
522
|
+
token: import("drizzle-orm/pg-core").PgColumn<{
|
|
523
|
+
name: "token";
|
|
524
|
+
tableName: "devices";
|
|
525
525
|
dataType: "string";
|
|
526
526
|
columnType: "PgText";
|
|
527
527
|
data: string;
|
|
@@ -536,14 +536,14 @@ declare const notificationPreferences: import("drizzle-orm/pg-core").PgTableWith
|
|
|
536
536
|
identity: undefined;
|
|
537
537
|
generated: undefined;
|
|
538
538
|
}, {}, {}>;
|
|
539
|
-
|
|
540
|
-
name: "
|
|
541
|
-
tableName: "
|
|
539
|
+
p256dh: import("drizzle-orm/pg-core").PgColumn<{
|
|
540
|
+
name: "p256dh";
|
|
541
|
+
tableName: "devices";
|
|
542
542
|
dataType: "string";
|
|
543
543
|
columnType: "PgText";
|
|
544
544
|
data: string;
|
|
545
545
|
driverParam: string;
|
|
546
|
-
notNull:
|
|
546
|
+
notNull: false;
|
|
547
547
|
hasDefault: false;
|
|
548
548
|
isPrimaryKey: false;
|
|
549
549
|
isAutoincrement: false;
|
|
@@ -553,60 +553,60 @@ declare const notificationPreferences: import("drizzle-orm/pg-core").PgTableWith
|
|
|
553
553
|
identity: undefined;
|
|
554
554
|
generated: undefined;
|
|
555
555
|
}, {}, {}>;
|
|
556
|
-
|
|
557
|
-
name: "
|
|
558
|
-
tableName: "
|
|
556
|
+
auth: import("drizzle-orm/pg-core").PgColumn<{
|
|
557
|
+
name: "auth";
|
|
558
|
+
tableName: "devices";
|
|
559
559
|
dataType: "string";
|
|
560
560
|
columnType: "PgText";
|
|
561
|
-
data:
|
|
561
|
+
data: string;
|
|
562
562
|
driverParam: string;
|
|
563
|
-
notNull:
|
|
563
|
+
notNull: false;
|
|
564
564
|
hasDefault: false;
|
|
565
565
|
isPrimaryKey: false;
|
|
566
566
|
isAutoincrement: false;
|
|
567
567
|
hasRuntimeDefault: false;
|
|
568
|
-
enumValues: [
|
|
568
|
+
enumValues: [string, ...string[]];
|
|
569
569
|
baseColumn: never;
|
|
570
570
|
identity: undefined;
|
|
571
571
|
generated: undefined;
|
|
572
572
|
}, {}, {}>;
|
|
573
|
-
|
|
574
|
-
name: "
|
|
575
|
-
tableName: "
|
|
576
|
-
dataType: "
|
|
577
|
-
columnType: "
|
|
578
|
-
data:
|
|
579
|
-
driverParam:
|
|
580
|
-
notNull:
|
|
573
|
+
appId: import("drizzle-orm/pg-core").PgColumn<{
|
|
574
|
+
name: "app_id";
|
|
575
|
+
tableName: "devices";
|
|
576
|
+
dataType: "string";
|
|
577
|
+
columnType: "PgText";
|
|
578
|
+
data: string;
|
|
579
|
+
driverParam: string;
|
|
580
|
+
notNull: false;
|
|
581
581
|
hasDefault: false;
|
|
582
582
|
isPrimaryKey: false;
|
|
583
583
|
isAutoincrement: false;
|
|
584
584
|
hasRuntimeDefault: false;
|
|
585
|
-
enumValues:
|
|
585
|
+
enumValues: [string, ...string[]];
|
|
586
586
|
baseColumn: never;
|
|
587
587
|
identity: undefined;
|
|
588
588
|
generated: undefined;
|
|
589
589
|
}, {}, {}>;
|
|
590
|
-
|
|
591
|
-
name: "
|
|
592
|
-
tableName: "
|
|
593
|
-
dataType: "
|
|
594
|
-
columnType: "
|
|
595
|
-
data:
|
|
596
|
-
driverParam:
|
|
597
|
-
notNull:
|
|
590
|
+
environment: import("drizzle-orm/pg-core").PgColumn<{
|
|
591
|
+
name: "environment";
|
|
592
|
+
tableName: "devices";
|
|
593
|
+
dataType: "string";
|
|
594
|
+
columnType: "PgText";
|
|
595
|
+
data: "production" | "sandbox";
|
|
596
|
+
driverParam: string;
|
|
597
|
+
notNull: false;
|
|
598
598
|
hasDefault: false;
|
|
599
599
|
isPrimaryKey: false;
|
|
600
600
|
isAutoincrement: false;
|
|
601
601
|
hasRuntimeDefault: false;
|
|
602
|
-
enumValues:
|
|
602
|
+
enumValues: ["production", "sandbox"];
|
|
603
603
|
baseColumn: never;
|
|
604
604
|
identity: undefined;
|
|
605
605
|
generated: undefined;
|
|
606
606
|
}, {}, {}>;
|
|
607
607
|
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
608
608
|
name: "created_at";
|
|
609
|
-
tableName: "
|
|
609
|
+
tableName: "devices";
|
|
610
610
|
dataType: "date";
|
|
611
611
|
columnType: "PgTimestamp";
|
|
612
612
|
data: Date;
|
|
@@ -621,9 +621,9 @@ declare const notificationPreferences: import("drizzle-orm/pg-core").PgTableWith
|
|
|
621
621
|
identity: undefined;
|
|
622
622
|
generated: undefined;
|
|
623
623
|
}, {}, {}>;
|
|
624
|
-
|
|
625
|
-
name: "
|
|
626
|
-
tableName: "
|
|
624
|
+
lastSeenAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
625
|
+
name: "last_seen_at";
|
|
626
|
+
tableName: "devices";
|
|
627
627
|
dataType: "date";
|
|
628
628
|
columnType: "PgTimestamp";
|
|
629
629
|
data: Date;
|
|
@@ -642,5 +642,5 @@ declare const notificationPreferences: import("drizzle-orm/pg-core").PgTableWith
|
|
|
642
642
|
dialect: "pg";
|
|
643
643
|
}>;
|
|
644
644
|
//#endregion
|
|
645
|
-
export {
|
|
645
|
+
export { devices, notificationSettings, userProfiles, users };
|
|
646
646
|
//# sourceMappingURL=identity.d.ts.map
|