* chore: Remove all avatar/logo references * Updated user profile to only use avatarUrl * fix: minor style issue * chore: Remove redundant includeTeamLogo * fix: Use right avatar default in event type list * fix: placeholder avatar team profile, target * chore: Add logoUrl/avatarUrl to JWT * fix: Bunch of org avatar issues, fix members list * Fix logoUrl on org pages * More type fixes * Hopefully final type fixes * Another round of type fixes * fix: UserForm ts * fix: Handle as return types, not input types * fix: Remove profile and add avatarUrl * fix: notFound as const * fix: Seeder avatarUrl params * revert: Migration changes for easier recovery * fix: Add explicit type to builder as avatar is now set * Add logoUrl to unpublished entity * Avatar test out of scope here * fix: Use the new avatarUrl after save * chore: Removed getOrgAvatarUrl/getTeamAvatarUrl * fix: Update sidebar image immediately after change * Unable to safe unnamed user, so default * fix: Unpublished page, add organization test * Add more tests
57 lines
1.2 KiB
TypeScript
57 lines
1.2 KiB
TypeScript
import { z } from "zod";
|
|
|
|
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
|
import prisma from "@calcom/prisma";
|
|
|
|
import { TRPCError } from "@trpc/server";
|
|
|
|
import type { TrpcSessionUser } from "../../../trpc";
|
|
|
|
export const ZGetOtherTeamInputSchema = z.object({
|
|
teamId: z.number(),
|
|
});
|
|
|
|
export type TGetOtherTeamInputSchema = z.infer<typeof ZGetOtherTeamInputSchema>;
|
|
|
|
type GetOptions = {
|
|
ctx: {
|
|
user: NonNullable<TrpcSessionUser>;
|
|
};
|
|
input: TGetOtherTeamInputSchema;
|
|
};
|
|
|
|
export const getOtherTeamHandler = async ({ input }: GetOptions) => {
|
|
// No need to validate if user is admin of org as we already do that on authedOrgAdminProcedure
|
|
const team = await prisma.team.findFirst({
|
|
where: {
|
|
id: input.teamId,
|
|
},
|
|
select: {
|
|
id: true,
|
|
name: true,
|
|
slug: true,
|
|
logoUrl: true,
|
|
bio: true,
|
|
metadata: true,
|
|
isPrivate: true,
|
|
parent: {
|
|
select: {
|
|
id: true,
|
|
slug: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
if (!team) {
|
|
throw new TRPCError({ code: "NOT_FOUND", message: "Team not found." });
|
|
}
|
|
|
|
return {
|
|
...team,
|
|
safeBio: markdownToSafeHTML(team.bio),
|
|
};
|
|
};
|
|
|
|
export default getOtherTeamHandler;
|