[go: up one dir, main page]

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, application-generic): Encapsulate preference mutations in workflow use-cases #7005

Merged
merged 39 commits into from
Nov 17, 2024

Conversation

rifont
Copy link
Contributor
@rifont rifont commented Nov 14, 2024

What changed? Why was the change needed?

  • Encapsulate preference mutations in workflow use-cases
    • Move all preference handling to CreateWorkflow, UpdateWorkflow, and DeleteWorkflow use-cases
    • Remove preference handling from UpsertPreferences use-case

Screenshots

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

Copy link
linear bot commented Nov 14, 2024

Copy link
netlify bot commented Nov 14, 2024

Deploy Preview for novu-stg-vite-dashboard-poc ready!

Name Link
🔨 Latest commit e20ad04
🔍 Latest deploy log https://app.netlify.com/sites/novu-stg-vite-dashboard-poc/deploys/673a009210b28e0008239efd
😎 Deploy Preview https://deploy-preview-7005--novu-stg-vite-dashboard-poc.netlify.app
📱 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
pkg-pr-new bot commented Nov 14, 2024

Open in Stackblitz

@novu/client

pnpm add https://pkg.pr.new/novuhq/novu/@novu/client@7005

@novu/framework

pnpm add https://pkg.pr.new/novuhq/novu/@novu/framework@7005

@novu/headless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/headless@7005

@novu/js

pnpm add https://pkg.pr.new/novuhq/novu/@novu/js@7005

@novu/nextjs

pnpm add https://pkg.pr.new/novuhq/novu/@novu/nextjs@7005

@novu/node

pnpm add https://pkg.pr.new/novuhq/novu/@novu/node@7005

@novu/notification-center

pnpm add https://pkg.pr.new/novuhq/novu/@novu/notification-center@7005

novu

pnpm add https://pkg.pr.new/novuhq/novu@7005

@novu/providers

pnpm add https://pkg.pr.new/novuhq/novu/@novu/providers@7005

@novu/react

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react@7005

@novu/react-native

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react-native@7005

@novu/shared

pnpm add https://pkg.pr.new/novuhq/novu/@novu/shared@7005

commit: e20ad04

@@ -40,7 +40,7 @@ export class Channels {
export class PreferencesDto {
@ValidateNested({ each: true })
@Type(() => WorkflowPreference)
workflow: WorkflowPreference;
all: WorkflowPreference;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was just completely wrong before.

{
$set: updatePayload,
},
);
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 database mutation should happen before invalidating.

defaultPreferences: DEFAULT_WORKFLOW_PREFERENCES,
userPreferences:
body.preferenceSettings &&
buildWorkflowPreferencesFromPreferenceChannels(body.critical ?? false, body.preferenceSettings),
Copy link
Contributor Author
@rifont rifont Nov 14, 2024

Choose a reason for hiding this comment

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

Internally, all Workflow DTOs now carry a defaultPreferences and userPreferences object now.

preferenceSettings and critical are removed from all internal DTOs in preparation for their full removal.

@rifont rifont merged commit c1f51c2 into next Nov 17, 2024
40 checks passed
@rifont rifont deleted the nv-4752-start-writing-to-v2-preferences-for-all branch November 17, 2024 15:06
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