chore: Cleanup full raw avatar responses from tRPC endpoints (#8901)
* [CAL-1383] Cleanup full raw avatar responses from tRPC endpoints * Cleanup additional handlers where base64 images were sent through the response * Add 'image' correctly to the profiles array --------- Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com> Co-authored-by: alannnc <alannnc@gmail.com> Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Alex van Andel <me@alexvanandel.com>gh-readonly-queue/main/pr-8955-7c46d1b34847501759158be6ad8da80c441eeb34
parent
a6330c0fc8
commit
7c46d1b348
|
@ -172,13 +172,16 @@ export const getByViewerHandler = async ({ ctx }: GetByViewerOptions) => {
|
|||
const mergedEventTypes = Object.values(eventTypesHashMap)
|
||||
.map((eventType) => eventType)
|
||||
.filter((evType) => evType.schedulingType !== SchedulingType.MANAGED);
|
||||
|
||||
const image = user?.username ? `${CAL_URL}/${user.username}/avatar.png` : undefined;
|
||||
|
||||
eventTypeGroups.push({
|
||||
teamId: null,
|
||||
membershipRole: null,
|
||||
profile: {
|
||||
slug: user.username,
|
||||
name: user.name,
|
||||
image: user.avatar || undefined,
|
||||
image,
|
||||
},
|
||||
eventTypes: orderBy(mergedEventTypes, ["position", "id"], ["desc", "asc"]),
|
||||
metadata: {
|
||||
|
@ -214,10 +217,11 @@ export const getByViewerHandler = async ({ ctx }: GetByViewerOptions) => {
|
|||
eventTypeGroups: eventTypeGroups.filter((groupBy) => !!groupBy.eventTypes?.length),
|
||||
// so we can show a dropdown when the user has teams
|
||||
profiles: eventTypeGroups.map((group) => ({
|
||||
teamId: group.teamId,
|
||||
membershipRole: group.membershipRole,
|
||||
...group.profile,
|
||||
...group.metadata,
|
||||
teamId: group.teamId,
|
||||
membershipRole: group.membershipRole,
|
||||
image: `${CAL_URL}/${group.profile.slug}/avatar.png`,
|
||||
})),
|
||||
};
|
||||
};
|
||||
|
|
|
@ -77,12 +77,13 @@ export const getByViewerHandler = async ({ ctx }: GetByViewerOptions) => {
|
|||
const userWebhooks = user.webhooks;
|
||||
let webhookGroups: WebhookGroup[] = [];
|
||||
|
||||
const image = user?.username ? `${CAL_URL}/${user.username}/avatar.png` : undefined;
|
||||
webhookGroups.push({
|
||||
teamId: null,
|
||||
profile: {
|
||||
slug: user.username,
|
||||
name: user.name,
|
||||
image: user.avatar || undefined,
|
||||
image,
|
||||
},
|
||||
webhooks: userWebhooks,
|
||||
metadata: {
|
||||
|
|
|
@ -80,12 +80,13 @@ export const getByViewerHandler = async ({ ctx }: GetByViewerOptions) => {
|
|||
|
||||
let workflowGroups: WorkflowGroup[] = [];
|
||||
|
||||
const image = user?.username ? `${CAL_URL}/${user.username}/avatar.png` : undefined;
|
||||
workflowGroups.push({
|
||||
teamId: null,
|
||||
profile: {
|
||||
slug: user.username,
|
||||
name: user.name,
|
||||
image: user.avatar || undefined,
|
||||
image,
|
||||
},
|
||||
workflows: userWorkflows,
|
||||
metadata: {
|
||||
|
|
Loading…
Reference in New Issue