Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat: share documents with links that expire (#803)

André61a5dcb353d1
diff --git a/apps/api/AGENTS.md b/apps/api/AGENTS.md
index 7a49c309..0fca216a 100644
--- a/apps/api/AGENTS.md
+++ b/apps/api/AGENTS.md
@@ -108,6 +108,9 @@ Enforced through macros in the route options.
role is `member`. Its rank can be changed, and the sync then leaves the row alone.
- `GET /attachments/:publicId/raw` is public. Keep `X-Content-Type-Options: nosniff`, forced
download outside a strict media allowlist, and the locked-down CSP.
+- `GET /share/document/:token/assets/:publicId/raw` serves a Docs asset without a session, only
+ while the token is a live link to the page that holds it or to an ancestor that shares its
+ subpages. It sends the same response as the route above.
## Tests
diff --git a/apps/api/src/modules/documents/model.ts b/apps/api/src/modules/documents/model.ts
index e0c53aac..67090ed9 100644
--- a/apps/api/src/modules/documents/model.ts
+++ b/apps/api/src/modules/documents/model.ts
@@ -47,6 +47,10 @@ export const DocumentResponse = t.Composite([
t.Object({
content: t.String(),
contentJson: t.Nullable(t.Record(t.String(), t.Any())),
+ shareToken: t.Nullable(t.String()),
+ shareExpiresAt: t.Nullable(t.String()),
+ shareIncludeChildren: t.Boolean(),
+ shareIncludeIssues: t.Boolean(),
}),
]);
diff --git a/apps/api/src/modules/documents/service.ts b/apps/api/src/modules/documents/service.ts
index 968052d7..add46a97 100644
--- a/apps/api/src/modules/documents/service.ts
+++ b/apps/api/src/modules/documents/service.ts
@@ -22,7 +22,7 @@ import {
or,
sql,
} from 'drizzle-orm';
-import { HttpError, iso } from '#shared/lib';
+import { HttpError, iso, shareLive } from '#shared/lib';
import { MENTION_HANDLE_RE } from '#shared/mentions';
import { documentMentionHandles, fanOutTextMentions } from './mentions';
import {
@@ -91,6 +91,12 @@ export interface DocumentSummaryRow {
export interface DocumentRow extends DocumentSummaryRow {
content: string;
contentJson: Record<string, unknown> | null;
+ // The public share link. A link past its expiry reads as not shared even before
+ // the sweep clears it.
+ shareToken: string | null;
+ shareExpiresAt: string | null;
+ shareIncludeChildren: boolean;
+ shareIncludeIssues: boolean;
}
export interface DocumentRevisionSummaryRow {
@@ -130,12 +136,26 @@ function documentAccess(userId: string) {
return or(eq(projectDocument.isPrivate, false), eq(projectDocument.ownerUserId, userId));
}
+// The columns that revoke a page's share link. A private page has no public link, so
+// making a page private writes them too.
+export const revokedDocumentShare = {
+ shareToken: null,
+ shareExpiresAt: null,
+ shareIncludeChildren: false,
+ shareIncludeIssues: false,
+};
+
function mapDocument(row: typeof projectDocument.$inferSelect, isFavorite = false): DocumentRow {
const { archivedByAncestorId: _archivedByAncestorId, ...publicRow } = row;
+ const shared = row.shareToken !== null && shareLive(row.shareExpiresAt);
return {
...publicRow,
isFavorite,
archivedAt: row.archivedAt ? iso(row.archivedAt) : null,
+ shareToken: shared ? row.shareToken : null,
+ shareExpiresAt: shared && row.shareExpiresAt ? iso(row.shareExpiresAt) : null,
+ shareIncludeChildren: shared && row.shareIncludeChildren,
+ shareIncludeIssues: shared && row.shareIncludeIssues,
createdAt: iso(row.createdAt),
updatedAt: iso(row.updatedAt),
};
@@ -145,7 +165,15 @@ function summaryOf(
row: typeof projectDocument.$inferSelect,
isFavorite = false,
): DocumentSummaryRow {
- const { content: _content, contentJson: _contentJson, ...summary } = mapDocument(row, isFavorite);
+ const {
+ content: _content,
+ contentJson: _contentJson,
+ shareToken: _shareToken,
+ shareExpiresAt: _shareExpiresAt,
+ shareIncludeChildren: _shareIncludeChildren,
+ shareIncludeIssues: _shareIncludeIssues,
+ ...summary
+ } = mapDocument(row, isFavorite);
return summary;
}
@@ -179,32 +207,39 @@ export function replaceAssetReferences<T>(
targetProject: { teamId: number; key: string },
targetDocumentId: number,
publicIds: Map<string, string>,
+): T {
+ return rewriteAssetUrls(value, sourceDocumentId, (match, mediaPrefix, publicId) => {
+ const targetPublicId = publicIds.get(publicId.toLowerCase());
+ return targetPublicId
+ ? `${mediaPrefix ?? ''}${documentAssetPath(targetProject, targetDocumentId, targetPublicId)}`
+ : match;
+ });
+}
+
+// Rewrites every asset URL in a document body, its Markdown or its Tiptap JSON: those
+// of one document, or of any document when documentId is null.
+export function rewriteAssetUrls<T>(
+ value: T,
+ documentId: number | null,
+ replace: (match: string, mediaPrefix: string | undefined, publicId: string) => string,
): T {
if (typeof value === 'string') {
- const replaced = value.replace(
+ return value.replace(
new RegExp(
- `(/(?:protected-)?media)?/projects/[^/\\s"']+/documents/${sourceDocumentId}/assets/([0-9a-f-]{36})/raw`,
+ `(/(?:protected-)?media)?/projects/[^/\\s"']+/documents/${documentId ?? '\\d+'}/assets/([0-9a-f-]{36})/raw`,
'gi',
),
- (match, mediaPrefix: string | undefined, publicId: string) => {
- const targetPublicId = publicIds.get(publicId.toLowerCase());
- return targetPublicId
- ? `${mediaPrefix ?? ''}${documentAssetPath(targetProject, targetDocumentId, targetPublicId)}`
- : match;
- },
- );
- return replaced as T;
+ replace,
+ ) as T;
}
if (Array.isArray(value)) {
- return value.map((item) =>
- replaceAssetReferences(item, sourceDocumentId, targetProject, targetDocumentId, publicIds),
- ) as T;
+ return value.map((item) => rewriteAssetUrls(item, documentId, replace)) as T;
}
if (value && typeof value === 'object') {
return Object.fromEntries(
Object.entries(value).map(([key, item]) => [
key,
- replaceAssetReferences(item, sourceDocumentId, targetProject, targetDocumentId, publicIds),
+ rewriteAssetUrls(item, documentId, replace),
]),
) as T;
}
@@ -1198,6 +1233,7 @@ export async function setDocumentAccess(
.update(projectDocument)
.set({
isPrivate,
+ ...(isPrivate ? revokedDocumentShare : {}),
updatedByUserId: userId,
updatedAt: sql`now()`,
version: sql`${projectDocument.version} + 1`,
@@ -1333,6 +1369,8 @@ export async function archiveDocument(
.set({
archivedAt: sql`now()`,
archivedByAncestorId: null,
+ // An archived page has no public link, and restoring it does not bring the link back.
+ ...revokedDocumentShare,
updatedByUserId: userId,
updatedAt: sql`now()`,
version: sql`${projectDocument.version} + 1`,
@@ -1355,6 +1393,7 @@ export async function archiveDocument(
.set({
archivedAt: sql`now()`,
archivedByAncestorId: documentId,
+ ...revokedDocumentShare,
updatedByUserId: userId,
updatedAt: sql`now()`,
version: sql`${projectDocument.version} + 1`,
@@ -1690,7 +1729,7 @@ export async function restoreDocumentRevision(
// A historical secret may never be restored into a public current row.
// Restoring a public snapshot into a private page keeps the safer current
// access level instead of unexpectedly publishing it.
- ...(revision.isPrivate ? { isPrivate: true } : {}),
+ ...(revision.isPrivate ? { isPrivate: true, ...revokedDocumentShare } : {}),
updatedByUserId: userId,
updatedAt: sql`now()`,
version: sql`${projectDocument.version} + 1`,
diff --git a/apps/api/src/modules/share/__tests__/integration/share.test.ts b/apps/api/src/modules/share/__tests__/integration/share.test.ts
index b5ab8cd2..934e05c1 100644
--- a/apps/api/src/modules/share/__tests__/integration/share.test.ts
+++ b/apps/api/src/modules/share/__tests__/integration/share.test.ts
@@ -2,11 +2,12 @@ import { describe, it, expect, beforeEach } from 'bun:test';
import { api, authedApi, createProject } from '#tests/helpers/app';
import { signUpTestUser } from '#tests/helpers/auth';
import { resetDb } from '#tests/helpers/db';
-import { db, issue as issueTable, projectView } from '@repo/db';
+import { createRole } from '#tests/helpers/roles';
+import { db, issue as issueTable, projectDocument, projectView } from '@repo/db';
import { eq } from 'drizzle-orm';
import { sweepExpiredShares } from '#modules/share/service';
-// Public read-only sharing. Enabling sharing on an issue or a saved view sets an
+// Public read-only sharing. Enabling sharing on an issue, a saved view or a document sets an
// unguessable token; the /share/* GET routes then return a self-contained bundle
// (project scaffold + entity) with no session. Revoking clears the token, so the
// link stops working. The enable/revoke routes are gated by the same permission as
@@ -556,4 +557,421 @@ describe('share', () => {
expect(await sweepExpiredShares()).toBe(1);
});
});
+
+ describe('project overview', () => {
+ it('lists the live links of a project and revokes the ones the caller may edit', async () => {
+ const { asOwner, issueId } = await setup();
+ const project = asOwner.projects({ projectKey: 'MKT' });
+ const view = (await project.views.post({ name: 'Board' })).data!;
+ const doc = (await project.documents.post({ title: 'Guide', content: 'MKT-1' })).data!;
+ const expiresAt = new Date(Date.now() + 86_400_000).toISOString();
+ await asOwner.issues({ issueId }).share.post({ expiresAt });
+ await asOwner.views({ viewId: view.id }).share.post();
+ await asOwner.documents({ documentId: doc.id }).share.post({ includeIssues: true });
+
+ const listed = await project.shares.get();
+ expect(listed.status).toBe(200);
+ expect(listed.data!.issues).toEqual([
+ {
+ id: issueId,
+ sequence: 1,
+ title: 'Shared thing',
+ extended: false,
+ expiresAt: expect.anything(),
+ },
+ ]);
+ expect(listed.data!.views).toEqual([
+ { id: view.id, name: 'Board', extended: false, expiresAt: null },
+ ]);
+ expect(listed.data!.documents).toEqual([
+ {
+ id: doc.id,
+ title: 'Guide',
+ includeChildren: false,
+ includeIssues: true,
+ expiresAt: null,
+ },
+ ]);
+ expect(listed.data!.canRevoke).toEqual({ issues: true, views: true, documents: true });
+
+ const reader = await signUpTestUser();
+ const readerRole = await createRole(asOwner, 'MKT', {
+ name: 'Reader',
+ permissions: { work_items: { read: true } },
+ });
+ const invite = await project.invites.post({ email: reader.email, role: 'member' });
+ const asReader = authedApi(reader.cookie);
+ await asReader.invites({ token: invite.data!.token }).accept.post();
+ await project
+ .members({ userId: reader.userId })
+ .patch({ role: 'member', roleId: readerRole.data!.id });
+ const seen = await asReader.projects({ projectKey: 'MKT' }).shares.get();
+ expect(seen.data!.issues).toHaveLength(1);
+ expect(seen.data!.views).toEqual([]);
+ expect(seen.data!.documents).toEqual([]);
+ expect(seen.data!.canRevoke).toEqual({ issues: false, views: false, documents: false });
+ expect((await asReader.projects({ projectKey: 'MKT' }).shares.delete()).data).toEqual({
+ revoked: 0,
+ });
+
+ expect((await project.shares.delete()).data).toEqual({ revoked: 3 });
+ const after = await project.shares.get();
+ expect(after.data).toMatchObject({ issues: [], views: [], documents: [] });
+
+ const outsider = authedApi((await signUpTestUser()).cookie);
+ expect((await outsider.projects({ projectKey: 'MKT' }).shares.get()).status).toBe(403);
+ });
+ });
+
+ // A shared page is read without a session, and with includeChildren its subpages too.
+ // Its assets load through the token, and only those of the pages the link opens.
+ describe('document sharing', () => {
+ type Client = ReturnType<typeof authedApi>;
+ const documents = (client: Client) => client.projects({ projectKey: 'MKT' }).documents;
+
+ async function page(client: Client, title: string, parentId: number | null = null) {
+ return (await documents(client).post({ title, parentId, content: `# ${title}` })).data!;
+ }
+
+ // Root > Child > Grandchild, with Parent above Root and Sibling beside it.
+ async function tree() {
+ const { asOwner } = await setup();
+ const parent = await page(asOwner, 'Parent');
+ const root = await page(asOwner, 'Root', parent.id);
+ const sibling = await page(asOwner, 'Sibling', parent.id);
+ const child = await page(asOwner, 'Child', root.id);
+ const grandchild = await page(asOwner, 'Grandchild', child.id);
+ return { asOwner, parent, root, sibling, child, grandchild };
+ }
+
+ const subpage = (token: string, documentId: number) =>
+ api.share.document({ token }).documents({ documentId }).get();
+
+ it('enables a link, serves the page, reports it on the document, then revokes it', async () => {
+ const { asOwner, root } = await tree();
+ const enabled = await asOwner.documents({ documentId: root.id }).share.post();
+ expect(enabled.status).toBe(200);
+ const { token } = enabled.data!;
+
+ const shared = await api.share.document({ token }).get();
+ expect(shared.status).toBe(200);
+ expect(shared.data.document).toMatchObject({ id: root.id, title: 'Root', content: '# Root' });
+ expect(shared.data.project).toEqual({ name: 'Marketing', key: 'MKT' });
+ expect(shared.data.pages).toEqual([
+ { id: root.id, parentId: null, title: 'Root', icon: null },
+ ]);
+
+ const read = await documents(asOwner)({ documentId: root.id }).get();
+ expect(read.data).toMatchObject({ shareToken: token, shareIncludeChildren: false });
+
+ expect((await asOwner.documents({ documentId: root.id }).share.delete()).status).toBe(204);
+ expect((await api.share.document({ token }).get()).status).toBe(404);
+ const after = await documents(asOwner)({ documentId: root.id }).get();
+ expect(after.data!.shareToken).toBeNull();
+ });
+
+ it('names the issues of the project the page mentions only when the link shows them', async () => {
+ const { asOwner, issueId, columnId } = await setup();
+ const issues = asOwner.projects({ projectKey: 'MKT' }).issues;
+ const archived = (await issues.post({ columnId, title: 'Old thing' })).data!;
+ await db
+ .update(issueTable)
+ .set({ archivedAt: new Date() })
+ .where(eq(issueTable.id, archived.id));
+ await createProject(asOwner, { key: 'OPS', name: 'Operations' });
+ const content = `See MKT-1, MKT-${archived.sequenceNumber}, MKT-99, OPS-1 and XMKT-1.`;
+ const doc = (await documents(asOwner).post({ title: 'Notes', content })).data!;
+
+ const share = asOwner.documents({ documentId: doc.id }).share;
+ const { token } = (await share.post()).data!;
+ expect((await api.share.document({ token }).get()).data.issues).toEqual([]);
+
+ await share.post({ includeIssues: true });
+ const read = await documents(asOwner)({ documentId: doc.id }).get();
+ expect(read.data).toMatchObject({ shareIncludeIssues: true, shareIncludeChildren: false });
+ const state = { name: expect.any(String), color: expect.any(String) };
+ const shared = await api.share.document({ token }).get();
+ expect(shared.data.issues).toEqual([
+ { id: issueId, sequence: 1, title: 'Shared thing', state },
+ { id: archived.id, sequence: archived.sequenceNumber, title: 'Old thing', state },
+ ]);
+
+ await asOwner.documents({ documentId: doc.id }).share.delete();
+ const again = (await share.post()).data!;
+ expect((await api.share.document({ token: again.token }).get()).data.issues).toEqual([]);
+ });
+
+ it('opens a named issue through the link, reduced, and nothing else', async () => {
+ const { asOwner, issueId, columnId } = await setup();
+ const issues = asOwner.projects({ projectKey: 'MKT' }).issues;
+ const other = (await issues.post({ columnId, title: 'Not named' })).data!;
+ const root = await page(asOwner, 'Root');
+ const child = (
+ await documents(asOwner).post({ title: 'Child', parentId: root.id, content: 'See MKT-1.' })
+ ).data!;
+ const share = asOwner.documents({ documentId: root.id }).share;
+ const { token } = (await share.post({ includeChildren: true })).data!;
+ const open = (id: number) => api.share.document({ token }).issues({ issueId: id }).get();
+
+ expect((await open(issueId)).status).toBe(404);
+ await share.post({ includeIssues: true });
+ const opened = await open(issueId);
+ expect(opened.status).toBe(200);
+ expect(opened.data.issue).toMatchObject({
+ id: issueId,
+ title: 'Shared thing',
+ shareToken: null,
+ });
+ expect(opened.data.issue.labelIds).toEqual([]);
+ expect(opened.data.feed).toEqual([]);
+ expect((await open(other.id)).status).toBe(404);
+
+ const listed = await asOwner.issues({ issueId }).share.documents.get();
+ expect(listed.data).toEqual([{ documentId: root.id, title: 'Root', expiresAt: null }]);
+ expect((await asOwner.issues({ issueId: other.id }).share.documents.get()).data).toEqual([]);
+
+ await share.post({ includeChildren: false });
+ expect((await open(issueId)).status).toBe(404);
+ expect((await asOwner.issues({ issueId }).share.documents.get()).data).toEqual([]);
+ expect(child.id).toBeGreaterThan(0);
+ });
+
+ it('closes its links while the project has Docs turned off, and keeps them', async () => {
+ const { asOwner, issueId } = await setup();
+ const project = asOwner.projects({ projectKey: 'MKT' });
+ const doc = (await documents(asOwner).post({ title: 'Notes', content: 'See MKT-1.' })).data!;
+ const other = (await documents(asOwner).post({ title: 'Other' })).data!;
+ const asset = (
+ await documents(asOwner)({ documentId: doc.id }).assets.post({
+ file: new File(['bytes'], 'shot.png', { type: 'image/png' }),
+ })
+ ).data!;
+ const share = asOwner.documents({ documentId: doc.id }).share;
+ const { token } = (await share.post({ includeIssues: true })).data!;
+ const link = api.share.document({ token });
+ const reads = async () => [
+ (await link.get()).status,
+ (await link.assets({ publicId: asset.id }).raw.get()).status,
+ (await link.issues({ issueId }).get()).status,
+ ];
+ expect(await reads()).toEqual([200, 200, 200]);
+
+ await project.settings.patch({ features: { documents: false } });
+ expect(await reads()).toEqual([404, 404, 404]);
+ expect((await asOwner.issues({ issueId }).share.documents.get()).data).toEqual([]);
+ expect((await asOwner.documents({ documentId: other.id }).share.post()).status).toBe(403);
+ const listed = await project.shares.get();
+ expect(listed.data!.documents.map((row) => row.id)).toEqual([doc.id]);
+
+ await project.settings.patch({ features: { documents: true } });
+ expect(await reads()).toEqual([200, 200, 200]);
+
+ await project.settings.patch({ features: { documents: false } });
+ expect((await share.delete()).status).toBe(204);
+ await project.settings.patch({ features: { documents: true } });
+ expect((await link.get()).status).toBe(404);
+ });
+
+ it('opens the subpages only when the link includes them, never the parent or a sibling', async () => {
+ const { asOwner, parent, root, sibling, child, grandchild } = await tree();
+ const { token } = (await asOwner.documents({ documentId: root.id }).share.post()).data!;
+ expect((await subpage(token, child.id)).status).toBe(404);
+
+ const same = await asOwner
+ .documents({ documentId: root.id })
+ .share.post({ includeChildren: true });
+ expect(same.data!.token).toBe(token);
+ const shared = await api.share.document({ token }).get();
+ expect(shared.data.pages.map((p: { id: number }) => p.id)).toEqual([
+ root.id,
+ child.id,
+ grandchild.id,
+ ]);
+ const opened = await subpage(token, grandchild.id);
+ expect(opened.status).toBe(200);
+ expect(opened.data.document).toMatchObject({ id: grandchild.id, title: 'Grandchild' });
+ expect((await subpage(token, parent.id)).status).toBe(404);
+ expect((await subpage(token, sibling.id)).status).toBe(404);
+
+ await asOwner.documents({ documentId: root.id }).share.post({ includeChildren: false });
+ expect((await subpage(token, child.id)).status).toBe(404);
+ });
+
+ it('leaves private and archived subpages and everything below them out', async () => {
+ const { asOwner, root, child, grandchild } = await tree();
+ const secret = (
+ await documents(asOwner).post({ title: 'Secret', parentId: root.id, isPrivate: true })
+ ).data!;
+ const { token } = (
+ await asOwner.documents({ documentId: root.id }).share.post({ includeChildren: true })
+ ).data!;
+ expect((await subpage(token, secret.id)).status).toBe(404);
+
+ await documents(asOwner)({ documentId: child.id }).archive.post({ version: child.version });
+ const shared = await api.share.document({ token }).get();
+ expect(shared.data.pages.map((p: { id: number }) => p.id)).toEqual([root.id]);
+ expect((await subpage(token, child.id)).status).toBe(404);
+ expect((await subpage(token, grandchild.id)).status).toBe(404);
+ });
+
+ it('serves no archived page, and refuses to share one', async () => {
+ const { asOwner, root, sibling } = await tree();
+ const { token } = (await asOwner.documents({ documentId: root.id }).share.post()).data!;
+ await documents(asOwner)({ documentId: root.id }).archive.post({ version: root.version });
+ expect((await api.share.document({ token }).get()).status).toBe(404);
+
+ await documents(asOwner)({ documentId: sibling.id }).archive.post({
+ version: sibling.version,
+ });
+ const res = await asOwner.documents({ documentId: sibling.id }).share.post();
+ expect(res.status).toBe(409);
+ });
+
+ it('revokes the link of an archived page and of the subpages archived with it', async () => {
+ const { asOwner, root, child } = await tree();
+ const rootShare = asOwner.documents({ documentId: root.id }).share;
+ const childShare = asOwner.documents({ documentId: child.id }).share;
+ const { token } = (await rootShare.post({ includeChildren: true })).data!;
+ const { token: childToken } = (await childShare.post()).data!;
+
+ await documents(asOwner)({ documentId: root.id }).archive.post({ version: root.version });
+ const [rootRow, childRow] = await Promise.all(
+ [root.id, child.id].map(
+ async (id) => (await documents(asOwner)({ documentId: id }).get()).data!,
+ ),
+ );
+ expect(rootRow).toMatchObject({ shareToken: null, shareIncludeChildren: false });
+ expect(childRow.shareToken).toBeNull();
+ expect((await api.share.document({ token }).get()).status).toBe(404);
+ expect((await api.share.document({ token: childToken }).get()).status).toBe(404);
+
+ await documents(asOwner)({ documentId: root.id }).restore.post({ version: rootRow.version });
+ const restored = (await documents(asOwner)({ documentId: root.id }).get()).data!;
+ expect(restored.shareToken).toBeNull();
+ expect((await api.share.document({ token }).get()).status).toBe(404);
+ const again = (await rootShare.post()).data!;
+ expect(again.token).not.toBe(token);
+ });
+
+ it('has no link for a private page, and making a page private revokes it', async () => {
+ const { asOwner, root } = await tree();
+ const secret = (await documents(asOwner).post({ title: 'Secret', isPrivate: true })).data!;
+ expect((await asOwner.documents({ documentId: secret.id }).share.post()).status).toBe(404);
+
+ const { token } = (await asOwner.documents({ documentId: root.id }).share.post()).data!;
+ const made = await documents(asOwner)({ documentId: root.id }).access.post({
+ version: root.version,
+ isPrivate: true,
+ });
+ expect(made.data).toMatchObject({ isPrivate: true, shareToken: null });
+ await documents(asOwner)({ documentId: root.id }).access.post({
+ version: made.data!.version,
+ isPrivate: false,
+ });
+ expect((await api.share.document({ token }).get()).status).toBe(404);
+ });
+
+ it('expires like an issue link and starts a new one without the subpages', async () => {
+ const { asOwner, root } = await tree();
+ const first = (
+ await asOwner.documents({ documentId: root.id }).share.post({
+ includeChildren: true,
+ expiresAt: new Date(Date.now() + 86_400_000).toISOString(),
+ })
+ ).data!;
+ await db
+ .update(projectDocument)
+ .set({ shareExpiresAt: new Date(Date.now() - 1000) })
+ .where(eq(projectDocument.id, root.id));
+ expect((await api.share.document({ token: first.token }).get()).status).toBe(404);
+ const read = await documents(asOwner)({ documentId: root.id }).get();
+ expect(read.data).toMatchObject({ shareToken: null, shareExpiresAt: null });
+
+ expect(await sweepExpiredShares()).toBe(1);
+ const again = (await asOwner.documents({ documentId: root.id }).share.post()).data!;
+ expect(again.token).not.toBe(first.token);
+ expect(again.expiresAt).toBeNull();
+ const reread = await documents(asOwner)({ documentId: root.id }).get();
+ expect(reread.data!.shareIncludeChildren).toBe(false);
+ expect((await api.share.document({ token: first.token }).get()).status).toBe(404);
+ });
+
+ it('takes the permission to edit documents', async () => {
+ const { asOwner, root } = await tree();
+ const readerRole = await createRole(asOwner, 'MKT', {
+ name: 'Reader',
+ permissions: { documents: { read: true } },
+ });
+ const user = await signUpTestUser();
+ const invite = await asOwner
+ .projects({ projectKey: 'MKT' })
+ .invites.post({ email: user.email, role: 'member' });
+ const reader = authedApi(user.cookie);
+ await reader.invites({ token: invite.data!.token }).accept.post();
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ .members({ userId: user.userId })
+ .patch({ role: 'member', roleId: readerRole.data!.id });
+ expect((await reader.documents({ documentId: root.id }).share.post()).status).toBe(403);
+ expect((await reader.documents({ documentId: root.id }).share.delete()).status).toBe(403);
+
+ // Documents edit shares the page; turning on linked issues also takes work_items edit.
+ const editorRole = await createRole(asOwner, 'MKT', {
+ name: 'Doc editor',
+ permissions: { documents: { read: true, edit: true }, work_items: { read: true } },
+ });
+ await asOwner
+ .projects({ projectKey: 'MKT' })
+ .members({ userId: user.userId })
+ .patch({ role: 'member', roleId: editorRole.data!.id });
+ const share = reader.documents({ documentId: root.id }).share;
+ expect((await share.post({ includeChildren: true })).status).toBe(200);
+ expect((await share.post({ includeIssues: true })).status).toBe(403);
+ expect((await share.post({ includeIssues: false })).status).toBe(200);
+
+ const outsider = authedApi((await signUpTestUser()).cookie);
+ expect((await outsider.documents({ documentId: root.id }).share.post()).status).toBe(403);
+ expect((await asOwner.documents({ documentId: 999999 }).share.post()).status).toBe(404);
+ });
+
+ it('serves the assets of the pages the link opens and no others', async () => {
+ const { asOwner, root, sibling, child } = await tree();
+ const upload = async (documentId: number) =>
+ (
+ await documents(asOwner)({ documentId }).assets.post({
+ file: new File([`bytes of ${documentId}`], 'shot.png', { type: 'image/png' }),
+ })
+ ).data!;
+ const own = await upload(root.id);
+ const below = await upload(child.id);
+ const beside = await upload(sibling.id);
+ await documents(asOwner)({ documentId: root.id }).patch({
+ version: root.version,
+ content: `![own](/protected-media${own.url})\n\n![beside](/protected-media${beside.url})`,
+ });
+
+ const { token } = (await asOwner.documents({ documentId: root.id }).share.post()).data!;
+ const shared = await api.share.document({ token }).get();
+ expect(shared.data.document.content).toBe(
+ `![own](/media/share/document/${token}/assets/${own.id}/raw)\n\n` +
+ `![beside](/media/share/document/${token}/assets/${beside.id}/raw)`,
+ );
+
+ const asset = (publicId: string) =>
+ api.share.document({ token }).assets({ publicId }).raw.get();
+ const served = await asset(own.id);
+ expect(served.status).toBe(200);
+ expect(String(served.data)).toBe(`bytes of ${root.id}`);
+ expect(served.response.headers.get('x-content-type-options')).toBe('nosniff');
+ expect((await asset(beside.id)).status).toBe(404);
+ expect((await asset(below.id)).status).toBe(404);
+
+ await asOwner.documents({ documentId: root.id }).share.post({ includeChildren: true });
+ expect((await asset(below.id)).status).toBe(200);
+ expect((await asset(beside.id)).status).toBe(404);
+
+ await asOwner.documents({ documentId: root.id }).share.delete();
+ expect((await asset(own.id)).status).toBe(404);
+ });
+ });
});
diff --git a/apps/api/src/modules/share/index.ts b/apps/api/src/modules/share/index.ts
index 0c2e2c81..2a904dd8 100644
--- a/apps/api/src/modules/share/index.ts
+++ b/apps/api/src/modules/share/index.ts
@@ -3,16 +3,28 @@ import { noContent } from '#shared/http';
import { guards, entityGuard } from '#shared/guards';
import { authContext } from '#shared/auth-context';
import { HttpError } from '#shared/lib';
+import { assertPermission } from '#shared/access';
+import type { PermissionResource, PermissionAction } from '#shared/permissions';
import { commonErrors, errors } from '#shared/responses';
import { getIssueProjectId } from '#modules/issues/service';
import { getView } from '#modules/views/service';
+import { rawAttachmentQuery } from '#modules/attachments/model';
+import { attachmentObjectResponse } from '#modules/attachments/storage';
import {
BundleResponse,
+ IssueDocumentSharesResponse,
+ ProjectSharesResponse,
+ RevokedSharesResponse,
+ projectSharesParams,
ShareTokenResponse,
+ shareDocumentBody,
+ shareDocumentParams,
shareExtendedBody,
shareIssueParams,
shareTokenParams,
shareViewParams,
+ sharedDocumentAssetParams,
+ sharedDocumentPageParams,
sharedViewIssueParams,
} from './model';
import { getSharedViewCalendar } from './calendar';
@@ -24,6 +36,15 @@ import {
getSharedIssue,
getSharedView,
getSharedViewIssue,
+ enableDocumentShare,
+ disableDocumentShare,
+ getSharedDocument,
+ getSharedDocumentAsset,
+ getSharedDocumentIssue,
+ listIssueDocumentShares,
+ listProjectShares,
+ revokeProjectShares,
+ shareableDocumentProjectId,
type ShareExpiry,
} from './service';
@@ -38,12 +59,15 @@ function parseExpiry(value: string | null | undefined): ShareExpiry {
return at;
}
+const documentProjectId = (params: Record<string, string>) =>
+ shareableDocumentProjectId(Number(params.documentId));
+
export const shareRoutes = new Elysia({ name: 'share', detail: { tags: ['Share'] } })
.use(authContext)
.use(guards)
- // Guards for the enable/revoke routes, which address an issue or a view by its
- // own id. Sharing an issue is a work_items edit; sharing a view is a views edit, and
- // only a project's view has a share link: a private one is not found here.
+ // Guards for the enable/revoke routes, which address an issue, a view or a document
+ // by its own id. Sharing one is an edit of it. Only a project's view and a page that
+ // is not private have a share link: a private one is not found here.
.macro({
workItem: entityGuard('work_items', 'Issue not found', (p) =>
getIssueProjectId(Number(p.issueId)),
@@ -52,6 +76,15 @@ export const shareRoutes = new Elysia({ name: 'share', detail: { tags: ['Share']
const view = await getView(Number(p.viewId), user?.id ?? null);
return view && !view.isPrivate ? view.projectId : null;
}),
+ sharedDocument: entityGuard('documents', 'Document not found', documentProjectId),
+ // A new link takes the Docs section. Revoking does not, so a link can still be removed
+ // while Docs is off.
+ newDocumentShare: entityGuard(
+ 'documents',
+ 'Document not found',
+ documentProjectId,
+ 'documents',
+ ),
})
// --- Enable / revoke (session-gated) -------------------------------------------
@@ -76,6 +109,17 @@ export const shareRoutes = new Elysia({ name: 'share', detail: { tags: ['Share']
},
)
+ .get(
+ '/issues/:issueId/share/documents',
+ async ({ params }) => listIssueDocumentShares(params.issueId),
+ {
+ params: shareIssueParams,
+ workItem: 'read',
+ response: { 200: IssueDocumentSharesResponse, ...commonErrors },
+ detail: { summary: 'List the shared documents that show an issue' },
+ },
+ )
+
.delete(
'/issues/:issueId/share',
async ({ params }) => {
@@ -126,6 +170,82 @@ export const shareRoutes = new Elysia({ name: 'share', detail: { tags: ['Share']
},
)
+ .post(
+ '/documents/:documentId/share',
+ async ({ params, body, projectId, user }) => {
+ // Linked issues open through the link, so turning them on takes the right to share
+ // an issue.
+ if (body?.includeIssues) await assertPermission(projectId, user, 'work_items', 'edit');
+ const share = await enableDocumentShare(
+ params.documentId,
+ body?.includeChildren,
+ body?.includeIssues,
+ parseExpiry(body?.expiresAt),
+ );
+ if (!share) throw new HttpError(404, 'Document not found');
+ return share;
+ },
+ {
+ params: shareDocumentParams,
+ body: shareDocumentBody,
+ newDocumentShare: 'edit',
+ response: { 200: ShareTokenResponse, ...commonErrors, ...errors(409) },
+ detail: { summary: 'Enable document sharing' },
+ },
+ )
+
+ .delete(
+ '/documents/:documentId/share',
+ async ({ params }) => {
+ const ok = await disableDocumentShare(params.documentId);
+ if (!ok) throw new HttpError(404, 'Document not found');
+ return noContent();
+ },
+ {
+ params: shareDocumentParams,
+ sharedDocument: 'edit',
+ response: { 204: t.Void(), ...commonErrors },
+ detail: { summary: 'Revoke document sharing' },
+ },
+ )
+
+ // --- Project overview (session-gated) -----------------------------------------
+
+ .get(
+ '/projects/:projectKey/shares',
+ async ({ project, user }) => {
+ const [issues, views, documents] = await Promise.all([
+ allows(project.id, user, 'work_items', 'read'),
+ allows(project.id, user, 'views', 'read'),
+ allows(project.id, user, 'documents', 'read'),
+ ]);
+ const [canRevoke, shares] = await Promise.all([
+ revocableKinds(project.id, user),
+ listProjectShares(project.id, { issues, views, documents }),
+ ]);
+ return { ...shares, canRevoke };
+ },
+ {
+ params: projectSharesParams,
+ projectMember: true,
+ response: { 200: ProjectSharesResponse, ...commonErrors },
+ detail: { summary: 'List the public links of a project' },
+ },
+ )
+
+ .delete(
+ '/projects/:projectKey/shares',
+ async ({ project, user }) => ({
+ revoked: await revokeProjectShares(project.id, await revocableKinds(project.id, user)),
+ }),
+ {
+ params: projectSharesParams,
+ projectMember: true,
+ response: { 200: RevokedSharesResponse, ...commonErrors },
+ detail: { summary: 'Revoke every public link of a project the caller may revoke' },
+ },
+ )
+
// --- Public reads (no session; matched by PUBLIC_GET in auth-context) ----------
.get(
@@ -184,4 +304,84 @@ export const shareRoutes = new Elysia({ name: 'share', detail: { tags: ['Share']
response: { 200: BundleResponse, ...errors(400, 404) },
detail: { summary: 'Get an issue from a shared view' },
},
+ )
+ .get(
+ '/share/document/:token',
+ async ({ params }) => {
+ const bundle = await getSharedDocument(params.token);
+ if (!bundle) throw new HttpError(404, 'Not found');
+ return bundle;
+ },
+ {
+ params: shareTokenParams,
+ response: { 200: BundleResponse, ...errors(400, 404) },
+ detail: { summary: 'Get a shared document' },
+ },
+ )
+
+ .get(
+ '/share/document/:token/issues/:issueId',
+ async ({ params }) => {
+ const bundle = await getSharedDocumentIssue(params.token, params.issueId);
+ if (!bundle) throw new HttpError(404, 'Not found');
+ return bundle;
+ },
+ {
+ params: sharedViewIssueParams,
+ response: { 200: BundleResponse, ...errors(400, 404) },
+ detail: { summary: 'Get an issue a shared document names' },
+ },
+ )
+
+ .get(
+ '/share/document/:token/documents/:documentId',
+ async ({ params }) => {
+ const bundle = await getSharedDocument(params.token, params.documentId);
+ if (!bundle) throw new HttpError(404, 'Not found');
+ return bundle;
+ },
+ {
+ params: sharedDocumentPageParams,
+ response: { 200: BundleResponse, ...errors(400, 404) },
+ detail: { summary: 'Get a subpage of a shared document' },
+ },
+ )
+
+ .get(
+ '/share/document/:token/assets/:publicId/raw',
+ async ({ params, query, request }) => {
+ const asset = await getSharedDocumentAsset(params.token, params.publicId);
+ if (!asset) throw new HttpError(404, 'Not found');
+ return attachmentObjectResponse({ ...asset, request, download: query.download != null });
+ },
+ {
+ params: sharedDocumentAssetParams,
+ query: rawAttachmentQuery,
+ // Returns a raw Response (bytes), so no typed 200 body.
+ response: { ...errors(400, 404) },
+ detail: { summary: 'Download an asset of a shared document' },
+ },
);
+
+type GuardUser = Parameters<typeof assertPermission>[1];
+
+const allows = (
+ projectId: number,
+ user: GuardUser,
+ resource: PermissionResource,
+ action: PermissionAction,
+) =>
+ assertPermission(projectId, user, resource, action).then(
+ () => true,
+ () => false,
+ );
+
+// Revoking a link is an edit of what it shares, as on the per-entity routes.
+async function revocableKinds(projectId: number, user: GuardUser) {
+ const [issues, views, documents] = await Promise.all([
+ allows(projectId, user, 'work_items', 'edit'),
+ allows(projectId, user, 'views', 'edit'),
+ allows(projectId, user, 'documents', 'edit'),
+ ]);
+ return { issues, views, documents };
+}
diff --git a/apps/api/src/modules/share/model.ts b/apps/api/src/modules/share/model.ts
index 1e993be9..53b6a758 100644
--- a/apps/api/src/modules/share/model.ts
+++ b/apps/api/src/modules/share/model.ts
@@ -6,8 +6,55 @@ const token = t.String({ format: 'uuid' });
export const shareIssueParams = t.Object({ issueId: t.Numeric() });
export const shareViewParams = t.Object({ viewId: t.Numeric() });
+export const shareDocumentParams = t.Object({ documentId: t.Numeric() });
export const shareTokenParams = t.Object({ token });
export const sharedViewIssueParams = t.Object({ token, issueId: t.Numeric() });
+export const sharedDocumentPageParams = t.Object({ token, documentId: t.Numeric() });
+export const sharedDocumentAssetParams = t.Object({
+ token,
+ publicId: t.String({ format: 'uuid' }),
+});
+
+export const projectSharesParams = t.Object({ projectKey: t.String() });
+
+const shareExpiry = t.Nullable(t.String({ format: 'date-time' }));
+
+// The live public links of a project, and which kinds the reader may revoke.
+export const ProjectSharesResponse = t.Object({
+ issues: t.Array(
+ t.Object({
+ id: t.Number(),
+ sequence: t.Number(),
+ title: t.String(),
+ extended: t.Boolean(),
+ expiresAt: shareExpiry,
+ }),
+ ),
+ views: t.Array(
+ t.Object({ id: t.Number(), name: t.String(), extended: t.Boolean(), expiresAt: shareExpiry }),
+ ),
+ documents: t.Array(
+ t.Object({
+ id: t.Number(),
+ title: t.String(),
+ includeChildren: t.Boolean(),
+ includeIssues: t.Boolean(),
+ expiresAt: shareExpiry,
+ }),
+ ),
+ canRevoke: t.Object({ issues: t.Boolean(), views: t.Boolean(), documents: t.Boolean() }),
+});
+
+export const RevokedSharesResponse = t.Object({ revoked: t.Number() });
+
+// The shared documents whose links show an issue.
+export const IssueDocumentSharesResponse = t.Array(
+ t.Object({
+ documentId: t.Number(),
+ title: t.String(),
+ expiresAt: t.Nullable(t.String({ format: 'date-time' })),
+ }),
+);
// The share link's token and expiry, returned when sharing is enabled.
export const ShareTokenResponse = t.Object({
@@ -15,6 +62,16 @@ export const ShareTokenResponse = t.Object({
expiresAt: t.Nullable(t.String({ format: 'date-time' })),
});
+const expiresAt = t.Optional(
+ t.Nullable(
+ t.String({
+ format: 'date-time',
+ description:
+ 'When the link stops working, as an ISO 8601 timestamp in the future. null makes it never expire; omit to leave it unchanged. An expired link is revoked and enabling sharing again issues a new link.',
+ }),
+ ),
+);
+
// How much the link exposes, sent when enabling it. Enabling an already-shared
// entity keeps its token and only changes this; leaving the field out keeps that
// as it stands too, so fetching the link of a live share cannot downgrade it.
@@ -26,15 +83,24 @@ export const shareExtendedBody = t.Optional(
'Expose the full issues (assignees, labels, custom fields, activity) instead of their title, description, state, type, priority, dates, subtasks and links. Omit to leave it unchanged.',
}),
),
- expiresAt: t.Optional(
- t.Nullable(
- t.String({
- format: 'date-time',
- description:
- 'When the link stops working, as an ISO 8601 timestamp in the future. null makes it never expire; omit to leave it unchanged. An expired link is revoked and enabling sharing again issues a new link.',
- }),
- ),
+ expiresAt,
+ }),
+);
+
+export const shareDocumentBody = t.Optional(
+ t.Object({
+ includeChildren: t.Optional(
+ t.Boolean({
+ description: "Also open the page's subpages through the link. Omit to leave it unchanged.",
+ }),
+ ),
+ includeIssues: t.Optional(
+ t.Boolean({
+ description:
+ 'Show the issues of this project that the shared pages name, and open them read-only through the link. Turning it on takes work_items edit. Omit to leave it unchanged.',
+ }),
),
+ expiresAt,
}),
);
diff --git a/apps/api/src/modules/share/service.ts b/apps/api/src/modules/share/service.ts
index a4f93cf8..4802972f 100644
--- a/apps/api/src/modules/share/service.ts
+++ b/apps/api/src/modules/share/service.ts
@@ -1,8 +1,20 @@
import { randomUUID } from 'node:crypto';
-import { db, issue, projectView } from '@repo/db';
-import { and, eq, gt, isNotNull, isNull, lte, or, type AnyColumn, type SQL } from 'drizzle-orm';
-import { iso, shareLive } from '#shared/lib';
-import { getProjectById, type ProjectRow } from '#modules/projects/service';
+import { db, documentAsset, issue, projectColumn, projectDocument, projectView } from '@repo/db';
+import {
+ and,
+ asc,
+ eq,
+ gt,
+ inArray,
+ isNotNull,
+ isNull,
+ lte,
+ or,
+ type AnyColumn,
+ type SQL,
+} from 'drizzle-orm';
+import { HttpError, iso, shareLive } from '#shared/lib';
+import { getProjectById, projectFeatures, type ProjectRow } from '#modules/projects/service';
import { listColumns } from '#modules/columns/service';
import { listIssueTypes } from '#modules/issue-types/service';
import { listLabels, listLabelGroups } from '#modules/labels/service';
@@ -18,8 +30,9 @@ import {
} from '#modules/issues/links';
import { getParentRef, listSubtasks, type IssueRef } from '#modules/issues/subtasks';
import { applyFilters } from '#modules/views/filters';
+import { revokedDocumentShare, rewriteAssetUrls } from '#modules/documents/service';
-// Public read-only sharing: an issue or a saved view carries an unguessable
+// Public read-only sharing: an issue, a saved view or a document carries an unguessable
// share_token that, when set, makes it readable without a session through the
// /share/* routes. Enabling sets the token; revoking clears it. The public reads
// return a self-contained bundle (project scaffold + the entity) so the read-only
@@ -185,7 +198,7 @@ function activeShare(expiresAt: AnyColumn): SQL {
// it revoked. Runs from the api's background loop.
export async function sweepExpiredShares(): Promise<number> {
const now = new Date();
- const [issues, views] = await Promise.all([
+ const [issues, views, documents] = await Promise.all([
db
.update(issue)
.set({ shareToken: null, shareExtended: false, shareExpiresAt: null })
@@ -196,8 +209,13 @@ export async function sweepExpiredShares(): Promise<number> {
.set({ shareToken: null, shareExtended: false, shareExpiresAt: null })
.where(and(isNotNull(projectView.shareToken), lte(projectView.shareExpiresAt, now)))
.returning({ id: projectView.id }),
+ db
+ .update(projectDocument)
+ .set(revokedDocumentShare)
+ .where(and(isNotNull(projectDocument.shareToken), lte(projectDocument.shareExpiresAt, now)))
+ .returning({ id: projectDocument.id }),
]);
- return issues.length + views.length;
+ return issues.length + views.length + documents.length;
}
// --- Enable / revoke ------------------------------------------------------------
@@ -223,17 +241,26 @@ export async function enableIssueShare(
.where(eq(issue.id, issueId));
if (rows.length === 0) return null;
const next = nextShare(rows[0], extended, expiresAt);
- await db.update(issue).set(next.set).where(eq(issue.id, issueId));
+ await db
+ .update(issue)
+ .set({ shareToken: next.token, shareExpiresAt: next.expiresAt, shareExtended: next.choice })
+ .where(eq(issue.id, issueId));
return next.state;
}
-// The token and the column values an enable call writes, shared by issues and views.
+// What an enable call writes, shared by issues, views and documents: the token, the
+// expiry, and the link's choice (`extended`, or a document's `includeChildren`).
+// An undefined choice leaves the column as it stands. `live` tells a caller with a
+// second choice whether the link is new (see nextChoice).
function nextShare(
current: { token: string | null; expiresAt: Date | null },
- extended: boolean | undefined,
+ choice: boolean | undefined,
expiresAt: ShareExpiry,
): {
- set: { shareToken: string; shareExtended?: boolean; shareExpiresAt: Date | null };
+ token: string;
+ expiresAt: Date | null;
+ choice: boolean | undefined;
+ live: boolean;
state: ShareState;
} {
const live = current.token !== null && shareLive(current.expiresAt);
@@ -241,14 +268,18 @@ function nextShare(
let expiry: Date | null = null;
if (expiresAt !== undefined) expiry = expiresAt;
else if (live) expiry = current.expiresAt;
- const set: { shareToken: string; shareExtended?: boolean; shareExpiresAt: Date | null } = {
- shareToken: token,
- shareExpiresAt: expiry,
+ return {
+ token,
+ expiresAt: expiry,
+ choice: nextChoice(choice, live),
+ live,
+ state: { token, expiresAt: expiry ? iso(expiry) : null },
};
- // A fresh link starts reduced unless the caller asks for more.
- if (extended !== undefined) set.shareExtended = extended;
- else if (!live) set.shareExtended = false;
- return { set, state: { token, expiresAt: expiry ? iso(expiry) : null } };
+}
+
+// A fresh link starts with a choice off unless the caller turns it on.
+function nextChoice(choice: boolean | undefined, live: boolean): boolean | undefined {
+ return choice ?? (live ? undefined : false);
}
// Revokes sharing for an issue. Returns false if the issue does not exist.
@@ -273,7 +304,10 @@ export async function enableViewShare(
.where(eq(projectView.id, viewId));
if (rows.length === 0) return null;
const next = nextShare(rows[0], extended, expiresAt);
- await db.update(projectView).set(next.set).where(eq(projectView.id, viewId));
+ await db
+ .update(projectView)
+ .set({ shareToken: next.token, shareExpiresAt: next.expiresAt, shareExtended: next.choice })
+ .where(eq(projectView.id, viewId));
return next.state;
}
@@ -391,3 +425,472 @@ async function issueIdByToken(token: string): Promise<number> {
.where(and(eq(issue.shareToken, token), activeShare(issue.shareExpiresAt)));
return rows[0]?.id ?? 0;
}
+
+// --- Documents ------------------------------------------------------------------
+
+// A shared page, and with `includeChildren` its subpages, read without a session. A
+// private or archived page is never readable through a link, and neither is anything
+// below it.
+
+export interface SharedDocumentPage {
+ id: number;
+ parentId: number | null;
+ title: string;
+ icon: string | null;
+}
+
+export interface SharedDocumentBundle {
+ project: { name: string; key: string };
+ document: {
+ id: number;
+ title: string;
+ icon: string | null;
+ content: string;
+ contentJson: Record<string, unknown> | null;
+ fullWidth: boolean;
+ updatedAt: string;
+ };
+ // The pages the link opens, the shared page first with no parent.
+ pages: SharedDocumentPage[];
+ // The issues of the project this page names, when the link shows them.
+ issues: SharedDocumentIssue[];
+}
+
+// An issue a shared page names: what its chip shows. It opens through the same link
+// (getSharedDocumentIssue).
+export interface SharedDocumentIssue {
+ id: number;
+ sequence: number;
+ title: string;
+ state: { name: string; color: string };
+}
+
+// The project of a document that may be shared, for the enable/revoke guard. A private
+// page has no public link, so it is not found here.
+export async function shareableDocumentProjectId(documentId: number): Promise<number | null> {
+ const rows = await db
+ .select({ projectId: projectDocument.projectId })
+ .from(projectDocument)
+ .where(and(eq(projectDocument.id, documentId), eq(projectDocument.isPrivate, false)));
+ return rows[0]?.projectId ?? null;
+}
+
+const readablePage = and(eq(projectDocument.isPrivate, false), isNull(projectDocument.archivedAt));
+
+// Enables sharing for a document, the same way enableIssueShare does for an issue.
+export async function enableDocumentShare(
+ documentId: number,
+ includeChildren?: boolean,
+ includeIssues?: boolean,
+ expiresAt?: ShareExpiry,
+): Promise<ShareState | null> {
+ const rows = await db
+ .select({
+ token: projectDocument.shareToken,
+ expiresAt: projectDocument.shareExpiresAt,
+ archivedAt: projectDocument.archivedAt,
+ })
+ .from(projectDocument)
+ .where(eq(projectDocument.id, documentId));
+ if (rows.length === 0) return null;
+ if (rows[0].archivedAt) throw new HttpError(409, 'Restore this document before sharing it.');
+ const next = nextShare(rows[0], includeChildren, expiresAt);
+ // Checked again in the write: a page made private meanwhile must not get a token.
+ const written = await db
+ .update(projectDocument)
+ .set({
+ shareToken: next.token,
+ shareExpiresAt: next.expiresAt,
+ shareIncludeChildren: next.choice,
+ shareIncludeIssues: nextChoice(includeIssues, next.live),
+ })
+ .where(and(eq(projectDocument.id, documentId), readablePage))
+ .returning({ id: projectDocument.id });
+ if (written.length === 0) return null;
+ return next.state;
+}
+
+export async function disableDocumentShare(documentId: number): Promise<boolean> {
+ const rows = await db
+ .update(projectDocument)
+ .set(revokedDocumentShare)
+ .where(eq(projectDocument.id, documentId))
+ .returning({ id: projectDocument.id });
+ return rows.length > 0;
+}
+
+// The shared page of a token and the pages its link opens, or null when no live link
+// carries the token.
+async function sharedDocumentPages(
+ token: string,
+): Promise<{ project: ProjectRow; includeIssues: boolean; pages: SharedDocumentPage[] } | null> {
+ const [root] = await db
+ .select({
+ id: projectDocument.id,
+ projectId: projectDocument.projectId,
+ title: projectDocument.title,
+ icon: projectDocument.icon,
+ includeChildren: projectDocument.shareIncludeChildren,
+ includeIssues: projectDocument.shareIncludeIssues,
+ })
+ .from(projectDocument)
+ .where(
+ and(
+ eq(projectDocument.shareToken, token),
+ activeShare(projectDocument.shareExpiresAt),
+ readablePage,
+ ),
+ );
+ if (!root) return null;
+ // Turning Docs off closes the project's links. Turning it on opens the same links again.
+ const project = await getProjectById(root.projectId);
+ if (!project || !projectFeatures(project).documents) return null;
+ const pages: SharedDocumentPage[] = [
+ { id: root.id, parentId: null, title: root.title, icon: root.icon },
+ ];
+ const shared = { project, includeIssues: root.includeIssues, pages };
+ if (!root.includeChildren) return shared;
+ const rows = await db
+ .select({
+ id: projectDocument.id,
+ parentId: projectDocument.parentId,
+ title: projectDocument.title,
+ icon: projectDocument.icon,
+ })
+ .from(projectDocument)
+ .where(and(eq(projectDocument.projectId, root.projectId), readablePage))
+ .orderBy(asc(projectDocument.position), asc(projectDocument.id));
+ const children = new Map<number, SharedDocumentPage[]>();
+ for (const row of rows) {
+ if (row.parentId === null) continue;
+ const siblings = children.get(row.parentId);
+ if (siblings) siblings.push(row);
+ else children.set(row.parentId, [row]);
+ }
+ // Walk down from the shared page. A private or archived page is not among the rows,
+ // so its subtree is never reached.
+ for (let i = 0; i < pages.length; i++) pages.push(...(children.get(pages[i].id) ?? []));
+ return shared;
+}
+
+// The bundle for a shared document link: the shared page, or one of the subpages its
+// link opens. Null when the token is unknown or the page is not one the link opens.
+export async function getSharedDocument(
+ token: string,
+ documentId?: number,
+): Promise<SharedDocumentBundle | null> {
+ const shared = await sharedDocumentPages(token);
+ if (!shared) return null;
+ const id = documentId ?? shared.pages[0].id;
+ if (!shared.pages.some((page) => page.id === id)) return null;
+ const [row] = await db.select().from(projectDocument).where(eq(projectDocument.id, id));
+ if (!row) return null;
+ const { project } = shared;
+ // Asset URLs need a session. The page reads them through the token instead, from
+ // the web's public /media route.
+ const assetUrl = (_match: string, _prefix: string | undefined, publicId: string) =>
+ `/media/share/document/${token}/assets/${publicId}/raw`;
+ return {
+ project: { name: project.name, key: project.key },
+ document: {
+ id: row.id,
+ title: row.title,
+ icon: row.icon,
+ content: rewriteAssetUrls(row.content, null, assetUrl),
+ contentJson: rewriteAssetUrls(row.contentJson, null, assetUrl),
+ fullWidth: row.fullWidth,
+ updatedAt: iso(row.updatedAt),
+ },
+ pages: shared.pages,
+ issues: shared.includeIssues
+ ? await issuesBySequence(project.id, namedSequences(project.key, pageTexts(row)))
+ : [],
+ };
+}
+
+// The most issue identifiers one shared link resolves.
+const MAX_NAMED_ISSUES = 500;
+
+// The issue numbers that some text names by identifier (KEY-123).
+function namedSequences(key: string, texts: string[]): number[] {
+ if (!/^[A-Z0-9]+$/.test(key)) return [];
+ const pattern = new RegExp(`(?<![A-Za-z0-9])${key}-([1-9]\\d{0,8})(?![A-Za-z0-9])`, 'g');
+ const sequences = new Set<number>();
+ for (const text of texts) {
+ for (const match of text.matchAll(pattern)) {
+ if (sequences.size >= MAX_NAMED_ISSUES) break;
+ sequences.add(Number(match[1]));
+ }
+ }
+ return [...sequences];
+}
+
+const pageTexts = (page: { content: string; contentJson: unknown }) => [
+ page.content,
+ JSON.stringify(page.contentJson),
+];
+
+// The issues of a project with these numbers, archived ones included.
+async function issuesBySequence(
+ projectId: number,
+ sequences: number[],
+): Promise<SharedDocumentIssue[]> {
+ if (sequences.length === 0) return [];
+ const rows = await db
+ .select({
+ id: issue.id,
+ sequence: issue.sequenceNumber,
+ title: issue.title,
+ stateName: projectColumn.name,
+ stateColor: projectColumn.color,
+ })
+ .from(issue)
+ .innerJoin(projectColumn, eq(projectColumn.id, issue.columnId))
+ .where(and(eq(issue.projectId, projectId), inArray(issue.sequenceNumber, sequences)))
+ .orderBy(asc(issue.sequenceNumber));
+ return rows.map((row) => ({
+ id: row.id,
+ sequence: row.sequence,
+ title: row.title,
+ state: { name: row.stateName, color: row.stateColor },
+ }));
+}
+
+// The issue numbers named on any page a link opens.
+async function sequencesOfShare(key: string, pageIds: number[]): Promise<number[]> {
+ const pages = await db
+ .select({ content: projectDocument.content, contentJson: projectDocument.contentJson })
+ .from(projectDocument)
+ .where(inArray(projectDocument.id, pageIds));
+ return namedSequences(key, pages.flatMap(pageTexts));
+}
+
+// An issue that a page of a shared document names, read through the document's link
+// when the link shows linked issues. It carries what a view shared without full details
+// carries: no people, labels, custom fields or activity. Its subtasks and relations
+// list only issues the link also names. Null when the link does not name the issue.
+export async function getSharedDocumentIssue(
+ token: string,
+ issueId: number,
+): Promise<SharedIssueBundle | null> {
+ const shared = await sharedDocumentPages(token);
+ if (!shared?.includeIssues) return null;
+ const { project } = shared;
+ const sequences = await sequencesOfShare(
+ project.key,
+ shared.pages.map((page) => page.id),
+ );
+ const named = await issuesBySequence(project.id, sequences);
+ if (!named.some((row) => row.id === issueId)) return null;
+ const issueRow = await getIssue(issueId);
+ if (!issueRow) return null;
+ return issueBundle(issueRow, {
+ keepShareToken: false,
+ extended: false,
+ onlyIssueIds: new Set(named.map((row) => row.id)),
+ });
+}
+
+// A shared document whose link shows an issue, for the issue's own share dialog.
+export interface IssueDocumentShare {
+ documentId: number;
+ title: string;
+ expiresAt: string | null;
+}
+
+// The live document links that show this issue: the shared page or one of the subpages
+// its link opens names the issue, and the link shows linked issues.
+export async function listIssueDocumentShares(issueId: number): Promise<IssueDocumentShare[]> {
+ const issueRow = await getIssue(issueId);
+ if (!issueRow) return [];
+ const project = await getProjectById(issueRow.projectId);
+ if (!project) return [];
+ const roots = await db
+ .select({
+ id: projectDocument.id,
+ title: projectDocument.title,
+ token: projectDocument.shareToken,
+ expiresAt: projectDocument.shareExpiresAt,
+ })
+ .from(projectDocument)
+ .where(
+ and(
+ eq(projectDocument.projectId, project.id),
+ isNotNull(projectDocument.shareToken),
+ eq(projectDocument.shareIncludeIssues, true),
+ activeShare(projectDocument.shareExpiresAt),
+ readablePage,
+ ),
+ )
+ .orderBy(asc(projectDocument.title));
+ const shares: IssueDocumentShare[] = [];
+ for (const root of roots) {
+ const shared = await sharedDocumentPages(root.token!);
+ if (!shared) continue;
+ const sequences = await sequencesOfShare(
+ project.key,
+ shared.pages.map((page) => page.id),
+ );
+ if (!sequences.includes(issueRow.sequenceNumber)) continue;
+ shares.push({
+ documentId: root.id,
+ title: root.title,
+ expiresAt: root.expiresAt ? iso(root.expiresAt) : null,
+ });
+ }
+ return shares;
+}
+
+// An asset of a page the link opens, or null. An asset of any other page is not
+// found, even when another page embeds it.
+export async function getSharedDocumentAsset(
+ token: string,
+ publicId: string,
+): Promise<{ s3Key: string; contentType: string; filename: string } | null> {
+ const shared = await sharedDocumentPages(token);
+ if (!shared) return null;
+ const rows = await db
+ .select({
+ s3Key: documentAsset.s3Key,
+ contentType: documentAsset.contentType,
+ filename: documentAsset.filename,
+ })
+ .from(documentAsset)
+ .where(
+ and(
+ eq(documentAsset.publicId, publicId),
+ inArray(
+ documentAsset.documentId,
+ shared.pages.map((page) => page.id),
+ ),
+ ),
+ );
+ return rows[0] ?? null;
+}
+
+// --- Project overview ------------------------------------------------------------
+
+export interface ProjectShares {
+ issues: {
+ id: number;
+ sequence: number;
+ title: string;
+ extended: boolean;
+ expiresAt: string | null;
+ }[];
+ views: { id: number; name: string; extended: boolean; expiresAt: string | null }[];
+ documents: {
+ id: number;
+ title: string;
+ includeChildren: boolean;
+ includeIssues: boolean;
+ expiresAt: string | null;
+ }[];
+}
+
+const expiryOf = (expiresAt: Date | null) => (expiresAt ? iso(expiresAt) : null);
+
+// The live public links of a project, for the kinds the reader may see.
+export async function listProjectShares(
+ projectId: number,
+ readable: { issues: boolean; views: boolean; documents: boolean },
+): Promise<ProjectShares> {
+ const [issues, views, documents] = await Promise.all([
+ readable.issues
+ ? db
+ .select({
+ id: issue.id,
+ sequence: issue.sequenceNumber,
+ title: issue.title,
+ extended: issue.shareExtended,
+ expiresAt: issue.shareExpiresAt,
+ })
+ .from(issue)
+ .where(
+ and(
+ eq(issue.projectId, projectId),
+ isNotNull(issue.shareToken),
+ activeShare(issue.shareExpiresAt),
+ ),
+ )
+ .orderBy(asc(issue.sequenceNumber))
+ : [],
+ readable.views
+ ? db
+ .select({
+ id: projectView.id,
+ name: projectView.name,
+ extended: projectView.shareExtended,
+ expiresAt: projectView.shareExpiresAt,
+ })
+ .from(projectView)
+ .where(
+ and(
+ eq(projectView.projectId, projectId),
+ isNotNull(projectView.shareToken),
+ activeShare(projectView.shareExpiresAt),
+ ),
+ )
+ .orderBy(asc(projectView.name))
+ : [],
+ readable.documents
+ ? db
+ .select({
+ id: projectDocument.id,
+ title: projectDocument.title,
+ includeChildren: projectDocument.shareIncludeChildren,
+ includeIssues: projectDocument.shareIncludeIssues,
+ expiresAt: projectDocument.shareExpiresAt,
+ })
+ .from(projectDocument)
+ .where(
+ and(
+ eq(projectDocument.projectId, projectId),
+ isNotNull(projectDocument.shareToken),
+ activeShare(projectDocument.shareExpiresAt),
+ readablePage,
+ ),
+ )
+ .orderBy(asc(projectDocument.title))
+ : [],
+ ]);
+ return {
+ issues: issues.map((row) => ({ ...row, expiresAt: expiryOf(row.expiresAt) })),
+ views: views.map((row) => ({ ...row, expiresAt: expiryOf(row.expiresAt) })),
+ documents: documents.map((row) => ({ ...row, expiresAt: expiryOf(row.expiresAt) })),
+ };
+}
+
+// Revokes every public link of the project of the kinds given. Returns how many it
+// revoked.
+export async function revokeProjectShares(
+ projectId: number,
+ kinds: { issues: boolean; views: boolean; documents: boolean },
+): Promise<number> {
+ const [issues, views, documents] = await Promise.all([
+ kinds.issues
+ ? db
+ .update(issue)
+ .set({ shareToken: null, shareExtended: false, shareExpiresAt: null })
+ .where(and(eq(issue.projectId, projectId), isNotNull(issue.shareToken)))
+ .returning({ id: issue.id })
+ : [],
+ kinds.views
+ ? db
+ .update(projectView)
+ .set({ shareToken: null, shareExtended: false, shareExpiresAt: null })
+ .where(and(eq(projectView.projectId, projectId), isNotNull(projectView.shareToken)))
+ .returning({ id: projectView.id })
+ : [],
+ kinds.documents
+ ? db
+ .update(projectDocument)
+ .set(revokedDocumentShare)
+ .where(
+ and(eq(projectDocument.projectId, projectId), isNotNull(projectDocument.shareToken)),
+ )
+ .returning({ id: projectDocument.id })
+ : [],
+ ]);
+ return issues.length + views.length + documents.length;
+}
diff --git a/apps/api/src/shared/lib.ts b/apps/api/src/shared/lib.ts
index 6857198e..5cca39ca 100644
--- a/apps/api/src/shared/lib.ts
+++ b/apps/api/src/shared/lib.ts
@@ -24,7 +24,7 @@ export class HttpError extends Error {
export const iso = (value: Date): string => value.toISOString();
// Whether a share link with this expiry still works: no expiry, or one still ahead.
-// Issues, views and the share module all read a link's state through it.
+// Issues, views, documents and the share module all read a link's state through it.
export const shareLive = (expiresAt: Date | null): boolean =>
expiresAt === null || expiresAt.getTime() > Date.now();
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 34f4970f..f79bddad 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -8,7 +8,8 @@ Next.js App Router. Pages server-render, API data loads in the browser. Tailwind
use the `@/` alias.
- A feature imports the shared layer (`@/utils`, `@/lib`, `@/hooks`, `@/context`, `@/services`,
`@/i18n`, `@/components/*`), never another feature. One accepted one-way exception: `work-items`
- may compose `issue` components. A second such need moves the piece to `components/common`.
+ and `documents` may compose `issue` components (the read-only issue a public board or document
+ opens). A second such need moves the piece to `components/common`.
- The shared layer never imports a feature. `app/` pages stay thin: mount the feature page and
providers, or redirect.
diff --git a/apps/web/messages/ar/common.json b/apps/web/messages/ar/common.json
index 8e9ea749..4dc00173 100644
--- a/apps/web/messages/ar/common.json
+++ b/apps/web/messages/ar/common.json
@@ -133,6 +133,22 @@
"shareLink": "رابط المشاركة",
"fullDetails": "تفاصيل المهمة كاملة",
"fullDetailsHint": "المسؤولين والوسوم والحقول المخصصة والنشاط.",
+ "includeSubpages": "تضمين الصفحات الفرعية",
+ "includeSubpagesHint": "أي حد معاه الرابط يقدر يقرأ الصفحات اللي تحت الصفحة دي كمان.",
+ "includeIssues": "إظهار المهام المرتبطة",
+ "includeIssuesHint": "المهام من هذا المشروع اللي مذكورة في الصفحات بتظهر بعنوانها وحالتها، وبتتفتح للقراءة بس: الوصف والحالة والنوع والأولوية والتواريخ. من غير تعليقات ولا أشخاص.",
+ "throughDocuments": "عامة عن طريق مستندات مشتركة",
+ "throughDocumentsHint": "الصفحات المشتركة دي بتذكر المهمة دي وبتعرض المهام المرتبطة، فممكن تتقري من روابطها.",
+ "overviewTitle": "عام",
+ "overviewDescription": "كل حاجة في المشروع ده أي حد معاه الرابط يقدر يقراها، وإمتى كل رابط بيبطل.",
+ "overviewEmpty": "مفيش حاجة في المشروع ده متشاركة للعامة.",
+ "overviewDocuments": "المستندات",
+ "overviewIssues": "المهام",
+ "overviewViews": "العروض",
+ "revokeAll": "إلغاء كل الروابط",
+ "revokeAllTitle": "إلغاء كل الروابط العامة؟",
+ "revokeAllHint": "كل رابط عام في المشروع ده تقدر تغيّره هيبطل فورًا. المشاركة تاني بتعمل روابط جديدة.",
+ "revokeAllDone": "{count, plural, =0 {مفيش رابط اتلغى} one {اتلغى رابط واحد} other {اتلغى # روابط}}",
"stopSharing": "إيقاف المشاركة",
"createLink": "إنشاء رابط",
"copy": "نسخ",
diff --git a/apps/web/messages/ar/documents.json b/apps/web/messages/ar/documents.json
index fd8fae2a..b0ada491 100644
--- a/apps/web/messages/ar/documents.json
+++ b/apps/web/messages/ar/documents.json
@@ -60,6 +60,12 @@
"markdownCopied": "تم نسخ Markdown",
"copyLink": "نسخ الرابط",
"linkCopied": "تم نسخ الرابط",
+ "sharePublicly": "مشاركة علنًا",
+ "sharedPublicly": "مُشارَكة علنًا",
+ "sharePage": "مشاركة الصفحة",
+ "sharedPages": "الصفحات المُشارَكة",
+ "shareUnavailable": "الصفحة المشاركة دي مش متاحة. يمكن الرابط اتلغى أو انتهت صلاحيته.",
+ "lockedLink": "للأعضاء المسجلين فقط",
"versionHistory": "سجل الإصدارات",
"versionHistoryDescription": "الإصدار الحالي المحفوظ من هذه الصفحة.",
"currentVersion": "الإصدار الحالي · v{version}",
diff --git a/apps/web/messages/ar/issue.json b/apps/web/messages/ar/issue.json
index a63c03f5..8d37b314 100644
--- a/apps/web/messages/ar/issue.json
+++ b/apps/web/messages/ar/issue.json
@@ -104,6 +104,7 @@
"copied": "تم النسخ!",
"copyPrompt": "نسخ التوجيه",
"sharedPublicly": "مُشارَكة علنًا",
+ "sharedThroughDocument": "عامة عن طريق مستند",
"sharePublicly": "مشاركة علنًا",
"restore": "استعادة المهمة",
"archive": "أرشفة المهمة",
diff --git a/apps/web/messages/ar/nav.json b/apps/web/messages/ar/nav.json
index fec7f093..2eaa83f3 100644
--- a/apps/web/messages/ar/nav.json
+++ b/apps/web/messages/ar/nav.json
@@ -12,6 +12,7 @@
"configuration": "التهيئة",
"members": "الأعضاء",
"notifications": "الإشعارات",
+ "public": "عام",
"notificationPreferences": "تفضيلات الإشعارات",
"projectSettings": "إعدادات المشروع",
"backToProject": "العودة إلى المشروع",
diff --git a/apps/web/messages/en/common.json b/apps/web/messages/en/common.json
index f02c7825..73af9965 100644
--- a/apps/web/messages/en/common.json
+++ b/apps/web/messages/en/common.json
@@ -133,6 +133,22 @@
"shareLink": "Share link",
"fullDetails": "Full issue details",
"fullDetailsHint": "Assignees, labels, custom fields and activity.",
+ "includeSubpages": "Include subpages",
+ "includeSubpagesHint": "Anyone with the link can also read the pages below this one.",
+ "includeIssues": "Show linked issues",
+ "includeIssuesHint": "The issues of this project that the pages name show their title and state, and open read-only: description, state, type, priority and dates. No comments and no people.",
+ "throughDocuments": "Public through shared documents",
+ "throughDocumentsHint": "These shared pages name this issue and show linked issues, so it can be read through their links.",
+ "overviewTitle": "Public",
+ "overviewDescription": "Everything in this project that anyone with the link can read, and when each link stops working.",
+ "overviewEmpty": "Nothing in this project is shared publicly.",
+ "overviewDocuments": "Documents",
+ "overviewIssues": "Issues",
+ "overviewViews": "Views",
+ "revokeAll": "Revoke all links",
+ "revokeAllTitle": "Revoke all public links?",
+ "revokeAllHint": "Every public link in this project that you may change stops working at once. Sharing again creates new links.",
+ "revokeAllDone": "{count, plural, =0 {No link revoked} one {# link revoked} other {# links revoked}}",
"stopSharing": "Stop sharing",
"createLink": "Create link",
"copy": "Copy",
diff --git a/apps/web/messages/en/documents.json b/apps/web/messages/en/documents.json
index 0e83dbd7..7fb4682e 100644
--- a/apps/web/messages/en/documents.json
+++ b/apps/web/messages/en/documents.json
@@ -73,6 +73,12 @@
"markdownCopied": "Markdown copied",
"copyLink": "Copy link",
"linkCopied": "Link copied",
+ "sharePublicly": "Share publicly",
+ "sharedPublicly": "Shared publicly",
+ "sharePage": "Share page",
+ "sharedPages": "Shared pages",
+ "shareUnavailable": "This shared page is not available. The link may have been revoked or may have expired.",
+ "lockedLink": "Only for signed-in members",
"addFavorite": "Add to favorites",
"removeFavorite": "Remove from favorites",
"lock": "Lock page",
diff --git a/apps/web/messages/en/issue.json b/apps/web/messages/en/issue.json
index 03d6ee8d..c3b7ab04 100644
--- a/apps/web/messages/en/issue.json
+++ b/apps/web/messages/en/issue.json
@@ -104,6 +104,7 @@
"copied": "Copied!",
"copyPrompt": "Copy Prompt",
"sharedPublicly": "Shared publicly",
+ "sharedThroughDocument": "Public through a document",
"sharePublicly": "Share publicly",
"restore": "Restore issue",
"archive": "Archive issue",
diff --git a/apps/web/messages/en/nav.json b/apps/web/messages/en/nav.json
index 4597e1f2..723b105e 100644
--- a/apps/web/messages/en/nav.json
+++ b/apps/web/messages/en/nav.json
@@ -12,6 +12,7 @@
"configuration": "Configuration",
"members": "Members",
"notifications": "Notifications",
+ "public": "Public",
"notificationPreferences": "Notification preferences",
"projectSettings": "Project settings",
"backToProject": "Back to project",
diff --git a/apps/web/messages/es-ES/common.json b/apps/web/messages/es-ES/common.json
index 7f0a84c7..cc912daa 100644
--- a/apps/web/messages/es-ES/common.json
+++ b/apps/web/messages/es-ES/common.json
@@ -133,6 +133,22 @@
"shareLink": "Compartir enlace",
"fullDetails": "Detalles completos del ticket",
"fullDetailsHint": "Asignatarios, etiquetas, campos personalizados y actividad.",
+ "includeSubpages": "Incluir subpáginas",
+ "includeSubpagesHint": "Quien tenga el enlace también puede leer las páginas que hay debajo de esta.",
+ "includeIssues": "Mostrar incidencias vinculadas",
+ "includeIssuesHint": "Las incidencias de este proyecto que nombran las páginas muestran su título y estado, y se abren en modo lectura: descripción, estado, tipo, prioridad y fechas. Sin comentarios ni personas.",
+ "throughDocuments": "Pública a través de documentos compartidos",
+ "throughDocumentsHint": "Estas páginas compartidas nombran esta incidencia y muestran incidencias vinculadas, así que se puede leer desde sus enlaces.",
+ "overviewTitle": "Público",
+ "overviewDescription": "Todo lo de este proyecto que cualquiera con el enlace puede leer, y cuándo deja de funcionar cada enlace.",
+ "overviewEmpty": "No hay nada de este proyecto compartido públicamente.",
+ "overviewDocuments": "Documentos",
+ "overviewIssues": "Incidencias",
+ "overviewViews": "Vistas",
+ "revokeAll": "Revocar todos los enlaces",
+ "revokeAllTitle": "¿Revocar todos los enlaces públicos?",
+ "revokeAllHint": "Todos los enlaces públicos de este proyecto que puedes cambiar dejan de funcionar a la vez. Compartir de nuevo crea enlaces nuevos.",
+ "revokeAllDone": "{count, plural, =0 {Ningún enlace revocado} one {# enlace revocado} other {# enlaces revocados}}",
"stopSharing": "Dejar de compartir",
"createLink": "Crear enlace",
"copy": "Copiar",
diff --git a/apps/web/messages/es-ES/documents.json b/apps/web/messages/es-ES/documents.json
index 640b6ffc..dafb0df0 100644
--- a/apps/web/messages/es-ES/documents.json
+++ b/apps/web/messages/es-ES/documents.json
@@ -73,6 +73,12 @@
"markdownCopied": "Markdown copiado",
"copyLink": "Copiar el enlace",
"linkCopied": "Enlace copiado",
+ "sharePublicly": "Compartir públicamente",
+ "sharedPublicly": "Compartida públicamente",
+ "sharePage": "Compartir la página",
+ "sharedPages": "Páginas compartidas",
+ "shareUnavailable": "Esta página compartida no está disponible. Puede que el enlace haya sido revocado o haya caducado.",
+ "lockedLink": "Solo para miembros con sesión iniciada",
"addFavorite": "Añadir a favoritos",
"removeFavorite": "Quitar de favoritos",
"lock": "Bloquear la página",
diff --git a/apps/web/messages/es-ES/issue.json b/apps/web/messages/es-ES/issue.json
index b40e392d..0c43b4b1 100644
--- a/apps/web/messages/es-ES/issue.json
+++ b/apps/web/messages/es-ES/issue.json
@@ -104,6 +104,7 @@
"copied": "¡Copiado!",
"copyPrompt": "Copiar la consigna",
"sharedPublicly": "Compartida públicamente",
+ "sharedThroughDocument": "Pública a través de un documento",
"sharePublicly": "Compartir públicamente",
"restore": "Restaurar el ticket",
"archive": "Archivar el ticket",
diff --git a/apps/web/messages/es-ES/nav.json b/apps/web/messages/es-ES/nav.json
index 48dc8a25..6040b6cf 100644
--- a/apps/web/messages/es-ES/nav.json
+++ b/apps/web/messages/es-ES/nav.json
@@ -12,6 +12,7 @@
"configuration": "Configuración",
"members": "Miembros",
"notifications": "Notificaciones",
+ "public": "Público",
"notificationPreferences": "Preferencias de notificaciones",
"projectSettings": "Ajustes del proyecto",
"backToProject": "Volver al proyecto",
diff --git a/apps/web/messages/fa/common.json b/apps/web/messages/fa/common.json
index c5cfd78f..71dc11aa 100644
--- a/apps/web/messages/fa/common.json
+++ b/apps/web/messages/fa/common.json
@@ -133,6 +133,22 @@
"shareLink": "اشتراک‌گذاری لینک",
"fullDetails": "جزئیات کامل تسک",
"fullDetailsHint": "مسئولان، برچسب‌ها، فیلدهای سفارشی و فعالیت.",
+ "includeSubpages": "شامل زیرصفحه‌ها",
+ "includeSubpagesHint": "هر کسی که لینک را دارد، صفحه‌های زیر این صفحه را هم می‌تواند بخواند.",
+ "includeIssues": "نمایش مسائل مرتبط",
+ "includeIssuesHint": "مسائل این پروژه که در صفحه‌ها نام برده شده‌اند با عنوان و وضعیت نمایش داده می‌شوند و فقط‌خواندنی باز می‌شوند: توضیح، وضعیت، نوع، اولویت و تاریخ‌ها. بدون دیدگاه و بدون افراد.",
+ "throughDocuments": "عمومی از طریق اسناد اشتراکی",
+ "throughDocumentsHint": "این صفحه‌های اشتراکی از این مسئله نام می‌برند و مسائل مرتبط را نشان می‌دهند، پس از طریق پیوندهایشان قابل خواندن است.",
+ "overviewTitle": "عمومی",
+ "overviewDescription": "هر چیزی در این پروژه که هر کسی با پیوند می‌تواند بخواند، و زمان از کار افتادن هر پیوند.",
+ "overviewEmpty": "هیچ چیزی در این پروژه به‌صورت عمومی به اشتراک گذاشته نشده است.",
+ "overviewDocuments": "اسناد",
+ "overviewIssues": "مسائل",
+ "overviewViews": "نماها",
+ "revokeAll": "لغو همه پیوندها",
+ "revokeAllTitle": "همه پیوندهای عمومی لغو شوند؟",
+ "revokeAllHint": "همه پیوندهای عمومی این پروژه که اجازه تغییرشان را دارید یک‌جا از کار می‌افتند. اشتراک دوباره پیوندهای تازه می‌سازد.",
+ "revokeAllDone": "{count, plural, =0 {هیچ پیوندی لغو نشد} one {# پیوند لغو شد} other {# پیوند لغو شد}}",
"stopSharing": "توقف اشتراک‌گذاری",
"createLink": "ایجاد لینک",
"copy": "کپی",
diff --git a/apps/web/messages/fa/documents.json b/apps/web/messages/fa/documents.json
index 936780b6..3a6094ad 100644
--- a/apps/web/messages/fa/documents.json
+++ b/apps/web/messages/fa/documents.json
@@ -73,6 +73,12 @@
"markdownCopied": "Markdown کپی شد",
"copyLink": "کپی لینک",
"linkCopied": "لینک کپی شد",
+ "sharePublicly": "اشتراک‌گذاری عمومی",
+ "sharedPublicly": "به‌صورت عمومی به اشتراک گذاشته شد",
+ "sharePage": "اشتراک‌گذاری صفحه",
+ "sharedPages": "صفحه‌های اشتراکی",
+ "shareUnavailable": "این صفحه اشتراکی در دسترس نیست. ممکن است لینک لغو شده یا منقضی شده باشد.",
+ "lockedLink": "فقط برای اعضای واردشده",
"addFavorite": "افزودن به موردعلاقه‌ها",
"removeFavorite": "حذف از موردعلاقه‌ها",
"lock": "قفل کردن صفحه",
diff --git a/apps/web/messages/fa/issue.json b/apps/web/messages/fa/issue.json
index 4afb1688..14a6bde3 100644
--- a/apps/web/messages/fa/issue.json
+++ b/apps/web/messages/fa/issue.json
@@ -104,6 +104,7 @@
"copied": "کپی شد!",
"copyPrompt": "کپی پرامپت",
"sharedPublicly": "به‌صورت عمومی به اشتراک گذاشته شد",
+ "sharedThroughDocument": "عمومی از طریق یک سند",
"sharePublicly": "اشتراک‌گذاری عمومی",
"restore": "بازگردانی تسک",
"archive": "بایگانی تسک",
diff --git a/apps/web/messages/fa/nav.json b/apps/web/messages/fa/nav.json
index ff620f79..1f6f5539 100644
--- a/apps/web/messages/fa/nav.json
+++ b/apps/web/messages/fa/nav.json
@@ -12,6 +12,7 @@
"configuration": "پیکربندی",
"members": "اعضا",
"notifications": "اعلان‌ها",
+ "public": "عمومی",
"notificationPreferences": "تنظیمات اعلان",
"projectSettings": "تنظیمات پروژه",
"backToProject": "بازگشت به پروژه",
diff --git a/apps/web/messages/fr/common.json b/apps/web/messages/fr/common.json
index 2e976c6b..c5610de2 100644
--- a/apps/web/messages/fr/common.json
+++ b/apps/web/messages/fr/common.json
@@ -133,6 +133,22 @@
"shareLink": "Lien de partage",
"fullDetails": "Détails complets du ticket",
"fullDetailsHint": "Responsables, étiquettes, champs personnalisés et activité.",
+ "includeSubpages": "Inclure les sous-pages",
+ "includeSubpagesHint": "Toute personne disposant du lien peut aussi lire les pages situées sous celle-ci.",
+ "includeIssues": "Afficher les tickets liés",
+ "includeIssuesHint": "Les tickets de ce projet cités dans les pages affichent leur titre et leur statut, et s’ouvrent en lecture seule : description, statut, type, priorité et dates. Sans commentaires ni personnes.",
+ "throughDocuments": "Public via des documents partagés",
+ "throughDocumentsHint": "Ces pages partagées citent ce ticket et affichent les tickets liés, il est donc lisible via leurs liens.",
+ "overviewTitle": "Public",
+ "overviewDescription": "Tout ce que ce projet permet de lire à quiconque a le lien, et quand chaque lien cesse de fonctionner.",
+ "overviewEmpty": "Rien dans ce projet n’est partagé publiquement.",
+ "overviewDocuments": "Documents",
+ "overviewIssues": "Tickets",
+ "overviewViews": "Vues",
+ "revokeAll": "Révoquer tous les liens",
+ "revokeAllTitle": "Révoquer tous les liens publics ?",
+ "revokeAllHint": "Tous les liens publics de ce projet que vous pouvez modifier cessent de fonctionner immédiatement. Un nouveau partage crée de nouveaux liens.",
+ "revokeAllDone": "{count, plural, =0 {Aucun lien révoqué} one {# lien révoqué} other {# liens révoqués}}",
"stopSharing": "Arrêter le partage",
"createLink": "Créer un lien",
"copy": "Copier",
diff --git a/apps/web/messages/fr/documents.json b/apps/web/messages/fr/documents.json
index 8ff47524..0813deed 100644
--- a/apps/web/messages/fr/documents.json
+++ b/apps/web/messages/fr/documents.json
@@ -73,6 +73,12 @@
"markdownCopied": "Markdown copié",
"copyLink": "Copier le lien",
"linkCopied": "Lien copié",
+ "sharePublicly": "Partager publiquement",
+ "sharedPublicly": "Partagée publiquement",
+ "sharePage": "Partager la page",
+ "sharedPages": "Pages partagées",
+ "shareUnavailable": "Cette page partagée n'est pas disponible. Le lien a peut-être été révoqué ou a expiré.",
+ "lockedLink": "Réservé aux membres connectés",
"addFavorite": "Ajouter aux favoris",
"removeFavorite": "Retirer des favoris",
"lock": "Verrouiller la page",
diff --git a/apps/web/messages/fr/issue.json b/apps/web/messages/fr/issue.json
index ac801f65..dbebde0a 100644
--- a/apps/web/messages/fr/issue.json
+++ b/apps/web/messages/fr/issue.json
@@ -104,6 +104,7 @@
"copied": "Copié !",
"copyPrompt": "Copier le prompt",
"sharedPublicly": "Partagé publiquement",
+ "sharedThroughDocument": "Public via un document",
"sharePublicly": "Partager publiquement",
"restore": "Restaurer le ticket",
"archive": "Archiver le ticket",
diff --git a/apps/web/messages/fr/nav.json b/apps/web/messages/fr/nav.json
index 9c41295d..5405e956 100644
--- a/apps/web/messages/fr/nav.json
+++ b/apps/web/messages/fr/nav.json
@@ -12,6 +12,7 @@
"configuration": "Configuration",
"members": "Membres",
"notifications": "Notifications",
+ "public": "Public",
"notificationPreferences": "Préférences de notification",
"projectSettings": "Paramètres du projet",
"backToProject": "Retour au projet",
diff --git a/apps/web/messages/id/common.json b/apps/web/messages/id/common.json
index 07a1cf5c..4bcd20c1 100644
--- a/apps/web/messages/id/common.json
+++ b/apps/web/messages/id/common.json
@@ -133,6 +133,22 @@
"shareLink": "Bagikan tautan",
"fullDetails": "Detail issue lengkap",
"fullDetailsHint": "Penerima tugas, label, bidang khusus, dan aktivitas.",
+ "includeSubpages": "Sertakan subhalaman",
+ "includeSubpagesHint": "Siapa pun yang memiliki tautan juga dapat membaca halaman di bawah halaman ini.",
+ "includeIssues": "Tampilkan isu tertaut",
+ "includeIssuesHint": "Isu proyek ini yang disebut di halaman menampilkan judul dan statusnya, dan terbuka hanya-baca: deskripsi, status, tipe, prioritas, dan tanggal. Tanpa komentar dan tanpa orang.",
+ "throughDocuments": "Publik melalui dokumen yang dibagikan",
+ "throughDocumentsHint": "Halaman yang dibagikan ini menyebut isu ini dan menampilkan isu tertaut, jadi isu ini bisa dibaca lewat tautannya.",
+ "overviewTitle": "Publik",
+ "overviewDescription": "Semua isi proyek ini yang bisa dibaca siapa pun yang punya tautan, dan kapan tiap tautan berhenti berfungsi.",
+ "overviewEmpty": "Tidak ada isi proyek ini yang dibagikan secara publik.",
+ "overviewDocuments": "Dokumen",
+ "overviewIssues": "Isu",
+ "overviewViews": "Tampilan",
+ "revokeAll": "Cabut semua tautan",
+ "revokeAllTitle": "Cabut semua tautan publik?",
+ "revokeAllHint": "Semua tautan publik di proyek ini yang boleh Anda ubah langsung berhenti berfungsi. Membagikan lagi membuat tautan baru.",
+ "revokeAllDone": "{count, plural, =0 {Tidak ada tautan dicabut} other {# tautan dicabut}}",
"stopSharing": "Hentikan pembagian",
"createLink": "Buat tautan",
"copy": "Salin",
diff --git a/apps/web/messages/id/documents.json b/apps/web/messages/id/documents.json
index 898f5732..cfe15d12 100644
--- a/apps/web/messages/id/documents.json
+++ b/apps/web/messages/id/documents.json
@@ -73,6 +73,12 @@
"markdownCopied": "Markdown disalin",
"copyLink": "Salin tautan",
"linkCopied": "Tautan disalin",
+ "sharePublicly": "Bagikan secara publik",
+ "sharedPublicly": "Dibagikan secara publik",
+ "sharePage": "Bagikan halaman",
+ "sharedPages": "Halaman yang dibagikan",
+ "shareUnavailable": "Halaman yang dibagikan ini tidak tersedia. Tautan mungkin telah dicabut atau kedaluwarsa.",
+ "lockedLink": "Hanya untuk anggota yang sudah masuk",
"addFavorite": "Tambah ke favorit",
"removeFavorite": "Hapus dari favorit",
"lock": "Kunci halaman",
diff --git a/apps/web/messages/id/issue.json b/apps/web/messages/id/issue.json
index dfb899cb..e9c9b307 100644
--- a/apps/web/messages/id/issue.json
+++ b/apps/web/messages/id/issue.json
@@ -104,6 +104,7 @@
"copied": "Disalin!",
"copyPrompt": "Salin prompt",
"sharedPublicly": "Dibagikan secara publik",
+ "sharedThroughDocument": "Publik melalui dokumen",
"sharePublicly": "Bagikan secara publik",
"restore": "Pulihkan issue",
"archive": "Arsipkan issue",
diff --git a/apps/web/messages/id/nav.json b/apps/web/messages/id/nav.json
index e89f9679..f00b8904 100644
--- a/apps/web/messages/id/nav.json
+++ b/apps/web/messages/id/nav.json
@@ -12,6 +12,7 @@
"configuration": "Konfigurasi",
"members": "Anggota",
"notifications": "Notifikasi",
+ "public": "Publik",
"notificationPreferences": "Preferensi notifikasi",
"projectSettings": "Pengaturan proyek",
"backToProject": "Kembali ke proyek",
diff --git a/apps/web/messages/ko/common.json b/apps/web/messages/ko/common.json
index 09759053..94ae7dd6 100644
--- a/apps/web/messages/ko/common.json
+++ b/apps/web/messages/ko/common.json
@@ -133,6 +133,22 @@
"shareLink": "공유 링크",
"fullDetails": "이슈 전체 정보",
"fullDetailsHint": "담당자, 라벨, 사용자 지정 필드 및 활동을 포함합니다.",
+ "includeSubpages": "하위 페이지 포함",
+ "includeSubpagesHint": "링크가 있는 사람은 이 페이지 아래의 페이지도 읽을 수 있습니다.",
+ "includeIssues": "연결된 이슈 표시",
+ "includeIssuesHint": "페이지에 언급된 이 프로젝트의 이슈는 제목과 상태가 표시되고 읽기 전용으로 열립니다: 설명, 상태, 유형, 우선순위, 날짜. 댓글과 사람 정보는 없습니다.",
+ "throughDocuments": "공유 문서를 통해 공개됨",
+ "throughDocumentsHint": "이 공유 페이지들이 이 이슈를 언급하고 연결된 이슈를 표시하므로 해당 링크로 읽을 수 있습니다.",
+ "overviewTitle": "공개",
+ "overviewDescription": "이 프로젝트에서 링크만 있으면 누구나 읽을 수 있는 항목과 각 링크의 만료 시점입니다.",
+ "overviewEmpty": "이 프로젝트에 공개 공유된 항목이 없습니다.",
+ "overviewDocuments": "문서",
+ "overviewIssues": "이슈",
+ "overviewViews": "보기",
+ "revokeAll": "모든 링크 해제",
+ "revokeAllTitle": "모든 공개 링크를 해제할까요?",
+ "revokeAllHint": "변경 권한이 있는 이 프로젝트의 모든 공개 링크가 즉시 작동을 멈춥니다. 다시 공유하면 새 링크가 만들어집니다.",
+ "revokeAllDone": "{count, plural, =0 {해제된 링크 없음} other {링크 #개 해제됨}}",
"stopSharing": "공유 중지",
"createLink": "링크 생성",
"copy": "복사",
diff --git a/apps/web/messages/ko/documents.json b/apps/web/messages/ko/documents.json
index a5514b45..febfed20 100644
--- a/apps/web/messages/ko/documents.json
+++ b/apps/web/messages/ko/documents.json
@@ -73,6 +73,12 @@
"markdownCopied": "Markdown 복사됨",
"copyLink": "링크 복사",
"linkCopied": "링크 복사됨",
+ "sharePublicly": "공개 공유",
+ "sharedPublicly": "공개 공유 중",
+ "sharePage": "페이지 공유",
+ "sharedPages": "공유된 페이지",
+ "shareUnavailable": "공유된 페이지를 사용할 수 없습니다. 공유 링크가 취소되었거나 만료되었을 수 있습니다.",
+ "lockedLink": "로그인한 멤버만 볼 수 있습니다",
"addFavorite": "즐겨찾기에 추가",
"removeFavorite": "즐겨찾기에서 제거",
"lock": "페이지 잠금",
diff --git a/apps/web/messages/ko/issue.json b/apps/web/messages/ko/issue.json
index 3543b86d..4fd2f75e 100644
--- a/apps/web/messages/ko/issue.json
+++ b/apps/web/messages/ko/issue.json
@@ -104,6 +104,7 @@
"copied": "복사됨",
"copyPrompt": "프롬프트 복사",
"sharedPublicly": "공개 공유 중",
+ "sharedThroughDocument": "문서를 통해 공개됨",
"sharePublicly": "공개 공유",
"restore": "이슈 복원",
"archive": "이슈 보관",
diff --git a/apps/web/messages/ko/nav.json b/apps/web/messages/ko/nav.json
index 2697a4ea..6538f715 100644
--- a/apps/web/messages/ko/nav.json
+++ b/apps/web/messages/ko/nav.json
@@ -12,6 +12,7 @@
"configuration": "설정",
"members": "멤버",
"notifications": "알림",
+ "public": "공개",
"notificationPreferences": "알림 설정",
"projectSettings": "프로젝트 설정",
"backToProject": "프로젝트로 돌아가기",
diff --git a/apps/web/messages/pt-BR/common.json b/apps/web/messages/pt-BR/common.json
index ae0e73ea..0273c660 100644
--- a/apps/web/messages/pt-BR/common.json
+++ b/apps/web/messages/pt-BR/common.json
@@ -133,6 +133,22 @@
"shareLink": "Link de compartilhamento",
"fullDetails": "Detalhes completos da issue",
"fullDetailsHint": "Responsáveis, etiquetas, campos personalizados e atividade.",
+ "includeSubpages": "Incluir subpáginas",
+ "includeSubpagesHint": "Quem tiver o link também pode ler as páginas abaixo desta.",
+ "includeIssues": "Mostrar issues vinculadas",
+ "includeIssuesHint": "As issues deste projeto citadas nas páginas mostram título e status e abrem só para leitura: descrição, status, tipo, prioridade e datas. Sem comentários e sem pessoas.",
+ "throughDocuments": "Pública por documentos compartilhados",
+ "throughDocumentsHint": "Estas páginas compartilhadas citam esta issue e mostram issues vinculadas, então ela pode ser lida pelos links delas.",
+ "overviewTitle": "Público",
+ "overviewDescription": "Tudo deste projeto que qualquer pessoa com o link pode ler, e quando cada link deixa de funcionar.",
+ "overviewEmpty": "Nada deste projeto está compartilhado publicamente.",
+ "overviewDocuments": "Documentos",
+ "overviewIssues": "Issues",
+ "overviewViews": "Visualizações",
+ "revokeAll": "Revogar todos os links",
+ "revokeAllTitle": "Revogar todos os links públicos?",
+ "revokeAllHint": "Todos os links públicos deste projeto que você pode alterar param de funcionar na hora. Compartilhar de novo cria links novos.",
+ "revokeAllDone": "{count, plural, =0 {Nenhum link revogado} one {# link revogado} other {# links revogados}}",
"stopSharing": "Parar compartilhamento",
"createLink": "Criar link",
"copy": "Copiar",
diff --git a/apps/web/messages/pt-BR/documents.json b/apps/web/messages/pt-BR/documents.json
index 94147eae..d683e102 100644
--- a/apps/web/messages/pt-BR/documents.json
+++ b/apps/web/messages/pt-BR/documents.json
@@ -73,6 +73,12 @@
"markdownCopied": "Markdown copiado",
"copyLink": "Copiar link",
"linkCopied": "Link copiado",
+ "sharePublicly": "Compartilhar publicamente",
+ "sharedPublicly": "Compartilhada publicamente",
+ "sharePage": "Compartilhar página",
+ "sharedPages": "Páginas compartilhadas",
+ "shareUnavailable": "Esta página compartilhada não está disponível. O link pode ter sido revogado ou expirado.",
+ "lockedLink": "Somente para membros conectados",
"addFavorite": "Adicionar aos favoritos",
"removeFavorite": "Remover dos favoritos",
"lock": "Bloquear página",
diff --git a/apps/web/messages/pt-BR/issue.json b/apps/web/messages/pt-BR/issue.json
index 0a0a082a..9221fdf7 100644
--- a/apps/web/messages/pt-BR/issue.json
+++ b/apps/web/messages/pt-BR/issue.json
@@ -104,6 +104,7 @@
"copied": "Copiado!",
"copyPrompt": "Copiar prompt",
"sharedPublicly": "Compartilhado publicamente",
+ "sharedThroughDocument": "Pública por um documento",
"sharePublicly": "Compartilhar publicamente",
"restore": "Restaurar issue",
"archive": "Arquivar issue",
diff --git a/apps/web/messages/pt-BR/nav.json b/apps/web/messages/pt-BR/nav.json
index ef09540f..b92a18fa 100644
--- a/apps/web/messages/pt-BR/nav.json
+++ b/apps/web/messages/pt-BR/nav.json
@@ -12,6 +12,7 @@
"configuration": "Configuração",
"members": "Membros",
"notifications": "Notificações",
+ "public": "Público",
"notificationPreferences": "Preferências de notificação",
"projectSettings": "Configurações do projeto",
"backToProject": "Voltar ao projeto",
diff --git a/apps/web/messages/ru/common.json b/apps/web/messages/ru/common.json
index 18d77c02..f81253ba 100644
--- a/apps/web/messages/ru/common.json
+++ b/apps/web/messages/ru/common.json
@@ -133,6 +133,22 @@
"shareLink": "Ссылка",
"fullDetails": "Полные детали задачи",
"fullDetailsHint": "Исполнители, метки, пользовательские поля и активность.",
+ "includeSubpages": "Включить подстраницы",
+ "includeSubpagesHint": "Все, у кого есть ссылка, смогут читать и страницы, вложенные в эту.",
+ "includeIssues": "Показывать связанные задачи",
+ "includeIssuesHint": "Задачи этого проекта, упомянутые на страницах, показываются с названием и статусом и открываются только для чтения: описание, статус, тип, приоритет и даты. Без комментариев и людей.",
+ "throughDocuments": "Публична через общие документы",
+ "throughDocumentsHint": "Эти общие страницы упоминают задачу и показывают связанные задачи, поэтому её можно прочитать по их ссылкам.",
+ "overviewTitle": "Публичное",
+ "overviewDescription": "Всё в этом проекте, что может прочитать любой по ссылке, и когда каждая ссылка перестаёт работать.",
+ "overviewEmpty": "В этом проекте ничего не опубликовано.",
+ "overviewDocuments": "Документы",
+ "overviewIssues": "Задачи",
+ "overviewViews": "Представления",
+ "revokeAll": "Отозвать все ссылки",
+ "revokeAllTitle": "Отозвать все публичные ссылки?",
+ "revokeAllHint": "Все публичные ссылки этого проекта, которые вы можете менять, сразу перестанут работать. Повторная публикация создаёт новые ссылки.",
+ "revokeAllDone": "{count, plural, =0 {Ссылки не отозваны} one {Отозвана # ссылка} few {Отозваны # ссылки} other {Отозвано # ссылок}}",
"stopSharing": "Закрыть доступ",
"createLink": "Создать ссылку",
"copy": "Скопировать",
diff --git a/apps/web/messages/ru/documents.json b/apps/web/messages/ru/documents.json
index 2d926646..0d612a69 100644
--- a/apps/web/messages/ru/documents.json
+++ b/apps/web/messages/ru/documents.json
@@ -60,6 +60,12 @@
"markdownCopied": "Markdown скопирован",
"copyLink": "Копировать ссылку",
"linkCopied": "Ссылка скопирована",
+ "sharePublicly": "Открыть доступ",
+ "sharedPublicly": "В общем доступе",
+ "sharePage": "Поделиться страницей",
+ "sharedPages": "Общие страницы",
+ "shareUnavailable": "Эта общая страница недоступна. Возможно, ссылку отозвали или срок её действия истёк.",
+ "lockedLink": "Только для вошедших участников",
"versionHistory": "История версий",
"versionHistoryDescription": "Текущая сохранённая версия страницы.",
"currentVersion": "Текущая версия · v{version}",
diff --git a/apps/web/messages/ru/issue.json b/apps/web/messages/ru/issue.json
index 443a9402..cae06a55 100644
--- a/apps/web/messages/ru/issue.json
+++ b/apps/web/messages/ru/issue.json
@@ -104,6 +104,7 @@
"copied": "Скопировано!",
"copyPrompt": "Скопировать промпт",
"sharedPublicly": "В общем доступе",
+ "sharedThroughDocument": "Публична через документ",
"sharePublicly": "Открыть доступ",
"restore": "Восстановить задачу",
"archive": "Архивировать задачу",
diff --git a/apps/web/messages/ru/nav.json b/apps/web/messages/ru/nav.json
index 34187be5..200b23fe 100644
--- a/apps/web/messages/ru/nav.json
+++ b/apps/web/messages/ru/nav.json
@@ -12,6 +12,7 @@
"configuration": "Конфигурация",
"members": "Участники",
"notifications": "Уведомления",
+ "public": "Публичное",
"notificationPreferences": "Настройки уведомлений",
"projectSettings": "Настройки проекта",
"backToProject": "Назад к проекту",
diff --git a/apps/web/messages/tr/common.json b/apps/web/messages/tr/common.json
index 832040f0..1b78a38e 100644
--- a/apps/web/messages/tr/common.json
+++ b/apps/web/messages/tr/common.json
@@ -133,6 +133,22 @@
"shareLink": "Paylaşım bağlantısı",
"fullDetails": "Tüm iş ayrıntıları",
"fullDetailsHint": "Sorumlular, etiketler, özel alanlar ve etkinlikler.",
+ "includeSubpages": "Alt sayfaları dahil et",
+ "includeSubpagesHint": "Bağlantıya sahip olan herkes bu sayfanın altındaki sayfaları da okuyabilir.",
+ "includeIssues": "Bağlantılı işleri göster",
+ "includeIssuesHint": "Sayfalarda adı geçen bu projenin işleri başlık ve durumlarıyla gösterilir ve salt okunur açılır: açıklama, durum, tür, öncelik ve tarihler. Yorum ve kişi bilgisi yok.",
+ "throughDocuments": "Paylaşılan belgeler üzerinden herkese açık",
+ "throughDocumentsHint": "Bu paylaşılan sayfalar bu işi anıyor ve bağlantılı işleri gösteriyor, bu yüzden bağlantıları üzerinden okunabilir.",
+ "overviewTitle": "Herkese açık",
+ "overviewDescription": "Bu projede bağlantıya sahip herkesin okuyabildiği her şey ve her bağlantının ne zaman çalışmayı bırakacağı.",
+ "overviewEmpty": "Bu projede herkese açık paylaşılan bir şey yok.",
+ "overviewDocuments": "Belgeler",
+ "overviewIssues": "İşler",
+ "overviewViews": "Görünümler",
+ "revokeAll": "Tüm bağlantıları kaldır",
+ "revokeAllTitle": "Tüm genel bağlantılar kaldırılsın mı?",
+ "revokeAllHint": "Bu projede değiştirebildiğiniz tüm genel bağlantılar hemen çalışmayı bırakır. Yeniden paylaşmak yeni bağlantılar oluşturur.",
+ "revokeAllDone": "{count, plural, =0 {Bağlantı kaldırılmadı} one {# bağlantı kaldırıldı} other {# bağlantı kaldırıldı}}",
"stopSharing": "Paylaşımı durdur",
"createLink": "Bağlantı oluştur",
"copy": "Kopyala",
diff --git a/apps/web/messages/tr/documents.json b/apps/web/messages/tr/documents.json
index 37e21f38..3f3931ac 100644
--- a/apps/web/messages/tr/documents.json
+++ b/apps/web/messages/tr/documents.json
@@ -73,6 +73,12 @@
"markdownCopied": "Markdown kopyalandı",
"copyLink": "Bağlantıyı kopyala",
"linkCopied": "Bağlantı kopyalandı",
+ "sharePublicly": "Herkese açık paylaş",
+ "sharedPublicly": "Herkese açık paylaşıldı",
+ "sharePage": "Sayfayı paylaş",
+ "sharedPages": "Paylaşılan sayfalar",
+ "shareUnavailable": "Paylaşılan bu sayfaya ulaşılamıyor. Bağlantı iptal edilmiş ya da süresi dolmuş olabilir.",
+ "lockedLink": "Yalnızca oturum açmış üyeler için",
"addFavorite": "Favorilere ekle",
"removeFavorite": "Favorilerden çıkar",
"lock": "Sayfayı kilitle",
diff --git a/apps/web/messages/tr/issue.json b/apps/web/messages/tr/issue.json
index af26a0b1..f376710d 100644
--- a/apps/web/messages/tr/issue.json
+++ b/apps/web/messages/tr/issue.json
@@ -104,6 +104,7 @@
"copied": "Kopyalandı!",
"copyPrompt": "Prompt'u kopyala",
"sharedPublicly": "Herkese açık paylaşıldı",
+ "sharedThroughDocument": "Bir belge üzerinden herkese açık",
"sharePublicly": "Herkese açık paylaş",
"restore": "İşi geri yükle",
"archive": "İşi arşivle",
diff --git a/apps/web/messages/tr/nav.json b/apps/web/messages/tr/nav.json
index 77557c03..daddf999 100644
--- a/apps/web/messages/tr/nav.json
+++ b/apps/web/messages/tr/nav.json
@@ -12,6 +12,7 @@
"configuration": "Yapılandırma",
"members": "Üyeler",
"notifications": "Bildirimler",
+ "public": "Herkese açık",
"notificationPreferences": "Bildirim tercihleri",
"projectSettings": "Proje ayarları",
"backToProject": "Projeye dön",
diff --git a/apps/web/messages/uk/common.json b/apps/web/messages/uk/common.json
index 8cbad43b..c5d4509c 100644
--- a/apps/web/messages/uk/common.json
+++ b/apps/web/messages/uk/common.json
@@ -133,6 +133,22 @@
"shareLink": "Посилання",
"fullDetails": "Повні деталі задачі",
"fullDetailsHint": "Виконавці, мітки, власні поля та активність.",
+ "includeSubpages": "Включити підсторінки",
+ "includeSubpagesHint": "Усі, хто має посилання, зможуть читати й сторінки, вкладені в цю.",
+ "includeIssues": "Показувати пов’язані задачі",
+ "includeIssuesHint": "Задачі цього проєкту, згадані на сторінках, показуються з назвою і статусом і відкриваються лише для читання: опис, статус, тип, пріоритет і дати. Без коментарів і людей.",
+ "throughDocuments": "Публічна через спільні документи",
+ "throughDocumentsHint": "Ці спільні сторінки згадують задачу й показують пов’язані задачі, тож її можна прочитати за їхніми посиланнями.",
+ "overviewTitle": "Публічне",
+ "overviewDescription": "Усе в цьому проєкті, що може прочитати будь-хто за посиланням, і коли кожне посилання перестає працювати.",
+ "overviewEmpty": "У цьому проєкті нічого не опубліковано.",
+ "overviewDocuments": "Документи",
+ "overviewIssues": "Задачі",
+ "overviewViews": "Подання",
+ "revokeAll": "Відкликати всі посилання",
+ "revokeAllTitle": "Відкликати всі публічні посилання?",
+ "revokeAllHint": "Усі публічні посилання цього проєкту, які ви можете змінювати, одразу перестануть працювати. Повторне поширення створює нові посилання.",
+ "revokeAllDone": "{count, plural, =0 {Посилання не відкликано} one {Відкликано # посилання} few {Відкликано # посилання} other {Відкликано # посилань}}",
"stopSharing": "Закрити доступ",
"createLink": "Створити посилання",
"copy": "Скопіювати",
diff --git a/apps/web/messages/uk/documents.json b/apps/web/messages/uk/documents.json
index 508272fe..c0689471 100644
--- a/apps/web/messages/uk/documents.json
+++ b/apps/web/messages/uk/documents.json
@@ -60,6 +60,12 @@
"markdownCopied": "Markdown скопійовано",
"copyLink": "Копіювати посилання",
"linkCopied": "Посилання скопійовано",
+ "sharePublicly": "Відкрити доступ",
+ "sharedPublicly": "У спільному доступі",
+ "sharePage": "Поділитися сторінкою",
+ "sharedPages": "Спільні сторінки",
+ "shareUnavailable": "Ця спільна сторінка недоступна. Можливо, посилання відкликали або його термін дії минув.",
+ "lockedLink": "Лише для учасників, які увійшли",
"versionHistory": "Історія версій",
"versionHistoryDescription": "Поточна збережена версія сторінки.",
"currentVersion": "Поточна версія · v{version}",
diff --git a/apps/web/messages/uk/issue.json b/apps/web/messages/uk/issue.json
index cd354804..bb5f9061 100644
--- a/apps/web/messages/uk/issue.json
+++ b/apps/web/messages/uk/issue.json
@@ -104,6 +104,7 @@
"copied": "Скопійовано!",
"copyPrompt": "Скопіювати промпт",
"sharedPublicly": "У спільному доступі",
+ "sharedThroughDocument": "Публічна через документ",
"sharePublicly": "Відкрити доступ",
"restore": "Відновити задачу",
"archive": "Архівувати задачу",
diff --git a/apps/web/messages/uk/nav.json b/apps/web/messages/uk/nav.json
index 1feba962..f4504664 100644
--- a/apps/web/messages/uk/nav.json
+++ b/apps/web/messages/uk/nav.json
@@ -12,6 +12,7 @@
"configuration": "Конфігурація",
"members": "Учасники",
"notifications": "Сповіщення",
+ "public": "Публічне",
"notificationPreferences": "Налаштування сповіщень",
"projectSettings": "Налаштування проєкту",
"backToProject": "Назад до проєкту",
diff --git a/apps/web/messages/zh-CN/common.json b/apps/web/messages/zh-CN/common.json
index 5e55bcd4..d9fb9863 100644
--- a/apps/web/messages/zh-CN/common.json
+++ b/apps/web/messages/zh-CN/common.json
@@ -133,6 +133,22 @@
"shareLink": "共享链接",
"fullDetails": "完整工作项详情",
"fullDetailsHint": "负责人、标签、自定义字段和活动记录。",
+ "includeSubpages": "包含子页面",
+ "includeSubpagesHint": "拥有链接的任何人也可以阅读此页面下的页面。",
+ "includeIssues": "显示关联的事项",
+ "includeIssuesHint": "页面中提到的本项目事项会显示标题和状态,并可只读打开:描述、状态、类型、优先级和日期。不含评论和人员。",
+ "throughDocuments": "通过共享文档公开",
+ "throughDocumentsHint": "这些共享页面提到了此事项并显示关联事项,因此可以通过它们的链接阅读。",
+ "overviewTitle": "公开",
+ "overviewDescription": "本项目中任何持有链接的人都能阅读的内容,以及每个链接何时失效。",
+ "overviewEmpty": "本项目中没有公开分享的内容。",
+ "overviewDocuments": "文档",
+ "overviewIssues": "事项",
+ "overviewViews": "视图",
+ "revokeAll": "撤销所有链接",
+ "revokeAllTitle": "撤销所有公开链接?",
+ "revokeAllHint": "本项目中你有权更改的所有公开链接将立即失效。再次分享会生成新链接。",
+ "revokeAllDone": "{count, plural, =0 {未撤销链接} other {已撤销 # 个链接}}",
"stopSharing": "停止共享",
"createLink": "创建链接",
"copy": "复制",
diff --git a/apps/web/messages/zh-CN/documents.json b/apps/web/messages/zh-CN/documents.json
index cb37291c..91a7c37b 100644
--- a/apps/web/messages/zh-CN/documents.json
+++ b/apps/web/messages/zh-CN/documents.json
@@ -60,6 +60,12 @@
"markdownCopied": "Markdown 已复制",
"copyLink": "复制链接",
"linkCopied": "链接已复制",
+ "sharePublicly": "公开共享",
+ "sharedPublicly": "已公开共享",
+ "sharePage": "共享页面",
+ "sharedPages": "共享的页面",
+ "shareUnavailable": "此共享页面不可用,链接可能已撤销或已过期。",
+ "lockedLink": "仅限已登录的成员",
"versionHistory": "版本历史",
"versionHistoryDescription": "此页面当前保存的版本。",
"currentVersion": "当前版本 · v{version}",
diff --git a/apps/web/messages/zh-CN/issue.json b/apps/web/messages/zh-CN/issue.json
index fa6ab8d3..a45e4562 100644
--- a/apps/web/messages/zh-CN/issue.json
+++ b/apps/web/messages/zh-CN/issue.json
@@ -104,6 +104,7 @@
"copied": "已复制!",
"copyPrompt": "复制提示词",
"sharedPublicly": "已公开共享",
+ "sharedThroughDocument": "通过文档公开",
"sharePublicly": "公开共享",
"restore": "恢复工作项",
"archive": "归档工作项",
diff --git a/apps/web/messages/zh-CN/nav.json b/apps/web/messages/zh-CN/nav.json
index 5d9623fb..b2ae7257 100644
--- a/apps/web/messages/zh-CN/nav.json
+++ b/apps/web/messages/zh-CN/nav.json
@@ -12,6 +12,7 @@
"configuration": "配置",
"members": "成员",
"notifications": "通知",
+ "public": "公开",
"notificationPreferences": "通知偏好",
"projectSettings": "项目设置",
"backToProject": "返回项目",
diff --git a/apps/web/messages/zh-TW/common.json b/apps/web/messages/zh-TW/common.json
index 50955156..7ff40db0 100644
--- a/apps/web/messages/zh-TW/common.json
+++ b/apps/web/messages/zh-TW/common.json
@@ -133,6 +133,22 @@
"shareLink": "共享連結",
"fullDetails": "完整工作項目詳情",
"fullDetailsHint": "負責人、標籤、自訂欄位和活動記錄。",
+ "includeSubpages": "包含子頁面",
+ "includeSubpagesHint": "擁有連結的任何人也可以閱讀此頁面下的頁面。",
+ "includeIssues": "顯示關聯的項目",
+ "includeIssuesHint": "頁面中提到的本專案項目會顯示標題與狀態,並可唯讀開啟:描述、狀態、類型、優先順序與日期。不含留言與人員。",
+ "throughDocuments": "透過共享文件公開",
+ "throughDocumentsHint": "這些共享頁面提到此項目並顯示關聯項目,因此可透過它們的連結閱讀。",
+ "overviewTitle": "公開",
+ "overviewDescription": "本專案中任何持有連結的人都能閱讀的內容,以及每個連結何時失效。",
+ "overviewEmpty": "本專案中沒有公開分享的內容。",
+ "overviewDocuments": "文件",
+ "overviewIssues": "項目",
+ "overviewViews": "檢視",
+ "revokeAll": "撤銷所有連結",
+ "revokeAllTitle": "撤銷所有公開連結?",
+ "revokeAllHint": "本專案中你有權變更的所有公開連結會立即失效。再次分享會產生新連結。",
+ "revokeAllDone": "{count, plural, =0 {未撤銷連結} other {已撤銷 # 個連結}}",
"stopSharing": "停止共享",
"createLink": "建立連結",
"copy": "複製",
diff --git a/apps/web/messages/zh-TW/documents.json b/apps/web/messages/zh-TW/documents.json
index 82f0f3b6..c1690652 100644
--- a/apps/web/messages/zh-TW/documents.json
+++ b/apps/web/messages/zh-TW/documents.json
@@ -60,6 +60,12 @@
"markdownCopied": "Markdown 已複製",
"copyLink": "複製連結",
"linkCopied": "連結已複製",
+ "sharePublicly": "公開共享",
+ "sharedPublicly": "已公開共享",
+ "sharePage": "共享頁面",
+ "sharedPages": "共享的頁面",
+ "shareUnavailable": "此共享頁面不可用,連結可能已撤銷或已過期。",
+ "lockedLink": "僅限已登入的成員",
"versionHistory": "版本歷史",
"versionHistoryDescription": "此頁面目前儲存的版本。",
"currentVersion": "目前版本 · v{version}",
diff --git a/apps/web/messages/zh-TW/issue.json b/apps/web/messages/zh-TW/issue.json
index 17700223..e6fccb72 100644
--- a/apps/web/messages/zh-TW/issue.json
+++ b/apps/web/messages/zh-TW/issue.json
@@ -104,6 +104,7 @@
"copied": "已複製!",
"copyPrompt": "複製提示詞",
"sharedPublicly": "已公開共享",
+ "sharedThroughDocument": "透過文件公開",
"sharePublicly": "公開共享",
"restore": "恢復工作項目",
"archive": "封存工作項目",
diff --git a/apps/web/messages/zh-TW/nav.json b/apps/web/messages/zh-TW/nav.json
index 7254a8cc..ae4e86d1 100644
--- a/apps/web/messages/zh-TW/nav.json
+++ b/apps/web/messages/zh-TW/nav.json
@@ -12,6 +12,7 @@
"configuration": "設定",
"members": "成員",
"notifications": "通知",
+ "public": "公開",
"notificationPreferences": "通知偏好",
"projectSettings": "專案設定",
"backToProject": "返回專案",
diff --git a/apps/web/src/app/[teamRef]/(shell)/[projectKey]/public/page.tsx b/apps/web/src/app/[teamRef]/(shell)/[projectKey]/public/page.tsx
new file mode 100644
index 00000000..5d019b87
--- /dev/null
+++ b/apps/web/src/app/[teamRef]/(shell)/[projectKey]/public/page.tsx
@@ -0,0 +1,5 @@
+import PublicSharesPage from '@/features/shares/PublicSharesPage';
+
+export default function Page() {
+ return <PublicSharesPage />;
+}
diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css
index e9e37e28..92d76e52 100644
--- a/apps/web/src/app/globals.css
+++ b/apps/web/src/app/globals.css
@@ -389,6 +389,21 @@
text-decoration: underline;
text-underline-offset: 2px;
}
+/* A link on a public share page that needs a session (features/documents/utils/sharedLinks). */
+.md-content a.share-link-locked {
+ color: var(--muted-foreground);
+}
+.md-content a.share-link-locked::after {
+ content: '';
+ display: inline-block;
+ width: 0.8em;
+ height: 0.8em;
+ margin-inline-start: 0.2em;
+ vertical-align: -0.05em;
+ background-color: currentColor;
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E")
+ center / contain no-repeat;
+}
/* Mention chips: an @username in the text is rendered as its own node (see
lib/tiptap-mention.ts) and styled as a pill. */
.md-content .mention {
@@ -403,7 +418,8 @@
color: var(--foreground);
background: color-mix(in oklab, var(--warning) 45%, transparent);
}
-a.issue-ref {
+a.issue-ref,
+span.issue-ref {
display: inline-flex;
align-items: baseline;
gap: 0.35em;
@@ -422,6 +438,9 @@ a.issue-ref {
.md-content a.issue-ref {
text-decoration: none;
}
+span.issue-ref {
+ cursor: default;
+}
.issue-ref-dot {
display: inline-block;
width: 0.55em;
diff --git a/apps/web/src/app/media/[...path]/route.test.ts b/apps/web/src/app/media/[...path]/route.test.ts
index 74cb8728..41e37233 100644
--- a/apps/web/src/app/media/[...path]/route.test.ts
+++ b/apps/web/src/app/media/[...path]/route.test.ts
@@ -29,6 +29,11 @@ describe('public media proxy', () => {
['avatars', PUBLIC_ID],
['avatars', PUBLIC_ID, 'meta'],
['avatars', PUBLIC_ID, 'raw', 'extra'],
+ ['share', 'document', PUBLIC_ID, 'assets', 'not-an-id', 'raw'],
+ ['share', 'document', 'not-a-token', 'assets', PUBLIC_ID, 'raw'],
+ ['share', 'view', PUBLIC_ID, 'assets', PUBLIC_ID, 'raw'],
+ ['share', 'document', PUBLIC_ID, 'documents', PUBLIC_ID, 'raw'],
+ ['share', 'document', PUBLIC_ID, 'assets', PUBLIC_ID],
]) {
const response = await get(path);
assert.equal(response.status, 404, path.join('/'));
@@ -73,6 +78,19 @@ describe('public media proxy', () => {
);
});
+ it('serves an asset of a shared document through its token', async () => {
+ process.env.SERVICE_URL_API = 'http://api:3000';
+ let target = '';
+ globalThis.fetch = (async (input: string | URL | Request) => {
+ target = String(input);
+ return new Response('asset');
+ }) as typeof fetch;
+ const TOKEN = '0f8b8c1e-2d3a-4b5c-9d6e-7f8091a2b3c4';
+ const response = await get(['share', 'document', TOKEN, 'assets', PUBLIC_ID, 'raw']);
+ assert.equal(response.status, 200);
+ assert.equal(target, `http://api:3000/share/document/${TOKEN}/assets/${PUBLIC_ID}/raw`);
+ });
+
it('streams the exact media endpoint with the query and the cache validator', async () => {
process.env.SERVICE_URL_API = 'http://api:3000';
let capturedInput = '';
diff --git a/apps/web/src/app/media/[...path]/route.ts b/apps/web/src/app/media/[...path]/route.ts
index ac381546..8156c4a3 100644
--- a/apps/web/src/app/media/[...path]/route.ts
+++ b/apps/web/src/app/media/[...path]/route.ts
@@ -11,6 +11,27 @@ import { serverRuntimeEnv } from '@/utils/runtimeEnv';
const MEDIA_ROOTS = ['avatars', 'attachments', 'chat-attachments', 'initiative-attachments'];
const PUBLIC_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
+// The api path a media path names, or null for any other shape: `<root>/<id>/raw`, or
+// the asset of a shared document, `share/document/<token>/assets/<id>/raw`, which the
+// share token alone opens.
+function upstreamPath(path: string[]): string | null {
+ const [root, publicId, raw] = path;
+ if (path.length === 3 && MEDIA_ROOTS.includes(root) && PUBLIC_ID.test(publicId) && raw === 'raw')
+ return path.join('/');
+ const [share, kind, token, assets, assetId, last] = path;
+ if (
+ path.length === 6 &&
+ share === 'share' &&
+ kind === 'document' &&
+ PUBLIC_ID.test(token) &&
+ assets === 'assets' &&
+ PUBLIC_ID.test(assetId) &&
+ last === 'raw'
+ )
+ return path.join('/');
+ return null;
+}
+
// Copied from the api's response, including the headers that keep attacker-controlled
// bytes inert (nosniff, the disposition that forces a download, the sandbox CSP).
const PASSTHROUGH_HEADERS = [
@@ -24,22 +45,14 @@ const PASSTHROUGH_HEADERS = [
];
export async function GET(request: Request, { params }: { params: Promise<{ path: string[] }> }) {
- const { path } = await params;
- const [root, publicId, raw] = path;
- if (
- path.length !== 3 ||
- !MEDIA_ROOTS.includes(root) ||
- !PUBLIC_ID.test(publicId) ||
- raw !== 'raw'
- ) {
- return new Response(null, { status: 404 });
- }
+ const upstream = upstreamPath((await params).path);
+ if (!upstream) return new Response(null, { status: 404 });
// The public origin is what the browser uses; inside a compose network the api is
// reached by service name, which is what SERVICE_URL_API carries (as for the worker).
const origin = process.env.SERVICE_URL_API || serverRuntimeEnv().apiUrl;
const { search } = new URL(request.url);
- const upstream = await fetch(`${origin}/${root}/${publicId}/raw${search}`, {
+ const response = await fetch(`${origin}/${upstream}${search}`, {
// The api answers 304 to it, and passing it on keeps a cached avatar cached.
headers: forwardedHeaders(request),
cache: 'no-store',
@@ -48,10 +61,10 @@ export async function GET(request: Request, { params }: { params: Promise<{ path
const headers = new Headers();
for (const name of PASSTHROUGH_HEADERS) {
- const value = upstream.headers.get(name);
+ const value = response.headers.get(name);
if (value) headers.set(name, value);
}
- return new Response(upstream.body, { status: upstream.status, headers });
+ return new Response(response.body, { status: response.status, headers });
}
function forwardedHeaders(request: Request): HeadersInit {
diff --git a/apps/web/src/app/share/document/[token]/page.tsx b/apps/web/src/app/share/document/[token]/page.tsx
new file mode 100644
index 00000000..660058f1
--- /dev/null
+++ b/apps/web/src/app/share/document/[token]/page.tsx
@@ -0,0 +1,6 @@
+import PublicDocumentPage from '@/features/documents/PublicDocumentPage';
+
+export default async function Page({ params }: { params: Promise<{ token: string }> }) {
+ const { token } = await params;
+ return <PublicDocumentPage token={token} />;
+}
diff --git a/apps/web/src/components/common/editor/IssueRefChip.test.tsx b/apps/web/src/components/common/editor/IssueRefChip.test.tsx
new file mode 100644
index 00000000..ad7b8358
--- /dev/null
+++ b/apps/web/src/components/common/editor/IssueRefChip.test.tsx
@@ -0,0 +1,109 @@
+import assert from 'node:assert/strict';
+import { createRequire } from 'node:module';
+import { afterEach, beforeEach, describe, it } from 'node:test';
+import { act } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
+import { JSDOM } from 'jsdom';
+import * as auth from '@/lib/auth-client';
+import type { SharedDocumentIssue } from '@/lib/api/endpoints/share';
+import { IssueRefsProvider } from '@/context/issueRefs';
+
+const spyOn = createRequire(import.meta.url)('bun:test').spyOn as (
+ target: object,
+ method: string,
+) => { mockReturnValue(value: unknown): { mockRestore(): void } };
+
+let dom: JSDOM;
+let root: Root;
+let originals: Map<string, PropertyDescriptor | undefined>;
+let restoreSession: () => void;
+let originalFetch: typeof fetch;
+let requests: string[];
+let IssueRefChip: (typeof import('./IssueRefChip'))['default'];
+
+const issue = (sequence: number): SharedDocumentIssue => ({
+ id: sequence + 100,
+ sequence,
+ title: `Issue ${sequence}`,
+ state: { name: 'In Progress', color: '#22c55e' },
+});
+
+beforeEach(async () => {
+ dom = new JSDOM('<div id="root"></div>', { url: 'https://planner.test' });
+ const globals = {
+ window: dom.window,
+ document: dom.window.document,
+ navigator: dom.window.navigator,
+ Node: dom.window.Node,
+ Element: dom.window.Element,
+ HTMLElement: dom.window.HTMLElement,
+ IS_REACT_ACT_ENVIRONMENT: true,
+ };
+ originals = new Map(
+ Object.keys(globals).map((key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)]),
+ );
+ for (const [key, value] of Object.entries(globals))
+ Object.defineProperty(globalThis, key, { configurable: true, value });
+ ({ default: IssueRefChip } = await import('./IssueRefChip'));
+ const session = spyOn(auth, 'useSession').mockReturnValue({
+ data: null,
+ isPending: false,
+ error: null,
+ } as ReturnType<typeof auth.useSession>);
+ restoreSession = () => session.mockRestore();
+ originalFetch = globalThis.fetch;
+ requests = [];
+ globalThis.fetch = (async (input) => {
+ requests.push(String(input));
+ return Response.json({});
+ }) as typeof fetch;
+ root = createRoot(document.getElementById('root')!);
+});
+
+afterEach(() => {
+ act(() => root.unmount());
+ restoreSession();
+ globalThis.fetch = originalFetch;
+ dom.window.close();
+ for (const [key, descriptor] of originals) {
+ if (descriptor) Object.defineProperty(globalThis, key, descriptor);
+ else Reflect.deleteProperty(globalThis, key);
+ }
+});
+
+describe('IssueRefChip on a share page', () => {
+ it('shows the issues the share names and opens them under it', async () => {
+ const shared = {
+ issues: new Map([
+ [1, issue(1)],
+ [2, issue(2)],
+ ]),
+ href: (id: number) => `/share/document/tok?issue=${id}`,
+ };
+ const client = new QueryClient();
+ await act(() =>
+ root.render(
+ <QueryClientProvider client={client}>
+ <IssueRefsProvider refs={['share.MKT']} shared={shared}>
+ <IssueRefChip projectRef="share.MKT" sequence={1} />
+ <IssueRefChip projectRef="share.MKT" sequence={2} />
+ <IssueRefChip projectRef="share.MKT" sequence={3} />
+ </IssueRefsProvider>
+ </QueryClientProvider>,
+ ),
+ );
+
+ const chips = [...document.querySelectorAll('.issue-ref')].map((chip) => ({
+ tag: chip.tagName,
+ href: chip.getAttribute('href'),
+ text: chip.textContent,
+ }));
+ assert.deepEqual(chips, [
+ { tag: 'A', href: '/share/document/tok?issue=101', text: 'MKT-1Issue 1' },
+ { tag: 'A', href: '/share/document/tok?issue=102', text: 'MKT-2Issue 2' },
+ { tag: 'SPAN', href: null, text: 'MKT-3' },
+ ]);
+ assert.deepEqual(requests, []);
+ });
+});
diff --git a/apps/web/src/components/common/editor/IssueRefChip.tsx b/apps/web/src/components/common/editor/IssueRefChip.tsx
index 23ba9d85..ecd0665b 100644
--- a/apps/web/src/components/common/editor/IssueRefChip.tsx
+++ b/apps/web/src/components/common/editor/IssueRefChip.tsx
@@ -1,10 +1,12 @@
import { useRef } from 'react';
+import { useIssueRefs } from '@/context/issueRefs';
import { issuePath, splitProjectRef } from '@/utils/paths';
import type { ResolvedLinkPreview } from './resolveLinkPreview';
import { useLinkPreviewQuery } from './useLinkPreviewQuery';
// The link an issue identifier is drawn as in read-only text: the state colour, the
-// identifier and the title, read through the same query as the hover card.
+// identifier and the title, read through the same query as the hover card. On a public share page they come
+// from the share, and the chip opens the issue under it.
export default function IssueRefChip({
projectRef,
sequence,
@@ -12,20 +14,43 @@ export default function IssueRefChip({
projectRef: string;
sequence: number;
}) {
+ const { shared } = useIssueRefs();
const path = issuePath(projectRef, sequence);
- const { data, isError } = useLinkPreviewQuery(new URL(path, window.location.origin).href);
+ const { data, isError } = useLinkPreviewQuery(
+ shared ? undefined : new URL(path, window.location.origin).href,
+ );
// The query hides an internal preview while it revalidates, which the hover card
// starts on every open. The chip keeps what it showed until the answer is a failure.
const shown = useRef<ResolvedLinkPreview | undefined>(undefined);
if (data) shown.current = data;
if (isError) shown.current = undefined;
const preview = shown.current;
+ const id = `${splitProjectRef(projectRef).key}-${sequence}`;
+
+ if (shared) {
+ const issue = shared.issues.get(sequence);
+ const content = (
+ <>
+ {issue && <span className="issue-ref-dot" style={{ backgroundColor: issue.state.color }} />}
+ <span className="issue-ref-id">{id}</span>
+ {issue && <span className="issue-ref-title">{issue.title}</span>}
+ </>
+ );
+ return issue ? (
+ <a href={shared.href(issue.id)} className="issue-ref" title={issue.state.name}>
+ {content}
+ </a>
+ ) : (
+ <span className="issue-ref">{content}</span>
+ );
+ }
+
return (
<a href={path} className="issue-ref">
{preview?.status && (
<span className="issue-ref-dot" style={{ backgroundColor: preview.status.color }} />
)}
- <span className="issue-ref-id">{`${splitProjectRef(projectRef).key}-${sequence}`}</span>
+ <span className="issue-ref-id">{id}</span>
{preview?.issueTitle && <span className="issue-ref-title">{preview.issueTitle}</span>}
</a>
);
diff --git a/apps/web/src/components/common/page/PublicShareFrame.tsx b/apps/web/src/components/common/page/PublicShareFrame.tsx
index 3a41d502..3dd65749 100644
--- a/apps/web/src/components/common/page/PublicShareFrame.tsx
+++ b/apps/web/src/components/common/page/PublicShareFrame.tsx
@@ -1,8 +1,8 @@
import { type ReactNode } from 'react';
-// The bare wrapper for a public read-only share page (a shared issue or board).
+// The bare wrapper for a public read-only share page (a shared issue, board or document).
// No app navigation, header or session — just the shared content on a full-height
-// background, so the page shows only the board or the issue.
+// background, so the page shows only what is shared.
export default function PublicShareFrame({ children }: { children: ReactNode }) {
return <div className="min-h-screen bg-background text-foreground">{children}</div>;
}
diff --git a/apps/web/src/components/common/page/PublicShareHeader.tsx b/apps/web/src/components/common/page/PublicShareHeader.tsx
index bbe20b21..053754f7 100644
--- a/apps/web/src/components/common/page/PublicShareHeader.tsx
+++ b/apps/web/src/components/common/page/PublicShareHeader.tsx
@@ -1,7 +1,7 @@
import ItsAPlanMark from '@/components/brand/ItsAPlanMark';
import { APP_NAME, APP_SITE_URL } from '@/utils/app';
-// The header over a public shared page (a board or an issue). It shows the project
+// The header over a public shared page (a board, an issue or a document). It shows the project
// name, the ticker, and an optional trailing label. On a board that label is the
// shared view's name. The product mark links to the product site. The header shows
// identity only, with no app navigation and no session.
diff --git a/apps/web/src/components/common/share/ShareDialog.tsx b/apps/web/src/components/common/share/ShareDialog.tsx
index 08136f86..f21df2a8 100644
--- a/apps/web/src/components/common/share/ShareDialog.tsx
+++ b/apps/web/src/components/common/share/ShareDialog.tsx
@@ -1,6 +1,6 @@
'use client';
-import { useState } from 'react';
+import { type ReactNode, useState } from 'react';
import { toast } from 'sonner';
import { CalendarClock, Check, ChevronDown, Copy, Globe, Loader2 } from 'lucide-react';
import type { ShareOptions, ShareState } from '@/lib/api/endpoints/share';
@@ -22,6 +22,14 @@ import { useFormatter, useTranslations } from 'next-intl';
const EXPIRY_PRESETS = [1, 3, 7] as const;
+type ShareOptionName = 'extended' | 'includeChildren' | 'includeIssues';
+
+const OPTION_TEXT = {
+ extended: { label: 'fullDetails', hint: 'fullDetailsHint' },
+ includeChildren: { label: 'includeSubpages', hint: 'includeSubpagesHint' },
+ includeIssues: { label: 'includeIssues', hint: 'includeIssuesHint' },
+} as const;
+
function inDays(days: number): string {
return new Date(Date.now() + days * 24 * 60 * 60 * 1000).toISOString();
}
@@ -33,7 +41,7 @@ function endOfDay(day: Date): string {
return at.toISOString();
}
-// A generic public-share dialog for an issue or a saved view. It shows the current
+// A generic public-share dialog for an issue, a saved view or a document. It shows the current
// state (shared with a copyable link, or not shared) and toggles it through the
// enable/disable callbacks. The caller supplies the current token, the enable
// (returns the new token) and disable operations, and the path builder that turns a
@@ -43,28 +51,32 @@ export default function ShareDialog({
onOpenChange,
title,
token,
- extended,
+ options,
expiresAt,
enable,
disable,
pathForToken,
calendarPathForToken,
+ notice,
}: {
open: boolean;
onOpenChange: (open: boolean) => void;
title: string;
token: string | null;
- // How much the current link exposes.
- extended: boolean;
+ // The current link's settings: whether an issue or a view shows its full details, or
+ // whether a document's subpages and the issues it names come with it.
+ options: { name: ShareOptionName; checked: boolean }[];
// When the current link stops working, or null when it never does.
expiresAt: string | null;
- // Creates the link, or changes how much a live one exposes or when it expires;
+ // Creates the link, or changes the setting of a live one or when it expires;
// returns its token and expiry.
enable: (options: ShareOptions) => Promise<ShareState>;
disable: () => Promise<void>;
pathForToken: (token: string) => string;
// The calendar feed path, for a shared view. Omitted by an issue share.
calendarPathForToken?: (token: string) => string;
+ // Shown under the dialog's description, whether or not the entity has a link.
+ notice?: ReactNode;
}) {
const t = useTranslations('common.share');
const format = useFormatter();
@@ -105,10 +117,14 @@ export default function ShareDialog({
}
const onEnable = () =>
- run(async () => apply(await enable({ extended: false })), t('createFailed'));
+ run(
+ async () =>
+ apply(await enable(Object.fromEntries(options.map((option) => [option.name, false])))),
+ t('createFailed'),
+ );
- const onSetExtended = (next: boolean) =>
- run(async () => apply(await enable({ extended: next })), t('changeFailed'));
+ const onSetOption = (name: ShareOptionName, next: boolean) =>
+ run(async () => apply(await enable({ [name]: next })), t('changeFailed'));
const onSetExpiry = (next: string | null) => {
setExpiryOpen(false);
@@ -145,6 +161,7 @@ export default function ShareDialog({
<DialogTitle>{title}</DialogTitle>
<DialogDescription>{t('hint')}</DialogDescription>
</DialogHeader>
+ {notice}
{current ? (
<div className="flex flex-col gap-3">
@@ -194,17 +211,24 @@ export default function ShareDialog({
</div>
)}
- <label className="flex items-center justify-between gap-4 rounded-md border px-3 py-2.5">
- <span className="min-w-0">
- <span className="block text-sm">{t('fullDetails')}</span>
- <span className="block text-xs text-muted-foreground">{t('fullDetailsHint')}</span>
- </span>
- <Switch
- checked={extended}
- disabled={busy}
- onCheckedChange={(next) => void onSetExtended(next)}
- />
- </label>
+ {options.map((option) => (
+ <label
+ key={option.name}
+ className="flex items-center justify-between gap-4 rounded-md border px-3 py-2.5"
+ >
+ <span className="min-w-0">
+ <span className="block text-sm">{t(OPTION_TEXT[option.name].label)}</span>
+ <span className="block text-xs text-muted-foreground">
+ {t(OPTION_TEXT[option.name].hint)}
+ </span>
+ </span>
+ <Switch
+ checked={option.checked}
+ disabled={busy}
+ onCheckedChange={(next) => void onSetOption(option.name, next)}
+ />
+ </label>
+ ))}
<div className="flex items-center justify-between gap-4 rounded-md border px-3 py-2.5">
<span className="min-w-0">
diff --git a/apps/web/src/components/layout/SavedViewTab.tsx b/apps/web/src/components/layout/SavedViewTab.tsx
index 1c0ededb..d0580ef7 100644
--- a/apps/web/src/components/layout/SavedViewTab.tsx
+++ b/apps/web/src/components/layout/SavedViewTab.tsx
@@ -197,7 +197,7 @@ export default function SavedViewTab({
onOpenChange={setSharing}
title={t('shareBoard')}
token={view.shareToken}
- extended={view.shareExtended}
+ options={[{ name: 'extended', checked: view.shareExtended }]}
expiresAt={view.shareExpiresAt}
enable={share}
disable={disableShare}
diff --git a/apps/web/src/components/layout/SidebarConfigNav.tsx b/apps/web/src/components/layout/SidebarConfigNav.tsx
index d198e9e7..3a802f2b 100644
--- a/apps/web/src/components/layout/SidebarConfigNav.tsx
+++ b/apps/web/src/components/layout/SidebarConfigNav.tsx
@@ -1,7 +1,7 @@
import { usePathname } from 'next/navigation';
import { useTranslations } from 'next-intl';
-import { Bell, Settings, Users } from 'lucide-react';
-import { membersPath, notificationsPath } from '@/utils/paths';
+import { Bell, Globe, Settings, Users } from 'lucide-react';
+import { membersPath, notificationsPath, publicSharesPath } from '@/utils/paths';
import { useSettingsNavGroups } from '@/hooks/useSettingsNavGroups';
import { usePermissions } from '@/hooks/usePermissions';
import {
@@ -12,8 +12,8 @@ import {
} from '@/components/ui/sidebar';
import SidebarNavItem from '@/components/layout/SidebarNavItem';
-// The Configuration sidebar group: Members, Notifications and the "Project
-// settings" entry. That entry links to the first settings section the viewer may
+// The Configuration sidebar group: Members, Notifications, Public (the project's
+// public links) and the "Project settings" entry. That entry links to the first settings section the viewer may
// read and switches the sidebar into settings mode (see AppSidebar).
export default function SidebarConfigNav({ projectKey }: { projectKey: string | null }) {
const t = useTranslations('nav');
@@ -45,6 +45,13 @@ export default function SidebarConfigNav({ projectKey }: { projectKey: string |
disabled={disabled}
/>
)}
+ <SidebarNavItem
+ href={projectKey ? publicSharesPath(projectKey) : '#'}
+ icon={Globe}
+ label={t('public')}
+ active={!!projectKey && pathname === publicSharesPath(projectKey)}
+ disabled={disabled}
+ />
{firstHref && (
<SidebarNavItem
href={firstHref}
diff --git a/apps/web/src/context/issueRefs.tsx b/apps/web/src/context/issueRefs.tsx
index 3524ac9e..3b3be637 100644
--- a/apps/web/src/context/issueRefs.tsx
+++ b/apps/web/src/context/issueRefs.tsx
@@ -1,24 +1,36 @@
'use client';
import { createContext, useContext, type ReactNode } from 'react';
+import type { SharedDocumentIssue } from '@/lib/api/endpoints/share';
// The projects (by ref) an issue identifier is linked for, and whether the link may read
-// the issue it names to show its state and title.
-type IssueRefs = { refs: readonly string[]; resolve: boolean };
+// the issue it names to show its state and title. A public share page has no session to
+// read them with and passes the issues it was given, by sequence, in `shared`, with the
+// address that opens one under the share.
+export type SharedIssueRefs = {
+ issues: ReadonlyMap<number, SharedDocumentIssue>;
+ href: (issueId: number) => string;
+};
+
+type IssueRefs = { refs: readonly string[]; resolve: boolean; shared?: SharedIssueRefs };
const IssueRefsContext = createContext<IssueRefs>({ refs: [], resolve: false });
export function IssueRefsProvider({
refs,
resolve = true,
+ shared,
children,
}: {
refs: readonly string[];
resolve?: boolean;
+ shared?: SharedIssueRefs;
children: ReactNode;
}) {
return (
- <IssueRefsContext.Provider value={{ refs, resolve }}>{children}</IssueRefsContext.Provider>
+ <IssueRefsContext.Provider value={{ refs, resolve, shared }}>
+ {children}
+ </IssueRefsContext.Provider>
);
}
diff --git a/apps/web/src/features/documents/PublicDocumentPage.tsx b/apps/web/src/features/documents/PublicDocumentPage.tsx
new file mode 100644
index 00000000..2552f69b
--- /dev/null
+++ b/apps/web/src/features/documents/PublicDocumentPage.tsx
@@ -0,0 +1,97 @@
+'use client';
+
+import { useMemo } from 'react';
+import { useRouter, useSearchParams } from 'next/navigation';
+import { keepPreviousData, useQuery } from '@tanstack/react-query';
+import { useTranslations } from 'next-intl';
+import { getSharedDocument, getSharedDocumentIssue } from '@/lib/api/endpoints/share';
+import { titlePath, useDocumentTitle } from '@/hooks/useDocumentTitle';
+import { IssueRefsProvider } from '@/context/issueRefs';
+import PublicShareFrame from '@/components/common/page/PublicShareFrame';
+import PublicShareHeader from '@/components/common/page/PublicShareHeader';
+import PublicIssueOverlay from '@/features/issue/components/public/PublicIssueOverlay';
+import DocumentLoadingState from './components/DocumentLoadingState';
+import DocumentShareArticle from './components/DocumentShareArticle';
+import DocumentShareTree from './components/DocumentShareTree';
+import { parsePageParam, sharedIssueHref, sharedPageHref } from './utils/sharedLinks';
+
+// The public read-only page for a shared document (/share/document/:token). Fetches the
+// bundle by token and renders it with no session. A link that includes the subpages
+// lists them beside the page, and opening one reads it under the same token. The open
+// subpage is in `?page`, so it survives a reload and can be linked to. With linked issues
+// shown, an issue the page names opens over it, read under the same token (`?issue`).
+export default function PublicDocumentPage({ token }: { token: string }) {
+ const t = useTranslations('documents');
+ const router = useRouter();
+ const searchParams = useSearchParams();
+ const pageId = parsePageParam(searchParams.get('page'));
+ const issueId = parsePageParam(searchParams.get('issue'));
+ const query = useQuery({
+ queryKey: ['share', 'document', token, pageId],
+ queryFn: () => getSharedDocument(token, pageId ?? undefined),
+ retry: false,
+ placeholderData: keepPreviousData,
+ });
+ const shared = query.isError ? undefined : query.data;
+ const rootId = shared?.pages[0].id ?? 0;
+ const issueRefs = useMemo(
+ () => ({
+ issues: new Map((shared?.issues ?? []).map((issue) => [issue.sequence, issue])),
+ href: (id: number) => sharedIssueHref(token, pageId ?? rootId, rootId, id),
+ }),
+ [shared?.issues, token, pageId, rootId],
+ );
+ useDocumentTitle(
+ titlePath(shared?.project.name, shared && (shared.document.title || t('untitled'))),
+ );
+
+ if (query.isLoading) {
+ return (
+ <PublicShareFrame>
+ <DocumentLoadingState />
+ </PublicShareFrame>
+ );
+ }
+
+ if (!shared) {
+ return (
+ <PublicShareFrame>
+ <p className="px-6 py-10 text-sm text-muted-foreground">{t('shareUnavailable')}</p>
+ </PublicShareFrame>
+ );
+ }
+
+ const open = (id: number | null) => {
+ router.push(sharedPageHref(token, id ?? rootId, rootId));
+ };
+
+ return (
+ <PublicShareFrame>
+ <PublicShareHeader name={shared.project.name} ticker={shared.project.key} />
+ <div className="flex flex-col md:flex-row">
+ {shared.pages.length > 1 && (
+ <DocumentShareTree pages={shared.pages} currentId={shared.document.id} onOpen={open} />
+ )}
+ <IssueRefsProvider
+ refs={issueRefs.issues.size > 0 ? [`share.${shared.project.key}`] : []}
+ shared={issueRefs}
+ >
+ <DocumentShareArticle
+ token={token}
+ document={shared.document}
+ pages={shared.pages}
+ onOpen={open}
+ />
+ </IssueRefsProvider>
+ </div>
+ <PublicIssueOverlay
+ queryKey={['share', 'document', token, 'issue']}
+ load={(id) => getSharedDocumentIssue(token, id)}
+ issueId={issueId}
+ extended={false}
+ onOpenIssue={(id) => router.push(issueRefs.href(id))}
+ onClose={() => router.push(sharedPageHref(token, pageId ?? rootId, rootId))}
+ />
+ </PublicShareFrame>
+ );
+}
diff --git a/apps/web/src/features/documents/components/DocumentEditor.tsx b/apps/web/src/features/documents/components/DocumentEditor.tsx
index 2bc3ccd1..9609d805 100644
--- a/apps/web/src/features/documents/components/DocumentEditor.tsx
+++ b/apps/web/src/features/documents/components/DocumentEditor.tsx
@@ -229,6 +229,7 @@ export default function DocumentEditor({
canManage={canManage}
canManageLifecycle={canManageLifecycle}
canDelete={canManageLifecycle}
+ canShare={canEdit && !document.isPrivate && document.archivedAt === null}
busy={busy}
onBack={onBack}
onRetrySave={() => {
diff --git a/apps/web/src/features/documents/components/DocumentEditorHeader.tsx b/apps/web/src/features/documents/components/DocumentEditorHeader.tsx
index a758447f..04155d2c 100644
--- a/apps/web/src/features/documents/components/DocumentEditorHeader.tsx
+++ b/apps/web/src/features/documents/components/DocumentEditorHeader.tsx
@@ -17,6 +17,7 @@ import DocumentCopyLinkButton from './DocumentCopyLinkButton';
import DocumentFavoriteButton from './DocumentFavoriteButton';
import DocumentLockButton from './DocumentLockButton';
import DocumentOptionsMenu from './DocumentOptionsMenu';
+import DocumentShareButton from './DocumentShareButton';
export default function DocumentEditorHeader({
projectKey,
@@ -35,6 +36,7 @@ export default function DocumentEditorHeader({
canManage,
canManageLifecycle,
canDelete,
+ canShare,
busy,
onBack,
onRetrySave,
@@ -70,6 +72,7 @@ export default function DocumentEditorHeader({
canManage: boolean;
canManageLifecycle: boolean;
canDelete: boolean;
+ canShare: boolean;
busy: boolean;
onBack?: () => void;
onRetrySave: () => void;
@@ -189,6 +192,7 @@ export default function DocumentEditorHeader({
disabled={!canManage || document.archivedAt !== null || busy}
onChange={onLockChange}
/>
+ {canShare && <DocumentShareButton projectKey={projectKey} document={document} />}
<DocumentCopyLinkButton />
<div className="mx-1 hidden h-4 w-px bg-border sm:block" aria-hidden />
<Button
diff --git a/apps/web/src/features/documents/components/DocumentShareArticle.tsx b/apps/web/src/features/documents/components/DocumentShareArticle.tsx
new file mode 100644
index 00000000..2f59098f
--- /dev/null
+++ b/apps/web/src/features/documents/components/DocumentShareArticle.tsx
@@ -0,0 +1,86 @@
+import { type MouseEvent, useCallback, useMemo } from 'react';
+import type { Editor } from '@tiptap/core';
+import { useFormatter, useTranslations } from 'next-intl';
+import type { SharedDocumentBundle } from '@/lib/api/endpoints/share';
+import { cn } from '@/lib/utils';
+import { rewriteSharedLinks, sharedPageOf } from '../utils/sharedLinks';
+import DocumentMarkdownEditor from './DocumentMarkdownEditor';
+
+const noop = () => {};
+
+// One page of a shared document, read only: its title and its content. A link to another
+// page of the share opens it in place.
+export default function DocumentShareArticle({
+ token,
+ document,
+ pages,
+ onOpen,
+}: {
+ token: string;
+ document: SharedDocumentBundle['document'];
+ pages: SharedDocumentBundle['pages'];
+ onOpen: (pageId: number | null) => void;
+}) {
+ const t = useTranslations('documents');
+ const format = useFormatter();
+ const lockedTitle = t('lockedLink');
+ const pageIds = useMemo(() => new Set(pages.map((page) => page.id)), [pages]);
+ const rootId = pages[0].id;
+
+ const onReady = useCallback(
+ (editor: Editor | null) => {
+ if (!editor) return;
+ const share = { token, origin: window.location.origin, rootId, pageIds };
+ rewriteSharedLinks(editor, share, lockedTitle);
+ },
+ [token, rootId, pageIds, lockedTitle],
+ );
+
+ const onClick = (event: MouseEvent<HTMLElement>) => {
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
+ return;
+ // An issue chip opens its issue through the IssueRef extension.
+ const link = (event.target as Element).closest?.('a[href]:not(.issue-ref)');
+ if (!(link instanceof HTMLAnchorElement)) return;
+ const pageId = sharedPageOf(link.href, window.location.origin, token);
+ if (pageId === undefined) return;
+ event.preventDefault();
+ onOpen(pageId);
+ };
+
+ return (
+ <article
+ onClick={onClick}
+ className={cn(
+ 'mx-auto w-full max-w-[860px] min-w-0 px-5 pt-10 pb-24 sm:px-8 md:pt-14 lg:px-14',
+ document.fullWidth && 'max-w-[1280px] lg:px-20',
+ )}
+ >
+ <header className="mb-9 border-b border-border/55 pb-8">
+ <h1
+ className="flex items-start gap-2 text-[2rem] leading-[1.12] font-semibold tracking-[-0.035em] text-balance md:text-[2.5rem]"
+ dir="auto"
+ >
+ {document.icon && <span className="shrink-0">{document.icon}</span>}
+ <span className="min-w-0 break-words">{document.title || t('untitled')}</span>
+ </h1>
+ <p className="mt-3 text-xs text-muted-foreground/80">
+ {t('updated', {
+ time: format.dateTime(new Date(document.updatedAt), { dateStyle: 'medium' }),
+ })}
+ </p>
+ </header>
+ <DocumentMarkdownEditor
+ key={document.id}
+ defaultValue={document.content}
+ defaultJson={document.contentJson}
+ editable={false}
+ placeholder=""
+ className="text-[15px] leading-7 md:text-base md:leading-7"
+ onReady={onReady}
+ onChange={noop}
+ onBlur={noop}
+ />
+ </article>
+ );
+}
diff --git a/apps/web/src/features/documents/components/DocumentShareButton.tsx b/apps/web/src/features/documents/components/DocumentShareButton.tsx
new file mode 100644
index 00000000..cacafda3
--- /dev/null
+++ b/apps/web/src/features/documents/components/DocumentShareButton.tsx
@@ -0,0 +1,84 @@
+'use client';
+
+import { useState } from 'react';
+import { Globe } from 'lucide-react';
+import { useQueryClient } from '@tanstack/react-query';
+import { useTranslations } from 'next-intl';
+import type { ProjectDocument } from '@/lib/api/endpoints/documents';
+import {
+ disableDocumentShare,
+ enableDocumentShare,
+ type ShareOptions,
+} from '@/lib/api/endpoints/share';
+import { qk } from '@/services/queryKeys';
+import { usePermissions } from '@/hooks/usePermissions';
+import { shareDocumentPath } from '@/utils/paths';
+import { Button } from '@/components/ui/button';
+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
+import ShareDialog from '@/components/common/share/ShareDialog';
+
+export default function DocumentShareButton({
+ projectKey,
+ document,
+}: {
+ projectKey: string;
+ document: ProjectDocument;
+}) {
+ const t = useTranslations('documents');
+ const qc = useQueryClient();
+ const [open, setOpen] = useState(false);
+ // Linked issues open through the link, so the switch takes the right to share an issue.
+ const canShareIssues = usePermissions().can('work_items', 'edit');
+ const label = document.shareToken ? t('sharedPublicly') : t('sharePublicly');
+
+ // Refetches the page so the share fields the dialog reads stay in sync.
+ async function share(options: ShareOptions) {
+ const state = await enableDocumentShare(document.id, options);
+ await qc.invalidateQueries({ queryKey: qk.document(projectKey, document.id) });
+ return state;
+ }
+ async function disable() {
+ await disableDocumentShare(document.id);
+ await qc.invalidateQueries({ queryKey: qk.document(projectKey, document.id) });
+ }
+
+ return (
+ <>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Button
+ type="button"
+ variant="ghost"
+ size="icon-sm"
+ aria-label={label}
+ className={
+ document.shareToken
+ ? 'bg-emerald-500/15 text-emerald-600 hover:bg-emerald-500/25 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300'
+ : 'text-muted-foreground hover:text-foreground'
+ }
+ onClick={() => setOpen(true)}
+ >
+ <Globe />
+ </Button>
+ </TooltipTrigger>
+ <TooltipContent>{label}</TooltipContent>
+ </Tooltip>
+ <ShareDialog
+ open={open}
+ onOpenChange={setOpen}
+ title={t('sharePage')}
+ token={document.shareToken}
+ options={[
+ { name: 'includeChildren', checked: document.shareIncludeChildren },
+ ...(canShareIssues
+ ? [{ name: 'includeIssues' as const, checked: document.shareIncludeIssues }]
+ : []),
+ ]}
+ expiresAt={document.shareExpiresAt}
+ enable={share}
+ disable={disable}
+ pathForToken={shareDocumentPath}
+ />
+ </>
+ );
+}
diff --git a/apps/web/src/features/documents/components/DocumentShareTree.tsx b/apps/web/src/features/documents/components/DocumentShareTree.tsx
new file mode 100644
index 00000000..0a4ee3e1
--- /dev/null
+++ b/apps/web/src/features/documents/components/DocumentShareTree.tsx
@@ -0,0 +1,58 @@
+import { FileText } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import type { SharedDocumentPage } from '@/lib/api/endpoints/share';
+import { cn } from '@/lib/utils';
+
+// The pages a shared link opens, nested under the shared page, in tree order.
+function treeRows(pages: SharedDocumentPage[]): { page: SharedDocumentPage; depth: number }[] {
+ const rows: { page: SharedDocumentPage; depth: number }[] = [];
+ const visit = (page: SharedDocumentPage, depth: number) => {
+ rows.push({ page, depth });
+ for (const child of pages) if (child.parentId === page.id) visit(child, depth + 1);
+ };
+ visit(pages[0], 0);
+ return rows;
+}
+
+export default function DocumentShareTree({
+ pages,
+ currentId,
+ onOpen,
+}: {
+ pages: SharedDocumentPage[];
+ currentId: number;
+ onOpen: (id: number) => void;
+}) {
+ const t = useTranslations('documents');
+
+ return (
+ <nav
+ aria-label={t('sharedPages')}
+ className="max-h-48 shrink-0 overflow-y-auto border-b px-3 py-3 md:sticky md:top-0 md:max-h-screen md:w-64 md:border-e md:border-b-0"
+ >
+ <ul className="flex flex-col gap-0.5">
+ {treeRows(pages).map(({ page, depth }) => (
+ <li key={page.id}>
+ <button
+ type="button"
+ aria-current={page.id === currentId ? 'page' : undefined}
+ onClick={() => onOpen(page.id)}
+ style={{ paddingInlineStart: `${0.5 + depth}rem` }}
+ className={cn(
+ 'flex w-full items-center gap-2 rounded-md py-1.5 pe-2 text-start text-sm hover:bg-accent',
+ page.id === currentId && 'bg-accent font-medium',
+ )}
+ >
+ <span className="flex size-4 shrink-0 items-center justify-center text-muted-foreground">
+ {page.icon ?? <FileText className="size-3.5" />}
+ </span>
+ <span className="min-w-0 truncate" dir="auto">
+ {page.title || t('untitled')}
+ </span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ </nav>
+ );
+}
diff --git a/apps/web/src/features/documents/hooks/useDocumentCollaboration.test.tsx b/apps/web/src/features/documents/hooks/useDocumentCollaboration.test.tsx
index e9433855..30450e47 100644
--- a/apps/web/src/features/documents/hooks/useDocumentCollaboration.test.tsx
+++ b/apps/web/src/features/documents/hooks/useDocumentCollaboration.test.tsx
@@ -56,6 +56,10 @@ function projectDocument(version: number, content: string): ProjectDocument {
updatedByUserId: 'user-1',
createdAt: '2026-09-01T00:00:00.000Z',
updatedAt: '2026-09-01T00:00:00.000Z',
+ shareToken: null,
+ shareExpiresAt: null,
+ shareIncludeChildren: false,
+ shareIncludeIssues: false,
};
}
diff --git a/apps/web/src/features/documents/hooks/useDocumentCommentMarks.test.tsx b/apps/web/src/features/documents/hooks/useDocumentCommentMarks.test.tsx
index 873b86b6..1af81632 100644
--- a/apps/web/src/features/documents/hooks/useDocumentCommentMarks.test.tsx
+++ b/apps/web/src/features/documents/hooks/useDocumentCommentMarks.test.tsx
@@ -66,6 +66,10 @@ const projectDocument: ProjectDocument = {
updatedByUserId: 'user-2',
createdAt: '2026-09-01T00:00:00.000Z',
updatedAt: '2026-09-01T00:00:00.000Z',
+ shareToken: null,
+ shareExpiresAt: null,
+ shareIncludeChildren: false,
+ shareIncludeIssues: false,
};
let dom: JSDOM;
diff --git a/apps/web/src/features/documents/hooks/useDocumentDraft.test.tsx b/apps/web/src/features/documents/hooks/useDocumentDraft.test.tsx
index d2ba6941..dac8cfe6 100644
--- a/apps/web/src/features/documents/hooks/useDocumentDraft.test.tsx
+++ b/apps/web/src/features/documents/hooks/useDocumentDraft.test.tsx
@@ -54,6 +54,10 @@ function projectDocument(version: number, content: string): ProjectDocument {
updatedByUserId: 'user-1',
createdAt: '2026-09-01T00:00:00.000Z',
updatedAt: '2026-09-01T00:00:00.000Z',
+ shareToken: null,
+ shareExpiresAt: null,
+ shareIncludeChildren: false,
+ shareIncludeIssues: false,
};
}
diff --git a/apps/web/src/features/documents/utils/sharedLinks.test.ts b/apps/web/src/features/documents/utils/sharedLinks.test.ts
new file mode 100644
index 00000000..015a16f7
--- /dev/null
+++ b/apps/web/src/features/documents/utils/sharedLinks.test.ts
@@ -0,0 +1,146 @@
+import assert from 'node:assert/strict';
+import { afterEach, beforeEach, describe, it } from 'node:test';
+import { Editor, type JSONContent } from '@tiptap/core';
+import { JSDOM } from 'jsdom';
+import { documentEditorExtensions } from '../components/DocumentMarkdownEditor';
+import {
+ LOCKED_LINK_CLASS,
+ parsePageParam,
+ rewriteSharedLinks,
+ sharedIssueHref,
+ sharedLinkTarget,
+ sharedPageHref,
+ sharedPageOf,
+} from './sharedLinks';
+
+const origin = 'https://pm.example.test';
+const pageIds = new Set([10, 11, 12]);
+
+describe('sharedLinkTarget', () => {
+ it('opens a shared page under the share, absolute or relative', () => {
+ assert.deepEqual(sharedLinkTarget(`${origin}/team/PG/docs/11`, origin, pageIds), {
+ pageId: 11,
+ });
+ assert.deepEqual(sharedLinkTarget('/team/PG/docs/12/', origin, pageIds), { pageId: 12 });
+ assert.deepEqual(sharedLinkTarget('/team/PG/docs/12#block-1', origin, pageIds), {
+ pageId: 12,
+ });
+ });
+
+ it('locks app links the share does not open', () => {
+ assert.equal(sharedLinkTarget(`${origin}/team/PG/docs/99`, origin, pageIds), 'locked');
+ assert.equal(sharedLinkTarget('/team/issue/PG-1', origin, pageIds), 'locked');
+ assert.equal(sharedLinkTarget('/team/PG/docs/11/history', origin, pageIds), 'locked');
+ });
+
+ it('leaves external, public and in-page links as they are', () => {
+ assert.equal(sharedLinkTarget('https://example.com/team/PG/docs/11', origin, pageIds), null);
+ assert.equal(sharedLinkTarget('/share/document/abc', origin, pageIds), null);
+ assert.equal(sharedLinkTarget('/media/share/document/abc/assets/x/raw', origin, pageIds), null);
+ assert.equal(sharedLinkTarget('mailto:[email protected]', origin, pageIds), null);
+ });
+});
+
+describe('share page addresses', () => {
+ it('gives the shared page the share link and a subpage its ?page', () => {
+ assert.equal(sharedPageHref('tok', 10, 10), '/share/document/tok');
+ assert.equal(sharedPageHref('tok', 11, 10), '/share/document/tok?page=11');
+ });
+
+ it('reads the page back from an address of the same share only', () => {
+ assert.equal(sharedPageOf(`${origin}/share/document/tok?page=11`, origin, 'tok'), 11);
+ assert.equal(sharedPageOf(`${origin}/share/document/tok`, origin, 'tok'), null);
+ assert.equal(sharedPageOf(`${origin}/share/document/other?page=11`, origin, 'tok'), undefined);
+ assert.equal(sharedPageOf('https://example.com/share/document/tok', origin, 'tok'), undefined);
+ });
+
+ it('adds the open issue to the page address', () => {
+ assert.equal(sharedIssueHref('tok', 10, 10, 5), '/share/document/tok?issue=5');
+ assert.equal(sharedIssueHref('tok', 11, 10, 5), '/share/document/tok?page=11&issue=5');
+ });
+
+ it('accepts only a positive page id', () => {
+ assert.equal(parsePageParam('11'), 11);
+ for (const value of [null, '', '0', '-1', '1e3', '11abc']) {
+ assert.equal(parsePageParam(value), null);
+ }
+ });
+});
+
+describe('rewriteSharedLinks', () => {
+ let dom: JSDOM;
+ const globals = ['window', 'document', 'navigator', 'Node'] as const;
+ const previous = new Map<string, PropertyDescriptor | undefined>();
+
+ beforeEach(() => {
+ dom = new JSDOM('<!doctype html><div id="editor"></div>');
+ for (const name of globals) {
+ previous.set(name, Object.getOwnPropertyDescriptor(globalThis, name));
+ Object.defineProperty(globalThis, name, {
+ configurable: true,
+ value: name === 'window' ? dom.window : dom.window[name],
+ });
+ }
+ });
+
+ afterEach(() => {
+ dom.window.close();
+ for (const name of globals) {
+ const descriptor = previous.get(name);
+ if (descriptor) Object.defineProperty(globalThis, name, descriptor);
+ else Reflect.deleteProperty(globalThis, name);
+ }
+ });
+
+ const linked = (text: string, href: string): JSONContent => ({
+ type: 'text',
+ text,
+ marks: [{ type: 'link', attrs: { href } }],
+ });
+
+ it('points shared pages at the share and marks the rest as locked', () => {
+ const editor = new Editor({
+ element: document.getElementById('editor')!,
+ editable: false,
+ extensions: documentEditorExtensions({ placeholder: '', codeBlockLabel: '', tableLabel: '' }),
+ content: {
+ type: 'doc',
+ content: [
+ {
+ type: 'paragraph',
+ content: [
+ linked('sub', `${origin}/team/PG/docs/11`),
+ { type: 'text', text: ' ' },
+ linked('root', '/team/PG/docs/10'),
+ { type: 'text', text: ' ' },
+ linked('other', `${origin}/team/PG/docs/99`),
+ { type: 'text', text: ' ' },
+ linked('web', 'https://example.com/'),
+ ],
+ },
+ ],
+ },
+ });
+ rewriteSharedLinks(editor, { token: 'tok', origin, rootId: 10, pageIds }, 'Locked');
+
+ const links = [...editor.view.dom.querySelectorAll('a')].map((a) => ({
+ text: a.textContent,
+ href: a.getAttribute('href'),
+ class: a.getAttribute('class'),
+ title: a.getAttribute('title'),
+ }));
+ assert.deepEqual(
+ links.map(({ text, href }) => [text, href]),
+ [
+ ['sub', '/share/document/tok?page=11'],
+ ['root', '/share/document/tok'],
+ ['other', `${origin}/team/PG/docs/99`],
+ ['web', 'https://example.com/'],
+ ],
+ );
+ assert.ok(links[2].class?.split(' ').includes(LOCKED_LINK_CLASS));
+ assert.equal(links[2].title, 'Locked');
+ assert.ok(!links[3].class?.split(' ').includes(LOCKED_LINK_CLASS));
+ editor.destroy();
+ });
+});
diff --git a/apps/web/src/features/documents/utils/sharedLinks.ts b/apps/web/src/features/documents/utils/sharedLinks.ts
new file mode 100644
index 00000000..cf841337
--- /dev/null
+++ b/apps/web/src/features/documents/utils/sharedLinks.ts
@@ -0,0 +1,107 @@
+import type { Editor } from '@tiptap/core';
+import type { Mark } from '@tiptap/pm/model';
+import { shareDocumentPath } from '@/utils/paths';
+
+// Links inside a publicly shared document. A link to one of the pages the share opens is
+// pointed at the share itself, so a reader stays under the token instead of hitting the
+// login. Any other link into the app needs a session: it keeps its address, for members
+// who can sign in, and is marked as locked so a reader is not surprised by the login.
+
+export const LOCKED_LINK_CLASS = 'share-link-locked';
+
+const DOCUMENT_PATH = /^\/[^/]+\/[^/]+\/docs\/([1-9]\d*)\/?$/;
+// Routes that already work without a session.
+const PUBLIC_PREFIXES = ['/share/', '/media/'];
+
+export type SharedLinkTarget = { pageId: number } | 'locked' | null;
+
+// What a link in a shared page leads to: one of the shared pages, an app page behind
+// the login, or (null) somewhere outside the app that is left as it is.
+export function sharedLinkTarget(
+ href: string,
+ origin: string,
+ pageIds: ReadonlySet<number>,
+): SharedLinkTarget {
+ let url: URL;
+ try {
+ url = new URL(href, origin);
+ } catch {
+ return null;
+ }
+ if (url.origin !== origin) return null;
+ if (PUBLIC_PREFIXES.some((prefix) => url.pathname.startsWith(prefix))) return null;
+ const match = DOCUMENT_PATH.exec(url.pathname);
+ if (match && pageIds.has(Number(match[1]))) return { pageId: Number(match[1]) };
+ return 'locked';
+}
+
+// The address of one page of a shared document. The shared page itself has none of its
+// own: it is the share link.
+export function sharedPageHref(token: string, pageId: number, rootId: number): string {
+ const path = shareDocumentPath(token);
+ return pageId === rootId ? path : `${path}?page=${pageId}`;
+}
+
+// The address of a page with one of the issues it names open over it.
+export function sharedIssueHref(
+ token: string,
+ pageId: number,
+ rootId: number,
+ issueId: number,
+): string {
+ const page = sharedPageHref(token, pageId, rootId);
+ return `${page}${page.includes('?') ? '&' : '?'}issue=${issueId}`;
+}
+
+// The page a share address opens: the shared page (null) or the one in `?page`, or
+// undefined when the address is not this share.
+export function sharedPageOf(
+ href: string,
+ origin: string,
+ token: string,
+): number | null | undefined {
+ let url: URL;
+ try {
+ url = new URL(href, origin);
+ } catch {
+ return undefined;
+ }
+ if (url.origin !== origin || url.pathname !== shareDocumentPath(token)) return undefined;
+ return parsePageParam(url.searchParams.get('page'));
+}
+
+export function parsePageParam(value: string | null): number | null {
+ return value && /^[1-9]\d*$/.test(value) ? Number(value) : null;
+}
+
+// Rewrites the links of a read-only shared page in place, without touching its history.
+export function rewriteSharedLinks(
+ editor: Editor,
+ share: { token: string; origin: string; rootId: number; pageIds: ReadonlySet<number> },
+ lockedTitle: string,
+): void {
+ const linkType = editor.schema.marks.link;
+ if (!linkType || editor.isDestroyed) return;
+ const { tr } = editor.state;
+ editor.state.doc.descendants((node, pos) => {
+ if (!node.isText) return;
+ const link = node.marks.find((mark: Mark) => mark.type === linkType);
+ const href = link?.attrs.href;
+ if (!link || typeof href !== 'string') return;
+ const target = sharedLinkTarget(href, share.origin, share.pageIds);
+ if (!target) return;
+ const attrs =
+ target === 'locked'
+ ? { ...link.attrs, class: LOCKED_LINK_CLASS, title: lockedTitle }
+ : {
+ ...link.attrs,
+ href: sharedPageHref(share.token, target.pageId, share.rootId),
+ target: null,
+ };
+ const end = pos + node.nodeSize;
+ tr.removeMark(pos, end, linkType).addMark(pos, end, linkType.create(attrs));
+ });
+ if (!tr.docChanged) return;
+ tr.setMeta('addToHistory', false);
+ editor.view.dispatch(tr);
+}
diff --git a/apps/web/src/features/issue/components/actions/IssueActionsBar.tsx b/apps/web/src/features/issue/components/actions/IssueActionsBar.tsx
index b381ea67..aedc2d34 100644
--- a/apps/web/src/features/issue/components/actions/IssueActionsBar.tsx
+++ b/apps/web/src/features/issue/components/actions/IssueActionsBar.tsx
@@ -1,5 +1,5 @@
import { useRef, useState } from 'react';
-import { useQueryClient } from '@tanstack/react-query';
+import { useQuery, useQueryClient } from '@tanstack/react-query';
import { toast } from 'sonner';
import {
Archive,
@@ -15,7 +15,12 @@ import {
import type { ActionDef } from '@/lib/api/endpoints/actions';
import type { ProjectDetail } from '@/lib/api/endpoints/projects';
import type { IssueDetail as IssueDetailRow } from '@/lib/api/endpoints/issues';
-import { enableIssueShare, disableIssueShare, type ShareOptions } from '@/lib/api/endpoints/share';
+import {
+ enableIssueShare,
+ disableIssueShare,
+ listIssueDocumentShares,
+ type ShareOptions,
+} from '@/lib/api/endpoints/share';
import { actionIcon } from '@/utils/actionIcons';
import { useActionsQuery } from '@/services/actions.service';
import { useRestoreIssue } from '@/services/issues.service';
@@ -31,6 +36,7 @@ import { Button } from '@/components/ui/button';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import ShareDialog from '@/components/common/share/ShareDialog';
import MoveIssueDialog from './MoveIssueDialog';
+import IssueDocumentSharesNotice from './IssueDocumentSharesNotice';
import { useTranslations } from 'next-intl';
// The issue detail Actions: the manual actions whose condition matches this
@@ -64,6 +70,13 @@ export default function IssueActionsBar({
const [confirmingAction, setConfirmingAction] = useState<ActionDef | null>(null);
const [sharing, setSharing] = useState(false);
const [copied, setCopied] = useState(false);
+ const documentShares =
+ useQuery({
+ queryKey: [...qk.issue(issue.id), 'document-shares'],
+ queryFn: () => listIssueDocumentShares(issue.id),
+ enabled: canEdit,
+ }).data ?? [];
+ const shared = !!issue.shareToken || documentShares.length > 0;
const copiedTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
// Enabling/revoking the public link refetches the issue so its shareToken,
@@ -158,7 +171,9 @@ export default function IssueActionsBar({
variant="ghost"
size={btnSize}
className={
- issue.shareToken ? 'text-foreground' : 'text-muted-foreground hover:text-foreground'
+ shared
+ ? 'bg-emerald-500/15 text-emerald-600 hover:bg-emerald-500/25 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300'
+ : 'text-muted-foreground hover:text-foreground'
}
onClick={() => setSharing(true)}
>
@@ -166,7 +181,11 @@ export default function IssueActionsBar({
</Button>
</TooltipTrigger>
<TooltipContent>
- {issue.shareToken ? t('sharedPublicly') : t('sharePublicly')}
+ {issue.shareToken
+ ? t('sharedPublicly')
+ : documentShares.length > 0
+ ? t('sharedThroughDocument')
+ : t('sharePublicly')}
</TooltipContent>
</Tooltip>
)}
@@ -273,11 +292,14 @@ export default function IssueActionsBar({
onOpenChange={setSharing}
title={t('shareIssue')}
token={issue.shareToken}
- extended={issue.shareExtended}
+ options={[{ name: 'extended', checked: issue.shareExtended }]}
expiresAt={issue.shareExpiresAt}
enable={share}
disable={disableShare}
pathForToken={shareIssuePath}
+ notice={
+ <IssueDocumentSharesNotice projectRef={project.project.ref} shares={documentShares} />
+ }
/>
</>
);
diff --git a/apps/web/src/features/issue/components/actions/IssueDocumentSharesNotice.tsx b/apps/web/src/features/issue/components/actions/IssueDocumentSharesNotice.tsx
new file mode 100644
index 00000000..e2ffcb83
--- /dev/null
+++ b/apps/web/src/features/issue/components/actions/IssueDocumentSharesNotice.tsx
@@ -0,0 +1,50 @@
+import Link from 'next/link';
+import { FileText } from 'lucide-react';
+import { useFormatter, useTranslations } from 'next-intl';
+import type { IssueDocumentShare } from '@/lib/api/endpoints/share';
+import { documentPath } from '@/utils/paths';
+
+// The shared documents whose links also show this issue, in the issue's share dialog.
+export default function IssueDocumentSharesNotice({
+ projectRef,
+ shares,
+}: {
+ projectRef: string;
+ shares: IssueDocumentShare[];
+}) {
+ const t = useTranslations('common.share');
+ const format = useFormatter();
+ if (shares.length === 0) return null;
+
+ return (
+ <div className="flex flex-col gap-1.5 rounded-md border px-3 py-2.5">
+ <span className="text-sm">{t('throughDocuments')}</span>
+ <span className="text-xs text-muted-foreground">{t('throughDocumentsHint')}</span>
+ <ul className="mt-1 flex flex-col gap-1">
+ {shares.map((share) => (
+ <li key={share.documentId} className="flex items-center justify-between gap-3 text-sm">
+ <Link
+ href={documentPath(projectRef, share.documentId)}
+ className="flex min-w-0 items-center gap-1.5 hover:underline"
+ >
+ <FileText className="size-3.5 shrink-0 text-muted-foreground" />
+ <span className="truncate" dir="auto">
+ {share.title}
+ </span>
+ </Link>
+ <span className="shrink-0 text-xs text-muted-foreground">
+ {share.expiresAt
+ ? t('expiresOn', {
+ date: format.dateTime(new Date(share.expiresAt), {
+ dateStyle: 'medium',
+ timeStyle: 'short',
+ }),
+ })
+ : t('neverExpires')}
+ </span>
+ </li>
+ ))}
+ </ul>
+ </div>
+ );
+}
diff --git a/apps/web/src/features/work-items/components/public/PublicIssueOverlay.tsx b/apps/web/src/features/issue/components/public/PublicIssueOverlay.tsx
similarity index 70%
rename from apps/web/src/features/work-items/components/public/PublicIssueOverlay.tsx
rename to apps/web/src/features/issue/components/public/PublicIssueOverlay.tsx
index 24c8d362..4f0e96d4 100644
--- a/apps/web/src/features/work-items/components/public/PublicIssueOverlay.tsx
+++ b/apps/web/src/features/issue/components/public/PublicIssueOverlay.tsx
@@ -2,37 +2,38 @@
import { useQuery } from '@tanstack/react-query';
import { useTranslations } from 'next-intl';
-import { getSharedViewIssue } from '@/lib/api/endpoints/share';
+import type { SharedIssueBundle } from '@/lib/api/endpoints/share';
import { useDocumentTitle } from '@/hooks/useDocumentTitle';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
-import IssueDetailSkeleton from '@/features/issue/components/detail/IssueDetailSkeleton';
-import ReadOnlyIssueDetail from '@/features/issue/components/detail/ReadOnlyIssueDetail';
+import IssueDetailSkeleton from '../detail/IssueDetailSkeleton';
+import ReadOnlyIssueDetail from '../detail/ReadOnlyIssueDetail';
-// The read-only issue detail opened from a shared board card. It fetches the issue
-// under the board's own share token (the API checks the issue belongs to the shared
-// view's project) and renders it in a dialog. Composing the issue feature's
-// read-only detail is the allowed work-items → issue direction.
+// The read-only issue detail opened from a public share: a card of a shared board, or
+// an issue a shared document names. `load` reads the issue under that share's token
+// (the API checks the share reaches it) and the dialog renders it.
export default function PublicIssueOverlay({
- token,
+ queryKey,
+ load,
issueId,
extended,
onOpenIssue,
onClose,
}: {
- token: string;
+ queryKey: readonly unknown[];
+ load: (issueId: number) => Promise<SharedIssueBundle>;
issueId: number | null;
// Whether the board's link exposes the full issues; without it the bundle
// carries no activity and no custom fields.
extended: boolean;
- // Swaps the open issue for another one of the same board, so a subtask or the
+ // Swaps the open issue for another one of the same share, so a subtask or the
// other end of a relation opens in place.
onOpenIssue: (id: number) => void;
onClose: () => void;
}) {
const t = useTranslations('workItems.share');
const query = useQuery({
- queryKey: ['share', 'view', token, 'issue', issueId],
- queryFn: () => getSharedViewIssue(token, issueId as number),
+ queryKey: [...queryKey, issueId],
+ queryFn: () => load(issueId as number),
enabled: issueId != null,
retry: false,
});
diff --git a/apps/web/src/features/shares/PublicSharesPage.tsx b/apps/web/src/features/shares/PublicSharesPage.tsx
new file mode 100644
index 00000000..8cf56366
--- /dev/null
+++ b/apps/web/src/features/shares/PublicSharesPage.tsx
@@ -0,0 +1,93 @@
+'use client';
+
+import { FileText, LayoutGrid, SquareCheck } from 'lucide-react';
+import { useTranslations } from 'next-intl';
+import { useShell } from '@/context/shellContext';
+import { documentPath, issuePath, viewPath } from '@/utils/paths';
+import SectionPageView from '@/components/common/page/SectionPageView';
+import ListSkeleton from '@/components/common/skeleton/ListSkeleton';
+import PublicSharesSection from './components/PublicSharesSection';
+import PublicSharesRevokeAll from './components/PublicSharesRevokeAll';
+import { useProjectSharesQuery } from './services/shares.service';
+
+// The project's public links (/:team/:projectKey/public): every issue, saved view and
+// document that has a live share link, with its expiry. Each can be revoked here, and
+// the header action revokes all of them at once.
+export default function PublicSharesPage() {
+ const t = useTranslations('common.share');
+ const { project } = useShell();
+ const projectRef = project?.project.ref ?? '';
+ const query = useProjectSharesQuery(projectRef);
+ const shares = query.data;
+ if (!project) return null;
+
+ const key = project.project.key;
+ const total = shares ? shares.issues.length + shares.views.length + shares.documents.length : 0;
+ const anyRevocable =
+ !!shares &&
+ ((shares.canRevoke.issues && shares.issues.length > 0) ||
+ (shares.canRevoke.views && shares.views.length > 0) ||
+ (shares.canRevoke.documents && shares.documents.length > 0));
+
+ return (
+ <SectionPageView
+ title={t('overviewTitle')}
+ description={t('overviewDescription')}
+ actions={anyRevocable && <PublicSharesRevokeAll projectKey={projectRef} />}
+ >
+ {!shares ? (
+ <ListSkeleton rows={4} rowClassName="h-12" />
+ ) : total === 0 ? (
+ <p className="text-sm text-muted-foreground">{t('overviewEmpty')}</p>
+ ) : (
+ <div className="flex flex-col gap-8">
+ <PublicSharesSection
+ projectKey={projectRef}
+ kind="documents"
+ title={t('overviewDocuments')}
+ icon={FileText}
+ canRevoke={shares.canRevoke.documents}
+ rows={shares.documents.map((row) => ({
+ id: row.id,
+ label: row.title,
+ href: documentPath(projectRef, row.id),
+ details: [
+ ...(row.includeChildren ? [t('includeSubpages')] : []),
+ ...(row.includeIssues ? [t('includeIssues')] : []),
+ ],
+ expiresAt: row.expiresAt,
+ }))}
+ />
+ <PublicSharesSection
+ projectKey={projectRef}
+ kind="issues"
+ title={t('overviewIssues')}
+ icon={SquareCheck}
+ canRevoke={shares.canRevoke.issues}
+ rows={shares.issues.map((row) => ({
+ id: row.id,
+ label: `${key}-${row.sequence} ${row.title}`,
+ href: issuePath(projectRef, row.sequence),
+ details: row.extended ? [t('fullDetails')] : [],
+ expiresAt: row.expiresAt,
+ }))}
+ />
+ <PublicSharesSection
+ projectKey={projectRef}
+ kind="views"
+ title={t('overviewViews')}
+ icon={LayoutGrid}
+ canRevoke={shares.canRevoke.views}
+ rows={shares.views.map((row) => ({
+ id: row.id,
+ label: row.name,
+ href: viewPath(projectRef, row.id),
+ details: row.extended ? [t('fullDetails')] : [],
+ expiresAt: row.expiresAt,
+ }))}
+ />
+ </div>
+ )}
+ </SectionPageView>
+ );
+}
diff --git a/apps/web/src/features/shares/components/PublicShareRow.tsx b/apps/web/src/features/shares/components/PublicShareRow.tsx
new file mode 100644
index 00000000..c5855809
--- /dev/null
+++ b/apps/web/src/features/shares/components/PublicShareRow.tsx
@@ -0,0 +1,73 @@
+import Link from 'next/link';
+import type { LucideIcon } from 'lucide-react';
+import { useFormatter, useTranslations } from 'next-intl';
+import { Badge } from '@/components/ui/badge';
+import { Button } from '@/components/ui/button';
+import { type ShareKind, useRevokeShare } from '../services/shares.service';
+
+export interface PublicShareRowData {
+ id: number;
+ label: string;
+ href: string;
+ // The link's switches that are on, as their labels.
+ details: string[];
+ expiresAt: string | null;
+}
+
+export default function PublicShareRow({
+ projectKey,
+ kind,
+ icon: Icon,
+ canRevoke,
+ row,
+}: {
+ projectKey: string;
+ kind: ShareKind;
+ icon: LucideIcon;
+ canRevoke: boolean;
+ row: PublicShareRowData;
+}) {
+ const t = useTranslations('common.share');
+ const format = useFormatter();
+ const revoke = useRevokeShare(projectKey);
+
+ return (
+ <li className="flex items-center gap-3 px-3 py-2.5">
+ <Icon className="size-4 shrink-0 text-emerald-600 dark:text-emerald-400" />
+ <Link href={row.href} className="min-w-0 flex-1 truncate text-sm hover:underline" dir="auto">
+ {row.label}
+ </Link>
+ {row.details.map((detail) => (
+ <Badge
+ key={detail}
+ variant="secondary"
+ className="hidden shrink-0 font-normal sm:inline-flex"
+ >
+ {detail}
+ </Badge>
+ ))}
+ <span className="shrink-0 text-xs text-muted-foreground">
+ {row.expiresAt
+ ? t('expiresOn', {
+ date: format.dateTime(new Date(row.expiresAt), {
+ dateStyle: 'medium',
+ timeStyle: 'short',
+ }),
+ })
+ : t('neverExpires')}
+ </span>
+ {canRevoke && (
+ <Button
+ type="button"
+ variant="ghost"
+ size="sm"
+ disabled={revoke.isPending}
+ onClick={() => revoke.mutate({ kind, id: row.id })}
+ className="shrink-0 text-muted-foreground hover:text-destructive"
+ >
+ {t('stopSharing')}
+ </Button>
+ )}
+ </li>
+ );
+}
diff --git a/apps/web/src/features/shares/components/PublicSharesRevokeAll.tsx b/apps/web/src/features/shares/components/PublicSharesRevokeAll.tsx
new file mode 100644
index 00000000..f8e7c1e3
--- /dev/null
+++ b/apps/web/src/features/shares/components/PublicSharesRevokeAll.tsx
@@ -0,0 +1,36 @@
+import { useState } from 'react';
+import { toast } from 'sonner';
+import { useTranslations } from 'next-intl';
+import { Button } from '@/components/ui/button';
+import ConfirmDialog from '@/components/common/overlay/ConfirmDialog';
+import { useRevokeAllShares } from '../services/shares.service';
+
+// The Public page's header action: revokes every link the viewer may revoke, after a
+// confirmation.
+export default function PublicSharesRevokeAll({ projectKey }: { projectKey: string }) {
+ const t = useTranslations('common.share');
+ const [confirming, setConfirming] = useState(false);
+ const revokeAll = useRevokeAllShares(projectKey);
+
+ return (
+ <>
+ <Button variant="destructive" size="sm" onClick={() => setConfirming(true)}>
+ {t('revokeAll')}
+ </Button>
+ {confirming && (
+ <ConfirmDialog
+ title={t('revokeAllTitle')}
+ confirmLabel={t('revokeAll')}
+ onConfirm={async () => {
+ const { revoked } = await revokeAll.mutateAsync();
+ toast.success(t('revokeAllDone', { count: revoked }));
+ setConfirming(false);
+ }}
+ onClose={() => setConfirming(false)}
+ >
+ {t('revokeAllHint')}
+ </ConfirmDialog>
+ )}
+ </>
+ );
+}
diff --git a/apps/web/src/features/shares/components/PublicSharesSection.tsx b/apps/web/src/features/shares/components/PublicSharesSection.tsx
new file mode 100644
index 00000000..3c2510b2
--- /dev/null
+++ b/apps/web/src/features/shares/components/PublicSharesSection.tsx
@@ -0,0 +1,41 @@
+import type { LucideIcon } from 'lucide-react';
+import type { ShareKind } from '../services/shares.service';
+import PublicShareRow, { type PublicShareRowData } from './PublicShareRow';
+
+// One kind of shared entity on the Public page. Renders nothing when none is shared.
+export default function PublicSharesSection({
+ projectKey,
+ kind,
+ title,
+ icon,
+ canRevoke,
+ rows,
+}: {
+ projectKey: string;
+ kind: ShareKind;
+ title: string;
+ icon: LucideIcon;
+ canRevoke: boolean;
+ rows: PublicShareRowData[];
+}) {
+ if (rows.length === 0) return null;
+ return (
+ <section className="flex flex-col gap-2">
+ <h2 className="text-sm font-medium text-muted-foreground">
+ {title} · {rows.length}
+ </h2>
+ <ul className="divide-y rounded-md border">
+ {rows.map((row) => (
+ <PublicShareRow
+ key={row.id}
+ projectKey={projectKey}
+ kind={kind}
+ icon={icon}
+ canRevoke={canRevoke}
+ row={row}
+ />
+ ))}
+ </ul>
+ </section>
+ );
+}
diff --git a/apps/web/src/features/shares/services/shares.service.ts b/apps/web/src/features/shares/services/shares.service.ts
new file mode 100644
index 00000000..f8f25d54
--- /dev/null
+++ b/apps/web/src/features/shares/services/shares.service.ts
@@ -0,0 +1,42 @@
+import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
+import {
+ disableDocumentShare,
+ disableIssueShare,
+ disableViewShare,
+ listProjectShares,
+ revokeProjectShares,
+} from '@/lib/api/endpoints/share';
+
+export type ShareKind = 'issues' | 'views' | 'documents';
+
+const sharesKey = (projectKey: string) => ['project-shares', projectKey] as const;
+
+export function useProjectSharesQuery(projectKey: string) {
+ return useQuery({
+ queryKey: sharesKey(projectKey),
+ queryFn: () => listProjectShares(projectKey),
+ enabled: projectKey !== '',
+ });
+}
+
+const REVOKE: Record<ShareKind, (id: number) => Promise<void>> = {
+ issues: disableIssueShare,
+ views: disableViewShare,
+ documents: disableDocumentShare,
+};
+
+export function useRevokeShare(projectKey: string) {
+ const qc = useQueryClient();
+ return useMutation({
+ mutationFn: ({ kind, id }: { kind: ShareKind; id: number }) => REVOKE[kind](id),
+ onSuccess: () => qc.invalidateQueries({ queryKey: sharesKey(projectKey) }),
+ });
+}
+
+export function useRevokeAllShares(projectKey: string) {
+ const qc = useQueryClient();
+ return useMutation({
+ mutationFn: () => revokeProjectShares(projectKey),
+ onSuccess: () => qc.invalidateQueries({ queryKey: sharesKey(projectKey) }),
+ });
+}
diff --git a/apps/web/src/features/work-items/PublicBoardPage.tsx b/apps/web/src/features/work-items/PublicBoardPage.tsx
index d37cd0ee..f00b63e1 100644
--- a/apps/web/src/features/work-items/PublicBoardPage.tsx
+++ b/apps/web/src/features/work-items/PublicBoardPage.tsx
@@ -3,12 +3,12 @@
import { useState } from 'react';
import { useQuery } from '@tanstack/react-query';
import { useTranslations } from 'next-intl';
-import { getSharedView } from '@/lib/api/endpoints/share';
+import { getSharedView, getSharedViewIssue } from '@/lib/api/endpoints/share';
import { titlePath, useDocumentTitle } from '@/hooks/useDocumentTitle';
import PublicShareFrame from '@/components/common/page/PublicShareFrame';
import ListSkeleton from '@/components/common/skeleton/ListSkeleton';
import ReadOnlyBoard from './components/public/ReadOnlyBoard';
-import PublicIssueOverlay from './components/public/PublicIssueOverlay';
+import PublicIssueOverlay from '@/features/issue/components/public/PublicIssueOverlay';
// The public read-only page for a shared saved view (/share/view/:token). Fetches
// the board bundle by token and renders it with no session; clicking an issue opens
@@ -48,7 +48,8 @@ export default function PublicBoardPage({ token }: { token: string }) {
<PublicShareFrame>
<ReadOnlyBoard bundle={query.data} onOpenIssue={setOpenIssueId} />
<PublicIssueOverlay
- token={token}
+ queryKey={['share', 'view', token, 'issue']}
+ load={(issueId) => getSharedViewIssue(token, issueId)}
issueId={openIssueId}
extended={query.data.view.extended}
onOpenIssue={setOpenIssueId}
diff --git a/apps/web/src/hooks/useShellTitle.ts b/apps/web/src/hooks/useShellTitle.ts
index e2eafc55..e5b96077 100644
--- a/apps/web/src/hooks/useShellTitle.ts
+++ b/apps/web/src/hooks/useShellTitle.ts
@@ -16,6 +16,7 @@ const SECTION_LABELS = {
notes: 'notes',
members: 'members',
notifications: 'notifications',
+ public: 'public',
api: 'apiDocs',
mcp: 'mcpServer',
} as const;
diff --git a/apps/web/src/lib/api/endpoints/documents.ts b/apps/web/src/lib/api/endpoints/documents.ts
index 1807f507..5925b47a 100644
--- a/apps/web/src/lib/api/endpoints/documents.ts
+++ b/apps/web/src/lib/api/endpoints/documents.ts
@@ -36,6 +36,10 @@ export interface ProjectDocumentSummary {
export interface ProjectDocument extends ProjectDocumentSummary {
content: string;
contentJson: Record<string, unknown> | null;
+ shareToken: string | null;
+ shareExpiresAt: string | null;
+ shareIncludeChildren: boolean;
+ shareIncludeIssues: boolean;
}
export interface DocumentIssueLink {
diff --git a/apps/web/src/lib/api/endpoints/share.ts b/apps/web/src/lib/api/endpoints/share.ts
index a99c9549..b42767ac 100644
--- a/apps/web/src/lib/api/endpoints/share.ts
+++ b/apps/web/src/lib/api/endpoints/share.ts
@@ -33,13 +33,56 @@ export interface SharedViewBundle {
issues: BoardIssue[];
}
+export interface SharedDocumentPage {
+ id: number;
+ parentId: number | null;
+ title: string;
+ icon: string | null;
+}
+
+// A shared page, or one of its subpages. Asset URLs in the content already point at
+// the token-scoped media route.
+export interface SharedDocumentBundle {
+ project: { name: string; key: string };
+ document: {
+ id: number;
+ title: string;
+ icon: string | null;
+ content: string;
+ contentJson: Record<string, unknown> | null;
+ fullWidth: boolean;
+ updatedAt: string;
+ };
+ // The pages the link opens, the shared page first with no parent.
+ pages: SharedDocumentPage[];
+ // The issues of the project the page names, when the link shows them.
+ issues: SharedDocumentIssue[];
+}
+
+// An issue a shared page names. It opens through the same link (getSharedDocumentIssue).
+export interface SharedDocumentIssue {
+ id: number;
+ sequence: number;
+ title: string;
+ state: { name: string; color: string };
+}
+
+// A shared document whose link shows an issue.
+export interface IssueDocumentShare {
+ documentId: number;
+ title: string;
+ expiresAt: string | null;
+}
+
// Public read-only sharing. Enabling returns the link token and its expiry and sets
-// how much it exposes and when it stops working; calling it again on a shared
+// what it exposes (`extended`, or a document's `includeChildren` and `includeIssues`) and when it stops working; calling it again on a shared
// entity keeps the link and only changes what is sent (an omitted field stays as
// it is, expiresAt null means never). An expired link is replaced by a new one.
// Disable revokes it. The getShared* reads need no session (public /share/* routes).
export interface ShareOptions {
extended?: boolean;
+ includeChildren?: boolean;
+ includeIssues?: boolean;
expiresAt?: string | null;
}
@@ -73,3 +116,51 @@ export const getSharedView = (token: string) => request<SharedViewBundle>(`/shar
export const getSharedViewIssue = (token: string, issueId: number) =>
request<SharedIssueBundle>(`/share/view/${token}/issues/${issueId}`);
+
+export const enableDocumentShare = (id: number, options: ShareOptions) =>
+ request<ShareState>(`/documents/${id}/share`, {
+ method: 'POST',
+ body: JSON.stringify(options),
+ });
+
+export const disableDocumentShare = (id: number) =>
+ request<void>(`/documents/${id}/share`, { method: 'DELETE' });
+
+export const getSharedDocumentIssue = (token: string, issueId: number) =>
+ request<SharedIssueBundle>(`/share/document/${token}/issues/${issueId}`);
+
+export const listIssueDocumentShares = (issueId: number) =>
+ request<IssueDocumentShare[]>(`/issues/${issueId}/share/documents`);
+
+// The live public links of a project, of the kinds the caller may read, and which kinds
+// the caller may revoke.
+export interface ProjectShares {
+ issues: {
+ id: number;
+ sequence: number;
+ title: string;
+ extended: boolean;
+ expiresAt: string | null;
+ }[];
+ views: { id: number; name: string; extended: boolean; expiresAt: string | null }[];
+ documents: {
+ id: number;
+ title: string;
+ includeChildren: boolean;
+ includeIssues: boolean;
+ expiresAt: string | null;
+ }[];
+ canRevoke: { issues: boolean; views: boolean; documents: boolean };
+}
+
+export const listProjectShares = (projectKey: string) =>
+ request<ProjectShares>(`/projects/${projectKey}/shares`);
+
+// Revokes every link of the kinds the caller may revoke.
+export const revokeProjectShares = (projectKey: string) =>
+ request<{ revoked: number }>(`/projects/${projectKey}/shares`, { method: 'DELETE' });
+
+export const getSharedDocument = (token: string, documentId?: number) =>
+ request<SharedDocumentBundle>(
+ documentId ? `/share/document/${token}/documents/${documentId}` : `/share/document/${token}`,
+ );
diff --git a/apps/web/src/utils/paths.ts b/apps/web/src/utils/paths.ts
index 81a1370c..d409a9fd 100644
--- a/apps/web/src/utils/paths.ts
+++ b/apps/web/src/utils/paths.ts
@@ -28,6 +28,7 @@ export const dashboardsPath = (ref: string) => `${projectPath(ref)}/dashboards`;
export const shareIssuePath = (token: string) => `/share/issue/${token}`;
export const shareViewPath = (token: string) => `/share/view/${token}`;
export const shareViewCalendarPath = (token: string) => `/share/view/${token}/calendar.ics`;
+export const shareDocumentPath = (token: string) => `/share/document/${token}`;
// The absolute share URL to copy, built from the current origin at call time.
export const shareUrl = (path: string) =>
@@ -67,6 +68,8 @@ export const apiDocsPath = (ref: string) => `${projectPath(ref)}/api`;
export const membersPath = (ref: string) => `${projectPath(ref)}/members`;
+export const publicSharesPath = (ref: string) => `${projectPath(ref)}/public`;
+
// An issue is addressed by its identifier under its team, not under its project:
// /acme/issue/MKT-42.
export const issuePath = (ref: string, sequenceNumber: number) => {
diff --git a/packages/db/drizzle/0175_document_share.sql b/packages/db/drizzle/0175_document_share.sql
new file mode 100644
index 00000000..dc8da94c
--- /dev/null
+++ b/packages/db/drizzle/0175_document_share.sql
@@ -0,0 +1,5 @@
+ALTER TABLE "project_document" ADD COLUMN "share_token" uuid;--> statement-breakpoint
+ALTER TABLE "project_document" ADD COLUMN "share_expires_at" timestamp with time zone;--> statement-breakpoint
+ALTER TABLE "project_document" ADD COLUMN "share_include_children" boolean DEFAULT false NOT NULL;--> statement-breakpoint
+ALTER TABLE "project_document" ADD COLUMN "share_include_issues" boolean DEFAULT false NOT NULL;--> statement-breakpoint
+ALTER TABLE "project_document" ADD CONSTRAINT "project_document_share_token_unique" UNIQUE("share_token");
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/0175_snapshot.json b/packages/db/drizzle/meta/0175_snapshot.json
new file mode 100644
index 00000000..f15cfca1
--- /dev/null
+++ b/packages/db/drizzle/meta/0175_snapshot.json
@@ -0,0 +1,13155 @@
+{
+ "id": "6670eb3f-9f37-4a28-9ca7-27bd1e611fe4",
+ "prevId": "4cf98670-cd5f-426f-958b-f467ce4d6eb2",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "account_userId_idx": {
+ "name": "account_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.apikey": {
+ "name": "apikey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "config_id": {
+ "name": "config_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'default'"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start": {
+ "name": "start",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prefix": {
+ "name": "prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "refill_interval": {
+ "name": "refill_interval",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refill_amount": {
+ "name": "refill_amount",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_refill_at": {
+ "name": "last_refill_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_enabled": {
+ "name": "rate_limit_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "rate_limit_time_window": {
+ "name": "rate_limit_time_window",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1000
+ },
+ "rate_limit_max": {
+ "name": "rate_limit_max",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 100
+ },
+ "request_count": {
+ "name": "request_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "remaining": {
+ "name": "remaining",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_request": {
+ "name": "last_request",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "apikey_configId_idx": {
+ "name": "apikey_configId_idx",
+ "columns": [
+ {
+ "expression": "config_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_referenceId_idx": {
+ "name": "apikey_referenceId_idx",
+ "columns": [
+ {
+ "expression": "reference_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "apikey_key_idx": {
+ "name": "apikey_key_idx",
+ "columns": [
+ {
+ "expression": "key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.jwks": {
+ "name": "jwks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "private_key": {
+ "name": "private_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "alg": {
+ "name": "alg",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "crv": {
+ "name": "crv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_access_token": {
+ "name": "oauth_access_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorization_code_id": {
+ "name": "authorization_code_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_id": {
+ "name": "refresh_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthAccessToken_clientId_idx": {
+ "name": "oauthAccessToken_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_sessionId_idx": {
+ "name": "oauthAccessToken_sessionId_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_userId_idx": {
+ "name": "oauthAccessToken_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_authorizationCodeId_idx": {
+ "name": "oauthAccessToken_authorizationCodeId_idx",
+ "columns": [
+ {
+ "expression": "authorization_code_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthAccessToken_refreshId_idx": {
+ "name": "oauthAccessToken_refreshId_idx",
+ "columns": [
+ {
+ "expression": "refresh_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_access_token_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_access_token_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_session_id_session_id_fk": {
+ "name": "oauth_access_token_session_id_session_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "session",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_user_id_user_id_fk": {
+ "name": "oauth_access_token_user_id_user_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_access_token_refresh_id_oauth_refresh_token_id_fk": {
+ "name": "oauth_access_token_refresh_id_oauth_refresh_token_id_fk",
+ "tableFrom": "oauth_access_token",
+ "tableTo": "oauth_refresh_token",
+ "columnsFrom": [
+ "refresh_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_access_token_token_unique": {
+ "name": "oauth_access_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client": {
+ "name": "oauth_client",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_secret": {
+ "name": "client_secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_discovery_id": {
+ "name": "client_discovery_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "skip_consent": {
+ "name": "skip_consent",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "enable_end_session": {
+ "name": "enable_end_session",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "subject_type": {
+ "name": "subject_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "client_credentials_scopes": {
+ "name": "client_credentials_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'{}'"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uri": {
+ "name": "uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contacts": {
+ "name": "contacts",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tos": {
+ "name": "tos",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy": {
+ "name": "policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_id": {
+ "name": "software_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_version": {
+ "name": "software_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "software_statement": {
+ "name": "software_statement",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "redirect_uris": {
+ "name": "redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "post_logout_redirect_uris": {
+ "name": "post_logout_redirect_uris",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backchannel_logout_uri": {
+ "name": "backchannel_logout_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backchannel_logout_session_required": {
+ "name": "backchannel_logout_session_required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "token_endpoint_auth_method": {
+ "name": "token_endpoint_auth_method",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "application_type": {
+ "name": "application_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "jwks": {
+ "name": "jwks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "jwks_uri": {
+ "name": "jwks_uri",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "grant_types": {
+ "name": "grant_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_types": {
+ "name": "response_types",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "require_pkce": {
+ "name": "require_pkce",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dpop_bound_access_tokens": {
+ "name": "dpop_bound_access_tokens",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauthClient_userId_idx": {
+ "name": "oauthClient_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_client_user_id_user_id_fk": {
+ "name": "oauth_client_user_id_user_id_fk",
+ "tableFrom": "oauth_client",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_client_client_id_unique": {
+ "name": "oauth_client_client_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "client_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client_assertion": {
+ "name": "oauth_client_assertion",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_client_resource": {
+ "name": "oauth_client_resource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "resource_id": {
+ "name": "resource_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "oauthClientResource_clientId_resourceId_uidx": {
+ "name": "oauthClientResource_clientId_resourceId_uidx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthClientResource_clientId_idx": {
+ "name": "oauthClientResource_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthClientResource_resourceId_idx": {
+ "name": "oauthClientResource_resourceId_idx",
+ "columns": [
+ {
+ "expression": "resource_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_client_resource_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_client_resource_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_client_resource",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_client_resource_resource_id_oauth_resource_identifier_fk": {
+ "name": "oauth_client_resource_resource_id_oauth_resource_identifier_fk",
+ "tableFrom": "oauth_client_resource",
+ "tableTo": "oauth_resource",
+ "columnsFrom": [
+ "resource_id"
+ ],
+ "columnsTo": [
+ "identifier"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_consent": {
+ "name": "oauth_consent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthConsent_clientId_idx": {
+ "name": "oauthConsent_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthConsent_userId_idx": {
+ "name": "oauthConsent_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_consent_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_consent_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_consent",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_consent_user_id_user_id_fk": {
+ "name": "oauth_consent_user_id_user_id_fk",
+ "tableFrom": "oauth_consent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_refresh_token": {
+ "name": "oauth_refresh_token",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reference_id": {
+ "name": "reference_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "authorization_code_id": {
+ "name": "authorization_code_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "resources": {
+ "name": "resources",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_user_info_claims": {
+ "name": "requested_user_info_claims",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revoked": {
+ "name": "revoked",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotated_at": {
+ "name": "rotated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotation_replay_response": {
+ "name": "rotation_replay_response",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rotation_replay_expires_at": {
+ "name": "rotation_replay_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "auth_time": {
+ "name": "auth_time",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "confirmation": {
+ "name": "confirmation",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scopes": {
+ "name": "scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "oauthRefreshToken_clientId_idx": {
+ "name": "oauthRefreshToken_clientId_idx",
+ "columns": [
+ {
+ "expression": "client_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_sessionId_idx": {
+ "name": "oauthRefreshToken_sessionId_idx",
+ "columns": [
+ {
+ "expression": "session_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_userId_idx": {
+ "name": "oauthRefreshToken_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "oauthRefreshToken_authorizationCodeId_idx": {
+ "name": "oauthRefreshToken_authorizationCodeId_idx",
+ "columns": [
+ {
+ "expression": "authorization_code_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "oauth_refresh_token_client_id_oauth_client_client_id_fk": {
+ "name": "oauth_refresh_token_client_id_oauth_client_client_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "oauth_client",
+ "columnsFrom": [
+ "client_id"
+ ],
+ "columnsTo": [
+ "client_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_session_id_session_id_fk": {
+ "name": "oauth_refresh_token_session_id_session_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "session",
+ "columnsFrom": [
+ "session_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "oauth_refresh_token_user_id_user_id_fk": {
+ "name": "oauth_refresh_token_user_id_user_id_fk",
+ "tableFrom": "oauth_refresh_token",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_refresh_token_token_unique": {
+ "name": "oauth_refresh_token_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.oauth_resource": {
+ "name": "oauth_resource",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token_ttl": {
+ "name": "access_token_ttl",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_ttl": {
+ "name": "refresh_token_ttl",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signing_algorithm": {
+ "name": "signing_algorithm",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signing_key_id": {
+ "name": "signing_key_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "allowed_scopes": {
+ "name": "allowed_scopes",
+ "type": "text[]",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "custom_claims": {
+ "name": "custom_claims",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dpop_bound_access_tokens_required": {
+ "name": "dpop_bound_access_tokens_required",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "disabled": {
+ "name": "disabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "policy_version": {
+ "name": "policy_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "oauth_resource_identifier_unique": {
+ "name": "oauth_resource_identifier_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "identifier"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.passkey": {
+ "name": "passkey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "public_key": {
+ "name": "public_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counter": {
+ "name": "counter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "device_type": {
+ "name": "device_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "backed_up": {
+ "name": "backed_up",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "transports": {
+ "name": "transports",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "aaguid": {
+ "name": "aaguid",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "passkey_userId_idx": {
+ "name": "passkey_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "passkey_credentialID_idx": {
+ "name": "passkey_credentialID_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "passkey_user_id_user_id_fk": {
+ "name": "passkey_user_id_user_id_fk",
+ "tableFrom": "passkey",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "session_userId_idx": {
+ "name": "session_userId_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_username": {
+ "name": "display_username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'user'"
+ },
+ "active": {
+ "name": "active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": true
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ },
+ "user_username_unique": {
+ "name": "user_username_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "username"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "verification_identifier_idx": {
+ "name": "verification_identifier_idx",
+ "columns": [
+ {
+ "expression": "identifier",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_event": {
+ "name": "agent_chat_event",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "bigserial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "message_id": {
+ "name": "message_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_chat_event_message_idx": {
+ "name": "agent_chat_event_message_idx",
+ "columns": [
+ {
+ "expression": "message_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_event_message_id_agent_chat_message_id_fk": {
+ "name": "agent_chat_event_message_id_agent_chat_message_id_fk",
+ "tableFrom": "agent_chat_event",
+ "tableTo": "agent_chat_message",
+ "columnsFrom": [
+ "message_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_favorite": {
+ "name": "agent_chat_favorite",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_chat_favorite_user_id_user_id_fk": {
+ "name": "agent_chat_favorite_user_id_user_id_fk",
+ "tableFrom": "agent_chat_favorite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_favorite_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_favorite_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_favorite",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_chat_favorite_user_id_thread_id_pk": {
+ "name": "agent_chat_favorite_user_id_thread_id_pk",
+ "columns": [
+ "user_id",
+ "thread_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_message": {
+ "name": "agent_chat_message",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_chat_message_thread_idx": {
+ "name": "agent_chat_message_thread_idx",
+ "columns": [
+ {
+ "expression": "thread_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_chat_message_due_idx": {
+ "name": "agent_chat_message_due_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming')",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_message_thread_id_agent_chat_thread_id_fk": {
+ "name": "agent_chat_message_thread_id_agent_chat_thread_id_fk",
+ "tableFrom": "agent_chat_message",
+ "tableTo": "agent_chat_thread",
+ "columnsFrom": [
+ "thread_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_message_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_message_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_message",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_chat_message_role_check": {
+ "name": "agent_chat_message_role_check",
+ "value": "\"agent_chat_message\".\"role\" IN ('user', 'assistant')"
+ },
+ "agent_chat_message_status_check": {
+ "name": "agent_chat_message_status_check",
+ "value": "\"agent_chat_message\".\"status\" IN ('pending', 'streaming', 'success', 'failed', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_thread": {
+ "name": "agent_chat_thread",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cli_session_id": {
+ "name": "cli_session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_chat_thread_agent_user_idx": {
+ "name": "agent_chat_thread_agent_user_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_thread_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_thread_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_thread",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_chat_thread_user_id_user_id_fk": {
+ "name": "agent_chat_thread_user_id_user_id_fk",
+ "tableFrom": "agent_chat_thread",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_chat_usage": {
+ "name": "agent_chat_usage",
+ "schema": "",
+ "columns": {
+ "thread_id": {
+ "name": "thread_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_chat_usage_agent_idx": {
+ "name": "agent_chat_usage_agent_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_chat_usage_agent_id_ai_agent_id_fk": {
+ "name": "agent_chat_usage_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_chat_usage",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_field_trigger": {
+ "name": "agent_field_trigger",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delay_sec": {
+ "name": "delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 120
+ }
+ },
+ "indexes": {
+ "agent_field_trigger_field_idx": {
+ "name": "agent_field_trigger_field_idx",
+ "columns": [
+ {
+ "expression": "field_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_field_trigger_agent_id_ai_agent_id_fk": {
+ "name": "agent_field_trigger_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_field_trigger",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_field_trigger_field_id_custom_field_id_fk": {
+ "name": "agent_field_trigger_field_id_custom_field_id_fk",
+ "tableFrom": "agent_field_trigger",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_field_trigger_agent_id_field_id_pk": {
+ "name": "agent_field_trigger_agent_id_field_id_pk",
+ "columns": [
+ "agent_id",
+ "field_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_field_trigger_delay_check": {
+ "name": "agent_field_trigger_delay_check",
+ "value": "\"agent_field_trigger\".\"delay_sec\" >= 0 AND \"agent_field_trigger\".\"delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_run": {
+ "name": "agent_run",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "schedule_id": {
+ "name": "schedule_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger": {
+ "name": "trigger",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'delegation'"
+ },
+ "scheduled_for": {
+ "name": "scheduled_for",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_activity_id": {
+ "name": "source_activity_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_document_comment_id": {
+ "name": "source_document_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output": {
+ "name": "output",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "input_tokens": {
+ "name": "input_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "output_tokens": {
+ "name": "output_tokens",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "started_at": {
+ "name": "started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "execution_started_at": {
+ "name": "execution_started_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "claimed_at": {
+ "name": "claimed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "finished_at": {
+ "name": "finished_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_run_schedule_fire_uq": {
+ "name": "agent_run_schedule_fire_uq",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "scheduled_for",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_due_idx": {
+ "name": "agent_run_due_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_schedule_idx": {
+ "name": "agent_run_schedule_idx",
+ "columns": [
+ {
+ "expression": "schedule_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_project_idx": {
+ "name": "agent_run_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_issue_idx": {
+ "name": "agent_run_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"agent_run\".\"issue_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_run_source_activity_idx": {
+ "name": "agent_run_source_activity_idx",
+ "columns": [
+ {
+ "expression": "source_activity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"agent_run\".\"source_activity_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_run_agent_id_ai_agent_id_fk": {
+ "name": "agent_run_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_project_id_project_id_fk": {
+ "name": "agent_run_project_id_project_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_issue_id_issue_id_fk": {
+ "name": "agent_run_issue_id_issue_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_schedule_id_agent_schedule_id_fk": {
+ "name": "agent_run_schedule_id_agent_schedule_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "agent_schedule",
+ "columnsFrom": [
+ "schedule_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_source_activity_id_issue_activity_id_fk": {
+ "name": "agent_run_source_activity_id_issue_activity_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "source_activity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "agent_run_document_id_project_document_id_fk": {
+ "name": "agent_run_document_id_project_document_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_run_source_document_comment_id_document_comment_id_fk": {
+ "name": "agent_run_source_document_comment_id_document_comment_id_fk",
+ "tableFrom": "agent_run",
+ "tableTo": "document_comment",
+ "columnsFrom": [
+ "source_document_comment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "agent_run_status_check": {
+ "name": "agent_run_status_check",
+ "value": "\"agent_run\".\"status\" IN ('pending', 'success', 'failed', 'canceled')"
+ },
+ "agent_run_trigger_check": {
+ "name": "agent_run_trigger_check",
+ "value": "\"agent_run\".\"trigger\" IN ('mention', 'delegation', 'field', 'schedule', 'manual', 'status', 'event')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_run_trace": {
+ "name": "agent_run_trace",
+ "schema": "",
+ "columns": {
+ "run_id": {
+ "name": "run_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attempt": {
+ "name": "attempt",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "session_id": {
+ "name": "session_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "events": {
+ "name": "events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "next_offset": {
+ "name": "next_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "truncated": {
+ "name": "truncated",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "agent_run_trace_run_id_agent_run_id_fk": {
+ "name": "agent_run_trace_run_id_agent_run_id_fk",
+ "tableFrom": "agent_run_trace",
+ "tableTo": "agent_run",
+ "columnsFrom": [
+ "run_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_run_trace_run_id_attempt_pk": {
+ "name": "agent_run_trace_run_id_attempt_pk",
+ "columns": [
+ "run_id",
+ "attempt"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_schedule": {
+ "name": "agent_schedule",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "prompt": {
+ "name": "prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'cron'"
+ },
+ "cron": {
+ "name": "cron",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'active'"
+ },
+ "next_run_at": {
+ "name": "next_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delay_sec": {
+ "name": "delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "options": {
+ "name": "options",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "last_run_at": {
+ "name": "last_run_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_schedule_due_idx": {
+ "name": "agent_schedule_due_idx",
+ "columns": [
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "next_run_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_agent_idx": {
+ "name": "agent_schedule_agent_idx",
+ "columns": [
+ {
+ "expression": "agent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_project_idx": {
+ "name": "agent_schedule_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_schedule_column_idx": {
+ "name": "agent_schedule_column_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_schedule_agent_id_ai_agent_id_fk": {
+ "name": "agent_schedule_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_schedule_project_id_project_id_fk": {
+ "name": "agent_schedule_project_id_project_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_schedule_column_id_project_column_id_fk": {
+ "name": "agent_schedule_column_id_project_column_id_fk",
+ "tableFrom": "agent_schedule",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_schedule_project_id_agent_id_name_unique": {
+ "name": "agent_schedule_project_id_agent_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "agent_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_schedule_status_check": {
+ "name": "agent_schedule_status_check",
+ "value": "\"agent_schedule\".\"status\" IN ('active', 'paused')"
+ },
+ "agent_schedule_type_check": {
+ "name": "agent_schedule_type_check",
+ "value": "(\"agent_schedule\".\"type\" = 'cron' AND \"agent_schedule\".\"cron\" IS NOT NULL AND \"agent_schedule\".\"next_run_at\" IS NOT NULL AND \"agent_schedule\".\"column_id\" IS NULL)\n OR (\"agent_schedule\".\"type\" = 'status' AND \"agent_schedule\".\"column_id\" IS NOT NULL AND \"agent_schedule\".\"cron\" IS NULL AND \"agent_schedule\".\"next_run_at\" IS NULL)\n OR (\"agent_schedule\".\"type\" NOT IN ('cron', 'status') AND \"agent_schedule\".\"cron\" IS NULL AND \"agent_schedule\".\"next_run_at\" IS NULL AND \"agent_schedule\".\"column_id\" IS NULL)"
+ },
+ "agent_schedule_delay_check": {
+ "name": "agent_schedule_delay_check",
+ "value": "\"agent_schedule\".\"delay_sec\" >= 0 AND \"agent_schedule\".\"delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_skill": {
+ "name": "agent_skill",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_url": {
+ "name": "source_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_prefix": {
+ "name": "s3_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "files": {
+ "name": "files",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_skill_team_idx": {
+ "name": "agent_skill_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_skill_team_id_team_id_fk": {
+ "name": "agent_skill_team_id_team_id_fk",
+ "tableFrom": "agent_skill",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_skill_team_id_name_unique": {
+ "name": "agent_skill_team_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "agent_skill_source_check": {
+ "name": "agent_skill_source_check",
+ "value": "\"agent_skill\".\"source\" IN ('upload', 'inline', 'github')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.agent_skill_link": {
+ "name": "agent_skill_link",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "skill_id": {
+ "name": "skill_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "agent_skill_link_skill_idx": {
+ "name": "agent_skill_link_skill_idx",
+ "columns": [
+ {
+ "expression": "skill_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_skill_link_agent_id_ai_agent_id_fk": {
+ "name": "agent_skill_link_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_skill_link",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_skill_link_skill_id_agent_skill_id_fk": {
+ "name": "agent_skill_link_skill_id_agent_skill_id_fk",
+ "tableFrom": "agent_skill_link",
+ "tableTo": "agent_skill",
+ "columnsFrom": [
+ "skill_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_skill_link_agent_id_skill_id_pk": {
+ "name": "agent_skill_link_agent_id_skill_id_pk",
+ "columns": [
+ "agent_id",
+ "skill_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_tool": {
+ "name": "agent_tool",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tool_key": {
+ "name": "tool_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credential_id": {
+ "name": "credential_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "agent_tool_team_tool_keyless_uq": {
+ "name": "agent_tool_team_tool_keyless_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "tool_key",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"agent_tool\".\"credential_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_tool_team_idx": {
+ "name": "agent_tool_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "agent_tool_credential_idx": {
+ "name": "agent_tool_credential_idx",
+ "columns": [
+ {
+ "expression": "credential_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_tool_team_id_team_id_fk": {
+ "name": "agent_tool_team_id_team_id_fk",
+ "tableFrom": "agent_tool",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_tool_credential_id_integration_credential_id_fk": {
+ "name": "agent_tool_credential_id_integration_credential_id_fk",
+ "tableFrom": "agent_tool",
+ "tableTo": "integration_credential",
+ "columnsFrom": [
+ "credential_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agent_tool_team_id_tool_key_credential_id_unique": {
+ "name": "agent_tool_team_id_tool_key_credential_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "tool_key",
+ "credential_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agent_tool_link": {
+ "name": "agent_tool_link",
+ "schema": "",
+ "columns": {
+ "agent_id": {
+ "name": "agent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "agent_tool_id": {
+ "name": "agent_tool_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "agent_tool_link_tool_idx": {
+ "name": "agent_tool_link_tool_idx",
+ "columns": [
+ {
+ "expression": "agent_tool_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "agent_tool_link_agent_id_ai_agent_id_fk": {
+ "name": "agent_tool_link_agent_id_ai_agent_id_fk",
+ "tableFrom": "agent_tool_link",
+ "tableTo": "ai_agent",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "agent_tool_link_agent_tool_id_agent_tool_id_fk": {
+ "name": "agent_tool_link_agent_tool_id_agent_tool_id_fk",
+ "tableFrom": "agent_tool_link",
+ "tableTo": "agent_tool",
+ "columnsFrom": [
+ "agent_tool_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "agent_tool_link_agent_id_agent_tool_id_pk": {
+ "name": "agent_tool_link_agent_id_agent_tool_id_pk",
+ "columns": [
+ "agent_id",
+ "agent_tool_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.ai_agent": {
+ "name": "ai_agent",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model_credential_id": {
+ "name": "model_credential_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "instructions": {
+ "name": "instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tools": {
+ "name": "tools",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "temperature": {
+ "name": "temperature",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reasoning_effort": {
+ "name": "reasoning_effort",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "max_steps": {
+ "name": "max_steps",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "run_timeout_sec": {
+ "name": "run_timeout_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "trigger_on_mention": {
+ "name": "trigger_on_mention",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "trigger_on_assign": {
+ "name": "trigger_on_assign",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "chat_enabled": {
+ "name": "chat_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "delegation_delay_sec": {
+ "name": "delegation_delay_sec",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 120
+ },
+ "api_key_ciphertext": {
+ "name": "api_key_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_iv": {
+ "name": "api_key_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "api_key_auth_tag": {
+ "name": "api_key_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "memory_enabled": {
+ "name": "memory_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "memory_last_messages": {
+ "name": "memory_last_messages",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "runner_scope": {
+ "name": "runner_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'team'"
+ },
+ "last_seen_at": {
+ "name": "last_seen_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_url": {
+ "name": "invocation_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_ciphertext": {
+ "name": "invocation_secret_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_iv": {
+ "name": "invocation_secret_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "invocation_secret_auth_tag": {
+ "name": "invocation_secret_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "ai_agent_team_username_uq": {
+ "name": "ai_agent_team_username_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(\"username\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "ai_agent_team_idx": {
+ "name": "ai_agent_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "ai_agent_team_id_team_id_fk": {
+ "name": "ai_agent_team_id_team_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ai_agent_user_id_user_id_fk": {
+ "name": "ai_agent_user_id_user_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "ai_agent_model_credential_id_integration_credential_id_fk": {
+ "name": "ai_agent_model_credential_id_integration_credential_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "integration_credential",
+ "columnsFrom": [
+ "model_credential_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "ai_agent_owner_user_id_user_id_fk": {
+ "name": "ai_agent_owner_user_id_user_id_fk",
+ "tableFrom": "ai_agent",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "ai_agent_user_id_unique": {
+ "name": "ai_agent_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "ai_agent_kind_check": {
+ "name": "ai_agent_kind_check",
+ "value": "\"ai_agent\".\"kind\" IN ('external', 'internal')"
+ },
+ "ai_agent_runner_scope_check": {
+ "name": "ai_agent_runner_scope_check",
+ "value": "\"ai_agent\".\"runner_scope\" IN ('owner', 'team')"
+ },
+ "ai_agent_reasoning_effort_check": {
+ "name": "ai_agent_reasoning_effort_check",
+ "value": "\"ai_agent\".\"reasoning_effort\" IN ('low', 'medium', 'high')"
+ },
+ "ai_agent_delegation_delay_check": {
+ "name": "ai_agent_delegation_delay_check",
+ "value": "\"ai_agent\".\"delegation_delay_sec\" >= 0 AND \"ai_agent\".\"delegation_delay_sec\" <= 86400"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.app_secret": {
+ "name": "app_secret",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.app_setting": {
+ "name": "app_setting",
+ "schema": "",
+ "columns": {
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.chat_attachment": {
+ "name": "chat_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploaded_by_user_id": {
+ "name": "uploaded_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "chat_attachment_project_idx": {
+ "name": "chat_attachment_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "chat_attachment_project_id_project_id_fk": {
+ "name": "chat_attachment_project_id_project_id_fk",
+ "tableFrom": "chat_attachment",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "chat_attachment_uploaded_by_user_id_user_id_fk": {
+ "name": "chat_attachment_uploaded_by_user_id_user_id_fk",
+ "tableFrom": "chat_attachment",
+ "tableTo": "user",
+ "columnsFrom": [
+ "uploaded_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "chat_attachment_public_id_unique": {
+ "name": "chat_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.custom_field": {
+ "name": "custom_field",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_type_id": {
+ "name": "issue_type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_type": {
+ "name": "field_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "member_scope": {
+ "name": "member_scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "show_in_body": {
+ "name": "show_in_body",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "custom_field_project_id_project_id_fk": {
+ "name": "custom_field_project_id_project_id_fk",
+ "tableFrom": "custom_field",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "custom_field_issue_type_id_issue_type_id_fk": {
+ "name": "custom_field_issue_type_id_issue_type_id_fk",
+ "tableFrom": "custom_field",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "issue_type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "custom_field_field_type_check": {
+ "name": "custom_field_field_type_check",
+ "value": "\"custom_field\".\"field_type\" IN ('text', 'markdown', 'url', 'number', 'boolean', 'date', 'datetime', 'datetime_range', 'select', 'multi_select', 'member')"
+ },
+ "custom_field_member_scope_check": {
+ "name": "custom_field_member_scope_check",
+ "value": "(\"custom_field\".\"field_type\" = 'member') = (\"custom_field\".\"member_scope\" IS NOT NULL) AND (\"custom_field\".\"member_scope\" IS NULL OR \"custom_field\".\"member_scope\" IN ('all', 'humans', 'agents'))"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.custom_field_option": {
+ "name": "custom_field_option",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "custom_field_option_field_id_custom_field_id_fk": {
+ "name": "custom_field_option_field_id_custom_field_id_fk",
+ "tableFrom": "custom_field_option",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "custom_field_option_field_id_value_unique": {
+ "name": "custom_field_option_field_id_value_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "field_id",
+ "value"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cycle": {
+ "name": "cycle",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "goal": {
+ "name": "goal",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "cycle_project_idx": {
+ "name": "cycle_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "start_date",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "cycle_project_id_project_id_fk": {
+ "name": "cycle_project_id_project_id_fk",
+ "tableFrom": "cycle",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "cycle_dates_check": {
+ "name": "cycle_dates_check",
+ "value": "\"cycle\".\"end_date\" >= \"cycle\".\"start_date\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.document_asset": {
+ "name": "document_asset",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploaded_by_user_id": {
+ "name": "uploaded_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "document_asset_document_idx": {
+ "name": "document_asset_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "document_asset_document_id_project_document_id_fk": {
+ "name": "document_asset_document_id_project_document_id_fk",
+ "tableFrom": "document_asset",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_asset_uploaded_by_user_id_user_id_fk": {
+ "name": "document_asset_uploaded_by_user_id_user_id_fk",
+ "tableFrom": "document_asset",
+ "tableTo": "user",
+ "columnsFrom": [
+ "uploaded_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "document_asset_public_id_unique": {
+ "name": "document_asset_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_collaboration": {
+ "name": "document_collaboration",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "epoch": {
+ "name": "epoch",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_collaboration_document_id_project_document_id_fk": {
+ "name": "document_collaboration_document_id_project_document_id_fk",
+ "tableFrom": "document_collaboration",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_comment": {
+ "name": "document_comment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "author_id": {
+ "name": "author_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "quote": {
+ "name": "quote",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "selection_from": {
+ "name": "selection_from",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "selection_to": {
+ "name": "selection_to",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "orphaned": {
+ "name": "orphaned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "resolved_at": {
+ "name": "resolved_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "document_comment_document_idx": {
+ "name": "document_comment_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "document_comment_document_id_project_document_id_fk": {
+ "name": "document_comment_document_id_project_document_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_comment_parent_id_document_comment_id_fk": {
+ "name": "document_comment_parent_id_document_comment_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "document_comment",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "document_comment_author_id_user_id_fk": {
+ "name": "document_comment_author_id_user_id_fk",
+ "tableFrom": "document_comment",
+ "tableTo": "user",
+ "columnsFrom": [
+ "author_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_step": {
+ "name": "document_step",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "client_id": {
+ "name": "client_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "step": {
+ "name": "step",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_step_document_id_project_document_id_fk": {
+ "name": "document_step_document_id_project_document_id_fk",
+ "tableFrom": "document_step",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "document_step_document_id_version_pk": {
+ "name": "document_step_document_id_version_pk",
+ "columns": [
+ "document_id",
+ "version"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.git_managed_repository": {
+ "name": "git_managed_repository",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "connection_id": {
+ "name": "connection_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "full_name": {
+ "name": "full_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "web_url": {
+ "name": "web_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "webhook_external_id": {
+ "name": "webhook_external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'connected'"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "git_managed_repository_project_connection_idx": {
+ "name": "git_managed_repository_project_connection_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "connection_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "git_managed_repository_project_id_project_id_fk": {
+ "name": "git_managed_repository_project_id_project_id_fk",
+ "tableFrom": "git_managed_repository",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "git_managed_repository_connection_id_git_provider_connection_id_fk": {
+ "name": "git_managed_repository_connection_id_git_provider_connection_id_fk",
+ "tableFrom": "git_managed_repository",
+ "tableTo": "git_provider_connection",
+ "columnsFrom": [
+ "connection_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "git_managed_repository_project_connection_external_unique": {
+ "name": "git_managed_repository_project_connection_external_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "connection_id",
+ "external_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.git_provider_connection": {
+ "name": "git_provider_connection",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "base_url": {
+ "name": "base_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "account_login": {
+ "name": "account_login",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "git_provider_connection_team_idx": {
+ "name": "git_provider_connection_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "git_provider_connection_team_id_team_id_fk": {
+ "name": "git_provider_connection_team_id_team_id_fk",
+ "tableFrom": "git_provider_connection",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.import_job": {
+ "name": "import_job",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "phase": {
+ "name": "phase",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'discover'"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "cursor": {
+ "name": "cursor",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "credential_ciphertext": {
+ "name": "credential_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_iv": {
+ "name": "credential_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credential_auth_tag": {
+ "name": "credential_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "import_job_project_idx": {
+ "name": "import_job_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_job_due_idx": {
+ "name": "import_job_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"import_job\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "import_job_project_id_project_id_fk": {
+ "name": "import_job_project_id_project_id_fk",
+ "tableFrom": "import_job",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "import_job_created_by_user_id_user_id_fk": {
+ "name": "import_job_created_by_user_id_user_id_fk",
+ "tableFrom": "import_job",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "import_job_phase_check": {
+ "name": "import_job_phase_check",
+ "value": "\"import_job\".\"phase\" IN ('discover', 'create', 'link', 'rewrite', 'attachments', 'done')"
+ },
+ "import_job_status_check": {
+ "name": "import_job_status_check",
+ "value": "\"import_job\".\"status\" IN ('pending', 'running', 'paused', 'completed', 'failed')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.import_record": {
+ "name": "import_record",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "import_job_id": {
+ "name": "import_job_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_entity_type": {
+ "name": "source_entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_id": {
+ "name": "source_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "source_display_id": {
+ "name": "source_display_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "local_entity_type": {
+ "name": "local_entity_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "local_id": {
+ "name": "local_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "import_record_job_source_uq": {
+ "name": "import_record_job_source_uq",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_record_job_local_idx": {
+ "name": "import_record_job_local_idx",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "local_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "local_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "import_record_job_display_idx": {
+ "name": "import_record_job_display_idx",
+ "columns": [
+ {
+ "expression": "import_job_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_entity_type",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "source_display_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "import_record_import_job_id_import_job_id_fk": {
+ "name": "import_record_import_job_id_import_job_id_fk",
+ "tableFrom": "import_record",
+ "tableTo": "import_job",
+ "columnsFrom": [
+ "import_job_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "import_record_source_entity_type_check": {
+ "name": "import_record_source_entity_type_check",
+ "value": "\"import_record\".\"source_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment', 'checklist', 'custom_field')"
+ },
+ "import_record_local_entity_type_check": {
+ "name": "import_record_local_entity_type_check",
+ "value": "\"import_record\".\"local_entity_type\" IS NULL OR \"import_record\".\"local_entity_type\" IN ('issue', 'comment', 'label', 'state', 'cycle', 'attachment', 'checklist', 'custom_field')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.initiative": {
+ "name": "initiative",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'planned'"
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_date": {
+ "name": "target_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "initiative_project_idx": {
+ "name": "initiative_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "initiative_project_id_project_id_fk": {
+ "name": "initiative_project_id_project_id_fk",
+ "tableFrom": "initiative",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "initiative_owner_user_id_user_id_fk": {
+ "name": "initiative_owner_user_id_user_id_fk",
+ "tableFrom": "initiative",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "initiative_status_check": {
+ "name": "initiative_status_check",
+ "value": "\"initiative\".\"status\" IN ('proposed', 'planned', 'active', 'completed', 'canceled')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.initiative_attachment": {
+ "name": "initiative_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "initiative_attachment_initiative_idx": {
+ "name": "initiative_attachment_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "initiative_attachment_initiative_id_initiative_id_fk": {
+ "name": "initiative_attachment_initiative_id_initiative_id_fk",
+ "tableFrom": "initiative_attachment",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "initiative_attachment_public_id_unique": {
+ "name": "initiative_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.initiative_label": {
+ "name": "initiative_label",
+ "schema": "",
+ "columns": {
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "initiative_label_initiative_id_initiative_id_fk": {
+ "name": "initiative_label_initiative_id_initiative_id_fk",
+ "tableFrom": "initiative_label",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "initiative_label_label_id_label_id_fk": {
+ "name": "initiative_label_label_id_label_id_fk",
+ "tableFrom": "initiative_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "initiative_label_initiative_id_label_id_pk": {
+ "name": "initiative_label_initiative_id_label_id_pk",
+ "columns": [
+ "initiative_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.integration_credential": {
+ "name": "integration_credential",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "integration_key": {
+ "name": "integration_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "integration_credential_team_idx": {
+ "name": "integration_credential_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "integration_credential_team_id_team_id_fk": {
+ "name": "integration_credential_team_id_team_id_fk",
+ "tableFrom": "integration_credential",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue": {
+ "name": "issue",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence_number": {
+ "name": "sequence_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type_id": {
+ "name": "type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cycle_id": {
+ "name": "cycle_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delegate_user_id": {
+ "name": "delegate_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimate_points": {
+ "name": "estimate_points",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimate_minutes": {
+ "name": "estimate_minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_extended": {
+ "name": "share_extended",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "share_expires_at": {
+ "name": "share_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_project_active_idx": {
+ "name": "issue_project_active_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"archived_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_project_title_idx": {
+ "name": "issue_project_title_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "lower(btrim(\"title\"))",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_parent_idx": {
+ "name": "issue_parent_idx",
+ "columns": [
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"parent_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_idx": {
+ "name": "issue_cycle_idx",
+ "columns": [
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"cycle_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_initiative_idx": {
+ "name": "issue_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue\".\"initiative_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_project_id_project_id_fk": {
+ "name": "issue_project_id_project_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_type_id_issue_type_id_fk": {
+ "name": "issue_type_id_issue_type_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_initiative_id_initiative_id_fk": {
+ "name": "issue_initiative_id_initiative_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_cycle_id_cycle_id_fk": {
+ "name": "issue_cycle_id_cycle_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "cycle",
+ "columnsFrom": [
+ "cycle_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_column_id_project_column_id_fk": {
+ "name": "issue_column_id_project_column_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "issue_parent_id_issue_id_fk": {
+ "name": "issue_parent_id_issue_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_assignee_user_id_user_id_fk": {
+ "name": "issue_assignee_user_id_user_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "assignee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_delegate_user_id_user_id_fk": {
+ "name": "issue_delegate_user_id_user_id_fk",
+ "tableFrom": "issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "delegate_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_share_token_unique": {
+ "name": "issue_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ },
+ "issue_project_id_sequence_number_unique": {
+ "name": "issue_project_id_sequence_number_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "sequence_number"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "issue_estimate_points_check": {
+ "name": "issue_estimate_points_check",
+ "value": "\"issue\".\"estimate_points\" >= 0"
+ },
+ "issue_estimate_minutes_check": {
+ "name": "issue_estimate_minutes_check",
+ "value": "\"issue\".\"estimate_minutes\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_activity": {
+ "name": "issue_activity",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reply_to_id": {
+ "name": "reply_to_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "body": {
+ "name": "body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "action": {
+ "name": "action",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "edited_at": {
+ "name": "edited_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_activity_issue_idx": {
+ "name": "issue_activity_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_activity_reply_idx": {
+ "name": "issue_activity_reply_idx",
+ "columns": [
+ {
+ "expression": "reply_to_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_activity_initiative_idx": {
+ "name": "issue_activity_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_activity_issue_id_issue_id_fk": {
+ "name": "issue_activity_issue_id_issue_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_initiative_id_initiative_id_fk": {
+ "name": "issue_activity_initiative_id_initiative_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_reply_to_id_issue_activity_id_fk": {
+ "name": "issue_activity_reply_to_id_issue_activity_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "reply_to_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_activity_actor_user_id_user_id_fk": {
+ "name": "issue_activity_actor_user_id_user_id_fk",
+ "tableFrom": "issue_activity",
+ "tableTo": "user",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_activity_kind_check": {
+ "name": "issue_activity_kind_check",
+ "value": "\"issue_activity\".\"kind\" IN ('comment', 'activity')"
+ },
+ "issue_activity_owner_check": {
+ "name": "issue_activity_owner_check",
+ "value": "(\"issue_activity\".\"issue_id\" IS NOT NULL) <> (\"issue_activity\".\"initiative_id\" IS NOT NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_attachment": {
+ "name": "issue_attachment",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3_key": {
+ "name": "s3_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "filename": {
+ "name": "filename",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_type": {
+ "name": "content_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "size_bytes": {
+ "name": "size_bytes",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_attachment_issue_idx": {
+ "name": "issue_attachment_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_attachment_issue_id_issue_id_fk": {
+ "name": "issue_attachment_issue_id_issue_id_fk",
+ "tableFrom": "issue_attachment",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_attachment_public_id_unique": {
+ "name": "issue_attachment_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_checklist": {
+ "name": "issue_checklist",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_checklist_issue_idx": {
+ "name": "issue_checklist_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_checklist_issue_id_issue_id_fk": {
+ "name": "issue_checklist_issue_id_issue_id_fk",
+ "tableFrom": "issue_checklist",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_checklist_item": {
+ "name": "issue_checklist_item",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "checklist_id": {
+ "name": "checklist_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "done": {
+ "name": "done",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_checklist_item_checklist_idx": {
+ "name": "issue_checklist_item_checklist_idx",
+ "columns": [
+ {
+ "expression": "checklist_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_checklist_item_checklist_id_issue_checklist_id_fk": {
+ "name": "issue_checklist_item_checklist_id_issue_checklist_id_fk",
+ "tableFrom": "issue_checklist_item",
+ "tableTo": "issue_checklist",
+ "columnsFrom": [
+ "checklist_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_cycle": {
+ "name": "issue_cycle",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cycle_id": {
+ "name": "cycle_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "entered_at": {
+ "name": "entered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "left_at": {
+ "name": "left_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_cycle_issue_idx": {
+ "name": "issue_cycle_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_cycle_idx": {
+ "name": "issue_cycle_cycle_idx",
+ "columns": [
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_cycle_open_idx": {
+ "name": "issue_cycle_open_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "cycle_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"issue_cycle\".\"left_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_cycle_issue_id_issue_id_fk": {
+ "name": "issue_cycle_issue_id_issue_id_fk",
+ "tableFrom": "issue_cycle",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_cycle_cycle_id_cycle_id_fk": {
+ "name": "issue_cycle_cycle_id_cycle_id_fk",
+ "tableFrom": "issue_cycle",
+ "tableTo": "cycle",
+ "columnsFrom": [
+ "cycle_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_development_check": {
+ "name": "issue_development_check",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "development_link_id": {
+ "name": "development_link_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "app_id": {
+ "name": "app_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_development_check_link_sha_idx": {
+ "name": "issue_development_check_link_sha_idx",
+ "columns": [
+ {
+ "expression": "development_link_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_development_check_development_link_id_issue_development_link_id_fk": {
+ "name": "issue_development_check_development_link_id_issue_development_link_id_fk",
+ "tableFrom": "issue_development_check",
+ "tableTo": "issue_development_link",
+ "columnsFrom": [
+ "development_link_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_development_check_development_link_id_app_id_name_unique": {
+ "name": "issue_development_check_development_link_id_app_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "development_link_id",
+ "app_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_development_link": {
+ "name": "issue_development_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "repository": {
+ "name": "repository",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pull_request'"
+ },
+ "external_key": {
+ "name": "external_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "number": {
+ "name": "number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state": {
+ "name": "state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "draft": {
+ "name": "draft",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "source_branch": {
+ "name": "source_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "target_branch": {
+ "name": "target_branch",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "head_sha": {
+ "name": "head_sha",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pipeline_status": {
+ "name": "pipeline_status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pipeline_url": {
+ "name": "pipeline_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_development_link_issue_idx": {
+ "name": "issue_development_link_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_development_link_pr_idx": {
+ "name": "issue_development_link_pr_idx",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_development_link_sha_idx": {
+ "name": "issue_development_link_sha_idx",
+ "columns": [
+ {
+ "expression": "provider",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "repository",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "head_sha",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_development_link_issue_id_issue_id_fk": {
+ "name": "issue_development_link_issue_id_issue_id_fk",
+ "tableFrom": "issue_development_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_development_link_issue_id_provider_repository_external_key_unique": {
+ "name": "issue_development_link_issue_id_provider_repository_external_key_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "issue_id",
+ "provider",
+ "repository",
+ "external_key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_field_option": {
+ "name": "issue_field_option",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "option_id": {
+ "name": "option_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_field_option_issue_id_issue_id_fk": {
+ "name": "issue_field_option_issue_id_issue_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_option_field_id_custom_field_id_fk": {
+ "name": "issue_field_option_field_id_custom_field_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_option_option_id_custom_field_option_id_fk": {
+ "name": "issue_field_option_option_id_custom_field_option_id_fk",
+ "tableFrom": "issue_field_option",
+ "tableTo": "custom_field_option",
+ "columnsFrom": [
+ "option_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_field_option_issue_id_field_id_option_id_pk": {
+ "name": "issue_field_option_issue_id_field_id_option_id_pk",
+ "columns": [
+ "issue_id",
+ "field_id",
+ "option_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_field_value": {
+ "name": "issue_field_value",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "field_id": {
+ "name": "field_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value_text": {
+ "name": "value_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_number": {
+ "name": "value_number",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_bool": {
+ "name": "value_bool",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_date": {
+ "name": "value_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_datetime": {
+ "name": "value_datetime",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_datetime_end": {
+ "name": "value_datetime_end",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "value_user_id": {
+ "name": "value_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_field_value_issue_id_issue_id_fk": {
+ "name": "issue_field_value_issue_id_issue_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_value_field_id_custom_field_id_fk": {
+ "name": "issue_field_value_field_id_custom_field_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "custom_field",
+ "columnsFrom": [
+ "field_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_field_value_value_user_id_user_id_fk": {
+ "name": "issue_field_value_value_user_id_user_id_fk",
+ "tableFrom": "issue_field_value",
+ "tableTo": "user",
+ "columnsFrom": [
+ "value_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_field_value_issue_id_field_id_unique": {
+ "name": "issue_field_value_issue_id_field_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "issue_id",
+ "field_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_import": {
+ "name": "issue_import",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "public_id": {
+ "name": "public_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_id": {
+ "name": "attachment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'mapped'"
+ },
+ "mapping": {
+ "name": "mapping",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "error_text": {
+ "name": "error_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_import_project_idx": {
+ "name": "issue_import_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_import_project_id_project_id_fk": {
+ "name": "issue_import_project_id_project_id_fk",
+ "tableFrom": "issue_import",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_import_attachment_id_chat_attachment_id_fk": {
+ "name": "issue_import_attachment_id_chat_attachment_id_fk",
+ "tableFrom": "issue_import",
+ "tableTo": "chat_attachment",
+ "columnsFrom": [
+ "attachment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_import_public_id_unique": {
+ "name": "issue_import_public_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "public_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_key_alias": {
+ "name": "issue_key_alias",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sequence_number": {
+ "name": "sequence_number",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "issue_key_alias_issue_idx": {
+ "name": "issue_key_alias_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_key_alias_project_id_project_id_fk": {
+ "name": "issue_key_alias_project_id_project_id_fk",
+ "tableFrom": "issue_key_alias",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_key_alias_issue_id_issue_id_fk": {
+ "name": "issue_key_alias_issue_id_issue_id_fk",
+ "tableFrom": "issue_key_alias",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_key_alias_project_id_sequence_number_pk": {
+ "name": "issue_key_alias_project_id_sequence_number_pk",
+ "columns": [
+ "project_id",
+ "sequence_number"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_label": {
+ "name": "issue_label",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_label_issue_id_issue_id_fk": {
+ "name": "issue_label_issue_id_issue_id_fk",
+ "tableFrom": "issue_label",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_label_label_id_label_id_fk": {
+ "name": "issue_label_label_id_label_id_fk",
+ "tableFrom": "issue_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_label_issue_id_label_id_pk": {
+ "name": "issue_label_issue_id_label_id_pk",
+ "columns": [
+ "issue_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_link": {
+ "name": "issue_link",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "source_issue_id": {
+ "name": "source_issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "target_issue_id": {
+ "name": "target_issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_link_pair_kind_idx": {
+ "name": "issue_link_pair_kind_idx",
+ "columns": [
+ {
+ "expression": "least(\"source_issue_id\", \"target_issue_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "greatest(\"source_issue_id\", \"target_issue_id\")",
+ "asc": true,
+ "isExpression": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "kind",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_link_source_idx": {
+ "name": "issue_link_source_idx",
+ "columns": [
+ {
+ "expression": "source_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_link_target_idx": {
+ "name": "issue_link_target_idx",
+ "columns": [
+ {
+ "expression": "target_issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_link_source_issue_id_issue_id_fk": {
+ "name": "issue_link_source_issue_id_issue_id_fk",
+ "tableFrom": "issue_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "source_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_link_target_issue_id_issue_id_fk": {
+ "name": "issue_link_target_issue_id_issue_id_fk",
+ "tableFrom": "issue_link",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "target_issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_link_kind_check": {
+ "name": "issue_link_kind_check",
+ "value": "\"issue_link\".\"kind\" IN ('blocks', 'relates', 'duplicates')"
+ },
+ "issue_link_self_check": {
+ "name": "issue_link_self_check",
+ "value": "\"issue_link\".\"source_issue_id\" <> \"issue_link\".\"target_issue_id\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.issue_status": {
+ "name": "issue_status",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_name": {
+ "name": "column_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "state_type": {
+ "name": "state_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "entered_at": {
+ "name": "entered_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "left_at": {
+ "name": "left_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "issue_status_issue_idx": {
+ "name": "issue_status_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "entered_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_status_column_idx": {
+ "name": "issue_status_column_idx",
+ "columns": [
+ {
+ "expression": "column_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"issue_status\".\"column_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "issue_status_open_idx": {
+ "name": "issue_status_open_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"issue_status\".\"left_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_status_issue_id_issue_id_fk": {
+ "name": "issue_status_issue_id_issue_id_fk",
+ "tableFrom": "issue_status",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_status_column_id_project_column_id_fk": {
+ "name": "issue_status_column_id_project_column_id_fk",
+ "tableFrom": "issue_status",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_template": {
+ "name": "issue_template",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "title_template": {
+ "name": "title_template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "description_template": {
+ "name": "description_template",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "type_id": {
+ "name": "type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "column_id": {
+ "name": "column_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "assignee_user_id": {
+ "name": "assignee_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_template_project_id_project_id_fk": {
+ "name": "issue_template_project_id_project_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_template_type_id_issue_type_id_fk": {
+ "name": "issue_template_type_id_issue_type_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "issue_type",
+ "columnsFrom": [
+ "type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_template_column_id_project_column_id_fk": {
+ "name": "issue_template_column_id_project_column_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "project_column",
+ "columnsFrom": [
+ "column_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "issue_template_assignee_user_id_user_id_fk": {
+ "name": "issue_template_assignee_user_id_user_id_fk",
+ "tableFrom": "issue_template",
+ "tableTo": "user",
+ "columnsFrom": [
+ "assignee_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_template_project_id_name_unique": {
+ "name": "issue_template_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_template_label": {
+ "name": "issue_template_label",
+ "schema": "",
+ "columns": {
+ "template_id": {
+ "name": "template_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label_id": {
+ "name": "label_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_template_label_template_id_issue_template_id_fk": {
+ "name": "issue_template_label_template_id_issue_template_id_fk",
+ "tableFrom": "issue_template_label",
+ "tableTo": "issue_template",
+ "columnsFrom": [
+ "template_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_template_label_label_id_label_id_fk": {
+ "name": "issue_template_label_label_id_label_id_fk",
+ "tableFrom": "issue_template_label",
+ "tableTo": "label",
+ "columnsFrom": [
+ "label_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_template_label_template_id_label_id_pk": {
+ "name": "issue_template_label_template_id_label_id_pk",
+ "columns": [
+ "template_id",
+ "label_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_type": {
+ "name": "issue_type",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_type_project_id_project_id_fk": {
+ "name": "issue_type_project_id_project_id_fk",
+ "tableFrom": "issue_type",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "issue_type_project_id_name_unique": {
+ "name": "issue_type_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_watcher": {
+ "name": "issue_watcher",
+ "schema": "",
+ "columns": {
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "subscribed": {
+ "name": "subscribed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "issue_watcher_issue_id_issue_id_fk": {
+ "name": "issue_watcher_issue_id_issue_id_fk",
+ "tableFrom": "issue_watcher",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_watcher_user_id_user_id_fk": {
+ "name": "issue_watcher_user_id_user_id_fk",
+ "tableFrom": "issue_watcher",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "issue_watcher_issue_id_user_id_pk": {
+ "name": "issue_watcher_issue_id_user_id_pk",
+ "columns": [
+ "issue_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_worklog": {
+ "name": "issue_worklog",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "minutes": {
+ "name": "minutes",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "spent_on": {
+ "name": "spent_on",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "note": {
+ "name": "note",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "issue_worklog_issue_idx": {
+ "name": "issue_worklog_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "spent_on",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_worklog_issue_id_issue_id_fk": {
+ "name": "issue_worklog_issue_id_issue_id_fk",
+ "tableFrom": "issue_worklog",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "issue_worklog_user_id_user_id_fk": {
+ "name": "issue_worklog_user_id_user_id_fk",
+ "tableFrom": "issue_worklog",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "issue_worklog_minutes_check": {
+ "name": "issue_worklog_minutes_check",
+ "value": "\"issue_worklog\".\"minutes\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.label": {
+ "name": "label",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_project_id_project_id_fk": {
+ "name": "label_project_id_project_id_fk",
+ "tableFrom": "label",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "label_group_id_label_group_id_fk": {
+ "name": "label_group_id_label_group_id_fk",
+ "tableFrom": "label",
+ "tableTo": "label_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_project_id_name_unique": {
+ "name": "label_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.label_group": {
+ "name": "label_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "label_group_project_id_project_id_fk": {
+ "name": "label_group_project_id_project_id_fk",
+ "tableFrom": "label_group",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "label_group_project_id_name_unique": {
+ "name": "label_group_project_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.model_price": {
+ "name": "model_price",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "model": {
+ "name": "model",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "input": {
+ "name": "input",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "output": {
+ "name": "output",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "cache_read": {
+ "name": "cache_read",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cache_write": {
+ "name": "cache_write",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "model_price_workspace_id_workspace_id_fk": {
+ "name": "model_price_workspace_id_workspace_id_fk",
+ "tableFrom": "model_price",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "model_price_workspace_id_provider_model_unique": {
+ "name": "model_price_workspace_id_provider_model_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "provider",
+ "model"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "model_price_rates_check": {
+ "name": "model_price_rates_check",
+ "value": "\"model_price\".\"input\" >= 0 AND \"model_price\".\"output\" >= 0 AND coalesce(\"model_price\".\"cache_read\", 0) >= 0 AND coalesce(\"model_price\".\"cache_write\", 0) >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.note_board": {
+ "name": "note_board",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "canvas": {
+ "name": "canvas",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "note_board_project_idx": {
+ "name": "note_board_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "updated_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "note_board_project_id_project_id_fk": {
+ "name": "note_board_project_id_project_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_owner_user_id_user_id_fk": {
+ "name": "note_board_owner_user_id_user_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_created_by_user_id_user_id_fk": {
+ "name": "note_board_created_by_user_id_user_id_fk",
+ "tableFrom": "note_board",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.note_board_member": {
+ "name": "note_board_member",
+ "schema": "",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "note_board_member_user_idx": {
+ "name": "note_board_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "note_board_member_board_id_note_board_id_fk": {
+ "name": "note_board_member_board_id_note_board_id_fk",
+ "tableFrom": "note_board_member",
+ "tableTo": "note_board",
+ "columnsFrom": [
+ "board_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "note_board_member_user_id_user_id_fk": {
+ "name": "note_board_member_user_id_user_id_fk",
+ "tableFrom": "note_board_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "note_board_member_board_id_user_id_pk": {
+ "name": "note_board_member_board_id_user_id_pk",
+ "columns": [
+ "board_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification": {
+ "name": "notification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source_activity_id": {
+ "name": "source_activity_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "document_comment_id": {
+ "name": "document_comment_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "actor_user_id": {
+ "name": "actor_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actor_name": {
+ "name": "actor_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "read_at": {
+ "name": "read_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "snoozed_until": {
+ "name": "snoozed_until",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "notification_user_idx": {
+ "name": "notification_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "created_at",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_user_unread_idx": {
+ "name": "notification_user_unread_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": false,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification\".\"read_at\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_issue_idx": {
+ "name": "notification_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification\".\"issue_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "notification_source_activity_idx": {
+ "name": "notification_source_activity_idx",
+ "columns": [
+ {
+ "expression": "source_activity_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification\".\"source_activity_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_user_id_user_id_fk": {
+ "name": "notification_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_project_id_project_id_fk": {
+ "name": "notification_project_id_project_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_issue_id_issue_id_fk": {
+ "name": "notification_issue_id_issue_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_source_activity_id_issue_activity_id_fk": {
+ "name": "notification_source_activity_id_issue_activity_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "issue_activity",
+ "columnsFrom": [
+ "source_activity_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "notification_document_id_project_document_id_fk": {
+ "name": "notification_document_id_project_document_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "notification_document_comment_id_document_comment_id_fk": {
+ "name": "notification_document_comment_id_document_comment_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "document_comment",
+ "columnsFrom": [
+ "document_comment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "notification_actor_user_id_user_id_fk": {
+ "name": "notification_actor_user_id_user_id_fk",
+ "tableFrom": "notification",
+ "tableTo": "user",
+ "columnsFrom": [
+ "actor_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "notification_type_check": {
+ "name": "notification_type_check",
+ "value": "\"notification\".\"type\" IN ('assigned', 'mentioned', 'commented', 'state_changed')"
+ },
+ "notification_target_check": {
+ "name": "notification_target_check",
+ "value": "(\"notification\".\"issue_id\" IS NULL) <> (\"notification\".\"document_id\" IS NULL)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.notification_delivery": {
+ "name": "notification_delivery",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "channel": {
+ "name": "channel",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "recipient": {
+ "name": "recipient",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "notification_delivery_due_idx": {
+ "name": "notification_delivery_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"notification_delivery\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "notification_delivery_project_id_project_id_fk": {
+ "name": "notification_delivery_project_id_project_id_fk",
+ "tableFrom": "notification_delivery",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "notification_delivery_channel_check": {
+ "name": "notification_delivery_channel_check",
+ "value": "\"notification_delivery\".\"channel\" IN ('email', 'telegram')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project": {
+ "name": "project",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "next_sequence": {
+ "name": "next_sequence",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "mcp_enabled": {
+ "name": "mcp_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "initiatives_enabled": {
+ "name": "initiatives_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "dashboards_enabled": {
+ "name": "dashboards_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "documents_enabled": {
+ "name": "documents_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "notes_enabled": {
+ "name": "notes_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "cycles_enabled": {
+ "name": "cycles_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "subtasks_enabled": {
+ "name": "subtasks_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "checklists_enabled": {
+ "name": "checklists_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "issue_stats_enabled": {
+ "name": "issue_stats_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "points_estimate_enabled": {
+ "name": "points_estimate_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "time_estimate_enabled": {
+ "name": "time_estimate_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "time_logging_enabled": {
+ "name": "time_logging_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_team_id_team_id_fk": {
+ "name": "project_team_id_team_id_fk",
+ "tableFrom": "project",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_team_key_uq": {
+ "name": "project_team_key_uq",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "key"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_action": {
+ "name": "project_action",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "condition": {
+ "name": "condition",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "effect": {
+ "name": "effect",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_action_project_idx": {
+ "name": "project_action_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_action_project_id_project_id_fk": {
+ "name": "project_action_project_id_project_id_fk",
+ "tableFrom": "project_action",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_column": {
+ "name": "project_column",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "state_type": {
+ "name": "state_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'unstarted'"
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'#6b7280'"
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "wip_limit": {
+ "name": "wip_limit",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "wip_mode": {
+ "name": "wip_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'soft'"
+ },
+ "auto_assign_user_id": {
+ "name": "auto_assign_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_column_project_id_project_id_fk": {
+ "name": "project_column_project_id_project_id_fk",
+ "tableFrom": "project_column",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_column_auto_assign_user_id_user_id_fk": {
+ "name": "project_column_auto_assign_user_id_user_id_fk",
+ "tableFrom": "project_column",
+ "tableTo": "user",
+ "columnsFrom": [
+ "auto_assign_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_column_project_id_position_unique": {
+ "name": "project_column_project_id_position_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "position"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "project_column_state_type_check": {
+ "name": "project_column_state_type_check",
+ "value": "\"project_column\".\"state_type\" IN ('backlog', 'unstarted', 'started', 'completed', 'canceled')"
+ },
+ "project_column_wip_mode_check": {
+ "name": "project_column_wip_mode_check",
+ "value": "\"project_column\".\"wip_mode\" IN ('soft', 'hard')"
+ },
+ "project_column_wip_limit_check": {
+ "name": "project_column_wip_limit_check",
+ "value": "\"project_column\".\"wip_limit\" IS NULL OR \"project_column\".\"wip_limit\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_dashboard": {
+ "name": "project_dashboard",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "layout": {
+ "name": "layout",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_dashboard_project_idx": {
+ "name": "project_dashboard_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_dashboard_project_id_project_id_fk": {
+ "name": "project_dashboard_project_id_project_id_fk",
+ "tableFrom": "project_dashboard",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document": {
+ "name": "project_document",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "full_width": {
+ "name": "full_width",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_locked": {
+ "name": "is_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "archived_by_ancestor_id": {
+ "name": "archived_by_ancestor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by_user_id": {
+ "name": "updated_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_expires_at": {
+ "name": "share_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_include_children": {
+ "name": "share_include_children",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "share_include_issues": {
+ "name": "share_include_issues",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_project_tree_idx": {
+ "name": "project_document_project_tree_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "parent_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_document_owner_idx": {
+ "name": "project_document_owner_idx",
+ "columns": [
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_document_project_archive_idx": {
+ "name": "project_document_project_archive_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "archived_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_project_id_project_id_fk": {
+ "name": "project_document_project_id_project_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_parent_id_project_document_id_fk": {
+ "name": "project_document_parent_id_project_document_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "parent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_archived_by_ancestor_id_project_document_id_fk": {
+ "name": "project_document_archived_by_ancestor_id_project_document_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "archived_by_ancestor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_owner_user_id_user_id_fk": {
+ "name": "project_document_owner_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_created_by_user_id_user_id_fk": {
+ "name": "project_document_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_updated_by_user_id_user_id_fk": {
+ "name": "project_document_updated_by_user_id_user_id_fk",
+ "tableFrom": "project_document",
+ "tableTo": "user",
+ "columnsFrom": [
+ "updated_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_document_share_token_unique": {
+ "name": "project_document_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "project_document_version_check": {
+ "name": "project_document_version_check",
+ "value": "\"project_document\".\"version\" > 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_document_initiative": {
+ "name": "project_document_initiative",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "initiative_id": {
+ "name": "initiative_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_initiative_initiative_idx": {
+ "name": "project_document_initiative_initiative_idx",
+ "columns": [
+ {
+ "expression": "initiative_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_initiative_document_id_project_document_id_fk": {
+ "name": "project_document_initiative_document_id_project_document_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_initiative_initiative_id_initiative_id_fk": {
+ "name": "project_document_initiative_initiative_id_initiative_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "initiative",
+ "columnsFrom": [
+ "initiative_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_initiative_created_by_user_id_user_id_fk": {
+ "name": "project_document_initiative_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_initiative",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_initiative_document_id_initiative_id_pk": {
+ "name": "project_document_initiative_document_id_initiative_id_pk",
+ "columns": [
+ "document_id",
+ "initiative_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_issue": {
+ "name": "project_document_issue",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issue_id": {
+ "name": "issue_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_issue_issue_idx": {
+ "name": "project_document_issue_issue_idx",
+ "columns": [
+ {
+ "expression": "issue_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_issue_document_id_project_document_id_fk": {
+ "name": "project_document_issue_document_id_project_document_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_issue_issue_id_issue_id_fk": {
+ "name": "project_document_issue_issue_id_issue_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "issue",
+ "columnsFrom": [
+ "issue_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_issue_created_by_user_id_user_id_fk": {
+ "name": "project_document_issue_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_issue",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_issue_document_id_issue_id_pk": {
+ "name": "project_document_issue_document_id_issue_id_pk",
+ "columns": [
+ "document_id",
+ "issue_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_preference": {
+ "name": "project_document_preference",
+ "schema": "",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_favorite": {
+ "name": "is_favorite",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_preference_user_idx": {
+ "name": "project_document_preference_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_preference_document_id_project_document_id_fk": {
+ "name": "project_document_preference_document_id_project_document_id_fk",
+ "tableFrom": "project_document_preference",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_preference_user_id_user_id_fk": {
+ "name": "project_document_preference_user_id_user_id_fk",
+ "tableFrom": "project_document_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_document_preference_document_id_user_id_pk": {
+ "name": "project_document_preference_document_id_user_id_pk",
+ "columns": [
+ "document_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_document_revision": {
+ "name": "project_document_revision",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "parent_id": {
+ "name": "parent_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "title": {
+ "name": "title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "content_json": {
+ "name": "content_json",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "full_width": {
+ "name": "full_width",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_locked": {
+ "name": "is_locked",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "archived_at": {
+ "name": "archived_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by_user_id": {
+ "name": "created_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_document_revision_document_idx": {
+ "name": "project_document_revision_document_idx",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "version",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_document_revision_document_id_project_document_id_fk": {
+ "name": "project_document_revision_document_id_project_document_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "project_document",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_document_revision_owner_user_id_user_id_fk": {
+ "name": "project_document_revision_owner_user_id_user_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "project_document_revision_created_by_user_id_user_id_fk": {
+ "name": "project_document_revision_created_by_user_id_user_id_fk",
+ "tableFrom": "project_document_revision",
+ "tableTo": "user",
+ "columnsFrom": [
+ "created_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_document_revision_document_version_unique": {
+ "name": "project_document_revision_document_version_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "document_id",
+ "version"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_member": {
+ "name": "project_member",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'invite'"
+ },
+ "is_favorite": {
+ "name": "is_favorite",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_hidden": {
+ "name": "is_hidden",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_member_user_idx": {
+ "name": "project_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_member_project_id_project_id_fk": {
+ "name": "project_member_project_id_project_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_member_user_id_user_id_fk": {
+ "name": "project_member_user_id_user_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_member_role_id_team_role_id_fk": {
+ "name": "project_member_role_id_team_role_id_fk",
+ "tableFrom": "project_member",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_member_project_id_user_id_pk": {
+ "name": "project_member_project_id_user_id_pk",
+ "columns": [
+ "project_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "project_member_role_check": {
+ "name": "project_member_role_check",
+ "value": "\"project_member\".\"role\" IN ('owner', 'member')"
+ },
+ "project_member_source_check": {
+ "name": "project_member_source_check",
+ "value": "\"project_member\".\"source\" IN ('invite', 'scim')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_setting": {
+ "name": "project_setting",
+ "schema": "",
+ "columns": {
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key": {
+ "name": "key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_setting_project_id_project_id_fk": {
+ "name": "project_setting_project_id_project_id_fk",
+ "tableFrom": "project_setting",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_setting_project_id_key_pk": {
+ "name": "project_setting_project_id_key_pk",
+ "columns": [
+ "project_id",
+ "key"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_template": {
+ "name": "project_template",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "snapshot": {
+ "name": "snapshot",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "all_teams": {
+ "name": "all_teams",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "publication_id": {
+ "name": "publication_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "publication_url": {
+ "name": "publication_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "published_at": {
+ "name": "published_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_template_workspace_idx": {
+ "name": "project_template_workspace_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_template_workspace_id_workspace_id_fk": {
+ "name": "project_template_workspace_id_workspace_id_fk",
+ "tableFrom": "project_template",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_template_team": {
+ "name": "project_template_team",
+ "schema": "",
+ "columns": {
+ "template_id": {
+ "name": "template_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "project_template_team_team_idx": {
+ "name": "project_template_team_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_template_team_template_id_project_template_id_fk": {
+ "name": "project_template_team_template_id_project_template_id_fk",
+ "tableFrom": "project_template_team",
+ "tableTo": "project_template",
+ "columnsFrom": [
+ "template_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_template_team_team_id_team_id_fk": {
+ "name": "project_template_team_team_id_team_id_fk",
+ "tableFrom": "project_template_team",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_template_team_template_id_team_id_pk": {
+ "name": "project_template_team_template_id_team_id_pk",
+ "columns": [
+ "template_id",
+ "team_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_view": {
+ "name": "project_view",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "icon": {
+ "name": "icon",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "filters": {
+ "name": "filters",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "display": {
+ "name": "display",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "position": {
+ "name": "position",
+ "type": "double precision",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "share_token": {
+ "name": "share_token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "share_extended": {
+ "name": "share_extended",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "share_expires_at": {
+ "name": "share_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_private": {
+ "name": "is_private",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "owner_user_id": {
+ "name": "owner_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "project_view_project_idx": {
+ "name": "project_view_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "position",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "project_view_owner_idx": {
+ "name": "project_view_owner_idx",
+ "columns": [
+ {
+ "expression": "owner_user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_view_project_id_project_id_fk": {
+ "name": "project_view_project_id_project_id_fk",
+ "tableFrom": "project_view",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_view_owner_user_id_user_id_fk": {
+ "name": "project_view_owner_user_id_user_id_fk",
+ "tableFrom": "project_view",
+ "tableTo": "user",
+ "columnsFrom": [
+ "owner_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "project_view_share_token_unique": {
+ "name": "project_view_share_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "share_token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "project_view_private_owner_check": {
+ "name": "project_view_private_owner_check",
+ "value": "\"project_view\".\"is_private\" = (\"project_view\".\"owner_user_id\" is not null)"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.project_view_favorite": {
+ "name": "project_view_favorite",
+ "schema": "",
+ "columns": {
+ "view_id": {
+ "name": "view_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_view_favorite_view_id_project_view_id_fk": {
+ "name": "project_view_favorite_view_id_project_view_id_fk",
+ "tableFrom": "project_view_favorite",
+ "tableTo": "project_view",
+ "columnsFrom": [
+ "view_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_view_favorite_user_id_user_id_fk": {
+ "name": "project_view_favorite_user_id_user_id_fk",
+ "tableFrom": "project_view_favorite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_view_favorite_view_id_user_id_pk": {
+ "name": "project_view_favorite_view_id_user_id_pk",
+ "columns": [
+ "view_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_view_preference": {
+ "name": "project_view_preference",
+ "schema": "",
+ "columns": {
+ "view_id": {
+ "name": "view_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_hidden": {
+ "name": "is_hidden",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "project_view_preference_view_id_project_view_id_fk": {
+ "name": "project_view_preference_view_id_project_view_id_fk",
+ "tableFrom": "project_view_preference",
+ "tableTo": "project_view",
+ "columnsFrom": [
+ "view_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "project_view_preference_user_id_user_id_fk": {
+ "name": "project_view_preference_user_id_user_id_fk",
+ "tableFrom": "project_view_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "project_view_preference_view_id_user_id_pk": {
+ "name": "project_view_preference_view_id_user_id_pk",
+ "columns": [
+ "view_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.revision": {
+ "name": "revision",
+ "schema": "",
+ "columns": {
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rev": {
+ "name": "rev",
+ "type": "bigint",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ }
+ },
+ "indexes": {
+ "revision_project_idx": {
+ "name": "revision_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team": {
+ "name": "team",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "mcp_enabled": {
+ "name": "mcp_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "default_agent_ids": {
+ "name": "default_agent_ids",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "team_workspace_idx": {
+ "name": "team_workspace_idx",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_workspace_id_workspace_id_fk": {
+ "name": "team_workspace_id_workspace_id_fk",
+ "tableFrom": "team",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_slug_unique": {
+ "name": "team_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_invite": {
+ "name": "team_invite",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "team_role": {
+ "name": "team_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "project_role": {
+ "name": "project_role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "invited_by_user_id": {
+ "name": "invited_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_by_user_id": {
+ "name": "accepted_by_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "responded_at": {
+ "name": "responded_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "team_invite_team_pending_uq": {
+ "name": "team_invite_team_pending_uq",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_project_pending_uq": {
+ "name": "team_invite_project_pending_uq",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "email",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_invite\".\"status\" = 'pending' AND \"team_invite\".\"project_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_team_idx": {
+ "name": "team_invite_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_invite_project_idx": {
+ "name": "team_invite_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_invite_team_id_team_id_fk": {
+ "name": "team_invite_team_id_team_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_invite_project_id_project_id_fk": {
+ "name": "team_invite_project_id_project_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_invite_role_id_team_role_id_fk": {
+ "name": "team_invite_role_id_team_role_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "team_invite_invited_by_user_id_user_id_fk": {
+ "name": "team_invite_invited_by_user_id_user_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "invited_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "team_invite_accepted_by_user_id_user_id_fk": {
+ "name": "team_invite_accepted_by_user_id_user_id_fk",
+ "tableFrom": "team_invite",
+ "tableTo": "user",
+ "columnsFrom": [
+ "accepted_by_user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_invite_token_unique": {
+ "name": "team_invite_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "team_invite_team_role_check": {
+ "name": "team_invite_team_role_check",
+ "value": "\"team_invite\".\"team_role\" IN ('owner', 'manager', 'member')"
+ },
+ "team_invite_project_role_check": {
+ "name": "team_invite_project_role_check",
+ "value": "(\"team_invite\".\"project_id\" IS NULL AND \"team_invite\".\"project_role\" IS NULL)\n OR (\"team_invite\".\"project_id\" IS NOT NULL AND \"team_invite\".\"project_role\" IN ('owner', 'member'))"
+ },
+ "team_invite_status_check": {
+ "name": "team_invite_status_check",
+ "value": "\"team_invite\".\"status\" IN ('pending', 'accepted', 'rejected')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.team_member": {
+ "name": "team_member",
+ "schema": "",
+ "columns": {
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "source": {
+ "name": "source",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'invite'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "team_member_user_idx": {
+ "name": "team_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_member_team_id_team_id_fk": {
+ "name": "team_member_team_id_team_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "team_member_user_id_user_id_fk": {
+ "name": "team_member_user_id_user_id_fk",
+ "tableFrom": "team_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "team_member_team_id_user_id_pk": {
+ "name": "team_member_team_id_user_id_pk",
+ "columns": [
+ "team_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "team_member_role_check": {
+ "name": "team_member_role_check",
+ "value": "\"team_member\".\"role\" IN ('owner', 'manager', 'member', 'agent')"
+ },
+ "team_member_source_check": {
+ "name": "team_member_source_check",
+ "value": "\"team_member\".\"source\" IN ('invite', 'scim')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.team_notification_setting": {
+ "name": "team_notification_setting",
+ "schema": "",
+ "columns": {
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "ciphertext": {
+ "name": "ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "iv": {
+ "name": "iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "auth_tag": {
+ "name": "auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "redacted": {
+ "name": "redacted",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "team_notification_setting_team_id_team_id_fk": {
+ "name": "team_notification_setting_team_id_team_id_fk",
+ "tableFrom": "team_notification_setting",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.team_role": {
+ "name": "team_role",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "team_id": {
+ "name": "team_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "permissions": {
+ "name": "permissions",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "team_role_system_name_uq": {
+ "name": "team_role_system_name_uq",
+ "columns": [
+ {
+ "expression": "name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_role\".\"team_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_role_system_default_uq": {
+ "name": "team_role_system_default_uq",
+ "columns": [
+ {
+ "expression": "is_default",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"team_role\".\"team_id\" IS NULL AND \"team_role\".\"is_default\"",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "team_role_team_idx": {
+ "name": "team_role_team_idx",
+ "columns": [
+ {
+ "expression": "team_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "team_role_team_id_team_id_fk": {
+ "name": "team_role_team_id_team_id_fk",
+ "tableFrom": "team_role",
+ "tableTo": "team",
+ "columnsFrom": [
+ "team_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "team_role_team_id_name_unique": {
+ "name": "team_role_team_id_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "team_id",
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "team_role_default_system_check": {
+ "name": "team_role_default_system_check",
+ "value": "\"team_role\".\"team_id\" IS NULL OR NOT \"team_role\".\"is_default\""
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.template_publisher": {
+ "name": "template_publisher",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_ciphertext": {
+ "name": "key_ciphertext",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_iv": {
+ "name": "key_iv",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "key_auth_tag": {
+ "name": "key_auth_tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "author_name": {
+ "name": "author_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "author_url": {
+ "name": "author_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "template_publisher_workspace_id_workspace_id_fk": {
+ "name": "template_publisher_workspace_id_workspace_id_fk",
+ "tableFrom": "template_publisher",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_notification_preference": {
+ "name": "user_notification_preference",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_events": {
+ "name": "email_events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "telegram_events": {
+ "name": "telegram_events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'{}'::jsonb"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_notification_preference_user_id_user_id_fk": {
+ "name": "user_notification_preference_user_id_user_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_notification_preference_project_id_project_id_fk": {
+ "name": "user_notification_preference_project_id_project_id_fk",
+ "tableFrom": "user_notification_preference",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_notification_pref_user_project_unique": {
+ "name": "user_notification_pref_user_project_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "user_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_preference": {
+ "name": "user_preference",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "timezone": {
+ "name": "timezone",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'UTC'"
+ },
+ "locale": {
+ "name": "locale",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'en'"
+ },
+ "theme": {
+ "name": "theme",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'system'"
+ },
+ "issue_open_mode": {
+ "name": "issue_open_mode",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'panel'"
+ },
+ "start_page": {
+ "name": "start_page",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'work-items'"
+ },
+ "show_chat_by_default": {
+ "name": "show_chat_by_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "issue_stats_open": {
+ "name": "issue_stats_open",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "issue_stats_view": {
+ "name": "issue_stats_view",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'compact'"
+ },
+ "issue_activity_view": {
+ "name": "issue_activity_view",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'flat'"
+ },
+ "auto_watch": {
+ "name": "auto_watch",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "hotkeys": {
+ "name": "hotkeys",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_project_id": {
+ "name": "last_project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "seen_version": {
+ "name": "seen_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_preference_user_id_user_id_fk": {
+ "name": "user_preference_user_id_user_id_fk",
+ "tableFrom": "user_preference",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_preference_last_project_id_project_id_fk": {
+ "name": "user_preference_last_project_id_project_id_fk",
+ "tableFrom": "user_preference",
+ "tableTo": "project",
+ "columnsFrom": [
+ "last_project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "user_preference_theme_check": {
+ "name": "user_preference_theme_check",
+ "value": "\"user_preference\".\"theme\" IN ('light', 'dark', 'system')"
+ },
+ "user_preference_issue_open_mode_check": {
+ "name": "user_preference_issue_open_mode_check",
+ "value": "\"user_preference\".\"issue_open_mode\" IN ('panel', 'page')"
+ },
+ "user_preference_start_page_check": {
+ "name": "user_preference_start_page_check",
+ "value": "\"user_preference\".\"start_page\" IN ('inbox', 'dashboard', 'work-items', 'initiatives')"
+ },
+ "user_preference_issue_stats_view_check": {
+ "name": "user_preference_issue_stats_view_check",
+ "value": "\"user_preference\".\"issue_stats_view\" IN ('compact', 'timeline')"
+ },
+ "user_preference_issue_activity_view_check": {
+ "name": "user_preference_issue_activity_view_check",
+ "value": "\"user_preference\".\"issue_activity_view\" IN ('flat', 'grouped')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.user_telegram_account": {
+ "name": "user_telegram_account",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "username": {
+ "name": "username",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "first_name": {
+ "name": "first_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "link_code": {
+ "name": "link_code",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "link_code_expires_at": {
+ "name": "link_code_expires_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "linked_at": {
+ "name": "linked_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "user_telegram_account_chat_id_unique": {
+ "name": "user_telegram_account_chat_id_unique",
+ "columns": [
+ {
+ "expression": "chat_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_telegram_account\".\"chat_id\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "user_telegram_account_link_code_unique": {
+ "name": "user_telegram_account_link_code_unique",
+ "columns": [
+ {
+ "expression": "link_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"user_telegram_account\".\"link_code\" IS NOT NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "user_telegram_account_user_id_user_id_fk": {
+ "name": "user_telegram_account_user_id_user_id_fk",
+ "tableFrom": "user_telegram_account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook": {
+ "name": "webhook",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "events": {
+ "name": "events",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'[]'::jsonb"
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "consecutive_failures": {
+ "name": "consecutive_failures",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhook_project_idx": {
+ "name": "webhook_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_project_id_project_id_fk": {
+ "name": "webhook_project_id_project_id_fk",
+ "tableFrom": "webhook",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.webhook_delivery": {
+ "name": "webhook_delivery",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "webhook_id": {
+ "name": "webhook_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_id": {
+ "name": "event_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_type": {
+ "name": "event_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "attempts": {
+ "name": "attempts",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "next_attempt_at": {
+ "name": "next_attempt_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "last_error": {
+ "name": "last_error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "response_body": {
+ "name": "response_body",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "webhook_delivery_due_idx": {
+ "name": "webhook_delivery_due_idx",
+ "columns": [
+ {
+ "expression": "next_attempt_at",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "where": "\"webhook_delivery\".\"status\" = 'pending'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "webhook_delivery_webhook_idx": {
+ "name": "webhook_delivery_webhook_idx",
+ "columns": [
+ {
+ "expression": "webhook_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "webhook_delivery_webhook_id_webhook_id_fk": {
+ "name": "webhook_delivery_webhook_id_webhook_id_fk",
+ "tableFrom": "webhook_delivery",
+ "tableTo": "webhook",
+ "columnsFrom": [
+ "webhook_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.workspace": {
+ "name": "workspace",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "team_creation": {
+ "name": "team_creation",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'owner'"
+ },
+ "max_concurrent_runs": {
+ "name": "max_concurrent_runs",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_team_creation_check": {
+ "name": "workspace_team_creation_check",
+ "value": "\"workspace\".\"team_creation\" IN ('owner', 'managers', 'members')"
+ },
+ "workspace_max_concurrent_runs_check": {
+ "name": "workspace_max_concurrent_runs_check",
+ "value": "\"workspace\".\"max_concurrent_runs\" >= 0"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.workspace_manager": {
+ "name": "workspace_manager",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'admin'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "workspace_manager_owner_uq": {
+ "name": "workspace_manager_owner_uq",
+ "columns": [
+ {
+ "expression": "workspace_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"workspace_manager\".\"role\" = 'owner'",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "workspace_manager_user_idx": {
+ "name": "workspace_manager_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "workspace_manager_workspace_id_workspace_id_fk": {
+ "name": "workspace_manager_workspace_id_workspace_id_fk",
+ "tableFrom": "workspace_manager",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "workspace_manager_user_id_user_id_fk": {
+ "name": "workspace_manager_user_id_user_id_fk",
+ "tableFrom": "workspace_manager",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "workspace_manager_workspace_id_user_id_pk": {
+ "name": "workspace_manager_workspace_id_user_id_pk",
+ "columns": [
+ "workspace_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "workspace_manager_role_check": {
+ "name": "workspace_manager_role_check",
+ "value": "\"workspace_manager\".\"role\" IN ('owner', 'admin')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.scim_group": {
+ "name": "scim_group",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "display_name": {
+ "name": "display_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_group_instance_display_name_uq": {
+ "name": "scim_group_instance_display_name_uq",
+ "columns": [
+ {
+ "expression": "display_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"scim_group\".\"workspace_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_workspace_id_workspace_id_fk": {
+ "name": "scim_group_workspace_id_workspace_id_fk",
+ "tableFrom": "scim_group",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_group_workspace_id_display_name_unique": {
+ "name": "scim_group_workspace_id_display_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "display_name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_group_mapping": {
+ "name": "scim_group_mapping",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'member'"
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_group_mapping_project_idx": {
+ "name": "scim_group_mapping_project_idx",
+ "columns": [
+ {
+ "expression": "project_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_mapping_group_id_scim_group_id_fk": {
+ "name": "scim_group_mapping_group_id_scim_group_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "scim_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_project_id_project_id_fk": {
+ "name": "scim_group_mapping_project_id_project_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "project",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_mapping_role_id_team_role_id_fk": {
+ "name": "scim_group_mapping_role_id_team_role_id_fk",
+ "tableFrom": "scim_group_mapping",
+ "tableTo": "team_role",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_group_mapping_group_id_project_id_unique": {
+ "name": "scim_group_mapping_group_id_project_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "group_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {
+ "scim_group_mapping_role_check": {
+ "name": "scim_group_mapping_role_check",
+ "value": "\"scim_group_mapping\".\"role\" IN ('owner', 'member')"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.scim_group_member": {
+ "name": "scim_group_member",
+ "schema": "",
+ "columns": {
+ "group_id": {
+ "name": "group_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {
+ "scim_group_member_user_idx": {
+ "name": "scim_group_member_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_group_member_group_id_scim_group_id_fk": {
+ "name": "scim_group_member_group_id_scim_group_id_fk",
+ "tableFrom": "scim_group_member",
+ "tableTo": "scim_group",
+ "columnsFrom": [
+ "group_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_group_member_user_id_user_id_fk": {
+ "name": "scim_group_member_user_id_user_id_fk",
+ "tableFrom": "scim_group_member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "scim_group_member_group_id_user_id_pk": {
+ "name": "scim_group_member_group_id_user_id_pk",
+ "columns": [
+ "group_id",
+ "user_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.scim_user": {
+ "name": "scim_user",
+ "schema": "",
+ "columns": {
+ "workspace_id": {
+ "name": "workspace_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "external_id": {
+ "name": "external_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active": {
+ "name": "active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "scim_user_instance_user_uq": {
+ "name": "scim_user_instance_user_uq",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "where": "\"scim_user\".\"workspace_id\" IS NULL",
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "scim_user_user_idx": {
+ "name": "scim_user_user_idx",
+ "columns": [
+ {
+ "expression": "user_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "scim_user_workspace_id_workspace_id_fk": {
+ "name": "scim_user_workspace_id_workspace_id_fk",
+ "tableFrom": "scim_user",
+ "tableTo": "workspace",
+ "columnsFrom": [
+ "workspace_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "scim_user_user_id_user_id_fk": {
+ "name": "scim_user_user_id_user_id_fk",
+ "tableFrom": "scim_user",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "scim_user_workspace_id_user_id_unique": {
+ "name": "scim_user_workspace_id_user_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "workspace_id",
+ "user_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {},
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json
index 3589b2e3..fe4b08b1 100644
--- a/packages/db/drizzle/meta/_journal.json
+++ b/packages/db/drizzle/meta/_journal.json
@@ -1226,6 +1226,13 @@
"when": 1793804244937,
"tag": "0174_agent_schedules_permission",
"breakpoints": true
+ },
+ {
+ "idx": 175,
+ "version": "7",
+ "when": 1793861642060,
+ "tag": "0175_document_share",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/packages/db/src/schema/app.ts b/packages/db/src/schema/app.ts
index a0cefbee..81a1abb7 100644
--- a/packages/db/src/schema/app.ts
+++ b/packages/db/src/schema/app.ts
@@ -2183,6 +2183,15 @@ export const projectDocument = pgTable(
updatedByUserId: text('updated_by_user_id').references(() => user.id, {
onDelete: 'set null',
}),
+ // Unguessable token for the public read-only share link of this page. NULL
+ // means not shared; setting it enables the link, clearing it revokes access.
+ shareToken: uuid('share_token').unique(),
+ // When the share link stops working; NULL means never. See issue.shareExpiresAt.
+ shareExpiresAt: timestamp('share_expires_at', { withTimezone: true }),
+ // Whether the share link also opens the page's subpages.
+ shareIncludeChildren: boolean('share_include_children').notNull().default(false),
+ // Whether the shared pages show the title and state of the issues they name.
+ shareIncludeIssues: boolean('share_include_issues').notNull().default(false),
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true }).notNull().defaultNow(),
},
@@ -2297,8 +2306,9 @@ export const projectDocumentInitiative = pgTable(
);
// Files embedded in Docs pages. Bytes use the same S3-compatible object store as
-// issue/chat attachments; only authenticated document routes expose them, so a
-// private page's unguessable asset id never acts as a public capability URL.
+// issue/chat attachments; only authenticated document routes and the live share link
+// of a page expose them, so an unguessable asset id alone never acts as a public
+// capability URL.
export const documentAsset = pgTable(
'document_asset',
{