We need an endpoint which will accept a POST request with json body, validate the request and create a new topic in db. author_id field should be filled by user id from JWT token. We should return 400 if request isn't valid. We should return 401 if JWT token isn't provided. We should return 403 if user from JWT token was not found in database.
Request example
POST /topics
{
"description": "Some description", # required non-blank string field
"title": "Some title", # required non-blank string field
}
We need an endpoint which will accept a POST request with json body, validate the request and create a new topic in db.
author_id
field should be filled by user id from JWT token. We should return 400 if request isn't valid. We should return 401 if JWT token isn't provided. We should return 403 if user from JWT token was not found in database.Request example
Response example
So in the scope of this task we need to create endpoint which will create a new topic and return info about it.
PS more about typing we used for
@authorized_acces
can be read here