fix: invalid folder queries (#1898)

Currently the majority of folder mutations only work if the user is the
owner of the folder.
This commit is contained in:
David Nguyen
2025-07-16 14:37:55 +10:00
committed by GitHub
parent e5aaa17545
commit 32a5d33a16
20 changed files with 139 additions and 146 deletions

View File

@ -16,6 +16,7 @@ import { prefixedId } from '../../universal/id';
import { getFileServerSide } from '../../universal/upload/get-file.server';
import { putPdfFileServerSide } from '../../universal/upload/put-file.server';
import { determineDocumentVisibility } from '../../utils/document-visibility';
import { buildTeamWhereQuery } from '../../utils/teams';
import { getTeamById } from '../team/get-team';
import { getTeamSettings } from '../team/get-team-settings';
import { triggerWebhook } from '../webhooks/trigger/trigger-webhook';
@ -58,8 +59,10 @@ export const createDocument = async ({
const folder = await prisma.folder.findFirst({
where: {
id: folderId,
userId,
teamId,
team: buildTeamWhereQuery({
teamId,
userId,
}),
},
select: {
visibility: true,