Skip to content

Conversation

@GauriRajesh733
Copy link

ℹ️ 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?

@SamNie2027 SamNie2027 self-requested a review September 26, 2025 01:53
Copy link

@SamNie2027 SamNie2027 left a 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?

@GauriRajesh733
Copy link
Author

GauriRajesh733 commented Sep 26, 2025

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.

@thaninbew thaninbew self-requested a review September 28, 2025 22:48
Copy link

@SamNie2027 SamNie2027 left a 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 {
Copy link
Collaborator

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

here static type aswell!

Copy link
Collaborator

@thaninbew thaninbew Sep 29, 2025

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.

@GauriRajesh733
Copy link
Author

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).

@thaninbew
Copy link
Collaborator

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.

@GauriRajesh733
Copy link
Author

Sounds good! I moved the normalization helper functions to backend/src/utils/donations/donations.util.ts!

Copy link
Collaborator

@thaninbew thaninbew 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!!

@thaninbew thaninbew merged commit 71360d4 into main Sep 29, 2025
@thaninbew thaninbew deleted the gr-donations-service-domain-dtos branch September 29, 2025 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DonationsService & Domain DTOs (Part 1)

4 participants