Create a submissions app where one can submit their hackathon submissions & see the list.
This is a internship task for a Backend Developer Internship where the task given is to create a simple Hackathon hosting application.
python, pip, bash
LINK: https://easyupload.io/rymzac
Follow these commands to setup the project.
- Create a virtual env.
python3 -m venv venv
- Activate the environment.
source venv/bin/activate
- Install the requirements.
pip3 install -r requirements.txt
- Make migrations.
python3 manage.py makemigrations
- Apply migrations.
python3 manage.py migrate
- Run server.
python3 manage.py runserver
URL: /
Request type: GET
Authorization: False
Response:
"Welcome to AI-Planet-Assignment"
-
Task: Register Users to the application. URL: /users/register Request type: POST Authorization: False Sample Request Data: { "name":"Mohan", "email":"mohan@gmail.com", "password":"abcd" } Response: { "message": "USER_REGISTER" }
-
Task: Login the user to get token URL: /users/login Request type: POST Authorization: False Sample Request Data: { "email":"mohan@gmail.com", "password":"abcd" } Response: { "user_id": "ec3c816a-17f3-46d9-aab5-637e440e0217", "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiZWMzYzgxNmExN2YzNDZkOWFhYjU2MzdlNDQwZTAyMTciLCJleHAiOjE2ODQ4MzQzNzF9.JhUUGX_4z2CaOIeWHM9fp_0PRRnA9xGhmS4yi24kbTk" }
Save this
access_token
, and use it in headers having value of keyAuthorization
to be logged in as a secure user -
Task: Check currently logged in user profile URL: /users/check_profile Request type: GET Authorization: True Response: "aryan@gmail.com - Aryan - (7a9d5052-ffc0-46a7-b6d3-9ec50426d32f)"
-
Task: Staff members only can create hackathon. URL: /hackathons/create Request type: POST Authorization: True Sample Request Data: { "title":"Trial5", "start_time":"23-04-28 09:00:00", "end_time":"23-04-29 09:00:00", "description":"Trial Hackathon", "reward_prize":"10000 Rupees" } Response: { "message": "HACKATHON_CREATED" }
-
Task: Get all hackathons with filters **ALL (Default), FINISHED, ONGOING, INCOMING** URL: /hackathons/get_hackathons Query Parameter: filter= [ALL, FINISHED, ONGOING, INCOMING] Request type: GET Authorization: True Response: [ { "id": "81a1d103-1fa9-498f-9d6b-4036e12723b3", "title": "Trial3", "description": "Trial Hackathon", "background_image": null, "hackathon_image": null, "start_time": "2023-04-20T09:00:00Z", "end_time": "2023-04-27T09:00:00Z", "reward_prize": "10000 Rupees" } ]
-
Task: Users can enroll in hackathons URL: /hackathons/hackathon_register Request type: POST Authorization: True Sample Request Data: { "hackathon_id":"6c3e7ba2-63ff-40ca-bec9-d9a5ae99e494" } Response: { "message": "USER REGISTERED FOR HACKATHON" }
-
Task: Get hackathons list where user is enrolled URL: /hackathons/get_registered_hackathons Request type: GET Authorization: True Response: [ { "id": "81a1d103-1fa9-498f-9d6b-4036e12723b3", "title": "Trial3", "description": "Trial Hackathon", "background_image": null, "hackathon_image": null, "start_time": "2023-04-20T09:00:00Z", "end_time": "2023-04-27T09:00:00Z", "reward_prize": "10000 Rupees" } ]
-
Task: User can submit for enrolled hackathon. URL: /submissions/create_submission Request type: POST Authorization: True Sample Request Data: { "title":"submission1", "summary":"test", "hackathon_id":"81a1d103-1fa9-498f-9d6b-4036e12723b3", "submission_link":"www.google.com" } Response: { "message": "Submission Created" }
-
Task: User can get their submissions URL: /submissions/get_submissions Request type: GET Authorization: True Response: [ { "id": "f48d0c51-2a49-4464-95a3-4a9740feeaa2", "title": "submission1", "summary": "test", "created_at": "2023-04-23T08:52:20.522498Z", "user": { "user_id": "7a9d5052-ffc0-46a7-b6d3-9ec50426d32f", "name": "Aryan", "email": "aryan@gmail.com" }, "hackathon": { "id": "81a1d103-1fa9-498f-9d6b-4036e12723b3", "title": "Trial3", "description": "Trial Hackathon", "background_image": null, "hackathon_image": null, "start_time": "2023-04-20T09:00:00Z", "end_time": "2023-04-27T09:00:00Z", "reward_prize": "10000 Rupees" }, "details": { "submission_link": "www.google.com", "submission_type": "LINK" } } ]