Skip to content
/ swimmy Public

A Django API for a swimming pool manager to help manage their pools and expose resources to client apps.

Notifications You must be signed in to change notification settings

KNehe/swimmy

Repository files navigation

Django CI

SWIMMY API

  • A Django API for a swimming pool manager to help manage their pools and expose resources to client apps.

Setting up

  • Clone this repository git clone https://github.com/KNehe/swimmy.git.
  • Create a .env file in the project's root directory and add the following variables.
DEBUG=
SECRET_KEY=
  • The following variables are required to upload a swimming pool's image and thumbnail to AWS S3
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_STORAGE_BUCKET_NAME=
AWS_S3_FILE_OVERWRITE=
AWS_QUERYSTRING_AUTH=
AWS_S3_SIGNATURE_VERSION=
AWS_S3_REGION_NAME=
  • The variables below are used to send emails to users using Sendgrid
FRONTEND_URL= e.g FRONTEND_URL=https://yourdomain.com/users/reset_password_confirm
FROM_EMAIL=
SENDGRID_API_KEY=
EMAIL_HOST=smtp.sendgrid.net
EMAIL_USE_TLS=
EMAIL_PORT=
  • The variables below are used by PostgreSQL
DB_NAME_DEV=
DB_USERNAME=
DB_USER_PASSWORD=
DB_HOST=
DB_PORT=
  • Add all your client app origins
CORS_ALLOWED_ORIGINS= e.g CORS_ALLOWED_ORIGINS=http://localhost:3000,http://yourdomain.com
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 anotherhost
  • Create a virtual environment and activate it
  • Run pip install -r requirements.txt
  • Run python manage.py migrate
  • Insert some initial data for swimming pools in db
  • Run python manage.py loaddata dump
  • Run python manage.py runserver
  • Visit http://127.0.0.1:8000/api/v1/pools/ in your browser

Docker

  • Prep .env as described above
  • Run docker compose build
  • Run docker compose up
  • You can now check the server running at http://0.0.0.0:8000/

Apply migrations

  • Run docker ps and get container id of web
  • Run docker exec -t -i <container_id> bash
  • Run python manage.py migrate
  • Insert some initial data for swimming pools in db
  • Run python manage.py loaddata dump
  • Visit http://127.0.0.1:8000/api/v1/pools/ in your browser

Documentation

  • Read the docs at http://127.0.0.1:8000/api/v1/swagger/ or
  • http://127.0.0.1:8000/api/v1/redoc/

Features

  • JWT authentication(access and refresh tokens), register user.
  • JWT verification
  • Authorization (staff, users, object owners)
  • Create and manage pools
  • Book a pool, update, remove a booking
  • View recent user's recent bookings
  • Rate a pool, update, remove a rating
  • View all user's ratings
  • Pagination
  • Pool image upload to AWS S3
  • Password reset request and confirmation
  • Swagger and Redoc documentation

NOTE: Payments for a booking are made on the frontend through a Payment Gateway like PayPal.On success, the required payload is sent to the appropiate API endpoint.

About

A Django API for a swimming pool manager to help manage their pools and expose resources to client apps.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published