cre8ive-mart backend api
To run this project, install it locally using pip:
$ python -m venv ./venv
$ source ./venv/Scripts/activate
$ pip install -r requirements.txt
$ python manage.py makemigrations
$ python manage.py migrate
$ python manage.py runserver
The accounts app handles the authentication (Login, signup, change password, reset password, email authentication, google login) of the app
Before each of these routes, add api/
-
verify-email/again/
This expects an email to be provided then it sends a verification email to the user to verify their email. This is necessary when the verification email has expired and they didn't verify their email.
{ "email": "" }
-
signup/
This is to sign up the user into their account
{ "email": "", "password1": "", "password2": "", "name": "" }
the name should be the fullname (firstname and lastname)
-
google/
This just needs the access_token alone to be provided, and can be gotten by implementing firebase or any other method of your choice to the frontend
{ "access_token": "", "code": "" }
-
password/reset/
This expects an email to be provided then it sends an email to the user reset their password.
{ "email": "" }
password/reset/confirm///
This expects the new password of the user and uid and token which is gotten from the link/url of the current site.
{ "new_password1": "", "new_password2": "", "uid": "", "token": "" }
-
me/
This just returns the current logged in user's slug
-
users/
This returns all the users in the database
-
users/slug:slug/
This returns the the user whose slug is passed to the url
-
users/slug:slug/follow/
This follows the user whose slug is passed to the url
-
users/slug:slug/unfollow/
This unfollows the user whose slug is passed to the url
-
users/slug:slug/followers/
This this lists all the followers of the user whose slug is passed to the url
-
users/slug:slug/following/
This this lists all users that the user whose slug is passed to the url is following
-
profile/int:pk/
This shows a particular users profile, and if the profile is owned by the current user, then he can edit the profile with either a PUT or PATCH request.
The fields needed are date_of_birth, bio, sex, type_of_body, feet, inches, lives_in.
Note: Adding the skills to the user is not handled on this route
{ "date_of_birth": null, "bio": "", "sex": null, "type_of_body": null, "feet": null, "inches": null, "lives_in": "" }
sex accepts one of two options "Male" or "Female"
type_of_body accepts one of four options "Slim", "Average", "Athletic" and "Heavyset"
date_of_birth takes this format "yyyy-mm-dd" and should be put like this "1994-12-22"
feet and inches accepts a number and the front end should do the limiting to a certain length
-
profile/int:pk/skills/
This is for the user to add his skills to his profile.
The skills to be added are from a foreign key
{ "skills": [] }
-
skills/
This is to list all the skills in the database
-
skills/create/
This allows only admin users to create a new skill to the website
{ "name": "", "subcategory": "", "description": "" }
the description gives people us the freedom to explain the skills to people so they can better understand what they are selecting, or explain a particular skill to a random user.
-
skills/int:pk/
This allows only admin users to update and delete a particular skill
{ "name": "", "subcategory": "", "description": "" }
-
user/
This shows the current user logged in his details, and this will allow the user add or change his display picture
one can make a PUT request to this route to update the picture
{ "picture": null }
It is named picture instead of display_picture for convinience on the backend, so when signing up with google, it can automatically send the picture from google to the field
-
users/slug:slug/showcases/
This shows all the showcases of the current user whose slug is passed in the url
-
users/slug:slug/collaboration/
This shows all the collaborations of the current user whose slug is passed in the url
-
users/slug:slug/sadministrator/
This shows all the showcases that the current user whose slug is passed in the url is an administrator to
-
users/slug:slug/cadministrator/
This shows all the collaborations that the current user whose slug is passed in the url is an administrator to
The Showcase app handles the uploading/showcasing of works, admin administrators to a showcase so they can manage the project, and comments, replies and likes to showcases.
Before each of these routes, add api/
-
showcase/create/
This creates a new showcase, and muste be logged in to do this
{ "title": "example title", "description": "example description", "content": null, "skill_type": [ 1,2,3 ] }
The content is the images, videos, audio of the showcase and it is supposed to be gotten from AWS or Cloudnairy. The skill_type also receives an list of the skills id. The route also has a get method and this can be useful to show the fields already selected by the user.
-
showcase/
This shows all of the showcases in the database
-
showcase/mostliked/
This route lists the most liked showcaases of all time
-
showcase/mostlikedy/
This route lists the most liked showcaases of the year
-
showcase/mostlikedm/
This route lists the most liked showcaases of the month
-
showcase/mostlikedw/
This route lists the most liked showcaases of the week
-
showcase/followingshowcases/
Shows all the showcases that a logged in user follows.
-
showcase/slug:slug/
This gets a particular showcase through the slug
-
showcase/slug:slug/edit/
This allows administrators to a particular showcase to edit that showcase
{ "title": "The Gods Must Be Crazy", "description": "", "content": null, "skill_type": [ 1,2,3 ] }
- The content is the images, videos, audio of the showcase and it is supposed to be gotten from AWS or Cloudnairy.
- The skill_type also receives an list of the skills id that you want to add.
- The route also has a get method and this can be useful to show the fields already selected by the user.
-
showcase/slug:slug/like/
Here two requests can be made here, An empty POST request to like and a DELETE request to unlike a particular showcase, which is the showcase of the slug in the URL. The user has to be logged in to do this.
-
showcase/slug:slug/likers/
This lists all the likers to the showcase of the slug in the URL.
-
showcase/slug:slug/admin/
This shows all of the administrators of a particular showcase. This showcase is of the slug passed in the URL.
-
showcase/slug:slug/admin/add/
This allows administrators to add other administrators to the showcase, and you can add more than one user at a time as an admin.
{ "administrator": [ "slug of user", "slug of user" ] }
-
showcase/slug:slug/collaborator/
This shows all the collaborators to a particular showcase
-
showcase/slug:slug/collaborator/add/
This allows an administrator to add a collaborator to a showcase he is an admin of
{ "user": "user-slug", "role": "", "skill": [ 2,1 ] }
-
showcase/collaborator/int:pk/
This shows the details of a particular collaborator
-
showcase/collaborator/int:pk/update/
Allows administrators and the person added as a collaborator to edit the related collaborator's profile
{ "role": "danced throughout the movie", "skill": [ 3 ] }
-
showcase/collaborator/int:pk/delete/
Allows administrators and the person added as a collaborator to delete the related collaborator's profile
-
showcase/slug:slug/comment/
Allows authenticated users to make a comment on a showcase
{ "body": "" }
-
showcase/slug:slug/comments/
lists all the comments to a particular showcase
-
showcase/comments/int:pk/
Allows the owner of the comment to edit using a PUT or PATCH method and to delete the comment with the DELETE method, and must be authenticated to perform the action.
{ "body": "hello there" }
-
showcase/comments/int:pk/like/
An empty POST request to like and a DELETE request to unlike a particular comment
-
showcase/comments/int:pk/reply/
A POST request to reply a particular comment
{ "body": "" }
-
showcase/comments/int:pk/replies/
This lists all the replies to a particular comment. The comment whose id is passed into the URL
-
showcase/replies/int:pk/
This allows a POST and PATCH request to edit a particular reply, and a DELETE request to delete a particular reply. The reply whose id is passed into the URL
{ "body": "" }
-
showcase/replies/int:pk/like/
An empty POST request to like and a DELETE request to unlike a particular reply
The Collaborate app handles the collaboration on projects requests with other people, add administrators to a collaboration so they can manage it, and comments, replies and likes to a collaboration.
Before each of these routes, add api/
-
collaboration/
Shows al the collaboration requests in the database
-
collaboration/create/
This is to create a collaboration request for a project. expects a POST request.
{ "title": "", "description": "", "media": "", "location": "", "looking_for": [1,2] }
-
collaboration/slug:slug/
This is to retrieve a particular collaboration
-
collaboration/slug:slug/edit/
Allows administrators to edit a collaboration (i.e. to change the title, description, media files, location, and skills that are searched for)
{ "title": "", "description": "", "media": "", "location": "", "looking_for": [1,2] }
-
collaboration/slug:slug/admin/
This is to view all administrators to a collaboration.
-
collaboration/slug:slug/admin/add/
This is for adding more administrators to the collaboration.
{ "administrator": [ "ope-doe-kaunts1p0unp6bx", "odedeyi-david-9xgp9xo1jjiqlpk" ] }
-
collaboration/slug:slug/like/
An empty POST request to like and a DELETE request to unlike a particular collaboration.
-
collaboration/slug:slug/likers/
This lists all the likers to the collaboration of the slug in the URL.
-
collaboration/slug:slug/comment/
Allows authenticated users to make a comment on a collaboration.
{ "body": "" }
-
collaboration/slug:slug/comments/
lists all the comments to a particular collaboration.
-
collaboration/slug:slug/interest/
This shows all the interests shown to a collaboration.
-
collaboration/slug:slug/interest/show/
An empty POST and DELETE request to show interest and remove interest.
-
collaboration/comments/int:pk/
Allows the owner of the comment to edit using a PUT or PATCH method and to delete the comment with the DELETE method, and must be authenticated to perform the action.
{ "body": "hello there" }
-
collaboration/comments/int:pk/like/
An empty POST request to like and a DELETE request to unlike a particular comment
-
collaboration/comments/int:pk/reply/
A POST request to reply a particular comment
{ "body": "" }
-
collaboration/comments/int:pk/replies/
This lists all the replies to a particular comment. The comment whose id is passed into the URL
-
collaboration/replies/int:pk/
This allows a POST and PATCH request to edit a particular reply, and a DELETE request to delete a particular reply. The reply whose id is passed into the URL
{ "body": "" }
-
collaboration/replies/int:pk/like/
An empty POST request to like and a DELETE request to unlike a particular reply
- Pagination is automatically done by the app for 20 results per page
- For sign in and sign up, the major packages used were Django allauth and Django rest auth
- Need to fix
- Token authentication (JWT)
- image fields as an object