Skip to content

Latest commit

 

History

History
234 lines (182 loc) · 6.26 KB

README-user-story.md

File metadata and controls

234 lines (182 loc) · 6.26 KB

user stories

  • user can register
curl --location 'http://localhost:9080/api/v1/register' \
--header 'Content-Type: application/json' \
--data '{
    "username": "hidayat",
    "password": "pass"
}'
  • user can login
curl --location 'http://localhost:9080/api/v1/login' \
--header 'Content-Type: application/json' \
--data '{
    "username": "hidayat",
    "password": "pass"
}'
  • user can ask question
curl --location 'http://localhost:9080/api/v1/questions' \
--header 'Authorization: Bearer {{jwt-token}}' \
--header 'Content-Type: application/json' \
--data '{
    "title": "Luhut dan Jokowi",
    "question": "Mengapa Luhut diberi banyak jabatan oleh Presiden Joko Widodo?"
}'
  • user can see question, with thumbsup-thumbsdown count, thumbsup count, thumbsdown count, answer count. Should be sorted by latest question first
curl --location 'http://localhost:9080/api/v1/questions'
curl --location 'http://localhost:9080/api/v1/questions/{{question_id}}'
  • user can vote thumbsup | thumbsdown question
curl --location --request POST 'http://localhost:9080/api/v1/questions/{{question_id}}/thumbsup' \
--header 'Authorization: Bearer {{jwt-token}}'
curl --location --request POST 'http://localhost:9080/api/v1/questions/{{question_id}}/thumbsdown' \
--header 'Authorization: Bearer {{jwt-token}}'
  • user can edit (only) their question
curl --location --request PUT 'http://localhost:9080/api/v1/questions/{{question_id}}' \
--header 'Authorization: Bearer {{jwt-token}}' \
--header 'Content-Type: application/json' \
--data '{
    "title": "update title",
    "question": "update question"
}
'
  • user can delete (only) their question
curl --location --request DELETE 'http://localhost:9080/api/v1/questions/{{question_id}}' \
--header 'Authorization: Bearer {{jwt-token}}'
  • user can answer question
curl --location 'http://localhost:9080/api/v1/questions/{{question_id}}/answers' \
--header 'Authorization: Bearer {{jwt-token}}' \
--header 'Content-Type: application/json' \
--data '{
    "answer": "Doi selalu punya cara penyelesaiannya."
}'
  • user can see answer, with thumbsup-thumbsdown count, thumbsup count, thumbsdown count, comment count. Should be sorted by highest thumbsup-thumbsdown count.
curl --location 'http://localhost:9080/api/v1/questions/{{question_id}}/answers'
curl --location 'http://localhost:9080/api/v1/answers/{{answer_id}}'
  • user can vote thumbsup | thumbsdown answer
curl --location --request POST 'http://localhost:9080/api/v1/answers/{{answer_id}}/thumbsup' \
--header 'Authorization: Bearer {{jwt-token}}'
curl --location --request POST 'http://localhost:9080/api/v1/answers/{{answer_id}}/thumbsdown' \
--header 'Authorization: Bearer {{jwt-token}}'
  • user can edit (only) their answer
curl --location --request PUT 'http://localhost:9080/api/v1/answers/{{answer_id}}' \
--header 'Authorization: Bearer {{jwt-token}}' \
--header 'Content-Type: application/json' \
--data '{
    "answer": "update answer"
}
'
  • user can delete (only) their answer
curl --location --request DELETE 'http://localhost:9080/api/v1/answers/{{answer_id}}' \
--header 'Authorization: Bearer {{jwt-token}}'
  • user can comment on answer
curl --location 'http://localhost:9080/api/v1/answers/{{answer_id}}/comments' \
--header 'Authorization: Bearer {{jwt-token}}' \
--header 'Content-Type: application/json' \
--data '{
    "comment": "Setuju gan."
}'
  • user can see comment, with thumbsup-thumbsdown count, thumbsup count, thumbsdown count, subcomment count. Should be sorted by highest thumbsup-thumbsdown count.
curl --location 'http://localhost:9080/api/v1/answers/{{answer_id}}/comments'
curl --location 'http://localhost:9080/api/v1/comments/{{comment_id}}'
  • user can vote thumbsup | thumbsdown comment
curl --location --request POST 'http://localhost:9080/api/v1/comments/{{comment_id}}/thumbsup' \
--header 'Authorization: Bearer {{jwt-token}}'
curl --location --request POST 'http://localhost:9080/api/v1/comments/{{comment_id}}/thumbsdown' \
--header 'Authorization: Bearer {{jwt-token}}'
  • user can edit (only) their comment
curl --location --request PUT 'http://localhost:9080/api/v1/comments/{{comment_id}}' \
--header 'Authorization: Bearer {{jwt-token}}' \
--header 'Content-Type: application/json' \
--data '{
    "comment": "update comment"
}
'
  • user can delete (only) their comment
curl --location --request DELETE 'http://localhost:9080/api/v1/comments/{{comment_id}}/' \
--header 'Authorization: Bearer {{jwt-token}}'
  • user can comment on comment (subcomment)
curl --location 'http://localhost:9080/api/v1/answers/{{answer_id}}/comments' \
--header 'Authorization: Bearer {{jwt-token}}' \
--header 'Content-Type: application/json' \
--data '{
    "comment": "Lu mah setuju setuju aje.",
    "parent_comment_id": {{comment_id}}
}'
  • user can see subcomment, with thumbsup-thumbsdown count, thumbsup count, thumbsdown count, subcomment count. Should be sorted by highest thumbsup-thumbsdown count.
curl --location 'http://localhost:9080/api/v1/comments/{{comment_id}}/subcomments'
curl --location 'http://localhost:9080/api/v1/comments/{{subcomment_id}}'
  • user can vote thumbsup | thumbsdown subcomment
curl --location --request POST 'http://localhost:9080/api/v1/comments/{{subcomment_id}}/thumbsup' \
--header 'Authorization: Bearer {{jwt-token}}'
curl --location --request POST 'http://localhost:9080/api/v1/comments/{{subcomment_id}}/thumbsdown' \
--header 'Authorization: Bearer {{jwt-token}}'
  • user can edit (only) their subcomment
curl --location --request PUT 'http://localhost:9080/api/v1/comments/{{subcomment_id}}' \
--header 'Authorization: Bearer {{jwt-token}}' \
--header 'Content-Type: application/json' \
--data '{
    "comment": "update comment"
}
'
  • user can delete (only) their subcomment
curl --location --request DELETE 'http://localhost:9080/api/v1/comments/{{subcomment_id}}/' \
--header 'Authorization: Bearer {{jwt-token}}'