Skip to content

92bondstreet/privateaser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PRIVATEASER

JavaScript workshop based on the french startup https://www.privateaser.com

privateaser

Table of Contents generated with DocToc

🐣 Introduction

Privateaser is a marketplace that digitizes the world of event planning for bars, restaurants and venues (+3,000 locations), via a web application.

The Event management is a key sector of the Europe economy:

  • 100 billion euros in Europe
  • 20 billion euros in France
  • historically complex
  • not much digitized: you have to pick up your phone, wait to be called back, go to visit

Privateaser is a trusted third party between the bars and the bookers. The marketplace allows them to:

  • the bookers to find, to compare or to contact a place
  • the bookers to book with an one-click a place for an event
  • the bookers to manage all their events expenses
  • the managers to maximize the occupancy rate and therefore the revenue of their business

🎯 Objectives

We focus on this marketplace feature: to book with an one-click a place for an event.

The workshop goals are to

  1. compute the booking price of the booker
  2. compute the profit of the bar
  3. compute the profit of privateaser

πŸ‘©β€πŸ’» Just tell me what to do

  1. Fork the project via github

fork

  1. Clone your forked repository project https://github.com/YOUR_USERNAME/privateaser
❯ cd /path/to/workspace
❯ git clone [email protected]:YOUR_USERNAME/privateaser.git
  1. Open the entry point /public/index.html in your browser (that loads the index.js file)
# macos cli
❯ open public/index.html
# linux cli
❯ xdg-open public/index.html

# or by double-clicking in your browser files
  1. Check the ouput in your browser console (Use Ctrl + Shift + J or Cmd + Opt + J to focus to your console devtools)
  2. Solve each steps inside ./public/index.js file with JavaScript
  3. Once a step is solved, commit your modification:
❯ cd /path/to/workspace/privateaser
❯ git add -A && git commit -m "feat(price): decrease pricing according people"

(why following a commit message convention?

  1. 5 steps, so ideally 5 commits
  2. Don't forget to push before the end of the workshop
❯ git push origin master

Note: if you catch an error about authentication, add your ssh to your github profile.

  1. Check that your codebase works by checking the console output
  2. If you need some helps on git commands, read git - the simple guide

Don't forget:

  • DRY - Don't repeat yourself
  • DOT - Do One Thing
  • KISS - Keep It Simple Stupid
  • LIM - Less Is More
  • English only: codebase, variables, comments...

Focus only on coding, forgot the browser display (next workshop!).

Use console.log to display results (for the moment)

πŸƒβ€β™€οΈ Steps to do

⌚ Step 1 - Euro-People

Booking price

The booker books a place for an specific time range and a set of persons.

The booking price is the sum of the time component and the people component with

  • time component: the number of booked time multiplied by the bar price per hour
  • people component: the number of persons multiplied by the bar price per person
booking price = time + people

Just tell me what to do

Write JS code that generates the booking price for each booker from index.js file:

//example output from console.log
[
  {
    "id": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    ...
    "price": ?
  },
  {
    "id": "65203b0a-a864-4dea-81e2-e389515752a8",
    ...
    "price": ?
  },
  {
    "id": "94dab739-bd93-44c0-9be1-52dd07baa9f6",
    ...
    "price": ?
  }
]

🍺 Step 2 - Send more, pay less

Decreasing pricing for people

To be as competitive as possible, Privateaser decide to have a decreasing pricing for groups of important people

New price rules

price per people

  • decreases by 10% after 10 persons
  • decreases by 30% after 20 persons
  • decreases by 50% after 60 persons

Just tell me what to do

Adapt the booking price computation to take these new rules into account.

//example output from console.log
[
  {
    "id": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    ...
    "price": ?
  },
  {
    "id": "65203b0a-a864-4dea-81e2-e389515752a8",
    ...
    "price": ?
  },
  {
    "id": "94dab739-bd93-44c0-9be1-52dd07baa9f6",
    ...
    "price": ?
  }
]

πŸ’° Step 3 - Give me all your money

Now, it's time to pay the bar

There is a 30% commission on the booking price to cover the costs.

Commission

The commission is split like this:

  • insurance: half of commission
  • the Treasury: 1€ by person
  • Privateaser: the rest

Just tell me what to do

Compute the amount that belongs to the insurance, to the Treasury and to Privateaser.

//example output from console.log
[
  {
    "id": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    ...
    "commission": {
      "insurance": ?,
      "treasury": ?
      "privateaser": ?
    }
  },
  ...
]

πŸ’Έ Step 4 - The famous deductible

In case of an accident/theft, Privateaser applies a 5000€ deductible.

The booker can reduce the deductible amount from 5000€ to 200€ with a deductible option for a few more euros per person.

The deductible

The booker is charged an additional 1€/person when he chooses the deductible reduction option.

The additional charge goes to Privateaser, not to the bar.

Just tell me what to do

Compute the new amount price if the booker subscribed to deductible option.

//example output from console.log
[
  {
    "id": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    'options': {
      'deductibleReduction': true
    },
    ...
    "price": ?
  },
  ...
]

πŸ’³ Step 5 - Pay the actors

The actors

It's time to debit/credit each actor!

  • the booker must pay the booking price and the (optional) deductible reduction
  • the bar receives the booking price minus the commission
  • the insurance receives its part of the commission
  • the Treasury receives its part of the tax commission
  • Privateaser receives its part of the commission, plus the deductible reduction

Just tell me what to do

  • Compute the debit for the booker
  • Compute the credit of the bar, insurance, Treasury and Privateaser.
//example output from console.log
[
  {
    "deliveryId": "bba9500c-fd9e-453f-abf1-4cd8f52af377",
    "payment": [
      {
        "who": "booker",
        "type": "debit",
        "amount": ?
      },
      {
        "who": "bar",
        "type": "credit",
        "amount": ?
      },
      {
        "who": "insurance",
        "type": "credit",
        "amount": ?
      },
      {
        "who": "treasury",
        "type": "credit",
        "amount": ?
      },
      {
        "who": "privateaser",
        "type": "credit",
        "amount": ?
      }
    ]
  },
  ...
]

Source and inspiration

Licence

Uncopyrighted