perf: Remove useless data on EvenTypes getByViewer endpoint (#9704)
parent
79f34a4fc7
commit
e5fb19163e
|
@ -4,7 +4,7 @@ import { orderBy } from "lodash";
|
|||
import { hasFilter } from "@calcom/features/filters/lib/hasFilter";
|
||||
import { CAL_URL } from "@calcom/lib/constants";
|
||||
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
||||
import { baseEventTypeSelect, baseUserSelect } from "@calcom/prisma";
|
||||
import { baseEventTypeSelect } from "@calcom/prisma";
|
||||
import { MembershipRole, SchedulingType } from "@calcom/prisma/enums";
|
||||
import { teamMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||
|
@ -22,6 +22,12 @@ type GetByViewerOptions = {
|
|||
input: TEventTypeInputSchema;
|
||||
};
|
||||
|
||||
const userSelect = Prisma.validator<Prisma.UserSelect>()({
|
||||
id: true,
|
||||
username: true,
|
||||
name: true,
|
||||
});
|
||||
|
||||
const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
|
||||
// Position is required by lodash to sort on it. Don't remove it, TS won't complain but it would silently break reordering
|
||||
position: true,
|
||||
|
@ -41,12 +47,12 @@ const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
|
|||
},
|
||||
metadata: true,
|
||||
users: {
|
||||
select: baseUserSelect,
|
||||
select: userSelect,
|
||||
},
|
||||
children: {
|
||||
include: {
|
||||
users: {
|
||||
select: baseUserSelect,
|
||||
select: userSelect,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -54,7 +60,7 @@ const eventTypeSelect = Prisma.validator<Prisma.EventTypeSelect>()({
|
|||
hosts: {
|
||||
select: {
|
||||
user: {
|
||||
select: baseUserSelect,
|
||||
select: userSelect,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue