-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Na sledecem linku se nalazi demo snimak projekta: https://www.youtube.com/watch?v=6EixlUrPyvs

| Name | Type |
|---|---|
| id | uuid |
| title | string |
| description | string |
| author | string |
| votes | int |
| answers | int |
| views | int |
| tags | [string] |
| createdAt | timestamp |
| modifiedAt | timestamp |
-
Description: Returns a list of the most recent questions, in the future could be implemented to return most relevant questions.
-
Response:
-
200 OK,[Question]- Returns a list of questions with all of the information.
-
-
Description: Returns a list of the most recent questions, in the future could be implemented to return most relevant questions.
-
Response:
-
200 OK,Question- Returns a question. -
404 Not Found- ReturnsNot Foundif the question with given id does not exist.
-
-
Description: Returns a list of the most recent questions with given tag in the future could be implemented to return most relevant questions.
-
Response:
-
200 OK,Question- Returns a list of questions.
-
-
Description: Creates a new question and saves it to a database.
-
Request body:
{
"title": "Title of a question",
"description": "Description of a question",
"author": "",
"tags": [string]
}- Response:
-
200 OK,Question- Returns a questions that was created. -
400 Bad Request- ReturnsBad Requestwhen one of the fields is missing or is of a wrong type.
-
-
Description: Updates a question.
-
Request body:
{
"id", "uuid of the question",
"title": "New title or old title if it is left unchanged",
"description": "New description or old description",
"tags": [string]
}- Response:
-
200 OK,Question- Returns a question if it was updated successfully. -
400 Bad Request- ReturnsBad Requestwhen one of the fields is missing or is of a wrong type. -
401 Unauthorized- If a user that is not an author of a question tries to modify it. -
404 Not Found- If the question id is not found.
-
-
Description: Deletes a question with given id and all of the comments.
-
Response:
-
204 No Content- If a question is deleted successfully. -
401 Unauthorized- If a user that is not the author of a question tries to delete it. -
404 Not Found- If a question with given id is not found.
-
-
Description: Gives
+1or-1votes to a question. -
Request body:
{
"id": "uuid",
"votes": "upvote" or "downvote"
}- Response:
-
200 Ok- If a vote has been successfully submitted. -
400 Bad Request- If request body contains invalid information. -
401 Unauthorized- If a user that is not logged in tries to vote on a question. -
404 Not Found- If a question with given id is not found.
-
| Name | Type |
|---|---|
| comment_id | ObjectId |
| question_id | ObjectId |
| author_id | ObjectId |
| content | string |
| votes | int |
| upvotes | [ObjectId] |
| downvotes | [ObjectId] |
| creationDate | timestamp |
| modifiedDate | timestamp |
-
Description: Returns a list of all comments on selected question.
-
Response:
-
200 OK,[Comment]- Returns the list of comments. -
400 Bad Requset- If the question ID is invalid. 500 Internal Server Error
-
-
Description: Creates a new comment on question with given id.
-
Request body:
{
"content": string,
"userId": ObjectId
}- Response:
-
200 OK,Comment- Returns the comment that was created. -
400 Bad Request- Returns error message with information on what field is missing or what value has wrong type. -
404 Not Found- If the question with given id does not exist. 500 Internal Server Error
-
-
Description: Updates the comment with given id.
-
Request body:
{
"content": string,
"userId": ObjectId
}- Response:
-
200 OK,Comment- Returns comment if it was updated successfully. -
400 Bad Request- Returns error message with information on what field is missing or what value has wrong type. -
401 Unauthorized- If a user that is not an author of a comment tries to modify it. -
404 Not Found- If the comment with given id does not exists. 500 Internal Server Error
-
-
Description: Deletes all the comments for question with given id.
-
Response:
-
204 No Content- If the comments are deleted successfully. -
400 Bad Request- If question ID is invalid. -
401 Unauthorized- If user is not a moderator or if request is not sent by question service. -
500 Internal Server Error- If internal server error occurs.
-
-
Description: Deletes the comment with given id.
-
Response:
-
204 No Content- If the comment is deleted successfully. -
401 Unauthorized- If a user that is not the author of the comment nor moderator tries to delete it. -
404 Not Found- If the comment with given id does not exist. -
500 Internal Server Error- If internal server error occurs.
-
-
Description: Gives
+1votes to the comment. -
Request body:
{
"userId": ObjectId
}- Response:
-
200 Ok- Returns current vote count if a vote has been successfully submitted. -
400 Bad Request- If same vote has been already submitted. -
401 Unauthorized- If a user that is not logged in tries to vote on the comment. -
404 Not Found- If a comment with given id does not exist.
-
-
Description: Gives
-1votes to the comment. -
Request body:
{
"userId": ObjectId
}- Response:
-
200 Ok- Returns current vote count if a vote has been successfully submitted. -
400 Bad Request- If same vote has been already submitted. -
401 Unauthorized- If a user that is not logged in tries to vote on the comment. -
404 Not Found- If a comment with given id is not found.
-
| Name | Type |
|---|---|
| string | |
| user_id | uuid |
| username | string |
| password | string |
| name | string |
| surname | string |
| picturePath | string |
| year | int |
| course | string |
- Return all users
- Response:
*
200 OK
- Return profile account
- Response:
-
200 OK,Profile data- Return profile information -
404 Not found- Account doesn't exist
-
- Check if user exists with given username
- request json data:
{
"email" : string,
"username" : string,
"password" : string,
"name" : string,
"course" : string
}- Response:
-
201 OK, Return true if profile was created. -
400 Bad request- Missing some information -
403 Forbidden- Account already exist with same username
-
-
Update password with given password in body
-
Response:
-
200 OK- Successfully update -
400 Bad request- Incorrect password -
404 Not found- User does not exist.
-
- Update data info
- Response:
-
201 OKSuccessfully update -
400 Bad request- Incorrect data
-
*DELETE account with given password in body
- Response:
-
200 OK- Successfully deleted -
404 Not found- User does not exist.
-