Conversation
| if (rawPath.startsWith('/') && rawPath.split('/').length === 2 && method === 'PUT') { | ||
| const id = rawPath.split('/')[1]; | ||
| if (!id) return json(400, { message: 'id is required' }); | ||
| const body = event.body ? JSON.parse(event.body) as Record<string, {name:string, total_budget:number}> : {}; |
There was a problem hiding this comment.
i wrote util helper funcs to validate fields bc 1. detailed err messages, 2. ensure data being processed is in correct format, 3. faster performance - its not up in main yet, so probably just note for future work to use those methods to validate fields here!
Yurika-Kan
left a comment
There was a problem hiding this comment.
good stuff, just a comment on validating fields before trying to put them in & prehandling them before database does!
nourshoreibah
left a comment
There was a problem hiding this comment.
What Yurika said, feel free to steal her data validation things
nourshoreibah
left a comment
There was a problem hiding this comment.
Put endpoint actually does not need an ID. id should be generated automatically in db
nourshoreibah
left a comment
There was a problem hiding this comment.
wait wrong PR this is the edit one
ℹ️ Issue
Closes #61
📝 Description
project/{projectId}nameandtotal_budget✔️ Verification