This app allows managing booking of Eliona resources. It provides an API for external apps to allow synchronization with other services.
To start and initialize an app in an Eliona environment, the app has to be registered in Eliona. For this, entries in database tables public.eliona_app
and public.eliona_store
are necessary.
This initialization can be handled by the reset.sql
script.
-
CONNECTION_STRING
: configures the Eliona database. Otherwise, the app can't be initialized and started (e.g.postgres://user:pass@localhost:5432/iot
). -
INIT_CONNECTION_STRING
: configures the Eliona database for app initialization like creating schema and tables (e.g.postgres://user:pass@localhost:5432/iot
). Default is content ofCONNECTION_STRING
. -
API_ENDPOINT
: configures the endpoint to access the Eliona API v2. Otherwise, the app can't be initialized and started. (e.g.http://api-v2:3000/v2
) -
API_TOKEN
: defines the secret to authenticate the app and access the Eliona API. -
API_SERVER_PORT
(optional): define the port the API server listens. The default value is Port3000
. -
LOG_LEVEL
(optional): defines the minimum level that should be logged. The default level isinfo
.
The app requires configuration data that remains in the database. To do this, the app creates its own database schema booking
during initialization. To modify and handle the configuration data the app provides an API access. Have a look at the API specification how the configuration tables should be used.
booking.configuration
: Stores configuration information for front-end to guide the user with booking times. Supports only one configuration per installation.booking.event
: Contains information about bookings.booking.evet_resource
: Links events to assets.
Generation: to generate access method to database see Generation section below.
The app provides its own API to access configuration data and other functions. The full description of the API is defined in the openapi.yaml
OpenAPI definition file.
- API Reference shows Details of the API
Generation: to generate api server stub see Generation section below.
The booking app controls the "Occupancy" attribute in the assets that have been booked at least once.
The booking API is used by Eliona frontend to create bookings.
For the API server the OpenAPI Generator for go-server is used to generate a server stub. The easiest way to generate the server files is to use one of the predefined generation script which use the OpenAPI Generator Docker image.
.\generate-api-server.cmd # Windows
./generate-api-server.sh # Linux
For the database access SQLBoiler is used. The easiest way to generate the database files is to use one of the predefined generation script which use the SQLBoiler implementation. Please note that the database connection in the sqlboiler.toml
file have to be configured.
.\generate-db.cmd # Windows
./generate-db.sh # Linux