* refactor: rename repository files to include Repository suffix - Rename attribute.ts -> attributeRepository.ts - Rename attributeOption.ts -> attributeOptionRepository.ts - Rename attributeToUser.ts -> attributeToUserRepository.ts - Update all import statements throughout codebase Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * refactor: rename repository files and classes with Prisma prefix - Rename attribute.ts -> PrismaAttributeRepository.ts - Rename attributeOption.ts -> PrismaAttributeOptionRepository.ts - Rename attributeToUser.ts -> PrismaAttributeToUserRepository.ts - Update class names to PrismaAttributeRepository, PrismaAttributeOptionRepository, PrismaAttributeToUserRepository - Update all import statements and references throughout codebase Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * fix: update missed AttributeRepository import to PrismaAttributeRepository in teams members page Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
22 lines
788 B
TypeScript
22 lines
788 B
TypeScript
import { PrismaAttributeToUserRepository } from "../../../server/repository/PrismaAttributeToUserRepository";
|
|
|
|
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 assignments = await PrismaAttributeToUserRepository.findManyIncludeAttribute({ memberId });
|
|
return assignments.map((assignment) => ({
|
|
...assignment,
|
|
attributeOption: {
|
|
...assignment.attributeOption,
|
|
label: assignment.attributeOption.value,
|
|
},
|
|
}));
|
|
};
|