Giter VIP home page Giter VIP logo

booking-api's Introduction

Booking Api

The Booking API is built on top of the Shopify GraphQL API. We are reducing the number of calls to the Booking API by saving a lot of documents from MongoDB into Shopify metafields. This approach allows us to take advantage of Shopify as a hosting provider.

User documents are saved in Shopify user metafields. Products are stored in the corresponding product metafields. Locations will also be saved soon.

For each user, we create a new collection that contains all their services. We also create products that users can duplicate. These products come pre-set with metafields and are ready to be modified. Additionally, we have organized products into specific collections; for example, the "Hairstylist" collection includes services related to hairstyling.

TODO:

  • We need to move the booking time to the browser, returning only the booked time range.

Setup

The guide is not complete, since there is some metafields that needs to be setup in each product.

1. Edit local.settings.json.example

Assign the correct value to all env values and rename to local.settings.json

2. Add Carrier

You have to add carrier service to shopify, so it can calculate location distance.

POST https://{shop}.myshopify.com/admin/api/2022-10/carrier_services.json

{
  "carrier_service": {
    "name": "Beauty Shipping",
    "callback_url": "https://{apiURL}/api/shipping/rates",
    "service_discovery": true
  }
}

Then you need to add the carrier in the "Shipping and delivery" inside shopify Settings https://admin.shopify.com/store/{shopName}/settings

3. Add Webhooks

You need to create webhooks callback in the notifications. https://admin.shopify.com/store/bysistersdk/settings/notifications (scroll bottom on notification page, click webhooks)

Order update: https://{apiUrl}/api/webhooks/order

Crder creation: https://{apiUrl}/api/webhooks/order

Product update: https://{apiUrl}/api/webhooks/product

OpenAPI fragments and components (openapi/)

These files are part of the OpenAPI definition but not yet bundled together. These individual files contain different parts of the API specification, such as paths, schemas, or security definitions. These components are organized in a modular way, making it easier to maintain and update the API documentation.

Bundle openapi

npm run bundle

Github Actions

pull request

  1. Running all specs (jest)

main branch

  1. Bundle openapi fragments and generating the api documentation page
  2. Deploy docs folder to pages
  3. Deploy Azure functions to production

Postman

In case you need to import openapi def in postman you can use this script to set token in your env after login.

Please create new environment or else below code will not work.

let responseJson = pm.response.json();
let token = responseJson.payload.token;
pm.environment.set("bearerToken", token);

Index.ts

We try to NOT export all internal files from index folder file because we would like to mock single methods in jest. It's eaiser when not using index file.

What's included

  • Azure Functions
  • Azure Durable
  • Google Map
  • Shopify Api
  • Mongoose (MongoDB)
  • Zod (validation)
  • DateFns
  • Openapi
  • Orval

booking-api's People

Contributors

jamalsoueidan avatar actions-user avatar

Stargazers

Said Mansour avatar

Watchers

James Cloos avatar  avatar Kostas Georgiou avatar  avatar

booking-api's Issues

RESERVERATION: show the driving information in the calendar

We need to add the driving information in the calendar, like when to start driving to the customer, we can get this from shippingID.

We need to create a new api endpoint that only return shipping information for the orders, and unique so we don't have duplicated shipping events.

Add the endpoint to eventsource in the fullcalendar on the frontend.

We will have bookings and orders endpoint.

Bookings is for calendar section.

  • get-group-by-id
  • range

Orders is for order section.

  • get

PROFILE: option to type price/compare-price instead of dropdown

We need to change the price from dropdown selection to input type any price.

Process.

  1. frontpage check for price variant already exist, if not (ask booking-api to create it)
  2. afterwards post new service or update service
  3. webhook to listen to product update (delete old unused variants)

Frontend changes:

  1. UI form (price input, compare input)
  2. Storefront graphql find variant price/compare

Backend changes:

  1. Webhook for product change, then figure out if all product variants is used
  2. Create new endpoint to create new variant on product.

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.