feat(fullstack): Add notifications, user is now an entity, add testcontainers, rework custom permissions, get user from JWT in endpoints
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
create table app_user
|
||||
(
|
||||
created_at timestamp(6) not null,
|
||||
modified_at timestamp(6) not null,
|
||||
id varchar(255) not null,
|
||||
name varchar(255) not null,
|
||||
role varchar(255),
|
||||
status varchar(255) not null check (status in ('INVITED', 'ACTIVE', 'BLOCKED', 'SUSPENDED_SUBSCRIPTION')),
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
create table application_form
|
||||
(
|
||||
is_template boolean not null,
|
||||
created_at timestamp(6) not null,
|
||||
modified_at timestamp(6) not null,
|
||||
id uuid not null,
|
||||
created_by_id varchar(255) not null,
|
||||
created_by_name varchar(255) not null,
|
||||
last_modified_by_id varchar(255) not null,
|
||||
last_modified_by_name varchar(255) not null,
|
||||
name varchar(255) not null,
|
||||
organization_id varchar(255),
|
||||
status enum ('APPROVED','DRAFT','REJECTED','SIGNED','SUBMITTED') not null,
|
||||
is_template boolean not null,
|
||||
created_at timestamp(6) not null,
|
||||
modified_at timestamp(6) not null,
|
||||
id uuid not null,
|
||||
created_by_id varchar(255) not null,
|
||||
last_modified_by_id varchar(255) not null,
|
||||
name varchar(255) not null,
|
||||
organization_id varchar(255),
|
||||
status varchar(255) not null check (status in ('DRAFT', 'SUBMITTED', 'APPROVED', 'REJECTED', 'SIGNED')),
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
@@ -22,15 +31,14 @@ create table comment
|
||||
form_element_id uuid not null,
|
||||
id uuid not null,
|
||||
created_by_id varchar(255) not null,
|
||||
created_by_name varchar(255) not null,
|
||||
message varchar(255) not null,
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
create table form_element_options
|
||||
(
|
||||
employee_data_category tinyint not null check (employee_data_category between 0 and 3),
|
||||
processing_purpose tinyint not null check (processing_purpose between 0 and 3),
|
||||
employee_data_category smallint not null check (employee_data_category between 0 and 3),
|
||||
processing_purpose smallint not null check (processing_purpose between 0 and 3),
|
||||
form_element_id uuid not null,
|
||||
label varchar(255) not null,
|
||||
option_value varchar(255) not null
|
||||
@@ -38,9 +46,9 @@ create table form_element_options
|
||||
|
||||
create table form_element
|
||||
(
|
||||
type tinyint not null check (type between 0 and 4),
|
||||
form_element_section_id uuid not null,
|
||||
id uuid not null,
|
||||
type smallint not null check (type between 0 and 4),
|
||||
form_element_section_id uuid not null,
|
||||
id uuid not null,
|
||||
description varchar(255),
|
||||
title varchar(255),
|
||||
primary key (id)
|
||||
@@ -56,11 +64,40 @@ create table form_element_section
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
create table notification
|
||||
(
|
||||
is_read boolean not null,
|
||||
created_at timestamp(6) not null,
|
||||
id uuid not null,
|
||||
click_target varchar(255) not null,
|
||||
message TEXT not null,
|
||||
recipient_id varchar(255),
|
||||
target_group varchar(255) not null,
|
||||
title varchar(255) not null,
|
||||
type varchar(255) not null check (type in ('INFO', 'WARNING', 'ERROR')),
|
||||
primary key (id)
|
||||
);
|
||||
|
||||
alter table if exists application_form
|
||||
add constraint FKhtad5onoy2jknhtyfmx6cvvey
|
||||
foreign key (created_by_id)
|
||||
references app_user;
|
||||
|
||||
alter table if exists application_form
|
||||
add constraint FK5yewx8bespw0uiivxioeh7q0d
|
||||
foreign key (last_modified_by_id)
|
||||
references app_user;
|
||||
|
||||
alter table if exists comment
|
||||
add constraint FKlavy9axrt26sepreg5lqtuoap
|
||||
foreign key (application_form_id)
|
||||
references application_form;
|
||||
|
||||
alter table if exists comment
|
||||
add constraint FKbbjqikfmgeacfsnaasxxqoygh
|
||||
foreign key (created_by_id)
|
||||
references app_user;
|
||||
|
||||
alter table if exists comment
|
||||
add constraint FKfg84w0i76tw9os13950272c6f
|
||||
foreign key (form_element_id)
|
||||
@@ -80,3 +117,8 @@ alter table if exists form_element_section
|
||||
add constraint FKtn0lreovauwf2v29doo70o3qs
|
||||
foreign key (application_form_id)
|
||||
references application_form;
|
||||
|
||||
alter table if exists notification
|
||||
add constraint FKeg1j4hnp0y4lbm0y35hgr4e8r
|
||||
foreign key (recipient_id)
|
||||
references app_user;
|
||||
|
||||
Reference in New Issue
Block a user