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

refactor(api-service): issues management #7344

Merged
merged 40 commits into from
Dec 23, 2024
Merged

refactor(api-service): issues management #7344

merged 40 commits into from
Dec 23, 2024

Conversation

djabarovgeorge
Copy link
Contributor

@djabarovgeorge djabarovgeorge commented Dec 21, 2024

What changed? Why was the change needed?

Issue Management:

  • Responsibility for issues has been shifted to schemas and LiquidJS instead of custom code , that make us aligned with the preview flow.

https://www.loom.com/share/710a5a211e4a4cbaa236fbbcf882008a?provider=slack-openid-connect

Screenshots

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

# Conflicts:
#	apps/api/package.json
#	apps/api/src/app/environments-v1/usecases/output-renderers/render-email-output.usecase.ts
#	apps/api/src/app/workflows-v2/shared/schemas/email-control.schema.ts
# Conflicts:
#	apps/api/src/app/workflows-v2/shared/schemas/email-control.schema.ts
# Conflicts:
#	apps/api/src/app/workflows-v2/usecases/generate-preview/generate-preview.usecase.ts
Copy link

netlify bot commented Dec 21, 2024

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit e78a239
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/67692454eb8a91000892875f
😎 Deploy Preview https://deploy-preview-7344.dashboard.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Dec 21, 2024

Deploy Preview for dashboard-v2-novu-staging ready!

Name Link
🔨 Latest commit e78a239
🔍 Latest deploy log https://app.netlify.com/sites/dashboard-v2-novu-staging/deploys/676924547516e400088edc43
😎 Deploy Preview https://deploy-preview-7344.dashboard-v2.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

const valueEscapedNewLines = valueSingleQuotes.replace(/\n/g, '\\n');

return valueEscapedNewLines;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

else is not required.

Suggested change
} else {
}

return this.expandEmailEditorSchemaUseCase.execute({ emailEditorJson: body, fullPayloadForRender });
}
}

export const stringifyDataStructureWithSingleQuotes = (value: unknown, spaces: number = 0): string => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@djabarovgeorge can you please elaborate with an example? Why do we need this extra handling on single quotes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A few reasons:

  1. Alignment with the Liquid.js client used in the framework.
  2. I noticed that when a variable is missing, the framework currently parses it as unknown (we have it today in the framework). This option causes this behavior. I believe it's an issue, but I couldn't fix it quickly, so I suggest we address it separately.
    For now, we've ensured consistent behavior across channel steps.

@@ -1,11 +1,12 @@
import { ActionStepEnum, ChannelStepEnum } from '@novu/framework/internal';
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit-picky: This file could be replaced by a mapper returned from the ./schemas/index.ts to avoid introducing a new filename, mapper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the idea and have used this pattern myself, but I noticed that not everyone on the team is aligned with it. I suggest introducing it to the team first.

);

return {
result: {
preview: executeOutput.outputs as any,
type: stepData.type as unknown as ChannelTypeEnum,
},
previewPayloadExample: finalVariablesExample,
previewPayloadExample: mergedVariablesExample,
Copy link
Contributor

Choose a reason for hiding this comment

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

As per lexicon, these are the preview control data. Let's add a TODO for the renaming in a follow up PR.

I also have a task in my list, to remove the nesting added by the result attribute from this endpoint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree :)

@djabarovgeorge djabarovgeorge changed the title refactor(api): preview usecase refactor(api-service): preview usecase Dec 23, 2024
@djabarovgeorge djabarovgeorge merged commit aa64780 into next Dec 23, 2024
43 of 45 checks passed
@djabarovgeorge djabarovgeorge deleted the preview-usecase branch December 23, 2024 09:27
@djabarovgeorge djabarovgeorge changed the title refactor(api-service): preview usecase refactor(api-service): issues management Dec 23, 2024
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.

2 participants