Files
calendar/packages/lib/server/repository/credential.ts
T
Hariom BalharaandGitHub e362c37ff3 fix: Location Change to Organizer Default Conferencing App (#16379)
* Fix

* Dont include test files

* Fix location change

* Self review fixes

* Add unit test

* Add more test

* Add a bookingScenario as well
2024-09-11 21:31:53 +09:00

28 lines
816 B
TypeScript

import type { Prisma } from "@prisma/client";
import { prisma } from "@calcom/prisma";
import { safeCredentialSelect } from "@calcom/prisma/selects/credential";
export class CredentialRepository {
static async create(data: Prisma.CredentialCreateInput) {
return await prisma.credential.create({ data });
}
/**
* Doesn't retrieve key field as that has credentials
*/
static async findFirstByIdWithUser({ id }: { id: number }) {
return await prisma.credential.findFirst({ where: { id }, select: safeCredentialSelect });
}
/**
* Includes 'key' field which is sensitive data.
*/
static async findFirstByIdWithKeyAndUser({ id }: { id: number }) {
return await prisma.credential.findFirst({
where: { id },
select: { ...safeCredentialSelect, key: true },
});
}
}