-
Notifications
You must be signed in to change notification settings - Fork 6
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
[IOCIT-141] Handle user preferences for push notification format #232
Conversation
Example of PR titles that include pivotal stories:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some comments, logic looks good.
utils/domain-errors.ts
Outdated
title: NonEmptyString, | ||
detail: NonEmptyString, | ||
objectName: NonEmptyString | ||
): NotFoundError => ({ detail, kind: "NotFound", objectName, title }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not defining an enum for error kinds instead of always writing a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not "always", because this is a method that builds a NotFoundError
, so it's the only point in which that string will be written.
But I agree that having an enum is a best practice.
Done in 7908370
WebhookNotification/handler.ts
Outdated
@@ -125,11 +130,14 @@ export const sendToWebhook = ( | |||
notifyApiCall({ | |||
notification: { | |||
// If the service requires secure channels | |||
// or user did not allow to receave verbose notifications |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: Receive
WebhookNotification/handler.ts
Outdated
fiscalCode: message.fiscalCode | ||
}), | ||
// We are using T.map(E.getOrElseW(..)) because | ||
// TE.getOrElseW is unable to infer `userProfile` type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an fp-ts bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. With TE.getOrElse
it works fine.
Done in [#IOCIT-141] fix TE.getOrElse return type on userProfile
@@ -38,6 +39,11 @@ import * as TE from "fp-ts/lib/TaskEither"; | |||
import * as O from "fp-ts/lib/Option"; | |||
import { StandardServiceCategoryEnum } from "../../generated/api-admin/StandardServiceCategory"; | |||
|
|||
import { toInternalError, toNotFoundError } from "../../utils/domain-errors"; | |||
import { GetUserProfileReader } from "../../readers/user-profile.readers"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The folder is readers
, why calling the file .readers.ts
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3a35752
to
60ac8fb
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
fiscalCode: message.fiscalCode | ||
}), | ||
TE.getOrElse(err => { | ||
throw new Error(err.title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to throw the err title or the err message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, since this error is needed for replaying the operation, I thought it was not useful to write detailed info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a minor comment.
List of Changes
Motivation and Context
Send push notification as defined by user.
How Has This Been Tested?
Unit test
Screenshots (if appropriate):
Types of changes
Checklist: