first commit
This commit is contained in:
19
calcom/packages/lib/server/getUsersCredentials.ts
Normal file
19
calcom/packages/lib/server/getUsersCredentials.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { prisma } from "@calcom/prisma";
|
||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
|
||||
|
||||
type SessionUser = NonNullable<TrpcSessionUser>;
|
||||
type User = { id: SessionUser["id"] };
|
||||
|
||||
export async function getUsersCredentials(user: User) {
|
||||
const credentials = await prisma.credential.findMany({
|
||||
where: {
|
||||
userId: user.id,
|
||||
},
|
||||
select: credentialForCalendarServiceSelect,
|
||||
orderBy: {
|
||||
id: "asc",
|
||||
},
|
||||
});
|
||||
return credentials;
|
||||
}
|
||||
Reference in New Issue
Block a user