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,35 @@
import { db } from '../prisma-client';
export type IServiceProfile = Awaited<ReturnType<typeof getProfileById>>;
export function getProfileById(id: string) {
return db.profile.findUniqueOrThrow({
where: {
id,
},
});
}
export function getProfilesByExternalId(
externalId: string | null,
projectId: string
) {
if (externalId === null) {
return [];
}
return db.profile.findMany({
where: {
external_id: externalId,
project_id: projectId,
},
});
}
export function getProfile(id: string) {
return db.profile.findUniqueOrThrow({
where: {
id,
},
});
}