add fk(orgId) for all create

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-06-16 22:21:13 +02:00
parent 1fc64ef1f9
commit 4f9c624d08
8 changed files with 12 additions and 3 deletions

View File

@@ -32,7 +32,7 @@ async function getProjectId(
const project = await db.project.findUnique({
where: {
organizationSlug: request.client?.organizationSlug,
organizationId: request.client?.organizationSlug,
id: projectId,
},
});

View File

@@ -50,6 +50,7 @@ export async function POST(request: Request) {
.filter((a) => typeof a === 'string')
.map((projectId) => ({
organizationSlug: membership.organizationId,
organizationId: membership.organizationId,
projectId: projectId,
userId: user.id,
level: AccessLevel.read,
@@ -67,6 +68,7 @@ export async function POST(request: Request) {
.filter((a): a is string => typeof a === 'string')
.map((projectId) => ({
organizationSlug: payload.data.organization.slug,
organizationId: payload.data.organization.slug,
projectId: projectId,
userId: payload.data.public_user_data.user_id,
level: AccessLevel.read,