-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note edit and delete #507
Note edit and delete #507
Conversation
Pull Request Test Coverage Report for Build 9635296974Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9635298553Details
💛 - Coveralls |
eap_backend/eap_api/urls.py
Outdated
@@ -21,11 +21,17 @@ | |||
views.property_claim_list, | |||
name="property_claim_list", | |||
), | |||
# path( | |||
# "comments/<int:assurance_case_id>/", | |||
# views.comment_list, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove commented code
eap_backend/eap_api/urls.py
Outdated
path( | ||
"comments/<int:assurance_case_id>/", | ||
"assurance_case/<int:assurance_case_id>/comments/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I might disagree with the initial API design, I see it is important to keep in consistent with all the other resources: case_element_in_plural/
for listing/creation deletion where you can send the assurance_case_id
via request parameters instead of via slug. Please adjust accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cptanalatriste do you mean changing assurance_case
to assurance_cases
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking doing something similar to goals
, another top-level case item attached to assurance case (see goal_list
and goal_detail
). In that style, we would have two resources: comments/
to handle case-level retrieve and creation and comments/<int:pk>
for update, deletion and single-comment retrieval. Just to keep the same design over the whole API
next_frontend/.env.local
Outdated
@@ -1,7 +1,7 @@ | |||
# TODO(cgavidia): This should be handled via environment variables. | |||
# NEXT_PUBLIC_API_URL=http://localhost:8000 | |||
NEXT_PUBLIC_API_URL=http://localhost:8000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not merge this code into develop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cptanalatriste good catch! Will switch this out, forgot that we had this in the repo.
|
||
//@ts-ignore | ||
assuranceCase.comments.sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); | ||
|
||
useEffect(() => { | ||
//@ts-ignore | ||
assuranceCase.comments.sort((a, b) => new Date(b.created_at) - new Date(a.created_at)); | ||
console.log('Comments', assuranceCase.comments) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove unnecessary logs
} | ||
|
||
const updatedComments = assuranceCase.comments.filter((comment:any) => comment.id !== id) | ||
console.log('Updated Comments', updatedComments) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem
|
||
|
||
@api_view(["GET", "PUT", "DELETE"]) | ||
def comment_detail(request, pk): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that we're out of "crunch-mode", please at least at some unit tests for the new backend code. At least at the test_view
level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cptanalatriste this is where I was hoping you'd be able to help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RichGriff of course! I can add a couple of tests to the branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only some minor requests
@cptanalatriste will work on what I can today on the same branch. |
Pull Request Test Coverage Report for Build 9646635937Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 9646622294Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made
Pull Request Test Coverage Report for Build 9648535842Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
serializer = CommentSerializer(data=request.data) | ||
data = request.data.copy() | ||
data["assurance_case_id"] = ( | ||
assurance_case_id # Ensure assurance_case_id is set in the data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this shouldn't be needed. Aren't you already sending the assurance case ID in the payload body?
/comments/{assurance_case_id}/
endpoint to make this work with the above