Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC#1102/custom annotations #291

Merged
merged 22 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
8460ca1
feat: create annotation table with default annotations
smnhgn Nov 26, 2024
ce0d47d
feat: add system annotation get endpoint
smnhgn Jan 9, 2025
e330839
chore: add test for system annotation get endpoint
smnhgn Jan 9, 2025
2ca13b5
feat: add endpoint + test for single annotation config
smnhgn Jan 9, 2025
6502ac1
fix: permissions for annotation configs
smnhgn Jan 9, 2025
98604ee
refactor: rename AnnotationModel -> CellAnnotationConfigModel
smnhgn Jan 9, 2025
861f2df
feat add delete endpoint for annotation config + test
smnhgn Jan 9, 2025
fefd43e
feat: add update endpoint for annotation config + test
smnhgn Jan 9, 2025
7d60f5c
feat: add create endpoint for annotation config + tests
smnhgn Jan 9, 2025
026215e
fix: linter errors
smnhgn Jan 15, 2025
bb538f7
Update src/main/resources/schema/schema_v38.sql
smnhgn Jan 20, 2025
a0b108b
chore: remove todos for messaging client
smnhgn Jan 20, 2025
cbec214
fix: use db to set priority if missing in payload
smnhgn Jan 20, 2025
cd79530
fix: set correct priority
smnhgn Jan 20, 2025
6b3ec3a
fix: codacy problem
smnhgn Jan 20, 2025
0184a37
chore: add tests for empty/missing payload on create and update
smnhgn Jan 20, 2025
b4ec366
feat: only allow removal of custom annotation configs
smnhgn Jan 21, 2025
d391dd2
fix: spotless errors
smnhgn Jan 21, 2025
e80e5ab
feat: add column `annotation_name` in `user_table_annotations` with m…
smnhgn Jan 21, 2025
afc16cf
Update src/main/resources/schema/schema_v38.sql
smnhgn Jan 23, 2025
1b8de3a
Update src/main/resources/schema/schema_v38.sql
smnhgn Jan 23, 2025
137fbcb
fix: pr fixes
smnhgn Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion role-permissions-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@
"editServiceDisplayProperty",
"createMedia",
"editMedia",
"deleteMedia"
"deleteMedia",
"createCellAnnotationConfig",
"viewCellAnnotationConfig",
"deleteCellAnnotationConfig",
"editCellAnnotationConfig"
]
}
]
Expand Down
11 changes: 10 additions & 1 deletion role-permissions-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@
"editServiceStructureProperty",
"editServiceDisplayProperty"
]
},
{
"type": "grant",
"action": [
"createCellAnnotationConfig",
"viewCellAnnotationConfig",
"deleteCellAnnotationConfig",
"editCellAnnotationConfig"
]
}
]
}
}
24 changes: 24 additions & 0 deletions src/main/resources/schema/schema_v38.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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, FALSE);

INSERT INTO system_annotations (name, priority, fg_color, bg_color, display_name, is_multilang, is_dashboard, is_custom)
VALUES ('check-me', 2, '#ffffff', '#c274ff', '{"de":"Bitte überprüfen","en":"Please double-check"}', FALSE, TRUE, FALSE);

INSERT INTO system_annotations (name, priority, fg_color, bg_color, display_name, is_multilang, is_dashboard, is_custom)
VALUES ('postpone', 3, '#ffffff', '#999999', '{"de":"Später","en":"Later"}', FALSE, TRUE, FALSE);

INSERT INTO system_annotations (name, priority, fg_color, bg_color, display_name, is_multilang, is_dashboard, is_custom)
VALUES ('needs_translation', 4, '#ffffff', '#ffae74', '{"de":"Übersetzung nötig","en":"Translation necessary"}', TRUE, TRUE, FALSE);
smnhgn marked this conversation as resolved.
Show resolved Hide resolved
266 changes: 266 additions & 0 deletions src/main/resources/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,138 @@
}
}
},
"/system/annotations": {
"get": {
"summary": "Get all annotation configs",
"description": "Returns an array containing all available annotation configs.",
"tags": [
"system"
],
"operationId": "get-all-annotation-configs",
"consumes": [],
"produces": [
"application/json"
],
"parameters": [],
"responses": {
"200": {
"description": "The annotations",
"schema": {
"$ref": "#/definitions/Response: Annotation Configs"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/responses/unknown-error"
}
}
}
},
"post": {
"summary": "Create a new annotation config",
"description": "Creates the annotation config.",
"tags": [
"system"
],
"operationId": "create-new-annotation-config",
"parameters": [
{
"name": "annotation config",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/Request: Create annotation config"
}
}
],
"responses": {
"200": {
"description": "The new annotation config",
"schema": {
"$ref": "#/definitions/CellAnnotationConfig"
}
},
"default": {
"description": "Unexpected error",
"schema": {
"$ref": "#/responses/unknown-error"
}
}
}
}
},
"/system/annotations/{annotationName}": {
"parameters": [
{
"$ref": "#/parameters/annotationName"
}
],
"get": {
"summary": "Get annotation config",
"description": "Returns the config of an annotation.",
"tags": [
"system"
],
"operationId": "get-annotation-config",
"responses": {
"200": {
"description": "Config of the annotation",
"schema": {
"$ref": "#/definitions/CellAnnotationConfig"
}
},
"404": {
"$ref": "#/responses/not-found-in-database"
}
}
},
"patch": {
"summary": "Update annotation config",
"description": "Updates an annotation config.",
"tags": [
"system"
],
"operationId": "update-annotation-config",
"parameters": [
{
"name": "annotation config",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CellAnnotationConfig"
}
}
],
"responses": {
"200": {
"description": "Config of the annotation",
"schema": {
"$ref": "#/definitions/CellAnnotationConfig"
}
},
"404": {
"$ref": "#/responses/not-found-in-database"
}
}
},
"delete": {
"summary": "Delete an annotation config",
"description": "Deletes the config of an annotation.",
"tags": [
"system"
],
"operationId": "delete-annotation-config",
"responses": {
"200": {
"$ref": "#/responses/ok-empty-body"
},
"404": {
"$ref": "#/responses/not-found-in-database"
}
}
}
},
"/system/update": {
"post": {
"summary": "Update system tables",
Expand Down Expand Up @@ -2219,6 +2351,63 @@
}
}
},
"CellAnnotationConfig": {
"type": "object",
"required": [
"name",
"priority",
"fgColor",
"bgColor",
"displayName",
"isMultilang",
"isDashboard"
],
"properties": {
"name": {
"description": "name of the annotation",
"type": "string",
"example": "important"
},
"priority": {
"description": "priority of the annotation",
"type": "number",
"example": 1
},
"fgColor": {
"description": "foreground color of the annotation",
"type": "string",
"example": "#ffffff"
},
"bgColor": {
"description": "background color of the annotation",
"type": "string",
"example": "#ff7474"
},
"displayName": {
"description": "display name of the annotation as multilang obj",
"type": "object",
"example": {
"de": "Wichtig",
"en": "Important"
}
},
"isMultilang": {
"description": "multilang flag for the annotation",
"type": "boolean",
"example": false
},
"isDashboard": {
"description": "dashboard flag for the annotation",
"type": "boolean",
"example": true
},
"isCustom": {
"description": "custom flag for the annotation",
"type": "boolean",
"example": true
}
}
},
"Pagination": {
"type": "object",
"required": [
Expand Down Expand Up @@ -2475,6 +2664,25 @@
"services"
]
},
"Response: Annotation Configs": {
"type": "object",
"allOf": [
{
"$ref": "#/definitions/Property:Status"
}
],
"properties": {
"annotations": {
"type": "array",
"items": {
"$ref": "#/definitions/CellAnnotationConfig"
}
}
},
"required": [
"annotations"
]
},
"Response:Cell": {
"description": "The cell value.",
"type": "object",
Expand Down Expand Up @@ -3091,6 +3299,56 @@
}
}
},
"Request: Create annotation config": {
"type": "object",
"required": [
"name",
"fgColor",
"bgColor",
"displayName"
],
"properties": {
"name": {
"description": "name of the annotation",
"type": "string",
"example": "important"
},
"priority": {
"description": "priority of the annotation",
"type": "number",
"example": 1
},
"fgColor": {
"description": "foreground color of the annotation",
"type": "string",
"example": "#ffffff"
},
"bgColor": {
"description": "background color of the annotation",
"type": "string",
"example": "#ff7474"
},
"displayName": {
"description": "display name of the annotation as multilang obj",
"type": "object",
"example": {
"de": "Wichtig",
"en": "Important"
}
},
"isMultilang": {
"description": "multilang flag for the annotation",
"type": "boolean",
"example": false
},
"isDashboard": {
"description": "dashboard flag for the annotation",
"type": "boolean",
"example": true
}
},
"description": "Creates a new annotation config."
},
"Response: Complete table": {
"type": "object",
"required": [
Expand Down Expand Up @@ -4206,6 +4464,14 @@
"in": "query",
"type": "boolean",
"required": false
},
"annotationName": {
"name": "annotationName",
"description": "The name of the annotation",
"in": "path",
"required": true,
"type": "string",
"example": "postpone"
}
},
"responses": {
Expand Down
Loading
Loading