GithubHelp home page GithubHelp logo

express-booking's Introduction

Architecture & Technologies

ARCH

Prerequisites

Install docker

Install docker-compose

Getting Started ๐Ÿš€

Run it

git clone https://github.com/sahar-fehri/express-booking.git
cd express-booking
docker-compose up

Test it

With postman

Under postman folder you will find the environment and the collection to import into your postman.

Import the collection and for the env change the ip to put your own IP.

Finally you should have a total of 5 endpoints.

With swagger

Open your browser at http://ip:3000/api-docs/

  1. Register a user

  2. Login the user and copy the jwt token in the response

  3. Click Authorize button and paste the token

  4. Test the rest of the endpoints (book/cancel/availabilities)

Everytime you want to book with a new user please redo the first 3 steps

Scenario to test

We suppose that room ids will go from 0 to 19 and the timestamps will come fromt the frontend, but for the sake of testing we wont use real timestamps.

Companies entered for user registration should be either: cola or pepsi

  1. Register a user by entering for example:

    name: sam

    email: [email protected]

    password: 123

    company: cola

  2. Login the user by entering:

    email: [email protected]

    password: 123

  3. Book a room with id:0 from 8AM to 9AM by sam:

    resource: 0

    from: 8

    to: 9

Should be successful

  1. Book same room with id:0 from 8AM to 9AM by sam:

    resource: 0

    from: 8

    to: 9

Should fail with error text 'AlreadyBooked'

  1. Book another room with id:2 from 11AM to 12 by sam:

    resource: 2

    from: 11

    to: 12

Should be successful

  1. Check availabilities (Should find two booked rooms)

  2. Book another same room with id:2 from 11AM to 13AM ny sam

    resource: 2

    from: 11

    to: 13

Should fail with error text 'Slot Already Booked'

  1. Register another user:

    name: elon

    email: [email protected]

    password: 123

    company: pepsi

  2. Login the user by entering:

    email: [email protected]

    password: 123

  3. Cancel room already booked by sam with id:2 from 11AM to 12 by sam:

    resource: 2

    from: 11

    to: 12

Should fail with errortext 'You did not book this slot'

You can try to book/cancel different slots and check the availibility.

If you try booking 10 different rooms with users from only cola for exp the 11th booking should fail.

Happy testing ๐Ÿ˜ ๐ŸŽ‰

express-booking's People

Contributors

sahar-fehri 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.