Files
calendar/packages/features/attributes/lib/utils.ts
T
Joe Au-YeungGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
8b5d9202db refactor: convert PrismaAttributeToUserRepository to accept Prisma as dependency (#26515)
* refactor: convert PrismaAttributeToUserRepository to accept Prisma as dependency

Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>

* fix: use Prisma types from generated client instead of custom types

Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-01-06 18:09:07 +00:00

24 lines
902 B
TypeScript

import { PrismaAttributeToUserRepository } from "@calcom/features/attributes/repositories/PrismaAttributeToUserRepository";
import prisma from "@calcom/prisma";
export const getWhereClauseForAttributeOptionsManagedByCalcom = () => {
// Neither created nor updated by DSync
return {
createdByDSyncId: null,
// An option created by Cal.com can be updated by DSync, in that case the ownership is transferred to DSync
updatedByDSyncId: null,
};
};
export const findAssignmentsForMember = async ({ memberId }: { memberId: number }) => {
const attributeToUserRepo = new PrismaAttributeToUserRepository(prisma);
const assignments = await attributeToUserRepo.findManyIncludeAttribute({ memberId });
return assignments.map((assignment) => ({
...assignment,
attributeOption: {
...assignment.attributeOption,
label: assignment.attributeOption.value,
},
}));
};