Giter VIP home page Giter VIP logo

booking-pal-service's Introduction

Booking Pal Service

Booking pal service is a REST web service that allows booking pal IoT clients to connect and manage their room calendars.

Configurations

This service is using service account key to connect to Google Calendar API. Each calendar should have its own service account key. The service account key should be placed in calendarCredentials database table. The service account key should be in JSON format and stored in the serviceAccountKey column. Calendar Details table should have correct mapping to the valid calendar credentials.

To configure the service account for google calendar API, follow the steps below:

  1. Go to Google Cloud Console
  2. Create a new project
  3. Go to Google Calendar API
  4. Enable the API
  5. Go to Google Cloud Console Credentials
  6. Create a new service account
  7. Download the service account key in JSON format
  8. Store the service account key in calendarCredentials database table

You may need to share your calendar with the service account email address.

Also, get the calendar ID from your calendar settings and store it in the calendarDetails database table.

Please refer to this documentation on how to configure the service account key: https://developers.google.com/identity/protocols/oauth2/service-account

Database

Database has two configuration tables:

  1. calendarCredentials - This table stores the service account key for each calendar or set of calendars. The service account key should be in JSON format and stored in the serviceAccountKey column.
  2. calendarDetails - This table stores the calendar details. The calendar ID should be stored in the calendarId column. The calendarCredentialsId column should be mapped to the correct calendarCredentials table row. The calendarName column should be the name of the calendar. apiKey column should be the API key for the calendar. API key is used to authenticate the IoT client to the valid calendar.

Environment Variables

Name Description Default Value
PORT The port to run the server on 3000
DATABASE_URL The database connection string postgres://postgres:postgres@localhost:5432/booking-pal

Project Structure

This is created using Bun and Elysia. To get started, install bun globally:

curl -fsSL https://bun.sh/install | bash

Then install the dependencies:

 bun install

Then run the server:

bun run start

Development

To start the development server run:

bun run dev

Open http://localhost:3000/ with your browser to see the result.

Elysia is a hot-reloading server, so any changes you make to the code will be reflected in the browser immediately.

Also service is configured with swagger, so you can access the swagger UI at http://localhost:3000/swagger to see the API documentation.

booking-pal-service's People

Contributors

lilanga avatar

Watchers

 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.