fix adding managed event type to workflow (#12111)

Co-authored-by: CarinaWolli <wollencarina@gmail.com>
This commit is contained in:
Carina Wollendorfer 2023-10-27 08:00:34 -04:00 committed by GitHub
parent 08d65c85de
commit 09ecd445bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,13 +86,16 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
const hasOrgsPlan = IS_SELF_HOSTED || ctx.user.organizationId;
const where: Prisma.EventTypeWhereInput = {};
where.id = {
in: activeOn,
};
if (userWorkflow.teamId) {
//all children managed event types are added after
where.parentId = null;
}
const activeOnEventTypes = await ctx.prisma.eventType.findMany({
where: {
id: {
in: activeOn,
},
parentId: null,
},
where,
select: {
id: true,
children: {