-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: create annotation table with default annotations * feat: add system annotation get endpoint * chore: add test for system annotation get endpoint * feat: add endpoint + test for single annotation config * fix: permissions for annotation configs * refactor: rename AnnotationModel -> CellAnnotationConfigModel * feat add delete endpoint for annotation config + test * feat: add update endpoint for annotation config + test * feat: add create endpoint for annotation config + tests * fix: linter errors * Update src/main/resources/schema/schema_v38.sql Co-authored-by: Zingl Manfred <mz@campudus.com> * chore: remove todos for messaging client * fix: use db to set priority if missing in payload * fix: set correct priority * fix: codacy problem * chore: add tests for empty/missing payload on create and update * feat: only allow removal of custom annotation configs * fix: spotless errors * feat: add column `annotation_name` in `user_table_annotations` with migration * Update src/main/resources/schema/schema_v38.sql Co-authored-by: Zingl Manfred <mz@campudus.com> * Update src/main/resources/schema/schema_v38.sql Co-authored-by: Zingl Manfred <mz@campudus.com> * fix: pr fixes --------- Co-authored-by: Zingl Manfred <mz@campudus.com>
- Loading branch information
Showing
18 changed files
with
1,207 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
CREATE TABLE system_annotations ( | ||
name VARCHAR(50) NOT NULL, | ||
priority SERIAL, | ||
fg_color VARCHAR(50) NULL, | ||
bg_color VARCHAR(50) NULL, | ||
display_name JSON, | ||
is_multilang BOOLEAN NOT NULL DEFAULT FALSE, | ||
is_dashboard BOOLEAN NOT NULL DEFAULT TRUE, | ||
is_custom BOOLEAN NOT NULL DEFAULT TRUE, | ||
|
||
PRIMARY KEY (name) | ||
); | ||
|
||
INSERT INTO system_annotations | ||
(name, priority, fg_color, bg_color, display_name, is_multilang, is_dashboard, is_custom) | ||
VALUES | ||
('important', 1, '#ffffff', '#ff7474', '{"de":"Wichtig","en":"Important"}', FALSE, TRUE, TRUE), | ||
('check-me', 2, '#ffffff', '#c274ff', '{"de":"Bitte überprüfen","en":"Please double-check"}', FALSE, TRUE, TRUE), | ||
('postpone', 3, '#ffffff', '#999999', '{"de":"Später","en":"Later"}', FALSE, TRUE, TRUE), | ||
('needs_translation', 4, '#ffffff', '#ffae74', '{"de":"Übersetzung nötig","en":"Translation necessary"}', TRUE, TRUE, FALSE); | ||
|
||
CREATE OR REPLACE FUNCTION add_annotation_name_column(tableid BIGINT) | ||
RETURNS TEXT AS $$ | ||
BEGIN | ||
EXECUTE 'ALTER TABLE user_table_annotations_' || tableid || ' ADD COLUMN annotation_name TEXT NULL'; | ||
EXECUTE 'ALTER TABLE user_table_annotations_' || tableid || ' ADD FOREIGN KEY (annotation_name) REFERENCES system_annotations (name) ON DELETE CASCADE ON UPDATE CASCADE'; | ||
EXECUTE 'UPDATE user_table_annotations_' || tableid || ' SET annotation_name = value WHERE type = ''flag'''; | ||
EXECUTE 'UPDATE user_table_annotations_' || tableid || ' SET value = NULL WHERE type = ''flag'''; | ||
RETURN 'user_table_annotations_' || tableid :: TEXT; | ||
END | ||
$$ LANGUAGE plpgsql; | ||
|
||
SELECT add_annotation_name_column(table_id) | ||
FROM system_table; | ||
|
||
DROP FUNCTION add_annotation_name_column( BIGINT ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.