diff --git a/apps/api/src/app/workflows-v2/shared/schemas/push-control.schema.ts b/apps/api/src/app/workflows-v2/shared/schemas/push-control.schema.ts new file mode 100644 index 00000000000..7622bb3e428 --- /dev/null +++ b/apps/api/src/app/workflows-v2/shared/schemas/push-control.schema.ts @@ -0,0 +1,31 @@ +import { z } from 'zod'; +import { zodToJsonSchema } from 'zod-to-json-schema'; + +import { JSONSchemaDto, UiComponentEnum, UiSchema, UiSchemaGroupEnum } from '@novu/shared'; + +export const PushStepControlZodSchema = z + .object({ + subject: z.string(), + body: z.string(), + }) + .strict(); + +export type PushStepControlType = z.infer; + +export const pushStepControlSchema = zodToJsonSchema(PushStepControlZodSchema) as JSONSchemaDto; +export const pushStepUiSchema: UiSchema = { + group: UiSchemaGroupEnum.PUSH, + properties: { + subject: { + component: UiComponentEnum.PUSH_SUBJECT, + }, + body: { + component: UiComponentEnum.PUSH_BODY, + }, + }, +}; + +export const pushStepControl = { + uiSchema: pushStepUiSchema, + schema: pushStepControlSchema, +}; diff --git a/apps/api/src/app/workflows-v2/shared/step-type-to-control.mapper.ts b/apps/api/src/app/workflows-v2/shared/step-type-to-control.mapper.ts index 0b2abd32b4c..27f1edb7be7 100644 --- a/apps/api/src/app/workflows-v2/shared/step-type-to-control.mapper.ts +++ b/apps/api/src/app/workflows-v2/shared/step-type-to-control.mapper.ts @@ -4,6 +4,7 @@ import { emailStepControlSchema, emailStepUiSchema, inAppControlSchema, inAppUiS import { DelayTimeControlSchema, delayUiSchema } from './schemas/delay-control.schema'; import { DigestOutputJsonSchema, digestUiSchema } from './schemas/digest-control.schema'; import { smsStepControl } from './schemas/sms-control.schema'; +import { pushStepControl } from './schemas/push-control.schema'; export const PERMISSIVE_EMPTY_SCHEMA = { type: 'object', @@ -29,7 +30,8 @@ export const stepTypeToControlSchema: Record