onboarding completed

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-04-16 11:41:15 +02:00
committed by Carl-Gerhard Lindesvärd
parent 97627583ec
commit 7d22d2ddad
79 changed files with 2542 additions and 805 deletions

View File

@@ -1,9 +1,14 @@
import { auth } from '@clerk/nextjs';
import type { Project } from '../prisma-client';
import type { Prisma, Project } from '../prisma-client';
import { db } from '../prisma-client';
export type IServiceProject = Project;
export type IServiceProjectWithClients = Prisma.ProjectGetPayload<{
include: {
clients: true;
};
}>;
export async function getProjectById(id: string) {
const res = await db.project.findUnique({
@@ -19,6 +24,23 @@ export async function getProjectById(id: string) {
return res;
}
export async function getProjectWithClients(id: string) {
const res = await db.project.findUnique({
where: {
id,
},
include: {
clients: true,
},
});
if (!res) {
return null;
}
return res;
}
export async function getProjectsByOrganizationSlug(organizationSlug: string) {
return db.project.findMany({
where: {