This is the backend server of the project GamerTalk. You can find the frontend server here.
GamerTalk is an application that allows gamers to connect with each other with the goal of building connections and offering language exchange opportunities.
Deployment: https://gamertalk.onrender.com/
Task | Tech |
---|---|
Language | |
Framework | |
Database | |
Container |
Click here for the Frontend Tech Stack.
-
Clone the repository or create your own fork of the project:
git clone https://github.com/GamerTalk/Backend.git
If you forked the project, you will need to get the link for your own fork.
Next, chose to either run the backend in a docker container or locally on your own machine
-
Copy the contents of the
.envexample
file into a.env
file. -
Run the following command from your application root directory
docker-compose build
docker-compose up
or (run as deamon)
docker-compose up -d
If you need to rebuild the container:
docker-compose up --build
Migrate Django database:
docker-compose exec app python manage.py migrate
To import test database:
docker-compose exec app python manage.py loaddata fixtures/testusers.json
Optional but recommended: create a virtual dev environment at the root level. 2. Install dependencies:
```bash
pip install -r requirements.txt
```
-
Create a
.env
file at the root level of the project. Use the.env.example
file for what environment variables are required. -
Set up the database. This command with create a db.sqlite3 file in the config folder.
python manage.py migrate
-
Optional, load test users to database
python manage.py loaddata fixtures/testusers.json
-
(Not necessary for Docker) Start the development server:
python manage.py runserver
-
Open your browser and go to
http://localhost:8000/
to access the application.
Description: Creates the user information entry into the database.
-
Body Parameters:
{ "uid": "string", "username": "string", "about_me": "string", "fluent": ["string", "string"], "learning": [{"language":"string", "level": 1}, ...], "date_of_birth": "1999-01-01", "systems": ["string","string"], "genre": ["string", "string"], "currently_playing": "string", "region": "string" "profile_picture_url": "urlstring" }
-
Response:
-
Status Code: 200 (OK)
-
Response Body:
{ "uid": "uid", "username": "username", "about_me": "about_me", "fluent": "array", "learning": "array of object", "date_of_birth": "date_of_birth", "languages_column": "JSON", "systems": "user_systems", "genre": "genre", "region": "region" }
-
Description: Updates the user information entry into the database.
-
Body Parameters:
{ "uid": "string", "username": "string", "about_me": "string", "fluent": ["string", "string"], "learning": [{"language":"string", "level": 1}, ...], "date_of_birth": "1999-01-01", "systems": ["string","string"], "genre": ["string", "string"], "currently_playing": "string", "region": "string" "profile_picture_url": "urlstring" }
-
Response:
-
Status Code: 200 (OK)
-
Response Body:
{ "uid": "uid", "username": "username", "about_me": "about_me", "fluent": "array", "learning": "array of object", "date_of_birth": "date_of_birth", "languages_column": "JSON", "systems": "user_systems", "genre": "genre", "region": "region" }
-
Description: Takes in the filter parameters in the header and returns an array of users that fit said parameters
-
Header Parameters:
{ "systems":["playstation", "switch"], "genre":["shooters", "rpg"], "language": "japanese", "regions": ["north america"] }
-
Response:
-
Status Code: 200 (OK)
-
Response Body:
[ { "uid": "uid", "username": "username", "about_me": "about_me", "fluent": "array", "learning": "array of object", "date_of_birth": "date_of_birth", "languages_column": "JSON", "systems": "user_systems", "genre": "genre", "region": "region" }, ... ]
-
Description: Takes in the users uid parameter in the header and returns the user object
-
Header Parameters:
{ "uid":"string" }
-
Response:
-
Status Code: 200 (OK)
-
Response Body:
{ "uid": "uid", "username": "username", "about_me": "about_me", "fluent": "array", "learning": "array of object", "date_of_birth": "date_of_birth", "languages_column": "JSON", "systems": "user_systems", "genre": "genre", "region": "region" },
-
Description: Takes in the users uid parameter in the body with a confirmation code, and returns the user object
- Body Parameters:
{ "uid": "user uid", "secretCode": "unique code" }
- Response:
- Status Code: 200 (OK) || 400 (user doesn't exist)
- Response Body:"success or failure string"
Description: Takes in the users post in the body and stores it in the database.
- Body Parameters:
{ "uid": "uid", "message":"message", "time_of_message": "2015-03-25T12:00:00Z" }
- Response:
- Status Code: 200 (OK)
- Response Body:
{ "uid": "uid", "message":"message", "time_of_message": "2015-03-25T12:00:00Z" }
Description: Returns an array of all public users post.
- Response:
- Status Code: 200 (OK)
- Response Body:
[ { "uid": "uid", "message":"message", "time_of_message": "2015-03-25T12:00:00Z" }, ... ]
Description: Takes in the new flashcard information in the body and stores it in the flashcard database.
- Body Parameters:
{ "uid": "uid", "front":"language1", "back": "language2" }
- Response:
- Status Code: 200 (OK)
- Response Body:
{ "user_uid": "uid", "front":"language1", "back": "language2" }
Description: Takes in the users uid in the header, and returns all users flashcards as an array.
- Header Parameters:
{ "uid": "uid" }
- Response:
- Status Code: 200 (OK)
- Response Body:
[ { "user_uid": "uid", "front":"language1", "back": "language2" }, ... ]
Description: Takes in the users uid and the cards id, and deletes it from the database.
- Header Parameters:
{ "uid": "uid", "card_id": "Card id number" }
- Response:
- Status Code: 200 (OK)
- Response Body:
True
Contributions are welcome! Please follow these steps to contribute to the project:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your changes to your forked repository.
- Submit a pull request with a clear description of your changes.
MIT License
Copyright © 2023 GamerTalk
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.