The app is build with the Django REST framework and uses:
- Docker
- Postgres
- Celery
- RabbitMQ
- Redis
- drf-spectacular for documentation
- Clone the repository
- Rename
.env.sample
to.env
and replace the values - Run in your terminal
docker-compose up --build
- Now everything should be set up and app's documentation available on http://localhost:8000/api/docs/
To run tests:
- If containers are not running, run in your terminal
docker-compose up
- In the second terminal tab, run
docker ps
and get the ID of the app container - Run
docker exec -itu 0 <container ID> sh
to get access to the container's shell as a root user - Run
python manage.py test
to run all tests orpython manage.py test <app-name>.tests
to run tests for a specific app
User app
- Use
/api/user/create/
to create a new user - Then use
/api/user/token/
to create a token for the created user - Use
/api/user/profile/
to retrieve user details and update password and user profile details - Use
/api/user/forgot-password/
to send an email with a link to reset the password.
Posts app
-
Use
/api/post/posts/
to create a new post and retrieve all posts. Available query params:tags
- a list of tags ids to filter by. For example?tags=1,5,20
sort
- sorting posts by:title-asc
,title-desc
- titlecomments-asc
,comments-desc
- number of commentsdate-asc
,date-desc
-created_at
valueupdate-asc
,update-desc
-updated_at
value
each in ascending or descending order. For example
?sort=comments-asc
. -
Use
/api/post/posts/{id}/
to see post details, update and delete a post -
Use
/api/post/tags/
to retrieve all tags -
Use
/api/post/tags/{id}/
to update and delete a tag -
Use
/api/post/comments/
to create a comment -
Use
/api/post/comments/{id}/
to update and delete a comment -
Use
/api/post/postimages/
to create an additional image for a post -
Use
/api/post/postimages/{id}/
to update and delete a post image -
Use
/api/post/votes/
to create a vote of a comment -
Use
/api/post/votes/{id}/
to delete a vote. There is no option to update it (change thevote_type
property). If a user decides to change their vote, it will be deleted and then created a new one.
More information about API endpoints, with examples of data that needs to be sent with a request, can be found on http://localhost:8000/api/docs/. This will provide you with complete and easy-to-use documentation. It also gives the option to use every endpoint of this API.
This app uses djangorestframework-camel-case to enable the server to send and receive data in a format that is compatible with TypeScript. This package provides support for camel-case style serialization and deserialization, which is appropriate for the conventions used in Vue.js.