Skip to content

221 add validation to patch#227

Merged
Rayna-Yu merged 3 commits into
mainfrom
221-check-input-before-patch
Jun 21, 2026
Merged

221 add validation to patch#227
Rayna-Yu merged 3 commits into
mainfrom
221-check-input-before-patch

Conversation

@Rayna-Yu

@Rayna-Yu Rayna-Yu commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

#221

Closes #221

📝 Description

Briefly list the changes made to the code:

  1. Add validation utils to users
  2. Updated patch to check input before passing to db using validation utils
  3. Updated post to use validation utils
  4. Added unit tests

✔️ Verification

Added tests

🏕️ (Optional) Future Work / Notes

Did you notice anything ugly during the course of this ticket? Any bugs, design challenges, or unexpected behavior? Write it down so we can clean it up in a future ticket!

@Rayna-Yu Rayna-Yu marked this pull request as ready for review June 8, 2026 22:28
@Rayna-Yu Rayna-Yu requested a review from nourshoreibah as a code owner June 8, 2026 22:28
@github-actions github-actions Bot requested a review from tsudhakar87 June 8, 2026 22:28
github-actions Bot added a commit that referenced this pull request Jun 8, 2026

@tsudhakar87 tsudhakar87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks great! Just one question

Comment thread apps/backend/lambdas/users/handler.ts

@nourshoreibah nourshoreibah 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.

Mainly one comment about required fields!

let profileImage = body.profileImage as string | undefined;
const updates: { email?: string; name?: string; is_admin?: boolean; profile_image?: string } = {};

const emailResult = UserValidationUtils.validateEmail(body.email);

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.

Very much a nit but I wonder if we should just throw the whole body into the validation utils and let it handle all these conditionals 👀 I don't feel super strongly about this just an idea

Comment thread apps/backend/lambdas/users/validation-utils.ts
@Rayna-Yu Rayna-Yu added this pull request to the merge queue Jun 21, 2026
Merged via the queue into main with commit 22542f5 Jun 21, 2026
15 checks passed
@Rayna-Yu Rayna-Yu deleted the 221-check-input-before-patch branch June 21, 2026 14:34
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.

Check user input before passing to db on PATCH /users

3 participants