-
Notifications
You must be signed in to change notification settings - Fork 0
Gr donations service domain dtos #12
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
Conversation
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.
DTOs look great! I'm curious what made the package.json and yarn.lock change and the versions for some of these packages change, was it just from yarn install?
I think I was having some issues with the versions of different packages so I tried to update them, so I'm not sure if the changes were just because of yarn install. |
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.
Does yarn docker:up:dev work with the main package.json and lock.json?
I'm thinking the version management is going to be more stable if we can make due with the main's package.json and lock for as long as possible.
However considering no versions were dropped and the only one updated is prettier, which I don't think really affects the stability of the project, I think it is good with these changes
|
|
||
| showDedicationPublicly?: boolean = false; | ||
|
|
||
| private normalizeInterval(input: string | null): NormalizedInterval | null { |
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.
id make this static type, to make it more reusable without having to instantiate the DTO. Just what I prefer, but there are pros and cons.
|
|
||
| createdAt: string; | ||
|
|
||
| private normalizeDonorName(input: string | null): string | null { |
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.
here static type aswell!
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.
great job on all the files! this looks good. I wrote it in really fine print but I think it would be nice to also have a minimal "amount parser" normalization helper. It'd turn a string/number into a valid number. For invalid cases like a string input, it'd turn that into a 0. This might sound bad but it's to avoid crashes and we will rely on other validations before this to ensure we're not experiencing silent failures.
|
I was wondering if we should move the normalization helpers to a separate utils file if they are going to be static? For example, I think normalizeDonationAmount() could be used by createDonationDTO and publicDonationDTO (for now I added static helper to publicDonationDTO). |
Yes, that's a good idea! Your other changes look good. |
|
Sounds good! I moved the normalization helper functions to backend/src/utils/donations/donations.util.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.
great work!!
ℹ️ Issue
Closes #8
📝 Description
Created DonationResponse, CreateDonation, and PublicDonation DTOs.
Created normalization helper functions for donor name in PublicDonation (if donor wants to be anonymous do not include name) and recurring donation interval in CreateDonation (donations on weekly basis, monthly basis, etc.).
✔️ Verification
N/A
🏕️ (Optional) Future Work / Notes
Not sure if I needed to implement any other normalization helpers?