From 12577845d6c0c7a1b5c9afa5ef97e8250161fd67 Mon Sep 17 00:00:00 2001 From: ashutosh-bansal-2136 <82804130+ashutosh-bansal-2136@users.noreply.github.com> Date: Mon, 2 Aug 2021 14:59:06 +0530 Subject: [PATCH] docs(schedular-service and video-conferencing-service): update README.md (#277) --- README.md | 94 ++--- .../src/datasources/index.ts | 1 + .../datasources/schedular.cache.datasource.ts | 32 ++ .../datasources/scheduler.pg.datasource.ts | 4 +- services/scheduler-service/README.md | 347 +++++++----------- services/scheduler-service/openapi.json | 31 ++ services/scheduler-service/openapi.md | 62 ++++ .../calendar-subscription.controller.ts | 13 + .../calendar-working-hour.controller.ts | 1 + .../src/controllers/calendar.controller.ts | 15 + .../event-attachment.controller.ts | 6 + .../controllers/event-attendee.controller.ts | 8 + .../src/controllers/event.controller.ts | 16 + .../src/controllers/settings.controller.ts | 5 + .../controllers/working-hour.controller.ts | 10 + services/video-conferencing-service/README.md | 144 ++++---- .../video-conferencing-service/openapi.json | 9 + .../video-conferencing-service/openapi.md | 18 + .../video-chat-archive.controller.ts | 8 + .../video-chat-session.controller.ts | 14 + 20 files changed, 507 insertions(+), 331 deletions(-) create mode 100644 sandbox/scheduler-example/src/datasources/schedular.cache.datasource.ts diff --git a/README.md b/README.md index 5c14f71c0b..586081a104 100644 --- a/README.md +++ b/README.md @@ -1,57 +1,61 @@ # Sourceloop -[![LoopBack](https://github.com/strongloop/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)-@2x.png)](http://loopback.io/) +[![LoopBack]()](http://loopback.io/) [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) -The `Sourceloop` is a collection of pre-built microservices that aim to reduce time to market for Enterprise projects. Large enterprises usually face a similar set of challenges when developing cloud native platforms as part of digital transformation efforts or the creation of new products. The services are implemented as [LoopBack Extensions](https://loopback.io/doc/en/lb4/Extending-LoopBack-4.html), allowing you to install them into existing LoopBack applications or use the [LoopBack Command-line interface](https://loopback.io/doc/en/lb4/Command-line-interface.html) to generate standalone services. Our recommended approach is to deploy these services as standalone micro-services in Docker. +The `Sourceloop` is a collection of pre-built microservices that aim to reduce time to market for Enterprise projects. Large enterprises usually face a similar set of challenges when developing cloud native platforms as part of digital transformation efforts or the creation of new products. The services are implemented as [LoopBack Extensions](https://loopback.io/doc/en/lb4/Extending-LoopBack-4.html), allowing you to install them into existing LoopBack applications or use the [LoopBack Command-line interface](https://loopback.io/doc/en/lb4/Command-line-interface.html) to generate standalone services. Our recommended approach is to deploy these services as standalone micro-services in Docker. The current catalog consists of the following services: -* [audit-service](services/audit-service) -* [authentication-service](services/authentication-service) -* [in-mail-service](services/in-mail-service) -* [notification-service](services/notification-service) -* [scheduler-service](services/scheduler-service) -* [video-conferencing-service](services/video-conferencing-service) -* [bpmn-service](services/bpmn-service) +- [audit-service](services/audit-service) +- [authentication-service](services/authentication-service) +- [in-mail-service](services/in-mail-service) +- [notification-service](services/notification-service) +- [scheduler-service](services/scheduler-service) +- [video-conferencing-service](services/video-conferencing-service) +- [bpmn-service](services/bpmn-service) +- [chat-service](services/chat-service) This repository also contains a set of example projects in the [sandbox](sandbox) directory that can be run from `docker-compose`. -* [auth-multitenant-example](sandbox/auth-multitenant-example) -* [auth-ms-basic-example](sandbox/auth-ms-basic-example) -* [notification-socket-example](sandbox/notification-socket-example) -* [workflow-ms-example](sandbox/workflow-ms-example) -* [audit-ms-example](sandbox/audit-ms-example) -* [in-mail-example](sandbox/in-mail-example) +- [audit-ms-example](sandbox/audit-ms-example) +- [auth-multitenant-example](sandbox/auth-multitenant-example) +- [auth-ms-basic-example](sandbox/auth-ms-basic-example) +- [notification-socket-example](sandbox/notification-socket-example) +- [workflow-ms-example](sandbox/workflow-ms-example) +- [audit-ms-example](sandbox/audit-ms-example) +- [in-mail-example](sandbox/in-mail-example) +- [scheduler-example](sandbox/scheduler-example) +- [video-conferencing-ms-example](sandbox/video-conferencing-ms-example) ## Table of Contents - [Sourceloop](#Sourceloop) - * [Table of Contents](#table-of-contents) - + [Long Term Support](#long-term-support) - + [Documentation](#documentation) - + [Getting Started](#getting-started) - + [Production Deployment](#production-deployment) - + [Related Projects](#related-projects) - + [Feedback](#feedback) - + [Contributing](#contributing) - + [Code of Conduct](#code-of-conduct) - + [License](#license) - + - [Table of Contents](#table-of-contents) + - [Long Term Support](#long-term-support) + - [Documentation](#documentation) + - [Getting Started](#getting-started) + - [Production Deployment](#production-deployment) + - [Related Projects](#related-projects) + - [Feedback](#feedback) + - [Contributing](#contributing) + - [Code of Conduct](#code-of-conduct) + - [License](#license) + ### Long Term Support TODO: Establish LTS policy or document here that the catalog is still in development and has not reached an LTS release yet. -| Version | Status | Published | EOL | -| ------- | ------ | --------- | ---- | -| | | | | +| Version | Status | Published | EOL | +| ------- | ------ | --------- | --- | +| | | | | ### Documentation -* [LoopBack| LoopBack Documentation](https://loopback.io/doc/en/lb4/) -* [Extending LoopBack | LoopBack Documentation](https://loopback.io/doc/en/lb4/Extending-LoopBack-4.html) +- [LoopBack| LoopBack Documentation](https://loopback.io/doc/en/lb4/) +- [Extending LoopBack | LoopBack Documentation](https://loopback.io/doc/en/lb4/Extending-LoopBack-4.html) ### Getting Started @@ -152,7 +156,7 @@ import {ServiceMixin} from '@loopback/service-proxy'; import path from 'path'; import {MySequence} from './sequence'; -import { ExampleServiceComponent } from '@sourceloop/example-service'; +import {ExampleServiceComponent} from '@sourceloop/example-service'; import * as dotenv from 'dotenv'; import * as dotenvExt from 'dotenv-extended'; @@ -199,7 +203,6 @@ export class ExampleApplicationApplication extends BootMixin( }; } } - ``` Modify the environment variable file to have the following contents: @@ -208,11 +211,11 @@ Modify the environment variable file to have the following contents: NODE_ENV=dev ``` -You can now run the example service with `npm start`. +You can now run the example service with `npm start`. ### DataSources and Migrations -The `Sourceloop` can support any Loopback 4 [DataSource](https://loopback.io/doc/en/lb4/DataSource.html). While you may see existing `DataSource`s, it is not mandatory to use them. +The `Sourceloop` can support any Loopback 4 [DataSource](https://loopback.io/doc/en/lb4/DataSource.html). While you may see existing `DataSource`s, it is not mandatory to use them. The migrations required for this service are processed during the installation automatically if you set the `SOURCELOOP_MIGRATION` env variable. The migrations use [`db-migrate`](https://www.npmjs.com/package/db-migrate) with [`db-migrate-pg`](https://www.npmjs.com/package/db-migrate-pg) driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB. @@ -228,15 +231,15 @@ Inside of the `sandbox` folder, you will find example applications and Dockerfil The `Sourceloop` utilizes many extensions created by SourceFuse. -* [sourcefuse/loopback4-ratelimiter: A rate limiting extension for loopback4 applications (github.com)](https://github.com/sourcefuse/loopback4-ratelimiter) -* [sourcefuse/loopback4-notifications: An extension for setting up various notification mechanisms in loopback4 application, vis-a-vis, Push notification, SMS notification, Email notification (github.com)](https://github.com/sourcefuse/loopback4-notifications) -* [sourcefuse/loopback4-s3: A loopback4 extension for AWS S3 integration (github.com)](https://github.com/sourcefuse/loopback4-s3) -* [sourcefuse/loopback4-audit-log: A loopback-next extension for implementing audit logs in loopback applications for all DB transactions. (github.com)](https://github.com/sourcefuse/loopback4-audit-log) -* [sourcefuse/loopback4-soft-delete: A loopback4 extension for soft delete feature (github.com)](https://github.com/sourcefuse/loopback4-soft-delete) -* [sourcefuse/loopback4-authentication: A loopback-next extension for authentication feature. Oauth strategies supported. (github.com)](https://github.com/sourcefuse/loopback4-authentication) -* [sourcefuse/loopback4-authorization: An authorization extension for loopback4 applications (github.com)](https://github.com/sourcefuse/loopback4-authorization) -* [sourcefuse/loopback4-helmet: A loopback4 extension for helmetjs integration (github.com)](https://github.com/sourcefuse/loopback4-helmet) -* [sourcefuse/loopback4-vault: A loopback-next extension for HashiCorp's Vault integration in loopback-next applications (github.com)](https://github.com/sourcefuse/loopback4-vault) +- [sourcefuse/loopback4-ratelimiter: A rate limiting extension for loopback4 applications (github.com)](https://github.com/sourcefuse/loopback4-ratelimiter) +- [sourcefuse/loopback4-notifications: An extension for setting up various notification mechanisms in loopback4 application, vis-a-vis, Push notification, SMS notification, Email notification (github.com)](https://github.com/sourcefuse/loopback4-notifications) +- [sourcefuse/loopback4-s3: A loopback4 extension for AWS S3 integration (github.com)](https://github.com/sourcefuse/loopback4-s3) +- [sourcefuse/loopback4-audit-log: A loopback-next extension for implementing audit logs in loopback applications for all DB transactions. (github.com)](https://github.com/sourcefuse/loopback4-audit-log) +- [sourcefuse/loopback4-soft-delete: A loopback4 extension for soft delete feature (github.com)](https://github.com/sourcefuse/loopback4-soft-delete) +- [sourcefuse/loopback4-authentication: A loopback-next extension for authentication feature. Oauth strategies supported. (github.com)](https://github.com/sourcefuse/loopback4-authentication) +- [sourcefuse/loopback4-authorization: An authorization extension for loopback4 applications (github.com)](https://github.com/sourcefuse/loopback4-authorization) +- [sourcefuse/loopback4-helmet: A loopback4 extension for helmetjs integration (github.com)](https://github.com/sourcefuse/loopback4-helmet) +- [sourcefuse/loopback4-vault: A loopback-next extension for HashiCorp's Vault integration in loopback-next applications (github.com)](https://github.com/sourcefuse/loopback4-vault) ### Feedback @@ -244,7 +247,7 @@ If you've noticed a bug or have a question or have a feature request, [search th ### Contributing -* [Development Guidelines](https://github.com/sourcefuse/loopback4-microservice-catalog/blob/master/DEVELOPING.md) +- [Development Guidelines](https://github.com/sourcefuse/loopback4-microservice-catalog/blob/master/DEVELOPING.md) ### Code of Conduct @@ -253,4 +256,3 @@ Code of conduct guidelines [here.](CODE_OF_CONDUCT.md) ### License [MIT](LICENSE) - diff --git a/sandbox/scheduler-example/src/datasources/index.ts b/sandbox/scheduler-example/src/datasources/index.ts index 4b073f33c1..1e1393bc10 100644 --- a/sandbox/scheduler-example/src/datasources/index.ts +++ b/sandbox/scheduler-example/src/datasources/index.ts @@ -1 +1,2 @@ export * from './scheduler.pg.datasource'; +export * from './schedular.cache.datasource'; diff --git a/sandbox/scheduler-example/src/datasources/schedular.cache.datasource.ts b/sandbox/scheduler-example/src/datasources/schedular.cache.datasource.ts new file mode 100644 index 0000000000..2c91269df5 --- /dev/null +++ b/sandbox/scheduler-example/src/datasources/schedular.cache.datasource.ts @@ -0,0 +1,32 @@ +import {inject, lifeCycleObserver, LifeCycleObserver} from '@loopback/core'; +import {juggler} from '@loopback/repository'; + +const config = { + name: 'AuthCache', + connector: 'kv-redis', + url: '', + host: process.env.REDIS_HOST, + port: process.env.REDIS_PORT, + password: process.env.REDIS_PASSWORD, + db: process.env.REDIS_DB, +}; + +// Observe application's life cycle to disconnect the datasource when +// application is stopped. This allows the application to be shut down +// gracefully. The `stop()` method is inherited from `juggler.DataSource`. +// Learn more at https://loopback.io/doc/en/lb4/Life-cycle.html +@lifeCycleObserver('datasource') +export class AuthCacheDataSource + extends juggler.DataSource + implements LifeCycleObserver +{ + static dataSourceName = 'AuthCache'; + static readonly defaultConfig = config; + + constructor( + @inject('datasources.config.AuthCache', {optional: true}) + dsConfig: object = config, + ) { + super(dsConfig); + } +} diff --git a/sandbox/scheduler-example/src/datasources/scheduler.pg.datasource.ts b/sandbox/scheduler-example/src/datasources/scheduler.pg.datasource.ts index 7bf4d061de..10e0e5d465 100644 --- a/sandbox/scheduler-example/src/datasources/scheduler.pg.datasource.ts +++ b/sandbox/scheduler-example/src/datasources/scheduler.pg.datasource.ts @@ -18,12 +18,12 @@ export class SchedulerDbDataSource extends juggler.DataSource implements LifeCycleObserver { - static dataSourceName = 'scheduler'; + static dataSourceName = 'schedulerDb'; static readonly defaultConfig = config; constructor( // You need to set datasource configuration name as 'datasources.config.audit' otherwise you might get Errors - @inject('datasources.config.audit', {optional: true}) + @inject('datasources.config.schedulerDb', {optional: true}) dsConfig: object = config, ) { super(dsConfig); diff --git a/services/scheduler-service/README.md b/services/scheduler-service/README.md index 0efeb04f06..c2226bfb47 100644 --- a/services/scheduler-service/README.md +++ b/services/scheduler-service/README.md @@ -1,26 +1,25 @@ # scheduler-service -[![LoopBack](https://github.com/strongloop/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)-@2x.png)](http://loopback.io/) +[![LoopBack]()](http://loopback.io/) This is a loopback4 component for scheduling events in calendar (scheduler/calendar server). -Various features of Scheduler Service: +Various features of Scheduler Service: +1. CRUD feature: + Basic add/edit/delete Event/Invitation in calendar. (As a REST API) -1. CRUD feature: - Basic add/edit/delete Event/Invitation in calendar. (As a REST API) +2. Reminder Feature: + Support or provide integration with notification/reminder service, which has the option of sending email/popup and SMS notification. -2. Reminder Feature: - Support or provide integration with notification/reminder service, which has the option of sending email/popup and SMS notification. +3. Importing Calendar: + The Scheduler supports exporting all its event data to iCal format, and it supports importing events from an iCal file into the Scheduler. -3. Importing Calendar: - The Scheduler supports exporting all its event data to iCal format, and it supports importing events from an iCal file into the Scheduler. - - -4. Third party calendar support: - Provide a way to import events information from third party components like : Outlook and Google Calendar. +4. Third party calendar support: + Provide a way to import events information from third party components like : Outlook and Google Calendar. Main feature set: + - Calendar - Calendar Subscription - Working Hours @@ -28,9 +27,11 @@ Main feature set: - Event Attendee - Event Attachment +You can see the database schema [here](#database-schema). -## Install +To get started with a basic implementation of this service, see [/sandbox/scheduler-example](https://github.com/sourcefuse/loopback4-microservice-catalog/tree/master/sandbox/scheduler-example). +## Install ```sh npm install @sourceloop/scheduler-service @@ -38,32 +39,85 @@ npm install @sourceloop/scheduler-service ### Usage - - Create a new Loopback4 Application (If you don't have one already) - `lb4 testapp` - - Install the scheduler service - `npm i @sourceloop/scheduler-service` - - Set the [environment variables](#environment-variables). - - Run the [migrations](#migrations). - - Bind the Scheduler Config to `SchedulerBindings.Config` key- - ``` typescript - this.bind(SchedulerBindings.Config).to({ - jwtIssuer: process.env.JWT_ISSUER; - jwtSecret: process.env.JWT_SECRET; - }); - ``` - - Add the `SchedulerComponent` to your Loopback4 Application (in `application.ts`). - ``` typescript - // import the SchedulerComponent - import {SchedulerComponent} from '@sourceloop/scheduler-service'; - ... - // add Component for SchedulerComponent - this.component(SchedulerComponent); - ... - ``` - - Set up a [Loopback4 Datasource](https://loopback.io/doc/en/lb4/DataSource.html) with `dataSourceName` property set to - `SchedulerDatasourceName`. You can see an example datasource [here](#setting-up-a-datasource). - - Start the application - `npm start` +- Create a new Loopback4 Application (If you don't have one already) + `lb4 testapp` +- Install the scheduler service + `npm i @sourceloop/scheduler-service` +- Set the [environment variables](#environment-variables). +- Run the [migrations](#migrations). +- Bind the Scheduler Config to `SchedulerBindings.Config` key- + ```typescript + this.bind(SchedulerBindings.Config).to({ + jwtIssuer: process.env.JWT_ISSUER; + jwtSecret: process.env.JWT_SECRET; + }); + ``` +- Add the `SchedulerComponent` to your Loopback4 Application (in `application.ts`). + ```typescript + // import the SchedulerComponent + import {SchedulerComponent} from '@sourceloop/scheduler-service'; + ... + // add Component for SchedulerComponent + this.component(SchedulerComponent); + ... + ``` +- Set up a [Loopback4 Datasource](https://loopback.io/doc/en/lb4/DataSource.html) with `dataSourceName` property set to + `SchedulerDatasourceName`. You can see an example datasource [here](#setting-up-a-datasource). +- Set up a [Loopback4 Datasource](https://loopback.io/doc/en/lb4/DataSource.html) with `dataSourceName` property set to + `AuthCacheDatasourceName`. You can see an example datasource [here](#setting-up-a-datasource). +- Start the application + `npm start` + +### Workflow Diagrams + +![Schedular](https://user-images.githubusercontent.com/82804130/127480876-7dad27cf-11c6-4dbc-9988-f7af6f91c5b8.jpg) + +![event](https://user-images.githubusercontent.com/82804130/127480906-3c70d4e0-03b8-426f-bb63-ec726eb39353.jpg) + +### Environment Variables + +Do not forget to set Environment variables. The examples below show a common configuration for a PostgreSQL Database and Redis Database running locally. + +```environment +NODE_ENV=dev +LOG_LEVEL=DEBUG +HOST=0.0.0.0 +PORT=3000 +DB_HOST=localhost +DB_PORT=5432 +DB_USER=pg_service_user +DB_PASSWORD=pg_service_user_password +DB_DATABASE=schedular_db +DB_SCHEMA=public +REDIS_HOST=localhost +REDIS_PORT=6379 +REDIS_URL=redis_url +REDIS_PASSWORD=redis_service_user_password +REDIS_DATABASE=redis_schedular_db +JWT_SECRET=super_secret_string +JWT_ISSUER=https://authentication.service +``` + +| Name | Required | Default Value | Description | +| --------------------------------- | -------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `NODE_ENV` | Y | | Node environment value, i.e. `dev`, `test`, `prod` | +| `LOG_LEVEL` | Y | | Log level value, i.e. `error`, `warn`, `info`, `verbose`, `debug` | +| `HOST` | Y | | Host for the service to run under, i.e. `0.0.0.0` | +| `PORT` | Y | `3000` | Port for the service to listen on. | +| `DB_HOST` | Y | | Hostname for the database server. | +| `DB_PORT` | Y | | Port for the database server. | +| `DB_USER` | Y | | User for the database. | +| `DB_PASSWORD` | Y | | Password for the database user. | +| `DB_DATABASE` | Y | | Database to connect to on the database server. | +| `DB_SCHEMA` | Y | `public` | Database schema used for the data source. In PostgreSQL, this will be `public` unless a schema is made explicitly for the service. | +| `REDIS_HOST` | Y | | Hostname for the Redis server. | +| `REDIS_PORT` | Y | | Port to connect to redis server. | +| `REDIS_URL` | Y | | Fully composed URL for Redis connection. Used | +| instead of other settings if set. | +| `REDIS_PASSWORD` | Y | | Password for the redis user. | +| `REDIS_DATABASE` | Y | | Database to connect to on the redis server. | +| `JWT_SECRET` | Y | | Symmetric signing key of the JWT token. | +| `JWT_ISSUER` | Y | | Issuer of the JWT token. | ### Setting up a `DataSource` @@ -88,7 +142,8 @@ const config = { @lifeCycleObserver('datasource') export class SchedulerDataSource extends juggler.DataSource - implements LifeCycleObserver { + implements LifeCycleObserver +{ static dataSourceName = SchedulerDatasourceName; static readonly defaultConfig = config; @@ -101,200 +156,66 @@ export class SchedulerDataSource } ``` -## DB migrations - -The migrations required for this service are processed during the installation automatically if you set the `SCHEDULER_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use [`db-migrate`](https://www.npmjs.com/package/db-migrate) with [`db-migrate-pg`](https://www.npmjs.com/package/db-migrate-pg) driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `SCHEDULER_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB. - -#### Database Model - -![db-schema](https://github.com/sourcefuse/loopback4-microservice-catalog/blob/master/services/scheduler-service/migrations/scheduler_db_schema.png?raw=true) - -## APIs available - -### Calendar - -Calendar is a primary feature which will be associated with an external identifier. It will hold the information for the user associated to it. - -Calendar module will have following api endpoints : - -`GET /calendar` - These requests will be available to everyone in the event to look at. - -`GET /calendar/:id` - These requests will be available to everyone in the event to look at. - -`POST /calendar` - This is an api to create a calendar for any user. - Recommendation: Use this while adding a user to the main application, in order to create a primary calendar for that particular user. - -`PUT /calendar/:id` - This api is to update the calendar by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. - -`DELETE /calendar/:id` - This api is to update the calendar by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. - -**While creating the calendar there will be business logic to create Working hours and subscriptions. Creation of working hours will be entirely dependent on the key `enableWorkingHours` from calendar requests passed on from the consumer application.** - -### Calendar Subscription - -This module will be responsible for maintaining the access level of the user and holding the meta data for this calendar. -Metadata example: Calendar color, reminder settings, notification settings and more. -Calendar Subscription module will have following api endpoints: - -`GET /calendar-subscription/:id` - These requests will be available to the owner of the subscription. - -`POST /calendar/:calendarId/calendar-subscription` - -This is an api to create a calendar subscription for any calendar. - -`PUT /calendar-subscription/:id` - - This api is to update the calendar subscription by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the `owner` we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. - -`DELETE /calendar-subscription/:id` - This api is to update the calendar subscription by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. - -* Calendar subscriptions hold two important fields, namely `accessRole` and `isPrimary`. - -* Access role defines the access that one user has over the calendar. This will decide how the user interacts with the calendar. It could either be read-only, write or owner level access. - * `isPrimary` key represents whether the user is the owner and this is the primary calendar for the respective user or not. - * Delete action won’t happen for primary subscription. - -### Working Hours: - -Working hours are related to Calendar. If the Calendar had ‘enableWorkingHours’ as true then we create these according to the data provided. These hold the data for working hours and the days for which these hours are applicable. -Calendar module will have following api endpoints along with the business logic as described below: - -`GET /working-hour/:id` - These requests will be available to everyone to look at. This will be represent the work timings for the owner of the calendar. - -`POST /calendar/:calendarId/working-hour` - This is an api to create a calendar for any user. - - **Recommendation**: Use this while adding a user to the main application, in order to create a primary calendar for that particular user. - -`PUT /working-hour/:id` - This api is to update the calendar by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the `owner` we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. - -`DELETE /working-hour/:id` - This api is to update the calendar by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. - -* While creating the calendar there will be business logic to create Working hours and subscriptions. Creation of working hours will be entirely dependent on the key `enableWorkingHours’`from calendar requests passed on from the consumer application. -* Delete action won’t happen if only one `working_hour` entry is left in DB and the value for ‘enable_working_hour’ is set as true in Calendar. - -### Events: - -Events are the basic entity around which all our logic revolves. Events will hold the data related to attendees, event details, timings, organiser (email), etc. -Events module will have following api endpoints along with the business logic as described below: - -`POST /events` - While an organizer creates an event, we get participants details along with it. This api will check for slot availability of all the participants in that particular time slot. If the slot is free the event will be created. - - Events can be scheduled on behalf of someone else, In this case we will be saving the creator details (generally the organiser is the creator themselves, so we will be keeping the organiser and created_by the same). - -`GET /events` - This api will return the events data, based on the filter provided. Sending the data of participants will be optional and will depend on the query. - -`GET /events/:id` - This api will return events data based on the id. Sending the data of participants will be optional and will depend on the query. - -`DELETE /events/:id` - Api to delete the event based on id. The action is only allowed to the organiser or the admin(based on permission). +Here is a sample Implementation `Cache DataSource` implementation using environment variables and Redis as the data source. -`PUT /events/:id` - This api will be responsible for making any updates on an event. This action is only allowed to the organizer or the admin(based on permission). - -`PATCH /events/:id` - This api will be responsible for making any updates on an event. This action is only allowed to the organizer or the admin(based on permission). - -* `parentEventId` corresponds to an event in the event table itself. If an event has a value against this key, it will be treated as recurring event for that particular event. - * Updates for Creator name, Organizer details or Parent event Id won’t be accepted. - * If event timings are changed then the responses given by the participants will be nullified and then the participants need to accept/reject the invitation again. - * Event details from the past could not be updated. - * Event attendees and attachments will be created, in case they were sent with the Event data. - -### Event Attendee: - -All the actions under the event attendee module could be performed by the creator only (except for the get and patch functionality). - -`GET /events/:id/event-attendee` - Attendees are visible to everyone according to the access permissions provided to them. - -`POST /events/:id/event-attendee` - Attendees could be added to the event. This action could only be performed by the organizer - -`PATCH /event-attendee/:attendeeId` - Attendees can update details here. (Mainly accept or reject the invitation) - -`DELETE /event-attendee/:attendeeId` - Organiser is allowed to delete an attendee of an event. Event participants' details from the past could not be created or updated. - -### Event Attachment - -`GET /events/:id/attachment` - These requests will be available to everyone in the event to look at. - -`GET /attachment/:attachmentId` - These requests will be available to everyone in the event to look at. - -`POST /events/:id/attachment` - -Organizer can add attachments to the event (if it was missed while creating event). - -`PUT /attachment/:attachmentId` - -Organizer can update details of the attachment. - -`DELETE /attachment/:attachmentId` - Organizer can delete the attachment. - -* Event attachment from the past could not be created or updated. - -### Freebusy - -Returns free/busy information for a set of calendars (primary calendars). - -`POST /calendar/freeBusy` - Returns free/busy information for a set of calendars. - -### Global Settings +```typescript +import {inject, lifeCycleObserver, LifeCycleObserver} from '@loopback/core'; +import {juggler} from '@loopback/repository'; -Setting resources represent settings that users can configureI, such as the user's -`timezone` - The ID of the user’s timezone. -`format24HourTime` - Whether to show the time in 24 hour format. -`weekStart` - Whether the week should start on Sunday (0), Monday (1) or Saturday (6). -They can be retrieved via list and get methods. Note that if a setting has its default value, it might not be returned. +const config = { + name: 'AuthCache', + connector: 'kv-redis', + url: '', + host: process.env.REDIS_HOST, + port: process.env.REDIS_PORT, + password: process.env.REDIS_PASSWORD, + db: process.env.REDIS_DB, +}; -`GET /settings/list` - This api will return the settings data, based on the filter provided. +@lifeCycleObserver('datasource') +export class AuthCacheDataSource + extends juggler.DataSource + implements LifeCycleObserver +{ + static dataSourceName = 'AuthCache'; + static readonly defaultConfig = config; -`GET /settings/:Id` - These requests will be available to everyone in the setting to look at. + constructor( + @inject('datasources.config.AuthCache', {optional: true}) + dsConfig: object = config, + ) { + super(dsConfig); + } +} +``` -`POST /settings` - Create any new settings +## Migrations -`PUT /settings/:id` - Update setting. +The migrations required for this service are processed during the installation automatically if you set the `SCHEDULER_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use [`db-migrate`](https://www.npmjs.com/package/db-migrate) with [`db-migrate-pg`](https://www.npmjs.com/package/db-migrate-pg) driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `SCHEDULER_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB. -`DELETE /settings/:id` - Delete setting. +#### Database Schema -* Event settings from the past could not be created or updated. +![db-schema](https://github.com/sourcefuse/loopback4-microservice-catalog/blob/master/services/scheduler-service/migrations/scheduler_db_schema.png?raw=true) ## API's Details Visit the [OpenAPI spec docs](./openapi.md) ## Feedback + If you've noticed a bug or have a question or have a feature request, [search the issue tracker](https://github.com/sourcefuse/loopback4-notifications/issues) to see if someone else in the community has already created a ticket. If not, go ahead and [make one](https://github.com/sourcefuse/loopback4-notifications/issues/new/choose)! All feature requests are welcome. Implementation time may vary. Feel free to contribute the same, if you can. If you think this extension is useful, please [star](https://help.github.com/en/articles/about-stars) it. Appreciation really helps in keeping this project alive. + ## Contributing + Please read [CONTRIBUTING.md](https://github.com/sourcefuse/loopback4-notifications/blob/master/.github/CONTRIBUTING.md) for details on the process for submitting pull requests to us. + ## Code of conduct + Code of conduct guidelines [here](https://github.com/sourcefuse/loopback4-notifications/blob/master/.github/CODE_OF_CONDUCT.md). + ## License + [MIT](https://github.com/sourcefuse/loopback4-notifications/blob/master/LICENSE) diff --git a/services/scheduler-service/openapi.json b/services/scheduler-service/openapi.json index a9a7ef6961..42987193ea 100644 --- a/services/scheduler-service/openapi.json +++ b/services/scheduler-service/openapi.json @@ -1003,6 +1003,7 @@ "tags": [ "CalendarSubscriptionController" ], + "description": "This is an api to create a calendar subscription for any calendar.", "security": [ { "HTTPBearer": [] @@ -1048,6 +1049,7 @@ "tags": [ "CalendarSubscriptionController" ], + "description": "This api is to update the calendar subscription by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the `owner` we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission.", "security": [ { "HTTPBearer": [] @@ -1107,6 +1109,7 @@ "tags": [ "CalendarSubscriptionController" ], + "description": "These requests will be available to the owner of the subscription.", "security": [ { "HTTPBearer": [] @@ -1157,6 +1160,7 @@ "tags": [ "CalendarSubscriptionController" ], + "description": "This api is to update the calendar subscription by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission.", "security": [ { "HTTPBearer": [] @@ -1208,6 +1212,7 @@ "tags": [ "CalendarWorkingHourController" ], + "description": "This is an api to create a calendar for any user.", "security": [ { "HTTPBearer": [] @@ -1413,6 +1418,7 @@ "tags": [ "CalendarController" ], + "description": "This api is to update the calendar by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission.", "security": [ { "HTTPBearer": [] @@ -1489,6 +1495,7 @@ "tags": [ "CalendarController" ], + "description": "These requests will be available to everyone in the event to look at.", "security": [ { "HTTPBearer": [] @@ -1535,6 +1542,7 @@ "tags": [ "CalendarController" ], + "description": "This api is to update the calendar by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission.", "security": [ { "HTTPBearer": [] @@ -1565,6 +1573,7 @@ "tags": [ "CalendarController" ], + "description": "This is an api to create a calendar for any user. Recommendation: Use this while adding a user to the main application, in order to create a primary calendar for that particular user.", "security": [ { "HTTPBearer": [] @@ -1649,6 +1658,7 @@ "tags": [ "CalendarController" ], + "description": "These requests will be available to everyone in the event to look at.", "security": [ { "HTTPBearer": [] @@ -1771,6 +1781,7 @@ "tags": [ "EventAttachmentController" ], + "description": "Organizer can add attachments to the event (if it was missed while creating event).", "security": [ { "HTTPBearer": [] @@ -1816,6 +1827,7 @@ "tags": [ "EventAttachmentController" ], + "description": "Organizer can update details of the attachment.", "security": [ { "HTTPBearer": [] @@ -1875,6 +1887,7 @@ "tags": [ "EventAttachmentController" ], + "description": "These requests will be available to everyone in the event to look at.", "security": [ { "HTTPBearer": [] @@ -1925,6 +1938,7 @@ "tags": [ "EventAttachmentController" ], + "description": "Organizer can delete the attachment.", "security": [ { "HTTPBearer": [] @@ -1976,6 +1990,7 @@ "tags": [ "EventAttendeeController" ], + "description": "Attendees could be added to the event. This action could only be performed by the organizer", "security": [ { "HTTPBearer": [] @@ -2021,6 +2036,7 @@ "tags": [ "EventAttendeeController" ], + "description": "Attendees can update details here. (Mainly accept or reject the invitation)", "security": [ { "HTTPBearer": [] @@ -2080,6 +2096,7 @@ "tags": [ "EventAttendeeController" ], + "description": "Attendees are visible to everyone according to the access permissions provided to them.", "security": [ { "HTTPBearer": [] @@ -2130,6 +2147,7 @@ "tags": [ "EventAttendeeController" ], + "description": "Organiser is allowed to delete an attendee of an event. Event participants details from the past could not be created or updated.", "security": [ { "HTTPBearer": [] @@ -2211,6 +2229,7 @@ "tags": [ "EventController" ], + "description": "This api will be responsible for making any updates on an event. This action is only allowed to the organizer or the admin(based on permission).", "security": [ { "HTTPBearer": [] @@ -2249,6 +2268,7 @@ "tags": [ "EventController" ], + "description": "This api will be responsible for making any updates on an event. This action is only allowed to the organizer or the admin(based on permission).", "security": [ { "HTTPBearer": [] @@ -2287,6 +2307,7 @@ "tags": [ "EventController" ], + "description": "This api will return events data based on the id. Sending the data of participants will be optional and will depend on the query.", "security": [ { "HTTPBearer": [] @@ -2333,6 +2354,7 @@ "tags": [ "EventController" ], + "description": "Api to delete the event based on id. The action is only allowed to the organiser or the admin(based on permission).", "security": [ { "HTTPBearer": [] @@ -2363,6 +2385,7 @@ "tags": [ "EventController" ], + "description": "While an organizer creates an event, we get participants details along with it. This api will check for slot availability of all the participants in that particular time slot. If the slot is free the event will be created. Events can be scheduled on behalf of someone else, In this case we will be saving the creator details (generally the organiser is the creator themselves, so we will be keeping the organiser and created_by the same).", "security": [ { "HTTPBearer": [] @@ -2447,6 +2470,7 @@ "tags": [ "EventController" ], + "description": "This api will return the events data, based on the filter provided. Sending the data of participants will be optional and will depend on the query.", "security": [ { "HTTPBearer": [] @@ -2533,6 +2557,7 @@ "tags": [ "SettingsController" ], + "description": "Update setting.", "security": [ { "HTTPBearer": [] @@ -2609,6 +2634,7 @@ "tags": [ "SettingsController" ], + "description": "These requests will be available to everyone in the setting to look at.", "security": [ { "HTTPBearer": [] @@ -2655,6 +2681,7 @@ "tags": [ "SettingsController" ], + "description": "Delete setting.", "security": [ { "HTTPBearer": [] @@ -2685,6 +2712,7 @@ "tags": [ "SettingsController" ], + "description": "Create any new settings", "security": [ { "HTTPBearer": [] @@ -3499,6 +3527,7 @@ "tags": [ "WorkingHourController" ], + "description": "This api is to update the calendar by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the `owner` we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission.", "security": [ { "HTTPBearer": [] @@ -3575,6 +3604,7 @@ "tags": [ "WorkingHourController" ], + "description": "These requests will be available to everyone to look at. This will be represent the work timings for the owner of the calendar.", "security": [ { "HTTPBearer": [] @@ -3621,6 +3651,7 @@ "tags": [ "WorkingHourController" ], + "description": "This api is to update the calendar by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission.", "security": [ { "HTTPBearer": [] diff --git a/services/scheduler-service/openapi.md b/services/scheduler-service/openapi.md index 91a6510d0f..6d6535236a 100644 --- a/services/scheduler-service/openapi.md +++ b/services/scheduler-service/openapi.md @@ -2963,6 +2963,8 @@ fetch('/calendars/{id}', `PUT /calendars/{id}` +This api is to update the calendar by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. + > Body parameter ```json @@ -3193,6 +3195,8 @@ fetch('/calendars/{id}', `GET /calendars/{id}` +These requests will be available to everyone in the event to look at. +

Parameters

|Name|In|Type|Required|Description| @@ -3690,6 +3694,8 @@ fetch('/calendars/{id}', `DELETE /calendars/{id}` +This api is to update the calendar by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. +

Parameters

|Name|In|Type|Required|Description| @@ -3814,6 +3820,8 @@ fetch('/calendars', `POST /calendars` +This is an api to create a calendar for any user. Recommendation: Use this while adding a user to the main application, in order to create a primary calendar for that particular user. + > Body parameter ```json @@ -4078,6 +4086,8 @@ fetch('/calendars', `GET /calendars` +These requests will be available to everyone in the event to look at. +

Parameters

|Name|In|Type|Required|Description| @@ -6781,6 +6791,8 @@ fetch('/calendars/{id}/subscriptions', `POST /calendars/{id}/subscriptions` +This is an api to create a calendar subscription for any calendar. + > Body parameter ```json @@ -6945,6 +6957,8 @@ fetch('/calendars/{id}/subscriptions', `PATCH /calendars/{id}/subscriptions` +This api is to update the calendar subscription by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the `owner` we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. + > Body parameter ```json @@ -7051,6 +7065,8 @@ fetch('/calendars/{id}/subscriptions', `GET /calendars/{id}/subscriptions` +These requests will be available to the owner of the subscription. +

Parameters

|Name|In|Type|Required|Description| @@ -7187,6 +7203,8 @@ fetch('/calendars/{id}/subscriptions', `DELETE /calendars/{id}/subscriptions` +This api is to update the calendar subscription by passing an id. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. +

Parameters

|Name|In|Type|Required|Description| @@ -7298,6 +7316,8 @@ fetch('/calendars/{id}/working-hours', `POST /calendars/{id}/working-hours` +This is an api to create a calendar for any user. + > Body parameter ```json @@ -8158,6 +8178,8 @@ fetch('/events/{id}', `PUT /events/{id}` +This api will be responsible for making any updates on an event. This action is only allowed to the organizer or the admin(based on permission). + > Body parameter ```json @@ -8317,6 +8339,8 @@ fetch('/events/{id}', `PATCH /events/{id}` +This api will be responsible for making any updates on an event. This action is only allowed to the organizer or the admin(based on permission). + > Body parameter ```json @@ -8420,6 +8444,8 @@ fetch('/events/{id}', `GET /events/{id}` +This api will return events data based on the id. Sending the data of participants will be optional and will depend on the query. +

Parameters

|Name|In|Type|Required|Description| @@ -9063,6 +9089,8 @@ fetch('/events/{id}', `DELETE /events/{id}` +Api to delete the event based on id. The action is only allowed to the organiser or the admin(based on permission). +

Parameters

|Name|In|Type|Required|Description| @@ -9247,6 +9275,8 @@ fetch('/events', `POST /events` +While an organizer creates an event, we get participants details along with it. This api will check for slot availability of all the participants in that particular time slot. If the slot is free the event will be created. Events can be scheduled on behalf of someone else, In this case we will be saving the creator details (generally the organiser is the creator themselves, so we will be keeping the organiser and created_by the same). + > Body parameter ```json @@ -9585,6 +9615,8 @@ fetch('/events', `GET /events` +This api will return the events data, based on the filter provided. Sending the data of participants will be optional and will depend on the query. +

Parameters

|Name|In|Type|Required|Description| @@ -9987,6 +10019,8 @@ fetch('/events/{id}/attachments', `POST /events/{id}/attachments` +Organizer can add attachments to the event (if it was missed while creating event). + > Body parameter ```json @@ -10135,6 +10169,8 @@ fetch('/events/{id}/attachments', `PATCH /events/{id}/attachments` +Organizer can update details of the attachment. + > Body parameter ```json @@ -10237,6 +10273,8 @@ fetch('/events/{id}/attachments', `GET /events/{id}/attachments` +These requests will be available to everyone in the event to look at. +

Parameters

|Name|In|Type|Required|Description| @@ -10356,6 +10394,8 @@ fetch('/events/{id}/attachments', `DELETE /events/{id}/attachments` +Organizer can delete the attachment. +

Parameters

|Name|In|Type|Required|Description| @@ -10471,6 +10511,8 @@ fetch('/events/{id}/attendees', `POST /events/{id}/attendees` +Attendees could be added to the event. This action could only be performed by the organizer + > Body parameter ```json @@ -10623,6 +10665,8 @@ fetch('/events/{id}/attendees', `PATCH /events/{id}/attendees` +Attendees can update details here. (Mainly accept or reject the invitation) + > Body parameter ```json @@ -10726,6 +10770,8 @@ fetch('/events/{id}/attendees', `GET /events/{id}/attendees` +Attendees are visible to everyone according to the access permissions provided to them. +

Parameters

|Name|In|Type|Required|Description| @@ -10856,6 +10902,8 @@ fetch('/events/{id}/attendees', `DELETE /events/{id}/attendees` +Organiser is allowed to delete an attendee of an event. Event participants details from the past could not be created or updated. +

Parameters

|Name|In|Type|Required|Description| @@ -11045,6 +11093,8 @@ fetch('/settings/{id}', `PUT /settings/{id}` +Update setting. + > Body parameter ```json @@ -11255,6 +11305,8 @@ fetch('/settings/{id}', `GET /settings/{id}` +These requests will be available to everyone in the setting to look at. +

Parameters

|Name|In|Type|Required|Description| @@ -11345,6 +11397,8 @@ fetch('/settings/{id}', `DELETE /settings/{id}` +Delete setting. +

Parameters

|Name|In|Type|Required|Description| @@ -11443,6 +11497,8 @@ fetch('/settings', `POST /settings` +Create any new settings + > Body parameter ```json @@ -12788,6 +12844,8 @@ fetch('/working-hours/{id}', `PUT /working-hours/{id}` +This api is to update the calendar by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the `owner` we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. + > Body parameter ```json @@ -12998,6 +13056,8 @@ fetch('/working-hours/{id}', `GET /working-hours/{id}` +These requests will be available to everyone to look at. This will be represent the work timings for the owner of the calendar. +

Parameters

|Name|In|Type|Required|Description| @@ -13223,6 +13283,8 @@ fetch('/working-hours/{id}', `DELETE /working-hours/{id}` +This api is to update the calendar by passing an `id`. This action will be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email passed in the token and the corresponding access level, whereas to identify the admin we will check for the permission. +

Parameters

|Name|In|Type|Required|Description| diff --git a/services/scheduler-service/src/controllers/calendar-subscription.controller.ts b/services/scheduler-service/src/controllers/calendar-subscription.controller.ts index f54f4a2610..018d4ccb08 100644 --- a/services/scheduler-service/src/controllers/calendar-subscription.controller.ts +++ b/services/scheduler-service/src/controllers/calendar-subscription.controller.ts @@ -39,6 +39,8 @@ export class CalendarSubscriptionController { }) @authorize({permissions: [PermissionKey.ViewSubscription]}) @get(basePath, { + description: + 'These requests will be available to the owner of the subscription.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -66,6 +68,8 @@ export class CalendarSubscriptionController { }) @authorize({permissions: [PermissionKey.CreateSubscription]}) @post(basePath, { + description: + 'This is an api to create a calendar subscription for any calendar.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -99,6 +103,11 @@ export class CalendarSubscriptionController { }) @authorize({permissions: [PermissionKey.UpdateSubscription]}) @patch(basePath, { + description: `This api is to update the calendar subscription by passing an \`id\`. + This action will be allowed only to the owner of the calendar or the admin. + To identify the \`owner\` we will check for the email passed in the token and + the corresponding access level, whereas to identify the admin we will check + for the permission.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -128,6 +137,10 @@ export class CalendarSubscriptionController { }) @authorize({permissions: [PermissionKey.DeleteSubscription]}) @del(basePath, { + description: `This api is to update the calendar subscription by passing an id. + This action will be allowed only to the owner of the calendar or the admin. + To identify the ‘owner’ we will check for the email passed in the token and the + corresponding access level, whereas to identify the admin we will check for the permission.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { diff --git a/services/scheduler-service/src/controllers/calendar-working-hour.controller.ts b/services/scheduler-service/src/controllers/calendar-working-hour.controller.ts index 219e29cf02..48e212761b 100644 --- a/services/scheduler-service/src/controllers/calendar-working-hour.controller.ts +++ b/services/scheduler-service/src/controllers/calendar-working-hour.controller.ts @@ -63,6 +63,7 @@ export class CalendarWorkingHourController { }) @authorize({permissions: [PermissionKey.CreateWorkingHour]}) @post(basePath, { + description: 'This is an api to create a calendar for any user.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { diff --git a/services/scheduler-service/src/controllers/calendar.controller.ts b/services/scheduler-service/src/controllers/calendar.controller.ts index e171b7c3e8..584e6eb545 100644 --- a/services/scheduler-service/src/controllers/calendar.controller.ts +++ b/services/scheduler-service/src/controllers/calendar.controller.ts @@ -69,6 +69,9 @@ export class CalendarController { }) @authorize({permissions: [PermissionKey.CreateCalendar]}) @post(basePath, { + description: `This is an api to create a calendar for any user. + Recommendation: Use this while adding a user to the main application, in order to create + a primary calendar for that particular user.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -189,6 +192,8 @@ export class CalendarController { }) @authorize({permissions: [PermissionKey.ViewCalendar]}) @get(basePath, { + description: + 'These requests will be available to everyone in the event to look at.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -242,6 +247,8 @@ export class CalendarController { }) @authorize({permissions: [PermissionKey.ViewCalendar]}) @get(`${basePath}/{id}`, { + description: + 'These requests will be available to everyone in the event to look at.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -293,6 +300,10 @@ export class CalendarController { }) @authorize({permissions: [PermissionKey.UpdateCalendar]}) @put(`${basePath}/{id}`, { + description: `This api is to update the calendar by passing an id. This action will be allowed only to + the owner of the calendar or the admin. To identify the ‘owner’ we will check for the email + passed in the token and the corresponding access level, whereas to identify the admin we will + check for the permission.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { @@ -336,6 +347,10 @@ export class CalendarController { }) @authorize({permissions: [PermissionKey.DeleteCalendar]}) @del(`${basePath}/{id}`, { + description: `This api is to update the calendar by passing an id. This action will be allowed only to the + owner of the calendar or the admin. To identify the ‘owner’ we will check for the email + passed in the token and the corresponding access level, whereas to identify the admin we will + check for the permission.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { diff --git a/services/scheduler-service/src/controllers/event-attachment.controller.ts b/services/scheduler-service/src/controllers/event-attachment.controller.ts index 591ee83ec6..dd615f0925 100644 --- a/services/scheduler-service/src/controllers/event-attachment.controller.ts +++ b/services/scheduler-service/src/controllers/event-attachment.controller.ts @@ -38,6 +38,8 @@ export class EventAttachmentController { }) @authorize({permissions: [PermissionKey.ViewAttachment]}) @get(basePath, { + description: + 'These requests will be available to everyone in the event to look at.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -62,6 +64,8 @@ export class EventAttachmentController { }) @authorize({permissions: [PermissionKey.CreateAttachment]}) @post(basePath, { + description: + 'Organizer can add attachments to the event (if it was missed while creating event).', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -95,6 +99,7 @@ export class EventAttachmentController { }) @authorize({permissions: [PermissionKey.UpdateAttachment]}) @patch(basePath, { + description: 'Organizer can update details of the attachment.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -124,6 +129,7 @@ export class EventAttachmentController { }) @authorize({permissions: [PermissionKey.DeleteAttachment]}) @del(basePath, { + description: 'Organizer can delete the attachment.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { diff --git a/services/scheduler-service/src/controllers/event-attendee.controller.ts b/services/scheduler-service/src/controllers/event-attendee.controller.ts index 8c8e0ef535..56b2a8a827 100644 --- a/services/scheduler-service/src/controllers/event-attendee.controller.ts +++ b/services/scheduler-service/src/controllers/event-attendee.controller.ts @@ -38,6 +38,8 @@ export class EventAttendeeController { }) @authorize({permissions: [PermissionKey.ViewAttendee]}) @get(basePath, { + description: + 'Attendees are visible to everyone according to the access permissions provided to them.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -62,6 +64,8 @@ export class EventAttendeeController { }) @authorize({permissions: [PermissionKey.CreateAttendee]}) @post(basePath, { + description: + 'Attendees could be added to the event. This action could only be performed by the organizer', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -95,6 +99,8 @@ export class EventAttendeeController { }) @authorize({permissions: [PermissionKey.UpdateAttendee]}) @patch(basePath, { + description: + 'Attendees can update details here. (Mainly accept or reject the invitation)', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -124,6 +130,8 @@ export class EventAttendeeController { }) @authorize({permissions: [PermissionKey.DeleteAttendee]}) @del(basePath, { + description: + 'Organiser is allowed to delete an attendee of an event. Event participants details from the past could not be created or updated.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { diff --git a/services/scheduler-service/src/controllers/event.controller.ts b/services/scheduler-service/src/controllers/event.controller.ts index 32da9fe4ff..8f24c55def 100644 --- a/services/scheduler-service/src/controllers/event.controller.ts +++ b/services/scheduler-service/src/controllers/event.controller.ts @@ -60,6 +60,12 @@ export class EventController { }) @authorize({permissions: [PermissionKey.CreateEvent]}) @post(basePath, { + description: `While an organizer creates an event, we get participants details along with it. + This api will check for slot availability of all the participants in that particular + time slot. If the slot is free the event will be created. Events can be scheduled on + behalf of someone else, In this case we will be saving the creator details + (generally the organiser is the creator themselves, so we will be keeping the organiser + and created_by the same).`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -205,6 +211,8 @@ export class EventController { }) @authorize({permissions: [PermissionKey.ViewEvent]}) @get(basePath, { + description: + 'This api will return the events data, based on the filter provided. Sending the data of participants will be optional and will depend on the query.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -271,6 +279,8 @@ export class EventController { }) @authorize({permissions: [PermissionKey.ViewEvent]}) @get(`${basePath}/{id}`, { + description: + 'This api will return events data based on the id. Sending the data of participants will be optional and will depend on the query.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -296,6 +306,8 @@ export class EventController { }) @authorize({permissions: [PermissionKey.UpdateEvent]}) @patch(`${basePath}/{id}`, { + description: + 'This api will be responsible for making any updates on an event. This action is only allowed to the organizer or the admin(based on permission).', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { @@ -322,6 +334,8 @@ export class EventController { }) @authorize({permissions: [PermissionKey.UpdateEvent]}) @put(`${basePath}/{id}`, { + description: + 'This api will be responsible for making any updates on an event. This action is only allowed to the organizer or the admin(based on permission).', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { @@ -341,6 +355,8 @@ export class EventController { }) @authorize({permissions: [PermissionKey.DeleteEvent]}) @del(`${basePath}/{id}`, { + description: + 'Api to delete the event based on id. The action is only allowed to the organiser or the admin(based on permission).', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { diff --git a/services/scheduler-service/src/controllers/settings.controller.ts b/services/scheduler-service/src/controllers/settings.controller.ts index d1eccafb2d..c12559ee43 100644 --- a/services/scheduler-service/src/controllers/settings.controller.ts +++ b/services/scheduler-service/src/controllers/settings.controller.ts @@ -40,6 +40,7 @@ export class SettingsController { }) @authorize({permissions: [PermissionKey.CreateSettings]}) @post(basePath, { + description: 'Create any new settings', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -139,6 +140,8 @@ export class SettingsController { }) @authorize({permissions: [PermissionKey.ViewSettings]}) @get(`${basePath}/{id}`, { + description: + 'These requests will be available to everyone in the setting to look at.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -190,6 +193,7 @@ export class SettingsController { }) @authorize({permissions: [PermissionKey.UpdateSettings]}) @put(`${basePath}/{id}`, { + description: 'Update setting.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { @@ -209,6 +213,7 @@ export class SettingsController { }) @authorize({permissions: [PermissionKey.DeleteSettings]}) @del(`${basePath}/{id}`, { + description: 'Delete setting.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { diff --git a/services/scheduler-service/src/controllers/working-hour.controller.ts b/services/scheduler-service/src/controllers/working-hour.controller.ts index f4d458a294..c21771a4c7 100644 --- a/services/scheduler-service/src/controllers/working-hour.controller.ts +++ b/services/scheduler-service/src/controllers/working-hour.controller.ts @@ -143,6 +143,8 @@ export class WorkingHourController { }) @authorize({permissions: [PermissionKey.ViewWorkingHour]}) @get(`${basePath}/{id}`, { + description: + 'These requests will be available to everyone to look at. This will be represent the work timings for the owner of the calendar.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -194,6 +196,10 @@ export class WorkingHourController { }) @authorize({permissions: [PermissionKey.UpdateWorkingHour]}) @put(`${basePath}/{id}`, { + description: `This api is to update the calendar by passing an \`id\`. This action will be allowed only + to the owner of the calendar or the admin. To identify the \`owner\` we + will check for the email passed in the token and the corresponding access level, + whereas to identify the admin we will check for the permission.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { @@ -213,6 +219,10 @@ export class WorkingHourController { }) @authorize({permissions: [PermissionKey.DeleteWorkingHour]}) @del(`${basePath}/{id}`, { + description: `This api is to update the calendar by passing an \`id\`. This action will + be allowed only to the owner of the calendar or the admin. To identify the ‘owner’ + we will check for the email passed in the token and the corresponding access level, + whereas to identify the admin we will check for the permission.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { diff --git a/services/video-conferencing-service/README.md b/services/video-conferencing-service/README.md index c8249690aa..7eb7948eca 100644 --- a/services/video-conferencing-service/README.md +++ b/services/video-conferencing-service/README.md @@ -1,24 +1,28 @@ # video-conferencing-service -[![LoopBack](https://github.com/strongloop/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)-@2x.png)](http://loopback.io/) +[![LoopBack]()](http://loopback.io/) -Various features of Video Conferncing Services: +Various features of Video Conferencing Services: 1. Schedule Meetings and Generate Token - Book on demand meetings or schedule meetings and generate token which is required for connection to a session/room on the client side. + Book on demand meetings or schedule meetings and generate token which is required for connection to a session/room on the client side. -2. List Archives - Get a specific archive or list a set of archives for the recorded meetings. +2. List Archives + Get a specific archive or list a set of archives for the recorded meetings. 3. Configure storage target - Set Storage settings to store archives to custom s3 bucket or Microsoft Azure Storage. + Set Storage settings to store archives to custom s3 bucket or Microsoft Azure Storage. 4. Webhook Events - Webhook Events (such as session or webhook) when configured receive events from third party. These events are used to store session attendees or store archive information. - For Vonage, you need to add this microserivce server url in your current vonage project - so it will receive webhook events. See Vonage Documentation for more information. + Webhook Events (such as session or webhook) when configured receive events from third party. These events are used to store session attendees or store archive information. + For Vonage, you need to add this microserivce server url in your current vonage project + so it will receive webhook events. See [Vonage Documentation](https://developer.nexmo.com/documentation) for more information. -## Install +You can see the database schema [here](#database-schema). + +To get started with a basic implementation of this service, see [/sandbox/video-conferencing-ms-example](https://github.com/sourcefuse/loopback4-microservice-catalog/tree/master/sandbox/video-conferencing-ms-example). + +## Install ```sh npm i @sourceloop/video-conferencing-service @@ -26,36 +30,74 @@ npm i @sourceloop/video-conferencing-service ## Usage - - Create a new Loopback4 Application (If you don't have one already) +- Create a new Loopback4 Application (If you don't have one already) `lb4 testapp` - Install the video conferencing service -`npm i @sourceloop/video-conferencing-service` + `npm i @sourceloop/video-conferencing-service` - Set the [environment variables](#environment-variables). - Run the [migrations](#migrations). - Bind Vonage config to the `VonageBindings.Config` key - - ``` typescript - this.bind(VonageBindings.Config).to({ - apiKey: process.env.VONAGE_API_KEY, - apiSecret: process.env.VONAGE_API_SECRET, - timeToStart: 0 // time in minutes, meeting can not be started 'timeToStart' minutes before the scheduled time - }); + ```typescript + this.bind(VonageBindings.Config).to({ + apiKey: process.env.VONAGE_API_KEY, + apiSecret: process.env.VONAGE_API_SECRET, + timeToStart: 0, // time in minutes, meeting can not be started 'timeToStart' minutes before the scheduled time + }); ``` - Add the `VideoConfServiceComponent` to your Loopback4 Application (in `application.ts`). - ``` typescript + ```typescript // import the component for VideoConfService import { VideoConfServiceComponent } from '@sourceloop/video-conferencing-service'; ... - // add VideoConfServiceComponent inside the application class - this.component(VideoConfServiceComponent); + // add VideoConfServiceComponent inside the application class + this.component(VideoConfServiceComponent); ... - ``` + ``` - Set up a [Loopback4 Datasource](https://loopback.io/doc/en/lb4/DataSource.html) with `dataSourceName` property set to `VideoConfDatasource`. You can see an example datasource [here](#setting-up-a-datasource). - Start the application `npm start` +## Working and Flow +![video](https://user-images.githubusercontent.com/82804130/126984338-754c0788-270a-40df-b601-ff66dcd3d5f8.jpg) + + +### Environment Variables + +Do not forget to set Environment variables. The examples below show a common configuration for a PostgreSQL Database running locally. + +```environment +NODE_ENV=dev +LOG_LEVEL=DEBUG +HOST=0.0.0.0 +PORT=3000 +DB_HOST=localhost +DB_PORT=5432 +DB_USER=pg_service_user +DB_PASSWORD=pg_service_user_password +DB_DATABASE=video_conferencing_db +DB_SCHEMA=public +JWT_SECRET=super_secret_string +JWT_ISSUER=https://authentication.service +``` + +| Name | Required | Default Value | Description | +| ------------- | -------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `NODE_ENV` | Y | | Node environment value, i.e. `dev`, `test`, `prod` | +| `LOG_LEVEL` | Y | | Log level value, i.e. `error`, `warn`, `info`, `verbose`, `debug` | +| `HOST` | Y | | Host for the service to run under, i.e. `0.0.0.0` | +| `PORT` | Y | `3000` | Port for the service to listen on. | +| `DB_HOST` | Y | | Hostname for the database server. | +| `DB_PORT` | Y | | Port for the database server. | +| `DB_USER` | Y | | User for the database. | +| `DB_PASSWORD` | Y | | Password for the database user. | +| `DB_DATABASE` | Y | | Database to connect to on the database server. | +| `DB_SCHEMA` | Y | `public` | Database schema used for the data source. In PostgreSQL, this will be `public` unless a schema is made explicitly for the service. | +| `JWT_SECRET` | Y | | Symmetric signing key of the JWT token. | +| `JWT_ISSUER` | Y | | Issuer of the JWT token. | + ### Setting up a `DataSource` -Here is a sample Implementation `DataSource` implementation using environment variables and PostgreSQL as the data source. +Here is a sample Implementation `DataSource` implementation using environment variables and PostgreSQL as the data source. ```typescript import {inject, lifeCycleObserver, LifeCycleObserver} from '@loopback/core'; @@ -75,8 +117,10 @@ const config = { }; @lifeCycleObserver('datasource') -export class VideoDbDataSource extends juggler.DataSource - implements LifeCycleObserver { +export class VideoDbDataSource + extends juggler.DataSource + implements LifeCycleObserver +{ static dataSourceName = VideoConfDatasource; static readonly defaultConfig = config; @@ -89,60 +133,20 @@ export class VideoDbDataSource extends juggler.DataSource } ``` -## DB migrations - -The migrations required for this service are processed during the installation automatically if you set the `VIDEOCONF_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use [`db-migrate`](https://www.npmjs.com/package/db-migrate) with [`db-migrate-pg`](https://www.npmjs.com/package/db-migrate-pg) driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `VIDEOCONF_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB. - -## APIs available (Currently Vonage is Supported) +## Database Schema -1. Session Creation and Generating Token +![canva-photo-editor](https://user-images.githubusercontent.com/82804130/126635878-4e39ce2c-e48d-4a67-9c81-6a5f8ee9b70e.png) -### POST /session -Used for Creating a session with options such as end to end encryption, archive mode. -Note: Archving Option cannot be enabled while using end to end encryption, otherwise an Error will be thrown. -Successful execution will send a meeting link id which can be used to amend in client url. +## Migrations -### POST /session/{meetingLinkId}/token -Used for Generating token, which is used for connecting to a room/session on a client side. -In vonage, there are three different roles (Moderator, Subscriber, Publisher). -We can use expire time for limited validity of a token. -Successful execution will send a token. - -### PATCH /session/{meetingLinkId}/end -Used to stop the current active meeting. Meeting cannot be stopped again if it is already stopped. -Successful execution will add the endTime attribute to a recently ending session. - -2. List and deleting Archive(s) - -### GET /archives -Used to fetch a list of archives (meetings that were recorded). - -### GET /archives/{archiveId} -Used to fetch a specific archive w.r.t archiveId. -If archive is not present, it will throw HTTP Not Found Error. - -### DELETE /archives/{archiveId} -Used to delete a specific archive w.r.t archiveId. -If archive is not present, it will throw HTTP Not Found Error. - -3. Session Webhook - -### POST /webhooks/session -Webhook API hit from a third party to add/update session attendees in a meeting. -For configuration in vonage, see [Session Monitoring](https://tokbox.com/developer/guides/session-monitoring/) - - -4. Storage Target - -### PUT /archives/storage-target -Configures custom storage target to a custom Amazon s3 bucket or Microsoft Azure Storage. +The migrations required for this service are processed during the installation automatically if you set the `VIDEOCONF_MIGRATION` or `SOURCELOOP_MIGRATION` env variable. The migrations use [`db-migrate`](https://www.npmjs.com/package/db-migrate) with [`db-migrate-pg`](https://www.npmjs.com/package/db-migrate-pg) driver for migrations, so you will have to install these packages to use auto-migration. Please note that if you are using some pre-existing migrations or database, they may be effected. In such scenario, it is advised that you copy the migration files in your project root, using the `VIDEOCONF_MIGRATION_COPY` or `SOURCELOOP_MIGRATION_COPY` env variables. You can customize or cherry-pick the migrations in the copied files according to your specific requirements and then apply them to the DB. ## API's Details Visit the [OpenAPI spec docs](./openapi.md) - ## Feedback + If you've noticed a bug or have a question or have a feature request, [search the issue tracker](https://github.com/sourcefuse/loopback4-microservice-catalog/issues) to see if someone else in the community has already created a ticket. If not, go ahead and [make one](https://github.com/sourcefuse/loopback4-microservice-catalog/issues/new/choose)! All feature requests are welcome. Implementation time may vary. Feel free to contribute the same, if you can. diff --git a/services/video-conferencing-service/openapi.json b/services/video-conferencing-service/openapi.json index c8aebc4fcd..e37cf9a8e9 100644 --- a/services/video-conferencing-service/openapi.json +++ b/services/video-conferencing-service/openapi.json @@ -16,6 +16,7 @@ "tags": [ "VideoChatArchiveController" ], + "description": "Configures custom storage target to a custom Amazon s3 bucket or Microsoft Azure Storage.", "security": [ { "HTTPBearer": [] @@ -51,6 +52,7 @@ "tags": [ "VideoChatArchiveController" ], + "description": "Used to fetch a specific archive w.r.t archiveId. If archive is not present, it will throw HTTP Not Found Error.", "security": [ { "HTTPBearer": [] @@ -85,6 +87,7 @@ "tags": [ "VideoChatArchiveController" ], + "description": "Used to delete a specific archive w.r.t archiveId. If archive is not present, it will throw HTTP Not Found Error.", "security": [ { "HTTPBearer": [] @@ -121,6 +124,7 @@ "tags": [ "VideoChatArchiveController" ], + "description": "Used to fetch a list of archives (meetings that were recorded).", "security": [ { "HTTPBearer": [] @@ -190,6 +194,7 @@ "tags": [ "VideoChatSessionController" ], + "description": "Used to stop the current active meeting. Meeting cannot be stopped again if it is already stopped. Successful execution will add the endTime attribute to a recently ending session.", "security": [ { "HTTPBearer": [] @@ -220,6 +225,7 @@ "tags": [ "VideoChatSessionController" ], + "description": "Used for Generating token, which is used for connecting to a room/session on a client side. In vonage, there are three different roles (Moderator, Subscriber, Publisher). We can use expire time for limited validity of a token. Successful execution will send a token.", "security": [ { "HTTPBearer": [] @@ -266,6 +272,7 @@ "tags": [ "VideoChatSessionController" ], + "description": "Used fr editing the meeting", "security": [ { "HTTPBearer": [] @@ -306,6 +313,7 @@ "tags": [ "VideoChatSessionController" ], + "description": "Used for Creating a session with options such as end to end encryption, archive mode. Note: Archiving Option cannot be enabled while using end to end encryption, otherwise an Error will be thrown. Successful execution will send a meeting link id which can be used to amend in client url.", "security": [ { "HTTPBearer": [] @@ -341,6 +349,7 @@ "tags": [ "VideoChatSessionController" ], + "description": "Webhook API hit from a third party to add/update session attendees in a meeting.", "responses": { "204": { "description": "POST /webhooks/session Success" diff --git a/services/video-conferencing-service/openapi.md b/services/video-conferencing-service/openapi.md index 4825c8777d..815088d93a 100644 --- a/services/video-conferencing-service/openapi.md +++ b/services/video-conferencing-service/openapi.md @@ -85,6 +85,8 @@ fetch('/archives/storage-target', `PUT /archives/storage-target` +Configures custom storage target to a custom Amazon s3 bucket or Microsoft Azure Storage. + > Body parameter ```json @@ -167,6 +169,8 @@ fetch('/archives/{archiveId}', `GET /archives/{archiveId}` +Used to fetch a specific archive w.r.t archiveId. If archive is not present, it will throw HTTP Not Found Error. +

Parameters

|Name|In|Type|Required|Description| @@ -245,6 +249,8 @@ fetch('/archives/{archiveId}', `DELETE /archives/{archiveId}` +Used to delete a specific archive w.r.t archiveId. If archive is not present, it will throw HTTP Not Found Error. +

Parameters

|Name|In|Type|Required|Description| @@ -321,6 +327,8 @@ fetch('/archives', `GET /archives` +Used to fetch a list of archives (meetings that were recorded). + > Example responses > 200 Response @@ -472,6 +480,8 @@ fetch('/session/{meetingLinkId}/end', `PATCH /session/{meetingLinkId}/end` +Used to stop the current active meeting. Meeting cannot be stopped again if it is already stopped. Successful execution will add the endTime attribute to a recently ending session. +

Parameters

|Name|In|Type|Required|Description| @@ -542,6 +552,8 @@ fetch('/session/{meetingLinkId}/token', `POST /session/{meetingLinkId}/token` +Used for Generating token, which is used for connecting to a room/session on a client side. In vonage, there are three different roles (Moderator, Subscriber, Publisher). We can use expire time for limited validity of a token. Successful execution will send a token. + > Body parameter ```json @@ -667,6 +679,8 @@ fetch('/session/{meetingLinkId}', `PATCH /session/{meetingLinkId}` +Used fr editing the meeting + > Body parameter ```json @@ -764,6 +778,8 @@ fetch('/session', `POST /session` +Used for Creating a session with options such as end to end encryption, archive mode. Note: Archiving Option cannot be enabled while using end to end encryption, otherwise an Error will be thrown. Successful execution will send a meeting link id which can be used to amend in client url. + > Body parameter ```json @@ -844,6 +860,8 @@ fetch('/webhooks/session', `POST /webhooks/session` +Webhook API hit from a third party to add/update session attendees in a meeting. + > Body parameter ```json diff --git a/services/video-conferencing-service/src/controllers/video-chat-archive.controller.ts b/services/video-conferencing-service/src/controllers/video-chat-archive.controller.ts index 2ad346d284..6f3e4dbb44 100644 --- a/services/video-conferencing-service/src/controllers/video-chat-archive.controller.ts +++ b/services/video-conferencing-service/src/controllers/video-chat-archive.controller.ts @@ -31,6 +31,8 @@ export class VideoChatArchiveController { @authenticate(STRATEGY.BEARER) @authorize({permissions: [PermissionKeys.GetArchives]}) @get('/archives/{archiveId}', { + description: + 'Used to fetch a specific archive w.r.t archiveId. If archive is not present, it will throw HTTP Not Found Error.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -67,6 +69,8 @@ export class VideoChatArchiveController { @authenticate(STRATEGY.BEARER) @authorize({permissions: [PermissionKeys.GetArchives]}) @get('/archives', { + description: + 'Used to fetch a list of archives (meetings that were recorded).', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -87,6 +91,8 @@ export class VideoChatArchiveController { @authenticate(STRATEGY.BEARER) @authorize({permissions: [PermissionKeys.DeleteArchive]}) @del('/archives/{archiveId}', { + description: + 'Used to delete a specific archive w.r.t archiveId. If archive is not present, it will throw HTTP Not Found Error.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -125,6 +131,8 @@ export class VideoChatArchiveController { @authenticate(STRATEGY.BEARER) @authorize({permissions: [PermissionKeys.SetUploadTarget]}) @put('/archives/storage-target', { + description: + 'Configures custom storage target to a custom Amazon s3 bucket or Microsoft Azure Storage.', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { diff --git a/services/video-conferencing-service/src/controllers/video-chat-session.controller.ts b/services/video-conferencing-service/src/controllers/video-chat-session.controller.ts index ed4ae7d442..32efac88d5 100644 --- a/services/video-conferencing-service/src/controllers/video-chat-session.controller.ts +++ b/services/video-conferencing-service/src/controllers/video-chat-session.controller.ts @@ -53,6 +53,10 @@ export class VideoChatSessionController { @authenticate(STRATEGY.BEARER) @authorize({permissions: [PermissionKeys.CreateSession]}) @post('/session', { + description: `Used for Creating a session with options such as end to end encryption, archive mode. + Note: Archiving Option cannot be enabled while using end to end encryption, otherwise + an Error will be thrown. Successful execution will send a meeting link + id which can be used to amend in client url.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -119,6 +123,10 @@ export class VideoChatSessionController { @authenticate(STRATEGY.BEARER) @authorize({permissions: [PermissionKeys.GenerateToken]}) @post('/session/{meetingLinkId}/token', { + description: `Used for Generating token, which is used for connecting to a room/session on a client side. + In vonage, there are three different roles (Moderator, Subscriber, Publisher). + We can use expire time for limited validity of a token. Successful + execution will send a token.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.OK]: { @@ -219,6 +227,7 @@ export class VideoChatSessionController { @authenticate(STRATEGY.BEARER) @authorize({permissions: [PermissionKeys.EditMeeting]}) @patch('/session/{meetingLinkId}', { + description: 'Used for editing the meeting', security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { @@ -312,6 +321,9 @@ export class VideoChatSessionController { @authenticate(STRATEGY.BEARER) @authorize({permissions: [PermissionKeys.StopMeeting]}) @patch('/session/{meetingLinkId}/end', { + description: `Used to stop the current active meeting. Meeting cannot be stopped again if it is + already stopped. Successful execution will add the endTime attribute to a recently + ending session.`, security: OPERATION_SECURITY_SPEC, responses: { [STATUS_CODE.NO_CONTENT]: { @@ -367,6 +379,8 @@ export class VideoChatSessionController { @authorize({permissions: ['*']}) @post('/webhooks/session', { + description: + 'Webhook API hit from a third party to add/update session attendees in a meeting.', responses: { [STATUS_CODE.NO_CONTENT]: { description: 'POST /webhooks/session Success',