A pluggable Spring Boot RESTful web service to enable Notification system in Metalnx.
This server was generated by the swagger-codegen project.
Refer: OpenAPI-Spec
The underlying library integrating swagger to SpringBoot is springfox
Start your server as an simple java application
You can view the api documentation in swagger-ui by pointing to
http://localhost:8888/swagger-ui.html
Change default port value in application.properties
Database schema should be configured using flywaydb. This project includes code that supports database migrations across versions.
Reference docs
We'll use the Maven plugin in our own processes and documentation, but there are other options as well.
N.B.: User and password information needs to be kept secure. There are maven plugin configuration options.
- Set up the database (we will use postgres in the spirit of the iRODS install)
$ (sudo) su - postgres
postgres$ psql
psql> CREATE USER irodsext WITH PASSWORD 'password';
psql> CREATE DATABASE "notification";
psql> GRANT ALL PRIVILEGES ON DATABASE "notifications" TO irodsext;
psql> ALTER USER irodsext WITH SUPERUSER;
psql>Alter user irodsext with SUPERUSER;
need to add superuser role to use uuid-ossp
- Setting up Maven profile
vi ~/.m2/settings.xml
<profile>
<id>flyway-local</id>
<properties>
<flyway.jdbc.url>jdbc:postgresql://<address>:<port>/<metalnx-db-name></flyway.jdbc.url>
<flyway.db.user>irodsext</flyway.db.user>
<flyway.db.password>password</flyway.db.password>
<flyway.db.schema>public</flyway.db.schema>
</properties>
</profile>
- Clean database (Warning destructive! clears your database)
mvn flyway:clean
- Migration, this is the first command to run from 0 on a clean database
mvn flyway:migrate
For future migration use benchmark
mvn flyway:benchmark
Looks at existing database to set to initial version. This is not for new databases.
attribute_name | datatype | comment |
---|---|---|
id(PK) | BIGINT | auto generated sequence |
notification_id | uuid | using uuid-ossp module functions to generate universally unique identifiers (UUIDs) |
sender_id | VARCHAR | notification sender's userId extracted from JWT |
recipient_id | VARCHAR | notification recipient's userId |
subject | TEXT | notification subject |
message | TEXT | notification message |
seen | BOOLEAN | boolean for user's seen/unseen notification status |
deleted | BOOLEAN | boolean for deleted notification, notification will not be deleted from postgres db |
date_created | TIMESTAMP | timestamp auto-generated by postgres db |
severity_level | INTEGER | severity level of notification an integer value between 1 and 5 |
notification_type | VARCHAR | type of notification options are workflow, permission, system |
data_location_url | TEXT | notification associated logical location of data |