-
Notifications
You must be signed in to change notification settings - Fork 69
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
Create editExerciseComment mutation and update some snapshots for tests #2731
Conversation
@HS-90 is attempting to deploy a commit to the c0d3-prod Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
It shouldn't update any snapshots because they were updated and merged in this PR. Did you merge upstream changes and update the packages? |
if (exerciseComment?.authorId !== authorId) | ||
throw new Error('Comment is not by user') | ||
|
||
return prisma.exerciseComment.update({ |
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.
It would be nice to include the date too. So in the app, we can show when was the comment last edited
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.
@flacial Actually, I though prisma updates that automatically in the "updatedAt" field. If that's the case we wont need to manually update the time right?
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.
You're right.
@@ -44,3 +45,28 @@ export const addExerciseComment = async ( | |||
data: { authorId, content, exerciseId, parentId, userPic } | |||
}) | |||
} | |||
|
|||
export const editExerciseComment = async ( |
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.
Can't we wrap this with WithUserContainer higher order function because it checks if the user session exists?
I did update my fork and did 'git pull' in my local repo before submitting this PR. I had to update the snapshots in my local with 'yarn test -u' otherwise the snapshots failed. I'll have to look further into why it's failing the test. |
Codecov Report
@@ Coverage Diff @@
## master #2731 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 189 189
Lines 3555 3562 +7
Branches 984 985 +1
=========================================
+ Hits 3555 3562 +7
|
Thanks for the detailed test instructions. LGTM! 👍 |
Description: relates to #2400
This PR adds a graphQL mutation that will handle editing of exercise comments as part of the discussions feature in C0D3 Dojo.
To test:
Use an existing exerciseComment
id
or create a new one in graphQL like so:Remember/save the
id
that is generated/assigned to the newly createdexerciseComment
Use this id to run a query such as:
If successful, there should be a result similar to the following: