Conversation
|
|
||
| if (error) { | ||
| const status = postgrestErrorToHttpStatus(error); | ||
| return NextResponse.json({ error }, { status }); |
There was a problem hiding this comment.
don't forget to include the attribute names here!
| return NextResponse.json({ message: message.data }, { status: 200 }); | ||
| } catch (error) { | ||
| return NextResponse.json({ message: "Unexpected Server Error" }, { status: 500 }); | ||
| return NextResponse.json({ data }, { status: 200 }); |
There was a problem hiding this comment.
attribute name here too
| return NextResponse.json({ message: error.message }, { status: postgrestErrorToHttpStatus(error) }); | ||
| } | ||
| return NextResponse.json({ message: data }, { status: 200 }); |
There was a problem hiding this comment.
dont forget standard attribute names here too. we want to keep them consistent across all files
src/app/api/admin/trees/route.ts
Outdated
There was a problem hiding this comment.
lets remove all of this test auth logic to clean up the function
src/app/api/admin/trees/route.ts
Outdated
| @@ -53,10 +52,7 @@ export async function POST(request: NextRequest) { | |||
| ); | |||
| } | |||
| return NextResponse.json({ message: response.data }, { status: 200 }); | |||
There was a problem hiding this comment.
use standard attribute names here again
|
|
||
| if (error) { | ||
| const status = postgrestErrorToHttpStatus(error); | ||
| return NextResponse.json({ error }, { status }); |
MatthewBlam
left a comment
There was a problem hiding this comment.
great work so far!
i left some comments, but overall, please go trough each file and make sure to standardize all of the response formats using the specified format in the issue #33 description. here's some notes:
- remove any unrelated or unused code or logic that was used for testing purposes
- make sure all variable naming conventions are consistent across files
- make sure docstring comments are all formatted similarly (up to you on how to do so)
- dont forget about
volunteers/route.ts!
|
really sorry about all the mistakes! didn't rely on the instructions as clearly as i should have. i've committed the changes, please take another look when you have the chance! |
Developer: Mohini Chahal
Closes #33
Pull Request Summary
Standardized the PUT route for trees/[id] to follow consistent CRUD patterns:
Modifications
refer to summary for details of changes:
src/app/api/admin/volunteers/[id]/route.ts
src/app/api/admin/trees/[id]/route.ts
src/app/api/admin/trees/route.ts
Testing Considerations
PUT routes for volunteers and trees tested locally:
GET and POST routes for all trees tested locally:
POST inserts new tree
Screenshots/Screencast
{put screenshots of your change, or even better a screencast displaying the functionality}