update next, try fix next nav issue, minor improvements

# Conflicts:
#	apps/dashboard/src/middleware.ts
#	packages/db/src/services/organization.service.ts
#	pnpm-lock.yaml
This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-16 22:19:18 +02:00
committed by Carl-Gerhard Lindesvärd
parent 04375807d0
commit 4b50fed1dc
12 changed files with 104 additions and 307 deletions

View File

@@ -4,6 +4,7 @@ import type {
OrganizationInvitation,
OrganizationMembership,
} from '@clerk/nextjs/dist/types/server';
import { sort, sortBy } from 'ramda';
import type { ProjectAccess } from '../prisma-client';
import { db } from '../prisma-client';
@@ -18,6 +19,7 @@ export function transformOrganization(org: Organization) {
id: org.id,
name: org.name,
slug: org.slug!,
createdAt: org.createdAt,
};
}
@@ -27,7 +29,10 @@ export async function getCurrentOrganizations() {
const organizations = await clerkClient.users.getOrganizationMembershipList({
userId: session.userId,
});
return organizations.map((item) => transformOrganization(item.organization));
return sort(
(a, b) => a.createdAt - b.createdAt,
organizations.map((item) => transformOrganization(item.organization))
);
}
export function getOrganizationBySlug(slug: string) {

View File

@@ -65,5 +65,8 @@ export async function getCurrentProjects(organizationSlug: string) {
include: {
access: true,
},
orderBy: {
eventsCount: 'desc',
},
});
}