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

NV-2332 - Template Store - Add blueprint module #3432

Merged
merged 5 commits into from
May 21, 2023

Conversation

djabarovgeorge
Copy link
Contributor

What change does this PR introduce?

Add a dedicated blueprint module to fetch blueprints.

Why was this change needed?

Separate the blueprint logic from the notification-templates.

Other information (Screenshots)

@linear
Copy link

linear bot commented May 16, 2023

@djabarovgeorge djabarovgeorge marked this pull request as ready for review May 17, 2023 10:39
@djabarovgeorge djabarovgeorge changed the title Add blueprint module NV-2332 - Template Store - Add blueprint module May 17, 2023
Comment on lines -152 to -166
@Get('/:templateId/blueprint')
getNotificationTemplateBlueprintById(
@UserSession() user: IJwtPayload,
@Param('templateId') templateId: string
): Promise<NotificationTemplateResponse> {
return this.getBlueprintNotificationTemplate.execute(
GetBlueprintNotificationTemplateCommand.create({
environmentId: user.environmentId,
organizationId: user.organizationId,
userId: user._id,
templateId,
})
);
}

Copy link
Contributor

Choose a reason for hiding this comment

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

What we are trying to achieve moving them to an own module? As far as I remember when @davidsoderberg implemented this, blueprints will be base notification templates, so it felt right to live in the notifications template module and its API.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tend to agree, the blueprints are just the copy of the original notification template from another org. So I feel like there is no sense to move it to a separate module and make the breaking changes in the public API (not sure if anyone is using it).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the change was made for several reasons, you guys are right to say that the blueprint is in a sense are notification- template, but logically they are not. I was not sure what to name this new module as well
I wanted to separate those two because maybe tomorrow we will get this data from separate CMS and then it won't make sense to keep it in the notification-template namespace.
The most crucial part of why I created a separate module was the blueprint storage
but in the end, it was not relevant but I still decided to keep it separate.

Let me know what you think at the current state I am not tied in this decision and I can revert it if you think it is less intuitive.
@p-fernandez @LetItRock

Copy link
Contributor

Choose a reason for hiding this comment

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

@djabarovgeorge
I'm ok with leaving it, but all the reasons are not valid anymore as you said.
So my approach is to not overengineer if not needed and if you are not sure because the future changes might never happen. But anyway, this is just my personal opinion, and I feel it's ok to leave it if you already did a big chunk of work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The revert should not be too much work, I will merge for now and revisit this decision in middle of this week

@LetItRock LetItRock self-requested a review May 18, 2023 20:33
@djabarovgeorge djabarovgeorge added this pull request to the merge queue May 21, 2023
Merged via the queue into next with commit 5b3d6da May 21, 2023
34 checks passed
@djabarovgeorge djabarovgeorge deleted the NV-2332/template-store-create-blueprint-module branch May 21, 2023 08:22
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.

None yet

3 participants