Files
stats/apps/web/src/server/services/organization.service.ts
Carl-Gerhard Lindesvärd ccd1a1456f a lot
2024-02-04 13:23:21 +01:00

38 lines
652 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { db } from '../db';
export type IServiceOrganization = Awaited<
ReturnType<typeof getOrganizations>
>[number];
export function getOrganizations() {
return db.organization.findMany({
where: {
// users: {
// some: {
// id: '1',
// },
// }
},
});
}
export function getOrganizationById(id: string) {
return db.organization.findUniqueOrThrow({
where: {
id,
},
});
}
export function getOrganizationByProjectId(projectId: string) {
return db.organization.findFirst({
where: {
projects: {
some: {
id: projectId,
},
},
},
});
}