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

feat: [IOBP-838] Remove receipt from list endpoint #430

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

LeleDallas
Copy link
Contributor

Short description

Include a summary of the changes.
This pull request includes changes to the payment route to support a new endpoint for disabling user notices.

List of changes proposed in this pull request

  • Add paids/:eventId/disable route
  • Update global config with hideReceiptResponseCode field

Copy link

codecov bot commented Oct 25, 2024

Codecov Report

Attention: Patch coverage is 44.44444% with 5 lines in your changes missing coverage. Please review.

Project coverage is 64.24%. Comparing base (a64bf42) to head (c138e72).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/features/payments/routers/notices.ts 44.44% 5 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #430      +/-   ##
==========================================
- Coverage   64.28%   64.24%   -0.04%     
==========================================
  Files         167      167              
  Lines        5364     5372       +8     
  Branches      731      731              
==========================================
+ Hits         3448     3451       +3     
- Misses       1915     1920       +5     
  Partials        1        1              
Files with missing lines Coverage Δ
src/config.ts 96.29% <ø> (ø)
src/types/config.ts 100.00% <ø> (ø)
src/features/payments/routers/notices.ts 26.53% <44.44%> (+2.14%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1323b3b...c138e72. Read the comment docs.

Copy link
Contributor

@Hantex9 Hantex9 left a comment

Choose a reason for hiding this comment

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

Great work! Just a small note, and it’s good to go from my side.

Comment on lines 93 to 109
addNoticesHandler("post", "/paids/:eventId/disable", (req, res) => {
pipe(
req.params.eventId,
O.fromNullable,
O.fold(
() => res.sendStatus(400),
eventId =>
pipe(
O.fromNullable(NoticesDB.removeUserNotice(eventId)),
O.fold(
() => res.sendStatus(hideReceiptResponseCode),
() => res.sendStatus(hideReceiptResponseCode)
)
)
)
);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we don't really need two nested fold that have the same behavior, what do you think of replacing with the following suggestion?

Suggested change
addNoticesHandler("post", "/paids/:eventId/disable", (req, res) => {
pipe(
req.params.eventId,
O.fromNullable,
O.fold(
() => res.sendStatus(400),
eventId =>
pipe(
O.fromNullable(NoticesDB.removeUserNotice(eventId)),
O.fold(
() => res.sendStatus(hideReceiptResponseCode),
() => res.sendStatus(hideReceiptResponseCode)
)
)
)
);
});
addNoticesHandler("post", "/paids/:eventId/disable", (req, res) => {
pipe(
req.params.eventId,
O.fromNullable,
O.fold(
() => res.sendStatus(400),
eventId => {
NoticesDB.removeUserNotice(eventId);
return res.sendStatus(hideReceiptResponseCode);
}
)
);
});

Copy link
Contributor

@Hantex9 Hantex9 left a comment

Choose a reason for hiding this comment

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

LGTM!

@LeleDallas LeleDallas merged commit e69fe64 into master Oct 30, 2024
8 checks passed
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