@@ -52,6 +52,7 @@ import { getDefaultEvent, getGroupName, getUsernameList } from "@calcom/lib/defa
52
52
import { getErrorFromUnknown } from "@calcom/lib/errors" ;
53
53
import getIP from "@calcom/lib/getIP" ;
54
54
import getPaymentAppData from "@calcom/lib/getPaymentAppData" ;
55
+ import { getTeamIdFromEventType } from "@calcom/lib/getTeamIdFromEventType" ;
55
56
import { HttpError } from "@calcom/lib/http-error" ;
56
57
import isOutOfBounds , { BookingDateInPastError } from "@calcom/lib/isOutOfBounds" ;
57
58
import logger from "@calcom/lib/logger" ;
@@ -651,26 +652,6 @@ function getCustomInputsResponses(
651
652
return customInputsResponses ;
652
653
}
653
654
654
- async function getTeamId ( { eventType } : { eventType : Awaited < ReturnType < typeof getEventTypesFromDB > > } ) {
655
- if ( eventType ?. team ?. id ) {
656
- return eventType . team . id ;
657
- }
658
-
659
- // If it's a managed event we need to find the teamId for it from the parent
660
- if ( eventType . parentId ) {
661
- const managedEvent = await prisma . eventType . findFirst ( {
662
- where : {
663
- id : eventType . parentId ,
664
- } ,
665
- select : {
666
- teamId : true ,
667
- } ,
668
- } ) ;
669
-
670
- return managedEvent ?. teamId ;
671
- }
672
- }
673
-
674
655
async function handler (
675
656
req : NextApiRequest & { userId ?: number | undefined } ,
676
657
{
@@ -1151,7 +1132,7 @@ async function handler(
1151
1132
length : eventType . length ,
1152
1133
} ;
1153
1134
1154
- const teamId = await getTeamId ( { eventType } ) ;
1135
+ const teamId = await getTeamIdFromEventType ( { eventType } ) ;
1155
1136
1156
1137
const subscriberOptions : GetSubscriberOptions = {
1157
1138
userId : organizerUser . id ,
0 commit comments