chore: Add initial webhook wiring (TRPC handlers) to the new architecture (#27170)
* --init * clean up * unnecessary comment * remove comment * fix factory resolver * Add active filter to webhook query
This commit is contained in:
1 parent
646d18e286
commit
4115eaacbd
14 files changed
+142
-77
No files matched your search
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* EventTypes Repository Interface
|
||||
*
|
||||
* Central interface for EventType repository methods.
|
||||
*/
|
||||
|
||||
export interface IEventTypesRepository {
|
||||
/**
|
||||
* @param eventTypeId - The event type to check
|
||||
* @returns Parent ID if this is a managed child event type, null otherwise
|
||||
*/
|
||||
findParentEventTypeId(eventTypeId: number): Promise<number | null>;
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { IEventTypesRepository } from "@calcom/features/eventtypes/eventtypes.repository.interface";
|
||||
import { MembershipRepository } from "@calcom/features/membership/repositories/MembershipRepository";
|
||||
import { LookupTarget, ProfileRepository } from "@calcom/features/profile/repositories/ProfileRepository";
|
||||
import type { UserWithLegacySelectedCalendars } from "@calcom/features/users/repositories/UserRepository";
|
||||
@@ -9,8 +10,7 @@ import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import { eventTypeSelect } from "@calcom/lib/server/eventTypeSelect";
|
||||
import type { PrismaClient } from "@calcom/prisma";
|
||||
import { availabilityUserSelect, userSelect as userSelectWithSelectedCalendars } from "@calcom/prisma";
|
||||
import type { EventType as PrismaEventType } from "@calcom/prisma/client";
|
||||
import type { Prisma } from "@calcom/prisma/client";
|
||||
import type { Prisma, EventType as PrismaEventType } from "@calcom/prisma/client";
|
||||
import { MembershipRole } from "@calcom/prisma/enums";
|
||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||
import { EventTypeMetaDataSchema, rrSegmentQueryValueSchema } from "@calcom/prisma/zod-utils";
|
||||
@@ -78,9 +78,25 @@ function usersWithSelectedCalendars<
|
||||
return users.map((user) => withSelectedCalendars(user));
|
||||
}
|
||||
|
||||
export class EventTypeRepository {
|
||||
export class EventTypeRepository implements IEventTypesRepository {
|
||||
constructor(private prismaClient: PrismaClient) {}
|
||||
|
||||
async findParentEventTypeId(eventTypeId: number): Promise<number | null> {
|
||||
const managedChildEventType = await this.prismaClient.eventType.findFirst({
|
||||
where: {
|
||||
id: eventTypeId,
|
||||
parentId: {
|
||||
not: null,
|
||||
},
|
||||
},
|
||||
select: {
|
||||
parentId: true,
|
||||
},
|
||||
});
|
||||
|
||||
return managedChildEventType?.parentId ?? null;
|
||||
}
|
||||
|
||||
private generateCreateEventTypeData = (eventTypeCreateData: IEventType) => {
|
||||
const {
|
||||
userId,
|
||||
|
||||
Reference in new issue
Block a user