update Clerk V5

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-24 18:26:53 +02:00
parent 288fd6f6d0
commit e2d56fb34f
15 changed files with 360 additions and 330 deletions

View File

@@ -1,10 +1,10 @@
import { auth, clerkClient } from '@clerk/nextjs';
import type {
Organization,
OrganizationInvitation,
OrganizationMembership,
} from '@clerk/nextjs/dist/types/server';
import { sort, sortBy } from 'ramda';
import { auth, clerkClient } from '@clerk/nextjs/server';
import { sort } from 'ramda';
import type { ProjectAccess } from '../prisma-client';
import { db } from '../prisma-client';
@@ -31,7 +31,7 @@ export async function getCurrentOrganizations() {
});
return sort(
(a, b) => a.createdAt - b.createdAt,
organizations.map((item) => transformOrganization(item.organization))
organizations.data.map((item) => transformOrganization(item.organization))
);
}
@@ -74,7 +74,7 @@ export async function getInvites(organizationSlug: string) {
.getOrganizationInvitationList({
organizationId: org.id,
})
.then((invites) => invites.map(transformInvite));
.then((invites) => invites.data.map(transformInvite));
}
export function transformMember(
@@ -112,7 +112,7 @@ export async function getMembers(organizationSlug: string) {
}),
]);
return members
return members.data
.map((member) => {
const projectAccess = access.filter(
(item) => item.userId === member.publicUserData?.userId

View File

@@ -1,4 +1,4 @@
import { auth } from '@clerk/nextjs';
import { auth } from '@clerk/nextjs/server';
import type { Prisma, Project } from '../prisma-client';
import { db } from '../prisma-client';

View File

@@ -1,5 +1,5 @@
import { auth, clerkClient } from '@clerk/nextjs';
import type { User } from '@clerk/nextjs/dist/types/server';
import { auth, clerkClient } from '@clerk/nextjs/server';
import { db } from '../prisma-client';