-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(task-service): complete reimplementation of task service (#1839)
* feat(task-service): complete reimplementation of task service MIGRATION CHANGE: migration-20230809101404- basic setup of task service db migration-20230809100541- basic setu of example db migration-20230808104436- basic setup of task service db GH-1785 * feat(task-service): resolve sonar issues MIGRATION CHANGE: migration-20230808104436- add user task in migrations GH-1785 * fix(task-service): add filter option for events GH-1785 * fix(task-service): add adaptfrom in adapter, add user modify repo MIGRATION CHANGE: migration-20230808104436- updated migration to incude user modify properties GH-1785 * feat(task-service): add tests for new code MIGRATION CHANGE: migration-20230808104436- basic migrations for setup migration-20230808104437- http component related migrations BB-1785 * feat(task-service): rename sub task to user task interface BB-1785 * fix(task-service): remove redundant code from tests GH-1785 * fix(task-service): add cascade option for user tasks BB-1785
- Loading branch information
1 parent
a243dd0
commit e79c28a
Showing
161 changed files
with
29,140 additions
and
3,711 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,53 @@ | ||
'use strict'; | ||
|
||
var dbm; | ||
var type; | ||
var seed; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var Promise; | ||
|
||
/** | ||
* We receive the dbmigrate dependency from dbmigrate initially. | ||
* This enables us to not have to rely on NODE_PATH. | ||
*/ | ||
exports.setup = function(options, seedLink) { | ||
dbm = options.dbmigrate; | ||
type = dbm.dataType; | ||
seed = seedLink; | ||
Promise = options.Promise; | ||
}; | ||
|
||
exports.up = function(db) { | ||
var filePath = path.join(__dirname, 'sqls', '20230808104436-init-up.sql'); | ||
return new Promise( function( resolve, reject ) { | ||
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ | ||
if (err) return reject(err); | ||
console.log('received data: ' + data); | ||
|
||
resolve(data); | ||
}); | ||
}) | ||
.then(function(data) { | ||
return db.runSql(data); | ||
}); | ||
}; | ||
|
||
exports.down = function(db) { | ||
var filePath = path.join(__dirname, 'sqls', '20230808104436-init-down.sql'); | ||
return new Promise( function( resolve, reject ) { | ||
fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){ | ||
if (err) return reject(err); | ||
console.log('received data: ' + data); | ||
|
||
resolve(data); | ||
}); | ||
}) | ||
.then(function(data) { | ||
return db.runSql(data); | ||
}); | ||
}; | ||
|
||
exports._meta = { | ||
"version": 1 | ||
}; |
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
15 changes: 15 additions & 0 deletions
15
sandbox/task-example/migrations/sqls/20230808104436-init-down.sql
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,15 @@ | ||
DROP TABLE "main".tasks CASCADE; | ||
|
||
DROP TABLE "main".user_tasks CASCADE; | ||
|
||
DROP TABLE "main".task_assignements CASCADE; | ||
|
||
DROP TABLE "main".task_workflows CASCADE; | ||
|
||
DROP TABLE "main".events CASCADE; | ||
|
||
DROP TABLE "main".event_workflows CASCADE; | ||
|
||
DROP TABLE "main".workflows CASCADE; | ||
|
||
DROP TABLE "main".workflow_versions CASCADE; |
125 changes: 125 additions & 0 deletions
125
sandbox/task-example/migrations/sqls/20230808104436-init-up.sql
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,125 @@ | ||
CREATE SCHEMA IF NOT EXISTS main; | ||
GRANT ALL ON SCHEMA main TO public; | ||
|
||
CREATE TABLE "main".tasks | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
key varchar NOT NULL, | ||
name varchar, | ||
description varchar, | ||
status varchar, | ||
priority varchar, | ||
severity varchar, | ||
type varchar, | ||
start_date timestamptz, | ||
due_date timestamptz, | ||
end_date timestamptz, | ||
created_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
modified_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
deleted_on timestamptz, | ||
created_by uuid, | ||
modified_by uuid, | ||
deleted_by uuid, | ||
deleted boolean, | ||
assignee_id uuid, | ||
metadata json, | ||
external_id varchar, | ||
CONSTRAINT pk_tasks_id PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE "main".user_tasks | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
task_id uuid NOT NULL, | ||
status varchar, | ||
external_id varchar, | ||
name varchar, | ||
created_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
modified_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
deleted_on timestamptz, | ||
created_by uuid, | ||
modified_by uuid, | ||
deleted_by uuid, | ||
deleted boolean, | ||
CONSTRAINT pk_sub_tasks_id PRIMARY KEY (id), | ||
CONSTRAINT fk_sub_tasks_tasks FOREIGN KEY (task_id) REFERENCES "main".tasks (id) | ||
); | ||
|
||
CREATE TABLE "main".task_workflows | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
workflow_key varchar, | ||
task_key varchar, | ||
created_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
modified_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
deleted_on timestamptz, | ||
created_by uuid, | ||
modified_by uuid, | ||
deleted_by uuid, | ||
deleted boolean, | ||
CONSTRAINT pk_task_workflows_id PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE "main".events | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
"key" varchar, | ||
"description" varchar, | ||
source varchar, | ||
payload json, | ||
created_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
CONSTRAINT pk_events_id PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE "main".event_workflows | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
event_key varchar, | ||
workflow_key varchar, | ||
created_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
modified_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
deleted_on timestamptz, | ||
created_by uuid, | ||
modified_by uuid, | ||
deleted_by uuid, | ||
deleted boolean, | ||
CONSTRAINT pk_event_workflows_id PRIMARY KEY (id) | ||
); | ||
|
||
|
||
CREATE SCHEMA IF NOT EXISTS main; | ||
GRANT ALL ON SCHEMA main TO public; | ||
|
||
CREATE TABLE "main".workflows | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
workflow_version integer NOT NULL, | ||
name varchar, | ||
description varchar, | ||
external_identifier varchar, | ||
provider varchar, | ||
created_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
modified_on timestamptz DEFAULT current_timestamp NOT NULL, | ||
deleted_on timestamptz, | ||
created_by uuid, | ||
modified_by uuid, | ||
deleted_by uuid, | ||
deleted boolean, | ||
inputschema json, | ||
CONSTRAINT pk_workflows_id PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE "main".workflow_versions | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
"version" integer NOT NULL, | ||
workflow_id uuid NOT NULL, | ||
bpmn_diagram xml, | ||
external_workflow_id varchar, | ||
bpmn_file_name varchar(100), | ||
inputschema json, | ||
CONSTRAINT idx_workflow_versions PRIMARY KEY ("version", workflow_id) | ||
); | ||
|
||
ALTER TABLE "main".workflow_versions | ||
ADD CONSTRAINT fk_workflow_versions_workflows FOREIGN KEY (workflow_id) REFERENCES "main".workflows (id); |
3 changes: 3 additions & 0 deletions
3
sandbox/task-example/migrations/sqls/20230808104437-http-down.sql
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,3 @@ | ||
DROP TABLE "main".webhook_subscriptions CASCADE; | ||
|
||
DROP TABLE "main".client_apps CASCADE; |
17 changes: 17 additions & 0 deletions
17
sandbox/task-example/migrations/sqls/20230808104437-http-up.sql
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,17 @@ | ||
|
||
CREATE TABLE "main".webhook_subscriptions | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
"key" varchar NOT NULL, | ||
"url" varchar NOT NULL, | ||
CONSTRAINT pk_webhook_subscriptions_id PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE "main".client_apps | ||
( | ||
id uuid DEFAULT md5(random()::text || clock_timestamp()::text)::uuid NOT NULL, | ||
"api_key" varchar NOT NULL, | ||
"api_secret" varchar NOT NULL, | ||
name varchar NOT NULL, | ||
CONSTRAINT pk_api_keys_id PRIMARY KEY (id) | ||
); |
10 changes: 0 additions & 10 deletions
10
sandbox/task-example/migrations/sqls/20230809100541-init-down.sql
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.