feat: add organisations (#1820)

This commit is contained in:
David Nguyen
2025-06-10 11:49:52 +10:00
committed by GitHub
parent 0b37f19641
commit e6dc237ad2
631 changed files with 37616 additions and 25695 deletions

View File

@ -1,4 +1,5 @@
import { NEXT_PUBLIC_WEBAPP_URL } from '@documenso/lib/constants/app';
import { buildTeamWhereQuery } from '@documenso/lib/utils/teams';
import { prisma } from '@documenso/prisma';
import { procedure } from '../trpc';
@ -26,26 +27,12 @@ export const getDocumentInternalUrlForQRCodeRoute = procedure
},
{
id: documentId,
team: {
members: {
some: {
userId: ctx.user.id,
},
},
},
team: buildTeamWhereQuery({ teamId: undefined, userId: ctx.user.id }),
},
],
},
include: {
team: {
where: {
members: {
some: {
userId: ctx.user.id,
},
},
},
},
team: true,
},
});
@ -53,9 +40,5 @@ export const getDocumentInternalUrlForQRCodeRoute = procedure
return null;
}
if (document.team) {
return `${NEXT_PUBLIC_WEBAPP_URL()}/t/${document.team.url}/documents/${document.id}`;
}
return `${NEXT_PUBLIC_WEBAPP_URL()}/documents/${document.id}`;
return `${NEXT_PUBLIC_WEBAPP_URL()}/t/${document.team.url}/documents/${document.id}`;
});