Code Monkey home page Code Monkey logo

swimmy's Introduction

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.

swimmy's People

Contributors

knehe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.