Open
Conversation
Replace unvalidated TypeScript interface with Zod schemas for createTask and updateTask handlers, enforcing input validation at runtime per project conventions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
Author
Code reviewEncontrei 2 problemas:
SbrTask/backend/src/schemas/task.schema.ts Lines 6 to 8 in 8fada0e Correção sugerida: substituir
SbrTask/backend/src/controllers/taskController.ts Lines 119 to 128 in 8fada0e Correção sugerida: substituir 🤖 Generated with Claude Code - Se esta revisão foi útil, reaja com 👍. Caso contrário, reaja com 👎. |
- Replace datetime({ offset: true }) with z.string().date() to accept
YYYY-MM-DD from HTML date inputs
- Replace truthy && checks with !== undefined to allow clearing optional
fields like description and category
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TaskBodywith Zod schemas for runtime validationcreateTaskSchemaandupdateTaskSchemainbackend/src/schemas/task.schema.tssafeParseincreateTaskandupdateTaskhandlers, returning 400 on invalid inputMotivation
Per CLAUDE.md rule #1: all Express request bodies must be typed with Zod schemas for runtime validation.
Test plan
/taskswith missingtitlereturns 400 with validation details/taskswith invalidpriorityvalue returns 400/tasks/:idwith invalidstatusreturns 400