Skip to content

MSPCA-30: Generalized Decorator for Strings - #14

Merged
shreeyaadhikari merged 9 commits into
mainfrom
sa/mspca-30-generalized-decorator-for-strings
Oct 15, 2026
Merged

shreeyaadhikari merged 9 commits into
mainfrom
sa/mspca-30-generalized-decorator-for-strings

Conversation

@shreeyaadhikari

@shreeyaadhikari shreeyaadhikari commented Oct 14, 2026 •

Copy link
Copy Markdown

ℹ️ Issue

Closes MSPCA-30

📝 Description

This PR adds a single reusable @IsNonEmptyString() decorator that trims the value and then validates it, so whitespace-only strings are rejected and padded strings are trimmed.

Briefly list the changes made to the code:

  1. Added @IsNonEmptyString() in utils/dtos/utils.dto.ts. It combines a Transform that trims the value with IsString and IsNotEmpty.
  2. Added transform: true to the ValidationPipe in main.ts.
  3. Replaced the repeated decorator stacks with @IsNonEmptyString() for UpdateVolunteerDto, DenyMatchDto, CreateCognitoUserDto and SendEmailDTO
  4. Added tests for the decorator in utils/dtos/utils.dto.spec.ts

✔️ Verification

What steps did you take to verify your changes work? These should be clear enough for someone to be able to clone the branch and follow the steps themselves.

All backend tests pass.

🏕️ (Optional) Future Work / Notes

@shreeyaadhikari
shreeyaadhikari marked this pull request as ready for review October 14, 2026 22:24

@dburkhart07 dburkhart07 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

all small things. super clean pr. actually goated

Comment thread apps/backend/src/volunteers/dto/update-volunteer.dto.ts Outdated
Comment thread apps/backend/src/aws/ses/sendEmail.dto.ts Outdated
Comment thread apps/backend/src/aws/cognito/dtos/create-cognito-user.dto.ts Outdated
Comment thread apps/backend/src/aws/cognito/dtos/create-cognito-user.dto.ts Outdated

@Juwang110 Juwang110 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just one small nit looks good!

Comment thread apps/backend/src/utils/decorators/is-non-empty-string.decorator.ts
@shreeyaadhikari
shreeyaadhikari merged commit c531fdc into main Oct 15, 2026
10 checks passed
@shreeyaadhikari
shreeyaadhikari deleted the sa/mspca-30-generalized-decorator-for-strings branch October 15, 2026 20:06
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.

3 participants