Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Trigger Identifier to the Subscriber Preferences response #4559

Conversation

djabarovgeorge
Copy link
Contributor

@djabarovgeorge djabarovgeorge commented Oct 17, 2023

What change does this PR introduce?

Add the triggers field to be part of the response to the query. The mapping functionality is required.

Why was this change needed?

Some users would love to filter the preferences based on the identifier of the trigger.

Other information (Screenshots)

Created this initial solution and still have a couple of questions left hanging, will change this PR to ready from draft state after i figure it out.

closes #4417

@linear
Copy link

linear bot commented Oct 17, 2023

NV-2842 Add Trigger Identifier to the Subscriber Preferences response

What?

Add the triggers field to be part of the response to the query. The mapping functionality is included in this file:

Why?

Some users would love to filter the preferences based on the identifier of the trigger.

Definition of Done

  • GET /:subscriberId/preferences/:templateId response contains the triggers array in the template field.
  • A new E2E test at apps/api/src/app/subscribers/e2e/get-preferences.e2e.ts to cover the functionality

@djabarovgeorge djabarovgeorge marked this pull request as ready for review October 22, 2023 07:46
Comment on lines -124 to -133

export interface ITriggerVariable {
name: string;
type: TemplateVariableTypeEnum;
}

export interface ITriggerReservedVariable {
type: TriggerContextTypeEnum;
variables: ITriggerVariable[];
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a reason for having those in the DAL?
i noticed that they are duplicated and not aligned with the interface in the Shared lib.

@@ -253,6 +254,7 @@ function mapTemplateConfiguration(
name: template.name,
tags: template?.tags || [],
critical: template.critical != null ? template.critical : true,
triggers: template.triggers,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please update the Swagger API response in the subscriber's controller?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely! i knew I forgot something here 🤦‍♂️

@djabarovgeorge djabarovgeorge merged commit 6a71097 into next Oct 25, 2023
25 of 27 checks passed
@djabarovgeorge djabarovgeorge deleted the nv-2842-add-trigger-identifier-to-the-subscriber-preferences-response branch October 25, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NV-2971] [NV-2842] Add Trigger Identifier to the Subscriber Preferences response
3 participants