Skip to content
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

feat: add create, update, delete test #75

Merged
merged 13 commits into from
Nov 13, 2024
Merged

Conversation

solomonng2001
Copy link

@solomonng2001 solomonng2001 commented Nov 12, 2024

  • Add create test api endpoint on backend
  • test cases follows the following format
  • number of pairs of input line and output lines
  • input line (stdin)
  • output line (stdout)
  • ...repeat per input output pair
  • Add update test api endpoint on backend
  • Add delete test api endpoint on backend

POST /tests

To create a new test case, run the following command:

curl -X POST http://localhost:8083/tests \
-H "Content-Type: application/json" \
-d '{
"questionDocRefId": "sampleDocRefId123",
"questionTitle": "Sample Question Title",
"visibleTestCases": "2\nhello\nolleh\nHannah\nhannaH",
"hiddenTestCases": "2\nHannah\nhannaH\nabcdefg\ngfedcba"
}'

PUT /tests/{questionDocRefId}

To update an existing test case from an existing question, run the following command:

curl -X PUT http://localhost:8083/tests/{questionDocRefId} \
-H "Content-Type: application/json" \
-d '{
"visibleTestCases": "2\nhello\nolleh\nHannah\nhannaH",
"hiddenTestCases": "2\nHannah\nhannaH\nabcdefg\ngfedcba"
}'

DELETE /tests/{questionDocRefId}

To delete an existing test case from an existing question, run the following command:

curl -X DELETE http://localhost:8083/tests/{questionDocRefId} \
-H "Content-Type: application/json"

@solomonng2001 solomonng2001 self-assigned this Nov 12, 2024
@tituschewxj
Copy link

tituschewxj commented Nov 12, 2024

Should we add update and delete for this also? Since we can also update and delete a question.

Also I noticed that there could be a slight issue if the input and output contains \n since it is being split by newlines, but this could be avoided by ensuring that the input/output is a single line on the frontend.

@solomonng2001 solomonng2001 changed the title Solomon/add create test Solomon/add create, update, delete test Nov 13, 2024
@solomonng2001 solomonng2001 changed the title Solomon/add create, update, delete test feat: add create, update, delete test Nov 13, 2024
Copy link

@tituschewxj tituschewxj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tituschewxj tituschewxj merged commit f01ba09 into staging Nov 13, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants