Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lilanga/booking-pal-service
Booking pal REST API service for booking pal IoT clients
https://github.com/lilanga/booking-pal-service
bun elysiajs google-apis google-calendar-api prisma typescript
Last synced: about 2 months ago
JSON representation
Booking pal REST API service for booking pal IoT clients
- Host: GitHub
- URL: https://github.com/lilanga/booking-pal-service
- Owner: Lilanga
- Created: 2023-10-08T22:33:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-09T00:19:28.000Z (about 1 year ago)
- Last Synced: 2023-11-09T09:01:34.142Z (about 1 year ago)
- Topics: bun, elysiajs, google-apis, google-calendar-api, prisma, typescript
- Language: TypeScript
- Homepage: https://booking-pal-service.fly.dev/swagger
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://console.cloud.google.com/)
2. Create a new project
3. Go to [Google Calendar API](https://console.cloud.google.com/apis/library/calendar-json.googleapis.com)
4. Enable the API
5. Go to [Google Cloud Console Credentials](https://console.cloud.google.com/apis/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](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](https://bun.sh/) and [Elysia](https://elysia.to/). To get started, install bun globally:
```bash
curl -fsSL https://bun.sh/install | bash
```Then install the dependencies:
```bash
bun install
```Then run the server:
```bash
bun run start
```## Development
To start the development server run:
```bash
bun run dev
```Open 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 to see the API documentation.