Code docs: https://szymonrykala.github.io/ravsAPI Built on top of the Slim 4 micro framework
Installation steps:
- Configure environment by setting env variables specified in Environment section.
- Create a Cloudinary image transformation named
ravs-image-transformation
. - Log into the server or container and execute
/ops/install.php
script. - Set up a cron job (or corresponding tool) to each day execute
/ops/cleaning.php
script. - Log into Your administrator account with credentials specified in the environment.
dbConnect.php
- providec connection to the database for following scriptscleaning.php
- executes SQL defined functions for reservations and requests history cleaning purposesinstall.php
- contains all app instalation logic
This application uses PostgreSQL database with TLS connection.
DATABASE_URL
- connection string to database with specified schema: postgres://user_name
:user_password
@host
:port
/database_name
ADMIN_PASSWORD
- definition of admin account passwordADMIN_EMAIL
- admin email account
SMTP account is used to send notifications to the users.
SMTP_USER
- email address used to send emailsSMTP_PASSWORD
- password to email accountSMTP_HOST
- mailing hostSMTP_PORT
- smtp portSMTP_DEBUG
- debug property, default0
Cloudinary is an external service for image processing.
CLOUDINARY_CLOUD_NAME
- cloud name of cloudinary accountCLOUDINARY_SECRET
- cloudinary secretCLOUDINARY_KEY
- cloudinary account api key
TOKEN_SECRET
- secret string used to encode and decode the tokenTOKEN_EXPIRY
- days count when token expiers, default1
dayTOKEN_SIPHER_ALGORITHM
- token encoding algorithm, defaultHS512
Supported algorithms:ES384
,ES256
,HS256
,HS384
,HS512
,RS256
,RS384
,RS512
,EdDSA
.
LOG_PATH
- path to file with logs, defaultphp://stdout
LOGGER_LEVEL
- logger verbosity level Avaliable logger levels:DEBUG
,INFO
,NOTICE
,WARNING
,ERROR
,CRITICAL
,ALERT
,EMERGENCY
.DISPLAY_ERROR_DETAILS
- defaultfalse
LOG_ERROR_DETAILS
- defaultfalse
LOG_ERROR
- defaultfalse
Installation script will create one administrative access class and one admin account. In addition its configured with following parameters which can be updated:
DEFAULT_USER_ACCESS
- id of default access for new usersMAX_IMAGE_SIZE
- maximum size of image in BytesMAX_RESERVATION_TIME
- maximum time of reservation in minutesMIN_RESERVATION_TIME
- minimum time of reservation in minutesREQUEST_HISTORY
- history of the requests in daysRESERVATION_HISTORY
- history of reservations in days
- address - cannot remove if contains buildings
- building - cannot remove if contains rooms
- room - while removing all reservations will be deleted
- reservation - cannot remove if reservation is pending
- access - cannot remove if there are users assigned to this access class or it's admin or default user class
- user - if user defetes his account, his data are changed to random strings. To delete account in this state, administrator have to delete such user.
- if room do not has a key assigned, the key do not have to be provided
- keys can be piccked up till 1 hour after reservation planned start
Policies which each new reservation have to meet:
- Reserved room cannot be blocked
- Reservation time has to be future
- Time slot need to align with app configuration max. and min. time
- Reservation time have to be done when building is open
- There can be no overlaping reservations
- Reservation has not started
- You can update till day before reservation stat - disabled
- if room is changed - room cannot be blocked
- if time is changed
- Time slot need to align with app configuration max. and min. time
- Reservation time have to be done when building is open
- There can be no overlaping reservations
Postman docs: https://documenter.getpostman.com/view/13316422/UUxtEWFW