refactor packages

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-19 10:55:15 +01:00
parent ae8482c1e3
commit 2f3c5ddf76
142 changed files with 2234 additions and 5507 deletions

View File

@@ -0,0 +1,30 @@
import { db } from '../prisma-client';
export type IServiceProject = Awaited<ReturnType<typeof getProjectById>>;
export function getProjectById(id: string) {
return db.project.findUnique({
where: {
id,
},
});
}
export function getProjectsByOrganizationSlug(slug: string) {
return db.project.findMany({
where: {
organization_slug: slug,
},
});
}
export async function getProjectWithMostEvents(slug: string) {
return db.project.findFirst({
where: {
organization_slug: slug,
},
orderBy: {
eventsCount: 'desc',
},
});
}