Skip to content

Enrikaa/Reservations

Repository files navigation

Overview

This is a internal services which can get meeting room reservations, create reservation, cancel reservation.

TECHNOLOGIES

  • Python
  • Django
  • Django REST Framework
  • Djoser
  • Postman
  • PostgreSQL
  • Docker

SETUP

Run the project with Docker:

docker-compose up --build

Everything can be checked in Postman and Django Rest Framework. Below are instructions to help test the API in a Postman. First you need to login to get Auth Token with default user: [email protected] and password: admin. From login you will receive "auth_token". This token gives access to every API endpoint.

In your Postman import API endpoint collection fixture file named: Reservations.postman_collection.json

RUNNING TESTS

  1. Run docker containers

     docker-compose up
  2. Run pytest inside container

     docker exec -it reserv_api_1 /bin/bash -c "pytest"

GET AUTH TOKEN

  1. Get token from authentication:
    • In Postman use this endpoint:
      http://localhost:8000/api/v1/token/login/
      Make POST request and take auth_token from login. Use default credentials email: [email protected] password: admin

CHECK ALL EXISTING ROOMS

  1. Check all existing rooms:
    • In Postman use this endpoint:
      http://localhost:8000/api/v1/rooms/all/
      Use "auth_token"in the "Headers -> KEY: Authorization -> VALUE: Token {{ token }}" Make GET request and check all existing rooms

CHECK ALL EXISTING RESERVATIONS

  1. Check all existing reservations:
    • In Postman use this endpoint:
      http://localhost:8000/api/v1/reservations/all/
      Use "auth_token"in the "Headers -> KEY: Authorization -> VALUE: Token {{ token }}" Make GET request and check all existing reservations

GET MEETING ROOM RESERVATIONS

  1. Get meeting room reservations:
    • In Postman use this endpoint:
      http://localhost:8000/api/v1/reservations/room/1/
      Use "auth_token"in the "Headers -> KEY: Authorization -> VALUE: Token {{ token }}" Make GET request and check meeting room reservations

CREATE RESERVATION

  1. Create reservation:
    • In Postman use this endpoint:
      http://localhost:8000/api/v1/create/reservation/
      Use "auth_token"in the "Headers -> KEY: Authorization -> VALUE: Token {{ token }}" Make POST request and create reservation
    • Body example in Postman collection

CANCEL RESERVATION

  1. Cancel reservation
    • In Postman use this endpoint:
      http://localhost:8000/api/v1/reservation/delete/1/
      Use "auth_token"in the "Headers -> KEY: Authorization -> VALUE: Token {{ token }}" Make DELETE request and delete reservation by id

LOGOUT

  1. Logout and destroy token
    • In Postman use this endpoint:
      http://localhost:8000/api/v1/token/logout/
      Use "auth_token"in the "Headers -> KEY: Authorization -> VALUE: Token {{token}}" Make POST request and logout

Contact

Created by @enrika - feel free to contact me!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published