@headless-lms/adapter-db 0.4.0 → 0.6.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/client.d.ts +8 -2
- package/dist/client.js +10 -2
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -3
- package/dist/repositories/admin.d.ts +12 -4
- package/dist/repositories/admin.js +164 -22
- package/dist/repositories/admin.js.map +1 -1
- package/dist/repositories/assets.d.ts +2 -1
- package/dist/repositories/assets.js +12 -1
- package/dist/repositories/assets.js.map +1 -1
- package/dist/repositories/automations.js +1 -1
- package/dist/repositories/chats.d.ts +13 -4
- package/dist/repositories/chats.js +164 -70
- package/dist/repositories/chats.js.map +1 -1
- package/dist/repositories/content.d.ts +22 -5
- package/dist/repositories/content.js +201 -40
- package/dist/repositories/content.js.map +1 -1
- package/dist/repositories/credentials.js +1 -1
- package/dist/repositories/devices.js +1 -1
- package/dist/repositories/digest-runs.js +1 -1
- package/dist/repositories/discussion.d.ts +1 -1
- package/dist/repositories/discussion.js +9 -3
- package/dist/repositories/discussion.js.map +1 -1
- package/dist/repositories/entitlements.d.ts +10 -10
- package/dist/repositories/entitlements.js +47 -56
- package/dist/repositories/entitlements.js.map +1 -1
- package/dist/repositories/event-reports.d.ts +16 -0
- package/dist/repositories/event-reports.js +199 -0
- package/dist/repositories/event-reports.js.map +1 -0
- package/dist/repositories/grant-covers.d.ts +4 -3
- package/dist/repositories/grant-covers.js +7 -4
- package/dist/repositories/grant-covers.js.map +1 -1
- package/dist/repositories/identity.js +1 -1
- package/dist/repositories/integrations.js +1 -1
- package/dist/repositories/member.d.ts +12 -4
- package/dist/repositories/member.js +19 -7
- package/dist/repositories/member.js.map +1 -1
- package/dist/repositories/members.d.ts +2 -5
- package/dist/repositories/members.js +39 -94
- package/dist/repositories/members.js.map +1 -1
- package/dist/repositories/mentions.js +1 -1
- package/dist/repositories/notification-settings.js +1 -1
- package/dist/repositories/notifications.js +2 -2
- package/dist/repositories/notifications.js.map +1 -1
- package/dist/repositories/org-user-profile.d.ts +0 -17
- package/dist/repositories/org-user-profile.js +0 -1
- package/dist/repositories/org-user-profile.js.map +1 -1
- package/dist/repositories/organizations.d.ts +4 -4
- package/dist/repositories/organizations.js +26 -46
- package/dist/repositories/organizations.js.map +1 -1
- package/dist/repositories/outbox.d.ts +5 -1
- package/dist/repositories/outbox.js +12 -3
- package/dist/repositories/outbox.js.map +1 -1
- package/dist/repositories/posts.js +1 -1
- package/dist/repositories/progress.js +1 -1
- package/dist/repositories/roles.d.ts +35 -0
- package/dist/repositories/roles.js +244 -0
- package/dist/repositories/roles.js.map +1 -0
- package/dist/repositories/settings.js +1 -1
- package/dist/repositories/subscriptions.js +1 -1
- package/dist/schema/assets.d.ts +17 -0
- package/dist/schema/assets.js +1 -0
- package/dist/schema/assets.js.map +1 -1
- package/dist/schema/automations.d.ts +3 -3
- package/dist/schema/automations.js +1 -1
- package/dist/schema/automations.js.map +1 -1
- package/dist/schema/content.d.ts +488 -3
- package/dist/schema/content.js +89 -4
- package/dist/schema/content.js.map +1 -1
- package/dist/schema/discussion.d.ts +17 -0
- package/dist/schema/discussion.js +4 -2
- package/dist/schema/discussion.js.map +1 -1
- package/dist/schema/index.d.ts +4 -3
- package/dist/schema/index.js +7 -2
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/organizations.d.ts +24 -22
- package/dist/schema/organizations.js +3 -14
- package/dist/schema/organizations.js.map +1 -1
- package/dist/schema/roles.d.ts +369 -0
- package/dist/schema/roles.js +71 -0
- package/dist/schema/roles.js.map +1 -0
- package/drizzle/0017_configurable_roles.sql +38 -0
- package/drizzle/0018_messages_client_id.sql +2 -0
- package/drizzle/0019_events.sql +44 -0
- package/drizzle/0020_space_images.sql +9 -0
- package/drizzle/0021_org_metadata.sql +1 -0
- package/drizzle/meta/0017_snapshot.json +9518 -0
- package/drizzle/meta/0018_snapshot.json +9557 -0
- package/drizzle/meta/0019_snapshot.json +9919 -0
- package/drizzle/meta/0020_snapshot.json +10045 -0
- package/drizzle/meta/0021_snapshot.json +10052 -0
- package/drizzle/meta/_journal.json +35 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","names":[],"sources":["../../src/schema/content.ts"],"sourcesContent":["import {\n pgTable,\n text,\n integer,\n jsonb,\n timestamp,\n primaryKey,\n foreignKey,\n unique,\n index,\n check,\n} from \"drizzle-orm/pg-core\";\nimport { sql } from \"drizzle-orm\";\nimport type {\n Activity,\n ActivityAsset,\n Bundle,\n BundleItem,\n Community,\n ContentItem,\n Course,\n Download,\n DownloadAsset,\n Module,\n Space,\n SpaceLink,\n SpaceTopic,\n} from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { organizations } from \"./organizations.js\";\nimport { assets } from \"./assets.js\";\nimport type { Expect, NoDrift } from \"./drift.js\";\n\n// Bundles.\nexport const bundles = pgTable(\n \"bundles\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\").notNull(),\n name: text(\"name\").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.id] }),\n typeUq: unique().on(t.orgId, t.id, t.name),\n }),\n);\n\n// The content registry one row per piece of content, any\n// type. this is so we can PK to content items of different types.\nexport const contentItems = pgTable(\n \"content_items\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\").notNull(),\n type: text(\"type\", { enum: [\"course\", \"download\", \"community\"] }).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.id] }),\n // FK target for type-pinned references from concrete content tables.\n typeUq: unique().on(t.orgId, t.id, t.type),\n // Widened per new content type.\n typeCk: check(\n \"content_items_type_check\",\n sql`${t.type} in ('course', 'download', 'community')`,\n ),\n }),\n);\n\n// The content registry one row per piece of content, any\n// type. this is so we can PK to content items of different types.\nexport const bundleItems = pgTable(\n \"bundle_items\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n bundleId: text(\"bundle_id\").notNull(),\n contentId: text(\"content_id\").notNull(),\n\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.bundleId, t.contentId] }),\n contentItemFk: foreignKey({\n columns: [t.orgId, t.contentId],\n foreignColumns: [contentItems.orgId, contentItems.id],\n }).onDelete(\"cascade\"),\n bundleFk: foreignKey({\n columns: [t.orgId, t.bundleId],\n foreignColumns: [bundles.orgId, bundles.id],\n }).onDelete(\"cascade\"),\n contentIdx: index(\"bundle_items_content_idx\").on(t.orgId, t.contentId),\n }),\n);\n\nexport const courses = pgTable(\n \"courses\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"course\")),\n // Pinned to 'course' so the composite FK below cannot attach this row to a\n // registry row of another content type.\n type: text(\"type\")\n .$type<Course[\"type\"]>()\n .notNull()\n .generatedAlwaysAs(sql`'course'`),\n title: text(\"title\").notNull(),\n slug: text(\"slug\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n status: text(\"status\", { enum: [\"draft\", \"published\"] })\n .notNull()\n .default(\"draft\"),\n category: text(\"category\").notNull().default(\"\"),\n // Media-library asset rendered as the course's cover. Null = no cover.\n thumbnailAssetId: text(\"thumbnail_asset_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.id] }),\n slugUq: unique().on(t.orgId, t.slug),\n contentItemFk: foreignKey({\n columns: [t.orgId, t.id, t.type],\n foreignColumns: [contentItems.orgId, contentItems.id, contentItems.type],\n }).onDelete(\"cascade\"),\n // Restrictive, like `activity_assets.assetFk` — the asset is owned by the\n // assets domain and must be unlinked before it can be deleted. MATCH SIMPLE\n // means the constraint is skipped entirely while the thumbnail is null.\n thumbnailAssetFk: foreignKey({\n columns: [t.orgId, t.thumbnailAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n thumbnailIdx: index(\"courses_thumbnail_idx\").on(t.orgId, t.thumbnailAssetId),\n }),\n);\n\nexport const modules = pgTable(\n \"modules\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"module\")),\n courseId: text(\"course_id\").notNull(),\n title: text(\"title\").notNull(),\n seq: integer(\"seq\").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.id] }),\n // Modules are part of the course aggregate: deleting the course deletes them.\n courseFk: foreignKey({\n columns: [t.orgId, t.courseId],\n foreignColumns: [courses.orgId, courses.id],\n }).onDelete(\"cascade\"),\n // FK target for the course-pinned reference from activities.\n courseUq: unique().on(t.orgId, t.id, t.courseId),\n }),\n);\n\n// The leaf, directly in a module. Uniform content: seq + opaque settings blob.\nexport const activities = pgTable(\n \"activities\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"activity\")),\n moduleId: text(\"module_id\").notNull(),\n // Denormalised from the module: the course an activity belongs to is asked\n // for far more often than its module (progress, discussion, entitlements),\n // and the FK below pins the pair, so it cannot disagree with the module.\n courseId: text(\"course_id\").notNull(),\n seq: integer(\"seq\").notNull(),\n // Opaque per-activity blob: title, type, body, completion rule — whatever the\n // content needs. Assets are the one thing kept out of the blob.\n settings: jsonb(\"settings\").$type<Activity[\"settings\"]>(),\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 // Course-pinned, like `courses.contentItemFk`: the module reference carries\n // `course_id`, so an activity whose stored course disagrees with its\n // module's is rejected by the database rather than silently rotting.\n moduleFk: foreignKey({\n columns: [t.orgId, t.moduleId, t.courseId],\n foreignColumns: [modules.orgId, modules.id, modules.courseId],\n }).onDelete(\"cascade\"),\n seqUq: unique().on(t.orgId, t.moduleId, t.seq),\n }),\n);\n\n// activity ↔ asset: many-to-many (an activity uses many assets; an asset can be\n// reused by many activities). Assets owned by the assets domain, tracked here.\nexport const activityAssets = pgTable(\n \"activity_assets\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"activityAsset\")),\n activityId: text(\"activity_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.id] }),\n // The link cascades with its activity; the asset itself is owned by the\n // assets domain and survives (assetFk stays restrictive).\n activityFk: foreignKey({\n columns: [t.orgId, t.activityId],\n foreignColumns: [activities.orgId, activities.id],\n }).onDelete(\"cascade\"),\n assetFk: foreignKey({\n columns: [t.orgId, t.assetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n activityAssetUq: unique().on(t.orgId, t.activityId, t.assetId),\n assetIdx: index(\"activity_assets_asset_idx\").on(t.orgId, t.assetId),\n }),\n);\n\n// A download: an ordered set of media-library assets. Shares its PK with a\n// registry row (same id) via the type-pinned composite FK, exactly like courses.\nexport const downloads = pgTable(\n \"downloads\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"download\")),\n // Pinned to 'download' so the composite FK below cannot attach this row to\n // a registry row of another content type.\n type: text(\"type\")\n .$type<Download[\"type\"]>()\n .notNull()\n .generatedAlwaysAs(sql`'download'`),\n title: text(\"title\").notNull(),\n slug: text(\"slug\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n status: text(\"status\", { enum: [\"draft\", \"published\"] })\n .notNull()\n .default(\"draft\"),\n category: text(\"category\").notNull().default(\"\"),\n thumbnailAssetId: text(\"thumbnail_asset_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.id] }),\n slugUq: unique().on(t.orgId, t.slug),\n contentItemFk: foreignKey({\n columns: [t.orgId, t.id, t.type],\n foreignColumns: [contentItems.orgId, contentItems.id, contentItems.type],\n }).onDelete(\"cascade\"),\n // Restrictive: a thumbnail in use blocks deleting the asset.\n thumbnailFk: foreignKey({\n columns: [t.orgId, t.thumbnailAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n thumbnailIdx: index(\"downloads_thumbnail_idx\").on(t.orgId, t.thumbnailAssetId),\n }),\n);\n\n// download ↔ asset: the ordered set. Mirrors activity_assets one level\n// shallower — a download has no intermediate structure.\nexport const downloadAssets = pgTable(\n \"download_assets\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"downloadAsset\")),\n downloadId: text(\"download_id\").notNull(),\n assetId: text(\"asset_id\").notNull(),\n seq: integer(\"seq\").notNull().default(0),\n // Author's label; null falls back to the asset's filename.\n displayName: text(\"display_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 (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n // The link cascades with its download; the asset is owned by the assets\n // domain and survives (assetFk stays restrictive).\n downloadFk: foreignKey({\n columns: [t.orgId, t.downloadId],\n foreignColumns: [downloads.orgId, downloads.id],\n }).onDelete(\"cascade\"),\n assetFk: foreignKey({\n columns: [t.orgId, t.assetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n // Lets delivery key on asset_id rather than the link row id.\n downloadAssetUq: unique().on(t.orgId, t.downloadId, t.assetId),\n assetIdx: index(\"download_assets_asset_idx\").on(t.orgId, t.assetId),\n }),\n);\n\nexport const communities = pgTable(\n \"communities\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"community\")),\n type: text(\"type\")\n .$type<Community[\"type\"]>()\n .notNull()\n .generatedAlwaysAs(sql`'community'`),\n title: text(\"title\").notNull(),\n slug: text(\"slug\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n status: text(\"status\", { enum: [\"draft\", \"published\"] })\n .notNull()\n .default(\"draft\"),\n thumbnailAssetId: text(\"thumbnail_asset_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.id] }),\n slugUq: unique().on(t.orgId, t.slug),\n contentItemFk: foreignKey({\n columns: [t.orgId, t.id, t.type],\n foreignColumns: [contentItems.orgId, contentItems.id, contentItems.type],\n }).onDelete(\"cascade\"),\n thumbnailAssetFk: foreignKey({\n columns: [t.orgId, t.thumbnailAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n thumbnailIdx: index(\"communities_thumbnail_idx\").on(t.orgId, t.thumbnailAssetId),\n }),\n);\n\nexport const spaces = pgTable(\n \"spaces\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"space\")),\n communityId: text(\"community_id\").notNull(),\n name: text(\"name\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n seq: integer(\"seq\").notNull(),\n accessRule: text(\"access_rule\", { enum: [\"all_members\", \"by_request\", \"by_invite\"] })\n .notNull()\n .default(\"all_members\"),\n capacity: integer(\"capacity\"),\n settings: jsonb(\"settings\")\n .$type<Space[\"settings\"]>()\n .notNull()\n .default({ comments: true, reactions: true, requireReview: false }),\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 capacityCk: check(\n \"spaces_capacity_check\",\n sql`${t.capacity} is null or ${t.accessRule} <> 'all_members'`,\n ),\n orderIdx: index(\"spaces_order_idx\").on(t.orgId, t.communityId, t.seq),\n }),\n);\n\nexport const spaceTopics = pgTable(\n \"space_topics\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"topic\")),\n spaceId: text(\"space_id\").notNull(),\n name: text(\"name\").notNull(),\n seq: integer(\"seq\").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.id] }),\n nameUq: unique().on(t.orgId, t.spaceId, t.name),\n spaceUq: unique().on(t.orgId, t.spaceId, t.id),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId],\n foreignColumns: [spaces.orgId, spaces.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const spaceLinks = pgTable(\n \"space_links\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"spaceLink\")),\n spaceId: text(\"space_id\").notNull(),\n contentId: text(\"content_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.id] }),\n contentUq: unique().on(t.orgId, t.spaceId, t.contentId),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId],\n foreignColumns: [spaces.orgId, spaces.id],\n }).onDelete(\"cascade\"),\n contentFk: foreignKey({\n columns: [t.orgId, t.contentId],\n foreignColumns: [contentItems.orgId, contentItems.id],\n }).onDelete(\"cascade\"),\n contentIdx: index(\"space_links_content_idx\").on(t.orgId, t.contentId),\n }),\n);\n\ntype _BundlesDrift = Expect<NoDrift<typeof bundles.$inferSelect, Bundle>>;\ntype _BundleItemsDrift = Expect<NoDrift<typeof bundleItems.$inferSelect, BundleItem>>;\ntype _ContentItemsDrift = Expect<NoDrift<typeof contentItems.$inferSelect, ContentItem>>;\ntype _CoursesDrift = Expect<NoDrift<typeof courses.$inferSelect, Omit<Course, \"settings\">>>;\ntype _ModulesDrift = Expect<NoDrift<typeof modules.$inferSelect, Module>>;\ntype _ActivitiesDrift = Expect<NoDrift<typeof activities.$inferSelect, Activity>>;\ntype _ActivityAssetsDrift = Expect<NoDrift<typeof activityAssets.$inferSelect, ActivityAsset>>;\ntype _DownloadsDrift = Expect<NoDrift<typeof downloads.$inferSelect, Download>>;\ntype _DownloadAssetsDrift = Expect<NoDrift<typeof downloadAssets.$inferSelect, DownloadAsset>>;\ntype _CommunitiesDrift = Expect<\n NoDrift<typeof communities.$inferSelect, Omit<Community, \"settings\">>\n>;\ntype _SpacesDrift = Expect<NoDrift<typeof spaces.$inferSelect, Space>>;\ntype _SpaceTopicsDrift = Expect<NoDrift<typeof spaceTopics.$inferSelect, SpaceTopic>>;\ntype _SpaceLinksDrift = Expect<NoDrift<typeof spaceLinks.$inferSelect, SpaceLink>>;\n"],"mappings":";;;;;;AAkCA,MAAa,UAAU,QACrB,WACA;CACE,OAAO,KAAK,QAAQ,CAAC,CAClB,QAAQ,CAAC,CACT,iBAAiB,cAAc,EAAE;CACpC,IAAI,KAAK,IAAI,CAAC,CAAC,QAAQ;CACvB,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,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,EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAC3C,QAAQ,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;AAC3C,EACF;AAIA,MAAa,eAAe,QAC1B,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EAAE,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;CAC3C,WAAW,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;CACtD,SAAS,WAAW;EAClB,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO;EAC5B,gBAAgB,CAAC,OAAO,OAAO,OAAO,EAAE;CAC1C,CAAC,CAAC,CAAC,SAAS,SAAS;CACrB,WAAW,WAAW;EACpB,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS;EAC9B,gBAAgB,CAAC,aAAa,OAAO,aAAa,EAAE;CACtD,CAAC,CAAC,CAAC,SAAS,SAAS;CACrB,YAAY,MAAM,yBAAyB,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS;AACtE,EACF"}
|
|
1
|
+
{"version":3,"file":"content.js","names":[],"sources":["../../src/schema/content.ts"],"sourcesContent":["import {\n pgTable,\n text,\n integer,\n jsonb,\n timestamp,\n primaryKey,\n foreignKey,\n unique,\n index,\n check,\n} from \"drizzle-orm/pg-core\";\nimport { sql } from \"drizzle-orm\";\nimport type {\n Activity,\n ActivityAsset,\n Bundle,\n BundleItem,\n Community,\n ContentItem,\n Course,\n Download,\n DownloadAsset,\n Event,\n EventAsset,\n Module,\n Space,\n SpaceLink,\n SpaceTopic,\n} from \"@headless-lms/core/schemas\";\nimport { genId } from \"@headless-lms/core/shared/id\";\nimport { organizations } from \"./organizations.js\";\nimport { assets } from \"./assets.js\";\nimport type { Expect, NoDrift } from \"./drift.js\";\n\n// Bundles.\nexport const bundles = pgTable(\n \"bundles\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\").notNull(),\n name: text(\"name\").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.id] }),\n typeUq: unique().on(t.orgId, t.id, t.name),\n }),\n);\n\n// The content registry one row per piece of content, any\n// type. this is so we can PK to content items of different types.\nexport const contentItems = pgTable(\n \"content_items\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\").notNull(),\n type: text(\"type\", { enum: [\"course\", \"download\", \"community\", \"event\"] }).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.id] }),\n // FK target for type-pinned references from concrete content tables.\n typeUq: unique().on(t.orgId, t.id, t.type),\n // Widened per new content type.\n typeCk: check(\n \"content_items_type_check\",\n sql`${t.type} in ('course', 'download', 'community', 'event')`,\n ),\n }),\n);\n\n// The content registry one row per piece of content, any\n// type. this is so we can PK to content items of different types.\nexport const bundleItems = pgTable(\n \"bundle_items\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n bundleId: text(\"bundle_id\").notNull(),\n contentId: text(\"content_id\").notNull(),\n\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.bundleId, t.contentId] }),\n contentItemFk: foreignKey({\n columns: [t.orgId, t.contentId],\n foreignColumns: [contentItems.orgId, contentItems.id],\n }).onDelete(\"cascade\"),\n bundleFk: foreignKey({\n columns: [t.orgId, t.bundleId],\n foreignColumns: [bundles.orgId, bundles.id],\n }).onDelete(\"cascade\"),\n contentIdx: index(\"bundle_items_content_idx\").on(t.orgId, t.contentId),\n }),\n);\n\nexport const courses = pgTable(\n \"courses\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"course\")),\n // Pinned to 'course' so the composite FK below cannot attach this row to a\n // registry row of another content type.\n type: text(\"type\")\n .$type<Course[\"type\"]>()\n .notNull()\n .generatedAlwaysAs(sql`'course'`),\n title: text(\"title\").notNull(),\n slug: text(\"slug\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n status: text(\"status\", { enum: [\"draft\", \"published\"] })\n .notNull()\n .default(\"draft\"),\n category: text(\"category\").notNull().default(\"\"),\n // Media-library asset rendered as the course's cover. Null = no cover.\n thumbnailAssetId: text(\"thumbnail_asset_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.id] }),\n slugUq: unique().on(t.orgId, t.slug),\n contentItemFk: foreignKey({\n columns: [t.orgId, t.id, t.type],\n foreignColumns: [contentItems.orgId, contentItems.id, contentItems.type],\n }).onDelete(\"cascade\"),\n // Restrictive, like `activity_assets.assetFk` — the asset is owned by the\n // assets domain and must be unlinked before it can be deleted. MATCH SIMPLE\n // means the constraint is skipped entirely while the thumbnail is null.\n thumbnailAssetFk: foreignKey({\n columns: [t.orgId, t.thumbnailAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n thumbnailIdx: index(\"courses_thumbnail_idx\").on(t.orgId, t.thumbnailAssetId),\n }),\n);\n\nexport const modules = pgTable(\n \"modules\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"module\")),\n courseId: text(\"course_id\").notNull(),\n title: text(\"title\").notNull(),\n seq: integer(\"seq\").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.id] }),\n // Modules are part of the course aggregate: deleting the course deletes them.\n courseFk: foreignKey({\n columns: [t.orgId, t.courseId],\n foreignColumns: [courses.orgId, courses.id],\n }).onDelete(\"cascade\"),\n // FK target for the course-pinned reference from activities.\n courseUq: unique().on(t.orgId, t.id, t.courseId),\n }),\n);\n\n// The leaf, directly in a module. Uniform content: seq + opaque settings blob.\nexport const activities = pgTable(\n \"activities\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"activity\")),\n moduleId: text(\"module_id\").notNull(),\n // Denormalised from the module: the course an activity belongs to is asked\n // for far more often than its module (progress, discussion, entitlements),\n // and the FK below pins the pair, so it cannot disagree with the module.\n courseId: text(\"course_id\").notNull(),\n seq: integer(\"seq\").notNull(),\n // Opaque per-activity blob: title, type, body, completion rule — whatever the\n // content needs. Assets are the one thing kept out of the blob.\n settings: jsonb(\"settings\").$type<Activity[\"settings\"]>(),\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 // Course-pinned, like `courses.contentItemFk`: the module reference carries\n // `course_id`, so an activity whose stored course disagrees with its\n // module's is rejected by the database rather than silently rotting.\n moduleFk: foreignKey({\n columns: [t.orgId, t.moduleId, t.courseId],\n foreignColumns: [modules.orgId, modules.id, modules.courseId],\n }).onDelete(\"cascade\"),\n seqUq: unique().on(t.orgId, t.moduleId, t.seq),\n }),\n);\n\n// activity ↔ asset: many-to-many (an activity uses many assets; an asset can be\n// reused by many activities). Assets owned by the assets domain, tracked here.\nexport const activityAssets = pgTable(\n \"activity_assets\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"activityAsset\")),\n activityId: text(\"activity_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.id] }),\n // The link cascades with its activity; the asset itself is owned by the\n // assets domain and survives (assetFk stays restrictive).\n activityFk: foreignKey({\n columns: [t.orgId, t.activityId],\n foreignColumns: [activities.orgId, activities.id],\n }).onDelete(\"cascade\"),\n assetFk: foreignKey({\n columns: [t.orgId, t.assetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n activityAssetUq: unique().on(t.orgId, t.activityId, t.assetId),\n assetIdx: index(\"activity_assets_asset_idx\").on(t.orgId, t.assetId),\n }),\n);\n\n// A download: an ordered set of media-library assets. Shares its PK with a\n// registry row (same id) via the type-pinned composite FK, exactly like courses.\nexport const downloads = pgTable(\n \"downloads\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"download\")),\n // Pinned to 'download' so the composite FK below cannot attach this row to\n // a registry row of another content type.\n type: text(\"type\")\n .$type<Download[\"type\"]>()\n .notNull()\n .generatedAlwaysAs(sql`'download'`),\n title: text(\"title\").notNull(),\n slug: text(\"slug\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n status: text(\"status\", { enum: [\"draft\", \"published\"] })\n .notNull()\n .default(\"draft\"),\n category: text(\"category\").notNull().default(\"\"),\n thumbnailAssetId: text(\"thumbnail_asset_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.id] }),\n slugUq: unique().on(t.orgId, t.slug),\n contentItemFk: foreignKey({\n columns: [t.orgId, t.id, t.type],\n foreignColumns: [contentItems.orgId, contentItems.id, contentItems.type],\n }).onDelete(\"cascade\"),\n // Restrictive: a thumbnail in use blocks deleting the asset.\n thumbnailFk: foreignKey({\n columns: [t.orgId, t.thumbnailAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n thumbnailIdx: index(\"downloads_thumbnail_idx\").on(t.orgId, t.thumbnailAssetId),\n }),\n);\n\n// download ↔ asset: the ordered set. Mirrors activity_assets one level\n// shallower — a download has no intermediate structure.\nexport const downloadAssets = pgTable(\n \"download_assets\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"downloadAsset\")),\n downloadId: text(\"download_id\").notNull(),\n assetId: text(\"asset_id\").notNull(),\n seq: integer(\"seq\").notNull().default(0),\n // Author's label; null falls back to the asset's filename.\n displayName: text(\"display_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 (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n // The link cascades with its download; the asset is owned by the assets\n // domain and survives (assetFk stays restrictive).\n downloadFk: foreignKey({\n columns: [t.orgId, t.downloadId],\n foreignColumns: [downloads.orgId, downloads.id],\n }).onDelete(\"cascade\"),\n assetFk: foreignKey({\n columns: [t.orgId, t.assetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n // Lets delivery key on asset_id rather than the link row id.\n downloadAssetUq: unique().on(t.orgId, t.downloadId, t.assetId),\n assetIdx: index(\"download_assets_asset_idx\").on(t.orgId, t.assetId),\n }),\n);\n\nexport const events = pgTable(\n \"events\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"contentEvent\")),\n type: text(\"type\")\n .$type<Event[\"type\"]>()\n .notNull()\n .generatedAlwaysAs(sql`'event'`),\n title: text(\"title\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n thumbnailAssetId: text(\"thumbnail_asset_id\"),\n status: text(\"status\", { enum: [\"draft\", \"published\", \"canceled\"] })\n .notNull()\n .default(\"draft\"),\n startsAt: timestamp(\"starts_at\", { withTimezone: true }).notNull(),\n endsAt: timestamp(\"ends_at\", { withTimezone: true }).notNull(),\n timeZone: text(\"time_zone\").notNull(),\n location: jsonb(\"location\")\n .$type<Event[\"location\"]>()\n .notNull()\n .default({ venue: null, online: null }),\n recording: jsonb(\"recording\").$type<Event[\"recording\"]>(),\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 contentItemFk: foreignKey({\n columns: [t.orgId, t.id, t.type],\n foreignColumns: [contentItems.orgId, contentItems.id, contentItems.type],\n }).onDelete(\"cascade\"),\n thumbnailAssetFk: foreignKey({\n columns: [t.orgId, t.thumbnailAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n thumbnailIdx: index(\"events_thumbnail_idx\").on(t.orgId, t.thumbnailAssetId),\n startsIdx: index(\"events_status_starts_idx\").on(t.orgId, t.status, t.startsAt),\n timesCk: check(\"events_times_check\", sql`${t.endsAt} > ${t.startsAt}`),\n }),\n);\n\nexport const eventAssets = pgTable(\n \"event_assets\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"eventAsset\")),\n eventId: text(\"event_id\").notNull(),\n assetId: text(\"asset_id\").notNull(),\n seq: integer(\"seq\").notNull().default(0),\n displayName: text(\"display_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 (t) => ({\n pk: primaryKey({ columns: [t.orgId, t.id] }),\n eventFk: foreignKey({\n columns: [t.orgId, t.eventId],\n foreignColumns: [events.orgId, events.id],\n }).onDelete(\"cascade\"),\n assetFk: foreignKey({\n columns: [t.orgId, t.assetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n eventAssetUq: unique().on(t.orgId, t.eventId, t.assetId),\n assetIdx: index(\"event_assets_asset_idx\").on(t.orgId, t.assetId),\n }),\n);\n\nexport const communities = pgTable(\n \"communities\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"community\")),\n type: text(\"type\")\n .$type<Community[\"type\"]>()\n .notNull()\n .generatedAlwaysAs(sql`'community'`),\n title: text(\"title\").notNull(),\n slug: text(\"slug\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n status: text(\"status\", { enum: [\"draft\", \"published\"] })\n .notNull()\n .default(\"draft\"),\n thumbnailAssetId: text(\"thumbnail_asset_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.id] }),\n slugUq: unique().on(t.orgId, t.slug),\n contentItemFk: foreignKey({\n columns: [t.orgId, t.id, t.type],\n foreignColumns: [contentItems.orgId, contentItems.id, contentItems.type],\n }).onDelete(\"cascade\"),\n thumbnailAssetFk: foreignKey({\n columns: [t.orgId, t.thumbnailAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n thumbnailIdx: index(\"communities_thumbnail_idx\").on(t.orgId, t.thumbnailAssetId),\n }),\n);\n\nexport const spaces = pgTable(\n \"spaces\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"space\")),\n communityId: text(\"community_id\").notNull(),\n name: text(\"name\").notNull(),\n description: text(\"description\").notNull().default(\"\"),\n seq: integer(\"seq\").notNull(),\n accessRule: text(\"access_rule\", { enum: [\"all_members\", \"by_request\", \"by_invite\"] })\n .notNull()\n .default(\"all_members\"),\n capacity: integer(\"capacity\"),\n settings: jsonb(\"settings\")\n .$type<Space[\"settings\"]>()\n .notNull()\n .default({ comments: true, reactions: true, requireReview: false }),\n coverAssetId: text(\"cover_asset_id\"),\n backgroundAssetId: text(\"background_asset_id\"),\n iconAssetId: text(\"icon_asset_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.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 capacityCk: check(\n \"spaces_capacity_check\",\n sql`${t.capacity} is null or ${t.accessRule} <> 'all_members'`,\n ),\n orderIdx: index(\"spaces_order_idx\").on(t.orgId, t.communityId, t.seq),\n coverAssetFk: foreignKey({\n columns: [t.orgId, t.coverAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n backgroundAssetFk: foreignKey({\n columns: [t.orgId, t.backgroundAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n iconAssetFk: foreignKey({\n columns: [t.orgId, t.iconAssetId],\n foreignColumns: [assets.orgId, assets.id],\n }),\n coverIdx: index(\"spaces_cover_idx\").on(t.orgId, t.coverAssetId),\n backgroundIdx: index(\"spaces_background_idx\").on(t.orgId, t.backgroundAssetId),\n iconIdx: index(\"spaces_icon_idx\").on(t.orgId, t.iconAssetId),\n }),\n);\n\nexport const spaceTopics = pgTable(\n \"space_topics\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"topic\")),\n spaceId: text(\"space_id\").notNull(),\n name: text(\"name\").notNull(),\n seq: integer(\"seq\").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.id] }),\n nameUq: unique().on(t.orgId, t.spaceId, t.name),\n spaceUq: unique().on(t.orgId, t.spaceId, t.id),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId],\n foreignColumns: [spaces.orgId, spaces.id],\n }).onDelete(\"cascade\"),\n }),\n);\n\nexport const spaceLinks = pgTable(\n \"space_links\",\n {\n orgId: text(\"org_id\")\n .notNull()\n .references(() => organizations.id),\n id: text(\"id\")\n .notNull()\n .$defaultFn(() => genId(\"spaceLink\")),\n spaceId: text(\"space_id\").notNull(),\n contentId: text(\"content_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.id] }),\n contentUq: unique().on(t.orgId, t.spaceId, t.contentId),\n spaceFk: foreignKey({\n columns: [t.orgId, t.spaceId],\n foreignColumns: [spaces.orgId, spaces.id],\n }).onDelete(\"cascade\"),\n contentFk: foreignKey({\n columns: [t.orgId, t.contentId],\n foreignColumns: [contentItems.orgId, contentItems.id],\n }).onDelete(\"cascade\"),\n contentIdx: index(\"space_links_content_idx\").on(t.orgId, t.contentId),\n }),\n);\n\ntype _BundlesDrift = Expect<NoDrift<typeof bundles.$inferSelect, Bundle>>;\ntype _BundleItemsDrift = Expect<NoDrift<typeof bundleItems.$inferSelect, BundleItem>>;\ntype _ContentItemsDrift = Expect<NoDrift<typeof contentItems.$inferSelect, ContentItem>>;\ntype _CoursesDrift = Expect<NoDrift<typeof courses.$inferSelect, Omit<Course, \"settings\">>>;\ntype _ModulesDrift = Expect<NoDrift<typeof modules.$inferSelect, Module>>;\ntype _ActivitiesDrift = Expect<NoDrift<typeof activities.$inferSelect, Activity>>;\ntype _ActivityAssetsDrift = Expect<NoDrift<typeof activityAssets.$inferSelect, ActivityAsset>>;\ntype _DownloadsDrift = Expect<NoDrift<typeof downloads.$inferSelect, Download>>;\ntype _DownloadAssetsDrift = Expect<NoDrift<typeof downloadAssets.$inferSelect, DownloadAsset>>;\ntype _EventsDrift = Expect<NoDrift<typeof events.$inferSelect, Omit<Event, \"settings\">>>;\ntype _EventAssetsDrift = Expect<NoDrift<typeof eventAssets.$inferSelect, EventAsset>>;\ntype _CommunitiesDrift = Expect<\n NoDrift<typeof communities.$inferSelect, Omit<Community, \"settings\">>\n>;\ntype _SpacesDrift = Expect<NoDrift<typeof spaces.$inferSelect, Space>>;\ntype _SpaceTopicsDrift = Expect<NoDrift<typeof spaceTopics.$inferSelect, SpaceTopic>>;\ntype _SpaceLinksDrift = Expect<NoDrift<typeof spaceLinks.$inferSelect, SpaceLink>>;\n"],"mappings":";;;;;;AAoCA,MAAa,UAAU,QACrB,WACA;CACE,OAAO,KAAK,QAAQ,CAAC,CAClB,QAAQ,CAAC,CACT,iBAAiB,cAAc,EAAE;CACpC,IAAI,KAAK,IAAI,CAAC,CAAC,QAAQ;CACvB,MAAM,KAAK,MAAM,CAAC,CAAC,QAAQ;CAC3B,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,gCAA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AAE,CAAC;CAC3C,WAAW,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS;CACtD,SAAS,WAAW;EAClB,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO;EAC5B,gBAAgB,CAAC,OAAO,OAAO,OAAO,EAAE;CAC1C,CAAC,CAAC,CAAC,SAAS,SAAS;CACrB,WAAW,WAAW;EACpB,SAAS,CAAC,EAAE,OAAO,EAAE,SAAS;EAC9B,gBAAgB,CAAC,aAAa,OAAO,aAAa,EAAE;CACtD,CAAC,CAAC,CAAC,SAAS,SAAS;CACrB,YAAY,MAAM,yBAAyB,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS;AACtE,EACF"}
|
|
@@ -1666,6 +1666,23 @@ declare const messages: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
|
1666
1666
|
identity: undefined;
|
|
1667
1667
|
generated: undefined;
|
|
1668
1668
|
}, {}, {}>;
|
|
1669
|
+
clientId: import("drizzle-orm/pg-core").PgColumn<{
|
|
1670
|
+
name: "client_id";
|
|
1671
|
+
tableName: "messages";
|
|
1672
|
+
dataType: "string";
|
|
1673
|
+
columnType: "PgUUID";
|
|
1674
|
+
data: string;
|
|
1675
|
+
driverParam: string;
|
|
1676
|
+
notNull: false;
|
|
1677
|
+
hasDefault: false;
|
|
1678
|
+
isPrimaryKey: false;
|
|
1679
|
+
isAutoincrement: false;
|
|
1680
|
+
hasRuntimeDefault: false;
|
|
1681
|
+
enumValues: undefined;
|
|
1682
|
+
baseColumn: never;
|
|
1683
|
+
identity: undefined;
|
|
1684
|
+
generated: undefined;
|
|
1685
|
+
}, {}, {}>;
|
|
1669
1686
|
editedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
1670
1687
|
name: "edited_at";
|
|
1671
1688
|
tableName: "messages";
|
|
@@ -2,7 +2,7 @@ import { assets } from "./assets.js";
|
|
|
2
2
|
import { activities, communities, spaceTopics, spaces } from "./content.js";
|
|
3
3
|
import { orgUsers, organizations } from "./organizations.js";
|
|
4
4
|
import { desc, sql } from "drizzle-orm";
|
|
5
|
-
import { boolean, check, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, unique } from "drizzle-orm/pg-core";
|
|
5
|
+
import { boolean, check, foreignKey, index, integer, jsonb, pgTable, primaryKey, text, timestamp, unique, uniqueIndex, uuid } from "drizzle-orm/pg-core";
|
|
6
6
|
import { genId } from "@headless-lms/core/shared/id";
|
|
7
7
|
//#region src/schema/discussion.ts
|
|
8
8
|
const posts = pgTable("posts", {
|
|
@@ -318,6 +318,7 @@ const messages = pgTable("messages", {
|
|
|
318
318
|
orgUserId: text("org_user_id").notNull(),
|
|
319
319
|
body: text("body").notNull(),
|
|
320
320
|
replyToId: text("reply_to_id"),
|
|
321
|
+
clientId: uuid("client_id"),
|
|
321
322
|
editedAt: timestamp("edited_at", { withTimezone: true }),
|
|
322
323
|
deletedAt: timestamp("deleted_at", { withTimezone: true }),
|
|
323
324
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
@@ -346,7 +347,8 @@ const messages = pgTable("messages", {
|
|
|
346
347
|
foreignColumns: [t.orgId, t.id]
|
|
347
348
|
}),
|
|
348
349
|
chatIdx: index("messages_chat_idx").on(t.orgId, t.chatId, t.createdAt),
|
|
349
|
-
replyIdx: index("messages_reply_idx").on(t.orgId, t.replyToId)
|
|
350
|
+
replyIdx: index("messages_reply_idx").on(t.orgId, t.replyToId),
|
|
351
|
+
clientUq: uniqueIndex("messages_client_id_uq").on(t.orgId, t.chatId, t.orgUserId, t.clientId)
|
|
350
352
|
}));
|
|
351
353
|
const messageAttachments = pgTable("message_attachments", {
|
|
352
354
|
orgId: text("org_id").notNull().references(() => organizations.id),
|
|
@@ -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 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.$inferSelect, M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;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"}
|
|
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 uniqueIndex,\n uuid,\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 clientId: uuid(\"client_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 clientUq: uniqueIndex(\"messages_client_id_uq\").on(t.orgId, t.chatId, t.orgUserId, t.clientId),\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.$inferSelect, Mention>>;\n"],"mappings":";;;;;;;AAsDA,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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AO,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"}
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { invites, orgUsers, organizations } from "./organizations.js";
|
|
2
|
-
import { activities, activityAssets, bundleItems, bundles, communities, contentItems, courses, downloadAssets, downloads, modules, spaceLinks, spaceTopics, spaces } from "./content.js";
|
|
2
|
+
import { activities, activityAssets, bundleItems, bundles, communities, contentItems, courses, downloadAssets, downloads, eventAssets, events, modules, spaceLinks, spaceTopics, spaces } from "./content.js";
|
|
3
3
|
import { contentAccess, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, spaceMembers } from "./entitlements.js";
|
|
4
4
|
import { progressRecords } from "./progress.js";
|
|
5
5
|
import { devices, notificationSettings, userProfiles, users } from "./identity.js";
|
|
@@ -10,9 +10,10 @@ import { eventOutbox } from "./outbox.js";
|
|
|
10
10
|
import { automationRuns, automations, notificationDeliveries, notifications } from "./automations.js";
|
|
11
11
|
import { settings } from "./settings.js";
|
|
12
12
|
import { blockedUsers, chatUsers, chats, commentFlags, commentReactions, comments, digestRuns, mentions, messageAttachments, messageFlags, messageReactions, messages, postBookmarks, postFlags, postReactions, posts, subscriptions } from "./discussion.js";
|
|
13
|
+
import { orgRoles, roleAssignments } from "./roles.js";
|
|
13
14
|
declare namespace index_d_exports {
|
|
14
|
-
export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventOutbox, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
|
|
15
|
+
export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventAssets, eventOutbox, events, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgRoles, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, roleAssignments, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
|
|
15
16
|
}
|
|
16
17
|
//#endregion
|
|
17
|
-
export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventOutbox, index_d_exports, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
|
|
18
|
+
export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventAssets, eventOutbox, events, index_d_exports, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgRoles, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, roleAssignments, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/schema/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { assets } from "./assets.js";
|
|
3
|
-
import { activities, activityAssets, bundleItems, bundles, communities, contentItems, courses, downloadAssets, downloads, modules, spaceLinks, spaceTopics, spaces } from "./content.js";
|
|
3
|
+
import { activities, activityAssets, bundleItems, bundles, communities, contentItems, courses, downloadAssets, downloads, eventAssets, events, modules, spaceLinks, spaceTopics, spaces } from "./content.js";
|
|
4
4
|
import { devices, notificationSettings, userProfiles, users } from "./identity.js";
|
|
5
5
|
import { invites, orgUsers, organizations } from "./organizations.js";
|
|
6
6
|
import { contentAccess, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, spaceMembers } from "./entitlements.js";
|
|
@@ -11,6 +11,7 @@ import { eventOutbox } from "./outbox.js";
|
|
|
11
11
|
import { automationRuns, automations, notificationDeliveries, notifications } from "./automations.js";
|
|
12
12
|
import { settings } from "./settings.js";
|
|
13
13
|
import { blockedUsers, chatUsers, chats, commentFlags, commentReactions, comments, digestRuns, mentions, messageAttachments, messageFlags, messageReactions, messages, postBookmarks, postFlags, postReactions, posts, subscriptions } from "./discussion.js";
|
|
14
|
+
import { orgRoles, roleAssignments } from "./roles.js";
|
|
14
15
|
//#region src/schema/index.ts
|
|
15
16
|
var schema_exports = /* @__PURE__ */ __exportAll({
|
|
16
17
|
activities: () => activities,
|
|
@@ -39,7 +40,9 @@ var schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
39
40
|
entitlementEndingSoonNotices: () => entitlementEndingSoonNotices,
|
|
40
41
|
entitlementExpiryNotices: () => entitlementExpiryNotices,
|
|
41
42
|
entitlements: () => entitlements,
|
|
43
|
+
eventAssets: () => eventAssets,
|
|
42
44
|
eventOutbox: () => eventOutbox,
|
|
45
|
+
events: () => events,
|
|
43
46
|
invites: () => invites,
|
|
44
47
|
mentions: () => mentions,
|
|
45
48
|
messageAttachments: () => messageAttachments,
|
|
@@ -50,6 +53,7 @@ var schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
50
53
|
notificationDeliveries: () => notificationDeliveries,
|
|
51
54
|
notificationSettings: () => notificationSettings,
|
|
52
55
|
notifications: () => notifications,
|
|
56
|
+
orgRoles: () => orgRoles,
|
|
53
57
|
orgUsers: () => orgUsers,
|
|
54
58
|
organizations: () => organizations,
|
|
55
59
|
postBookmarks: () => postBookmarks,
|
|
@@ -57,6 +61,7 @@ var schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
57
61
|
postReactions: () => postReactions,
|
|
58
62
|
posts: () => posts,
|
|
59
63
|
progressRecords: () => progressRecords,
|
|
64
|
+
roleAssignments: () => roleAssignments,
|
|
60
65
|
settings: () => settings,
|
|
61
66
|
spaceLinks: () => spaceLinks,
|
|
62
67
|
spaceMembers: () => spaceMembers,
|
|
@@ -67,6 +72,6 @@ var schema_exports = /* @__PURE__ */ __exportAll({
|
|
|
67
72
|
users: () => users
|
|
68
73
|
});
|
|
69
74
|
//#endregion
|
|
70
|
-
export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventOutbox, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, schema_exports, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
|
|
75
|
+
export { activities, activityAssets, assets, automationRuns, automations, blockedUsers, bundleItems, bundles, chatUsers, chats, commentFlags, commentReactions, comments, communities, connections, contentAccess, contentItems, courses, credentials, devices, digestRuns, downloadAssets, downloads, entitlementEndingSoonNotices, entitlementExpiryNotices, entitlements, eventAssets, eventOutbox, events, invites, mentions, messageAttachments, messageFlags, messageReactions, messages, modules, notificationDeliveries, notificationSettings, notifications, orgRoles, orgUsers, organizations, postBookmarks, postFlags, postReactions, posts, progressRecords, roleAssignments, schema_exports, settings, spaceLinks, spaceMembers, spaceTopics, spaces, subscriptions, userProfiles, users };
|
|
71
76
|
|
|
72
77
|
//# sourceMappingURL=index.js.map
|
package/dist/schema/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/schema/index.ts"],"sourcesContent":["// Centralized Drizzle schema. All domain tables live here, grouped by the\n// bounded context that owns them. Re-exported so drizzle-kit and the\n// repositories have a single import surface.\nexport * from \"./organizations.js\";\nexport * from \"./content.js\";\nexport * from \"./entitlements.js\";\nexport * from \"./progress.js\";\nexport * from \"./identity.js\";\nexport * from \"./assets.js\";\nexport * from \"./credentials.js\";\nexport * from \"./integrations.js\";\nexport * from \"./outbox.js\";\nexport * from \"./automations.js\";\nexport * from \"./settings.js\";\nexport * from \"./discussion.js\";\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/schema/index.ts"],"sourcesContent":["// Centralized Drizzle schema. All domain tables live here, grouped by the\n// bounded context that owns them. Re-exported so drizzle-kit and the\n// repositories have a single import surface.\nexport * from \"./organizations.js\";\nexport * from \"./content.js\";\nexport * from \"./entitlements.js\";\nexport * from \"./progress.js\";\nexport * from \"./identity.js\";\nexport * from \"./assets.js\";\nexport * from \"./credentials.js\";\nexport * from \"./integrations.js\";\nexport * from \"./outbox.js\";\nexport * from \"./automations.js\";\nexport * from \"./settings.js\";\nexport * from \"./discussion.js\";\nexport * from \"./roles.js\";\n"],"mappings":""}
|