* 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>
32 lines
690 B
TypeScript
32 lines
690 B
TypeScript
import type { Prisma } from "@prisma/client";
|
|
|
|
import prisma from "@calcom/prisma";
|
|
|
|
export class PrismaAttributeOptionRepository {
|
|
static async findMany({ orgId }: { orgId: number }) {
|
|
return prisma.attributeOption.findMany({
|
|
where: {
|
|
attribute: {
|
|
teamId: orgId,
|
|
},
|
|
},
|
|
select: {
|
|
id: true,
|
|
value: true,
|
|
slug: true,
|
|
attributeId: true,
|
|
},
|
|
});
|
|
}
|
|
|
|
static async createMany({ createManyInput }: { createManyInput: Prisma.AttributeOptionCreateManyInput[] }) {
|
|
const { count } = await prisma.attributeOption.createMany({
|
|
data: createManyInput,
|
|
});
|
|
|
|
return {
|
|
count,
|
|
};
|
|
}
|
|
}
|