@sourceloop/scheduler-service / Exports
@sourceloop/scheduler-service¶
Overview¶
This is a loopback4 component for scheduling events in calendar (scheduler/calendar server).
Various features of Scheduler Service:
-
CRUD feature: Basic add/edit/delete Event/Invitation in calendar. (As a REST API)
-
Reminder Feature: Support or provide integration with notification/reminder service, which has the option of sending email/popup and SMS notification.
-
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.
-
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
- Events
- Event Attendee
- Event Attachment
You can see the database schema here.
To get started with a basic implementation of this service, see /sandbox/scheduler-example.
Install¶
Workflow Diagrams¶
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.
- Run the migrations.
-
Bind the Scheduler Config to
SchedulerBindings.Config
key-
-
Add the
SchedulerComponent
to your Loopback4 Application (inapplication.ts
)
- Set up a Loopback4 Datasource with
dataSourceName
property set toSchedulerDatasourceName
. You can see an example datasource here. - Set up a Loopback4 Datasource with
dataSourceName
property set toAuthCacheDatasourceName
. You can see an example datasource here. -
Audit Logs
To generate audit logs for video conferencing service, you'll have to set the env var
ADD_AUDIT_LOG_MIXIN
totrue
and configure a datasource for it like below:Configure .env of application in index.ts before exporting application like follows
-
Using with Sequelize
This service supports Sequelize as the underlying ORM using @loopback/sequelize extension. And in order to use it, you'll need to do following changes.
- To use Sequelize in your application, add following to application.ts:
- Use the
SequelizeDataSource
in your datasource as the parent class. Refer this for more.
- Start the application
npm start
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.
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
¶
Here is a sample Implementation DataSource
implementation using environment variables and PostgreSQL as the data source.
Here is a sample Implementation Cache DataSource
implementation using environment variables and Redis as the data source.
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
with 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 databases, they may be affected. In such a 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.
Additionally, there is now an option to choose between SQL migration or PostgreSQL migration. NOTE : For @sourceloop/cli users, this choice can be specified during the scaffolding process by selecting the "type of datasource" option.
Database Schema¶
API's Details¶
Visit the OpenAPI spec docs
Feedback¶
If you've noticed a bug or have a question or have a feature request, search the issue tracker to see if someone else in the community has already created a ticket. If not, go ahead and make one! 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 it. Appreciation really helps in keeping this project alive.
Contributing¶
Please read CONTRIBUTING.md for details on the process for submitting pull requests to us.
Code of conduct¶
Code of conduct guidelines here.