* feat: Base implementation of v2 of avatars * Make avatarUrl and logoUrl entirely optional * Made necessary backwards compat changes * fix: type errors * Fix: OG image * fix types * Consistency with other behaviour, ux tweak --------- Co-authored-by: Peer Richelsen <peeroke@gmail.com>
23 lines
430 B
TypeScript
23 lines
430 B
TypeScript
import prisma from "@calcom/prisma";
|
|
import type { TrpcSessionUser } from "@calcom/trpc/server/trpc";
|
|
|
|
type AvatarOptions = {
|
|
ctx: {
|
|
user: NonNullable<TrpcSessionUser>;
|
|
};
|
|
};
|
|
|
|
export const avatarHandler = async ({ ctx }: AvatarOptions) => {
|
|
const data = await prisma.user.findUnique({
|
|
where: {
|
|
id: ctx.user.id,
|
|
},
|
|
select: {
|
|
avatar: true,
|
|
},
|
|
});
|
|
return {
|
|
avatar: data?.avatar,
|
|
};
|
|
};
|