From c322a87eed083427b21fe0ec8c788627af706cf1 Mon Sep 17 00:00:00 2001 From: Wappler Date: Tue, 7 Jan 2025 21:56:04 -0600 Subject: [PATCH] wip to save variables without a post created a SC to .run when dynamic event is fired --- .wappler/project.json | 11 +--- .../app/modules/connections/DB.json | 8 +-- .../targets/Development/databases/DB.json | 8 +-- .../targets/Development/databases/MyDB.json | 15 ++++- app/api/myInsertMeta.json | 59 +++++++++++++++++++ app/api/myUpdate.json | 13 +++- app/modules/connections/DB.json | 8 +-- public/dmxAppConnect/config.js | 4 ++ views/observationPage.ejs | 2 + 9 files changed, 100 insertions(+), 28 deletions(-) create mode 100644 app/api/myInsertMeta.json diff --git a/.wappler/project.json b/.wappler/project.json index c00bcf9..e6b1451 100644 --- a/.wappler/project.json +++ b/.wappler/project.json @@ -38,14 +38,9 @@ "webLoggingMaxFiles": "5", "webLoggingMaxFileSize": "10m", "dockerTimezone": "Etc/UTC", - "databaseConnectionType": "custom", - "databaseType": "mysql", - "db_host": "localhost", - "db_port": "9910", - "db_user": "root", - "db_password": "m4U9O3LOTVWK8SZR", - "db_database": "db_training", - "NodeImageType": "slim" + "databaseConnectionType": "sqlite", + "NodeImageType": "slim", + "sqliteDbFile": "/public/ERTSQlite.db" }, { "name": "DO-ertfastfiller-sfo3", diff --git a/.wappler/targets/Development/app/modules/connections/DB.json b/.wappler/targets/Development/app/modules/connections/DB.json index 7153f38..12359b7 100644 --- a/.wappler/targets/Development/app/modules/connections/DB.json +++ b/.wappler/targets/Development/app/modules/connections/DB.json @@ -3,13 +3,9 @@ "module": "dbconnector", "action": "connect", "options": { - "client": "mysql2", + "client": "sqlite3", "connection": { - "host": "localhost", - "port": 9910, - "user": "root", - "password": "m4U9O3LOTVWK8SZR", - "database": "db_training" + "filename": "/public/ERTSQlite.db" } } } \ No newline at end of file diff --git a/.wappler/targets/Development/databases/DB.json b/.wappler/targets/Development/databases/DB.json index 1731536..f1e70bb 100644 --- a/.wappler/targets/Development/databases/DB.json +++ b/.wappler/targets/Development/databases/DB.json @@ -1,12 +1,8 @@ { "direct": true, - "type": "mysql2", + "type": "sqlite3", "connection": { - "host": "localhost", - "port": 9910, - "user": "root", - "password": "m4U9O3LOTVWK8SZR", - "database": "db_training" + "filename": "/public/ERTSQlite.db" }, "schema": { "tables": { diff --git a/.wappler/targets/Development/databases/MyDB.json b/.wappler/targets/Development/databases/MyDB.json index cbca4a4..f4e52b0 100644 --- a/.wappler/targets/Development/databases/MyDB.json +++ b/.wappler/targets/Development/databases/MyDB.json @@ -86,9 +86,22 @@ "primary": true, "nullable": false } + }, + "da_id": { + "db_edits": { + "type": "integer", + "name": "da_id", + "maxLength": "" + }, + "status": { + "new": true + } } }, - "db": {} + "db": {}, + "status": { + "children_modified": true + } } }, "views": {}, diff --git a/app/api/myInsertMeta.json b/app/api/myInsertMeta.json new file mode 100644 index 0000000..6c0fe3a --- /dev/null +++ b/app/api/myInsertMeta.json @@ -0,0 +1,59 @@ +{ + "meta": { + "$_GET": [ + { + "type": "array", + "name": "arrayvalue" + } + ], + "$_POST": [ + { + "type": "text", + "name": "da_id" + } + ] + }, + "exec": { + "steps": { + "name": "myinsertmeta", + "module": "dbupdater", + "action": "insert", + "options": { + "connection": "MyDB", + "sql": { + "type": "insert", + "values": [ + { + "table": "da_meta", + "column": "da_id", + "type": "text", + "value": "{{$_POST.da_id}}" + } + ], + "table": "da_meta", + "returning": "id", + "query": "insert into `da_meta` (`da_id`) values (?)", + "params": [ + { + "name": ":P1", + "type": "expression", + "value": "{{$_POST.da_id}}", + "test": "" + } + ] + } + }, + "meta": [ + { + "name": "identity", + "type": "text" + }, + { + "name": "affected", + "type": "number" + } + ], + "output": true + } + } +} \ No newline at end of file diff --git a/app/api/myUpdate.json b/app/api/myUpdate.json index 18cca0a..418e9b0 100644 --- a/app/api/myUpdate.json +++ b/app/api/myUpdate.json @@ -1,3 +1,14 @@ { - "exec": {} + "name": "Myupdate", + "module": "dbupdater", + "action": "update", + "options": { + "connection": "MyDB" + }, + "meta": [ + { + "name": "affected", + "type": "number" + } + ] } \ No newline at end of file diff --git a/app/modules/connections/DB.json b/app/modules/connections/DB.json index 7153f38..12359b7 100644 --- a/app/modules/connections/DB.json +++ b/app/modules/connections/DB.json @@ -3,13 +3,9 @@ "module": "dbconnector", "action": "connect", "options": { - "client": "mysql2", + "client": "sqlite3", "connection": { - "host": "localhost", - "port": 9910, - "user": "root", - "password": "m4U9O3LOTVWK8SZR", - "database": "db_training" + "filename": "/public/ERTSQlite.db" } } } \ No newline at end of file diff --git a/public/dmxAppConnect/config.js b/public/dmxAppConnect/config.js index a806762..5e36ac9 100644 --- a/public/dmxAppConnect/config.js +++ b/public/dmxAppConnect/config.js @@ -98,6 +98,10 @@ dmx.config({ } ], "outputType": "array" + }, + "arr1": { + "meta": null, + "outputType": "text" } } }); diff --git a/views/observationPage.ejs b/views/observationPage.ejs index e0b9666..2171756 100644 --- a/views/observationPage.ejs +++ b/views/observationPage.ejs @@ -1,4 +1,6 @@ + +