onboarding completed
This commit is contained in:
committed by
Carl-Gerhard Lindesvärd
parent
97627583ec
commit
7d22d2ddad
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user