Skip to content

spudster-team/slate_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Slate Backend

The Documentation is Coming Soon

Register

  • post: /api/user
  • body:
{
  "email": "[email protected]",
  "password": "strong_password",
  "first_name": "Nomeniavo Joe",
  "last_name": "Fitahiana",
  "photo": null
}
  • response: 201 created
{
  "user": {
    "id": 1,
    "email": "[email protected]",
    "first_name": "Nomeniavo Joe",
    "last_name": "Fitahiana",
    "photo": null
  },
  "token": "d75dad1a0db1c2b01cfb3b67d0f68b1e7dda2ed8"
} 

Login

  • post: /api/user/auth
  • body:
{
  "email": "[email protected]",
  "password": "strong_password"
}
  • response: 200 ok
{
  "user": {
    "id": 1,
    "email": "[email protected]",
    "first_name": "Nomeniavo Joe",
    "last_name": "Fitahiana",
    "photo": null
  },
  "token": "d75dad1a0db1c2b01cfb3b67d0f68b1e7dda2ed8"
} 

Add Question

  • post: /api/question
  • need authentication:
  • Authorization: token d75dad1a0db1c2b01cfb3b67d0f68b1e7dda2ed8
  • body:
{
  "title": "Comment résoudre une équation à 3 inconnue ?",
  "content": "Quelqu'un peut-il m'aider?",
  "photo": null
}
  • response: 201 created
[
  {
    "id": 19,
    "owner": "Nomeniavo Joe",
    "title": "J'ai une erreur de code avec python",
    "content": "voici",
    "date_posted": "2023-11-09T14:01:13.003538Z",
    "response": [],
    "tag": [],
    "up_vote": 0,
    "down_vote": 0,
    "n_response": 0,
    "photo": {
      "id": 8,
      "path": "https://slate-service-api.onrender.com/media/images/image_capture.png_1699538472.8806033.png"
    }
  }
]

Get All Question

  • get: /api/question
[
  {
    "id": 19,
    "owner": "Nomeniavo Joe",
    "title": "J'ai une erreur de code avec python",
    "content": "voici",
    "date_posted": "2023-11-09T14:01:13.003538Z",
    "response": [],
    "tag": [],
    "up_vote": 1,
    "down_vote": 0,
    "n_response": 0,
    "info": {
      "is_already_voted": true,
      "is_upvote": true
    },
    "photo": {
      "id": 8,
      "path": "https://slate-service-api.onrender.com/media/images/image_capture.png_1699538472.8806033.png"
    }
  }
]

Get one Question

  • get: /api/question/id:question_id
{
  "id": 19,
  "owner": "Nomeniavo Joe",
  "title": "J'ai une erreur de code avec python",
  "content": "voici",
  "date_posted": "2023-11-09T14:01:13.003538Z",
  "response": [],
  "tag": [],
  "up_vote": 1,
  "down_vote": 0,
  "n_response": 0,
  "info": {
    "is_already_voted": true,
    "is_upvote": true
  },
  "photo": {
    "id": 8,
    "path": "https://slate-service-api.onrender.com/media/images/image_capture.png_1699538472.8806033.png"
  }
}

Delete Question

  • get: /api/question/int:question_id
  • need authentication:
  • Authorization: token d75dad1a0db1c2b01cfb3b67d0f68b1e7dda2ed8
  • response: 204 no content

Vote Question

post: /api/question/vote/int:question_id

  • need authentication:

  • Authorization: token d75dad1a0db1c2b01cfb3b67d0f68b1e7dda2ed8

  • body:

{
  "is_upvote": true
}
  • response: 200 ok
[
  {
    "id": 19,
    "owner": "Nomeniavo Joe",
    "title": "J'ai une erreur de code avec python",
    "content": "voici",
    "date_posted": "2023-11-09T14:01:13.003538Z",
    "response": [],
    "tag": [],
    "up_vote": 1,
    "down_vote": 0,
    "n_response": 0,
    "info": {
      "is_already_voted": true,
      "is_upvote": true
    },
    "photo": {
      "id": 8,
      "path": "https://slate-service-api.onrender.com/media/images/image_capture.png_1699538472.8806033.png"
    }
  }
]

Response question

  • post: /api/question/response/int:question_id

  • need authenticaiton:

  • body

{
  "content": "",
  "photo": null
}
  • resposne
{
  "id": 19,
  "owner": {
    "id": 1,
    "email": "[email protected]",
    "first_name": "Nomeniavo Joe",
    "last_name": "Fitahiana",
    "photo": {
      "path": null
    }
  },
  "title": "J'ai une erreur de code avec python",
  "content": "test",
  "date_posted": "19 hours, 21 minutes",
  "response": [
    {
      "id": 1,
      "owner": "Nomeniavo Joe",
      "content": "Essai resonse",
      "date_posted": "2023-11-10T09:22:35.713150Z",
      "up_vote": 0,
      "down_vote": 0,
      "photo": {
        "path": null
      }
    }
  ],
  "tag": [],
  "up_vote": 0,
  "down_vote": 1,
  "n_response": 1,
  "info": {
    "is_already_voted": true,
    "is_upvote": false
  },
  "photo": {
    "id": 11,
    "path": "https://slate-service-api.onrender.com/media/images/image_capture.png_1699590711.0925508.png"
  }
}

Search Question

  • get: /api/question?search=python
[
  {
    "id": 19,
    "owner": "Nomeniavo Joe",
    "title": "J'ai une erreur de code avec python",
    "content": "voici",
    "date_posted": "2023-11-09T14:01:13.003538Z",
    "response": [],
    "tag": [],
    "up_vote": 1,
    "down_vote": 0,
    "n_response": 0,
    "info": {
      "is_already_voted": true,
      "is_upvote": true
    },
    "photo": {
      "id": 8,
      "path": "https://slate-service-api.onrender.com/media/images/image_capture.png_1699538472.8806033.png"
    }
  }
]

Get the most Active User

  • get: /api/user/most-active
[
  {
    "id": 4,
    "email": "[email protected]",
    "first_name": "t",
    "last_name": "t",
    "photo": {
      "path": null
    }
  },
  {
    "id": 1,
    "email": "[email protected]",
    "first_name": "Nomeniavo Joe",
    "last_name": "Fitahiana",
    "photo": {
      "path": null
    }
  },
  {
    "id": 7,
    "email": "[email protected]",
    "first_name": "josé",
    "last_name": "rado",
    "photo": {
      "path": null
    }
  },
  {
    "id": 9,
    "email": "[email protected]",
    "first_name": "josé",
    "last_name": "rado",
    "photo": {
      "path": null
    }
  },
  {
    "id": 3,
    "email": "[email protected]",
    "first_name": "rhja1",
    "last_name": "rhja1",
    "photo": {
      "path": null
    }
  },
  {
    "id": 5,
    "email": "[email protected]",
    "first_name": "josé",
    "last_name": "rado",
    "photo": {
      "path": null
    }
  },
  {
    "id": 2,
    "email": "[email protected]",
    "first_name": "rhja",
    "last_name": "rhja",
    "photo": {
      "path": null
    }
  }
]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published