From 13295865404d874a88a88df25a32d3c2d2ab7ceb Mon Sep 17 00:00:00 2001 From: Markus Thielen Date: Fri, 24 Mar 2023 19:22:59 +0100 Subject: [PATCH] Renamed some filed to bbc style --- ...do_datamodel.sql => bb_todo-datamodel.sql} | 0 ...o_resolvers.toml => bb_todo-resolver.toml} | 158 +++++++------- ...todo_typemap.json => bb_todo-typemap.json} | 0 bbconf/bb_todo_resolvers.toml | 179 ---------------- bbconf/compile_schema.sh | 3 - bbconf/dbproxy-config.toml | 4 +- bbconf/todo_datamodel.sql | 32 --- bbconf/todo_typemap.json | 200 ------------------ 8 files changed, 81 insertions(+), 495 deletions(-) rename bbconf/{bb_todo_datamodel.sql => bb_todo-datamodel.sql} (100%) rename bbconf/{todo_resolvers.toml => bb_todo-resolver.toml} (100%) rename bbconf/{bb_todo_typemap.json => bb_todo-typemap.json} (100%) delete mode 100644 bbconf/bb_todo_resolvers.toml delete mode 100755 bbconf/compile_schema.sh delete mode 100644 bbconf/todo_datamodel.sql delete mode 100644 bbconf/todo_typemap.json diff --git a/bbconf/bb_todo_datamodel.sql b/bbconf/bb_todo-datamodel.sql similarity index 100% rename from bbconf/bb_todo_datamodel.sql rename to bbconf/bb_todo-datamodel.sql diff --git a/bbconf/todo_resolvers.toml b/bbconf/bb_todo-resolver.toml similarity index 100% rename from bbconf/todo_resolvers.toml rename to bbconf/bb_todo-resolver.toml index 7c1378e..5f2de5d 100644 --- a/bbconf/todo_resolvers.toml +++ b/bbconf/bb_todo-resolver.toml @@ -1,20 +1,70 @@ -[resolvers.updateList] -operation_name = "updateList" +[resolvers.deleteList] +operation_name = "deleteList" -[resolvers.updateList.resolver] -command_type = "SQLUpdate" +[resolvers.deleteList.resolver] +command_type = "SQLDelete" -[resolvers.updateList.resolver.command] +[resolvers.deleteList.resolver.command] table = "List" columns = [] +modify_values = [] aggregate_result = true -[[resolvers.updateList.resolver.command.modify_values]] +[[resolvers.deleteList.resolver.command.where_clauses]] +table = "List" +column = "id" +condition_str = "= '$id'" +index = "" + +[resolvers.createList] +operation_name = "createList" + +[resolvers.createList.resolver] +command_type = "SQLInsert" + +[resolvers.createList.resolver.command] +table = "List" +columns = [] +where_clauses = [] +aggregate_result = true + +[[resolvers.createList.resolver.command.modify_values]] column = "title" value = "'$title'" -[[resolvers.updateList.resolver.command.where_clauses]] -table = "List" +[[resolvers.createList.resolver.command.modify_values]] +column = "user_username" +value = "'$user.$username'" + +[resolvers.updateTask] +operation_name = "updateTask" + +[resolvers.updateTask.resolver] +command_type = "SQLUpdate" + +[resolvers.updateTask.resolver.command] +table = "Task" +columns = [] +aggregate_result = true + +[[resolvers.updateTask.resolver.command.modify_values]] +column = "title" +value = "'$title'" + +[[resolvers.updateTask.resolver.command.modify_values]] +column = "description" +value = "'$description'" + +[[resolvers.updateTask.resolver.command.modify_values]] +column = "completed" +value = "$completed" + +[[resolvers.updateTask.resolver.command.modify_values]] +column = "list_id" +value = "'$list.$id'" + +[[resolvers.updateTask.resolver.command.where_clauses]] +table = "Task" column = "id" condition_str = "= '$id'" index = "" @@ -51,6 +101,27 @@ value = "'$list.$id'" column = "user_username" value = "'$user.$username'" +[resolvers.updateList] +operation_name = "updateList" + +[resolvers.updateList.resolver] +command_type = "SQLUpdate" + +[resolvers.updateList.resolver.command] +table = "List" +columns = [] +aggregate_result = true + +[[resolvers.updateList.resolver.command.modify_values]] +column = "title" +value = "'$title'" + +[[resolvers.updateList.resolver.command.where_clauses]] +table = "List" +column = "id" +condition_str = "= '$id'" +index = "" + [resolvers.deleteTask] operation_name = "deleteTask" @@ -106,74 +177,3 @@ table = "User" column = "username" condition_str = "= '$username'" index = "" - -[resolvers.updateTask] -operation_name = "updateTask" - -[resolvers.updateTask.resolver] -command_type = "SQLUpdate" - -[resolvers.updateTask.resolver.command] -table = "Task" -columns = [] -aggregate_result = true - -[[resolvers.updateTask.resolver.command.modify_values]] -column = "title" -value = "'$title'" - -[[resolvers.updateTask.resolver.command.modify_values]] -column = "description" -value = "'$description'" - -[[resolvers.updateTask.resolver.command.modify_values]] -column = "completed" -value = "$completed" - -[[resolvers.updateTask.resolver.command.modify_values]] -column = "list_id" -value = "'$list.$id'" - -[[resolvers.updateTask.resolver.command.where_clauses]] -table = "Task" -column = "id" -condition_str = "= '$id'" -index = "" - -[resolvers.deleteList] -operation_name = "deleteList" - -[resolvers.deleteList.resolver] -command_type = "SQLDelete" - -[resolvers.deleteList.resolver.command] -table = "List" -columns = [] -modify_values = [] -aggregate_result = true - -[[resolvers.deleteList.resolver.command.where_clauses]] -table = "List" -column = "id" -condition_str = "= '$id'" -index = "" - -[resolvers.createList] -operation_name = "createList" - -[resolvers.createList.resolver] -command_type = "SQLInsert" - -[resolvers.createList.resolver.command] -table = "List" -columns = [] -where_clauses = [] -aggregate_result = true - -[[resolvers.createList.resolver.command.modify_values]] -column = "title" -value = "'$title'" - -[[resolvers.createList.resolver.command.modify_values]] -column = "user_username" -value = "'$user.$username'" diff --git a/bbconf/bb_todo_typemap.json b/bbconf/bb_todo-typemap.json similarity index 100% rename from bbconf/bb_todo_typemap.json rename to bbconf/bb_todo-typemap.json diff --git a/bbconf/bb_todo_resolvers.toml b/bbconf/bb_todo_resolvers.toml deleted file mode 100644 index b5a823a..0000000 --- a/bbconf/bb_todo_resolvers.toml +++ /dev/null @@ -1,179 +0,0 @@ -[resolvers.getUser] -operation_name = "getUser" - -[resolvers.getUser.resolver] -command_type = "SQLSelect" - -[resolvers.getUser.resolver.command] -table = "User" -columns = [] -modify_values = [] -aggregate_result = true - -[[resolvers.getUser.resolver.command.where_clauses]] -table = "User" -column = "username" -condition_str = "= '$username'" -index = "" - -[resolvers.updateTask] -operation_name = "updateTask" - -[resolvers.updateTask.resolver] -command_type = "SQLUpdate" - -[resolvers.updateTask.resolver.command] -table = "Task" -columns = [] -aggregate_result = true - -[[resolvers.updateTask.resolver.command.modify_values]] -column = "title" -value = "'$title'" - -[[resolvers.updateTask.resolver.command.modify_values]] -column = "description" -value = "'$description'" - -[[resolvers.updateTask.resolver.command.modify_values]] -column = "completed" -value = "'$completed'" - -[[resolvers.updateTask.resolver.command.modify_values]] -column = "list_id" -value = "'$list.$id'" - -[[resolvers.updateTask.resolver.command.where_clauses]] -table = "Task" -column = "id" -condition_str = "= '$id'" -index = "" - -[resolvers.deleteList] -operation_name = "deleteList" - -[resolvers.deleteList.resolver] -command_type = "SQLDelete" - -[resolvers.deleteList.resolver.command] -table = "List" -columns = [] -modify_values = [] -aggregate_result = true - -[[resolvers.deleteList.resolver.command.where_clauses]] -table = "List" -column = "id" -condition_str = "= '$id'" -index = "" - -[resolvers.createUser] -operation_name = "createUser" - -[resolvers.createUser.resolver] -command_type = "SQLInsert" - -[resolvers.createUser.resolver.command] -table = "User" -columns = [] -where_clauses = [] -aggregate_result = true - -[[resolvers.createUser.resolver.command.modify_values]] -column = "username" -value = "'$username'" - -[[resolvers.createUser.resolver.command.modify_values]] -column = "name" -value = "'$name'" - -[resolvers.deleteTask] -operation_name = "deleteTask" - -[resolvers.deleteTask.resolver] -command_type = "SQLDelete" - -[resolvers.deleteTask.resolver.command] -table = "Task" -columns = [] -modify_values = [] -aggregate_result = true - -[[resolvers.deleteTask.resolver.command.where_clauses]] -table = "Task" -column = "id" -condition_str = "= '$id'" -index = "" - -[resolvers.createTask] -operation_name = "createTask" - -[resolvers.createTask.resolver] -command_type = "SQLInsert" - -[resolvers.createTask.resolver.command] -table = "Task" -columns = [] -where_clauses = [] -aggregate_result = true - -[[resolvers.createTask.resolver.command.modify_values]] -column = "title" -value = "'$title'" - -[[resolvers.createTask.resolver.command.modify_values]] -column = "description" -value = "'$description'" - -[[resolvers.createTask.resolver.command.modify_values]] -column = "completed" -value = "'$completed'" - -[[resolvers.createTask.resolver.command.modify_values]] -column = "list_id" -value = "'$list.$id'" - -[[resolvers.createTask.resolver.command.modify_values]] -column = "user_username" -value = "'$user.$username'" - -[resolvers.updateList] -operation_name = "updateList" - -[resolvers.updateList.resolver] -command_type = "SQLUpdate" - -[resolvers.updateList.resolver.command] -table = "List" -columns = [] -aggregate_result = true - -[[resolvers.updateList.resolver.command.modify_values]] -column = "title" -value = "'$title'" - -[[resolvers.updateList.resolver.command.where_clauses]] -table = "List" -column = "id" -condition_str = "= '$id'" -index = "" - -[resolvers.createList] -operation_name = "createList" - -[resolvers.createList.resolver] -command_type = "SQLInsert" - -[resolvers.createList.resolver.command] -table = "List" -columns = [] -where_clauses = [] -aggregate_result = true - -[[resolvers.createList.resolver.command.modify_values]] -column = "title" -value = "'$title'" - -[[resolvers.createList.resolver.command.modify_values]] -column = "user_username" -value = "'$user.$username'" diff --git a/bbconf/compile_schema.sh b/bbconf/compile_schema.sh deleted file mode 100755 index c9d2a5b..0000000 --- a/bbconf/compile_schema.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -# Run basebox installer from the samples/toodo/bbconf directory -cargo run --manifest-path ../../../installer/Cargo.toml -- -c install-config.toml diff --git a/bbconf/dbproxy-config.toml b/bbconf/dbproxy-config.toml index ff49708..c05f47d 100644 --- a/bbconf/dbproxy-config.toml +++ b/bbconf/dbproxy-config.toml @@ -22,9 +22,9 @@ acc_aud = "account" # path and file name to GraphQL schema file schema_file = "todo_schema.graphql" # Path and file name of the resolver map file -resolver_map_file = "bb_todo_resolvers.toml" +resolver_map_file = "bb_todo-resolver.toml" # Path and file name of the type map file -type_map_file = "bb_todo_typemap.json" +type_map_file = "bb_todo-typemap.json" [database] # Type of database; currently, only "postgres" is suppoerted diff --git a/bbconf/todo_datamodel.sql b/bbconf/todo_datamodel.sql deleted file mode 100644 index 523b8ea..0000000 --- a/bbconf/todo_datamodel.sql +++ /dev/null @@ -1,32 +0,0 @@ -CREATE TABLE "List" ( - "id" UUID DEFAULT gen_random_uuid() NOT NULL, - "title" VARCHAR NOT NULL, - "user_username" VARCHAR NOT NULL -); - -CREATE TABLE "Task" ( - "id" UUID DEFAULT gen_random_uuid() NOT NULL, - "title" VARCHAR NOT NULL, - "description" VARCHAR, - "completed" BOOLEAN NOT NULL, - "user_username" VARCHAR NOT NULL, - "list_id" UUID NOT NULL -); - -CREATE TABLE "User" ( - "username" VARCHAR NOT NULL, - "name" VARCHAR -); - -ALTER TABLE "List" ADD PRIMARY KEY ("id"); - -ALTER TABLE "Task" ADD PRIMARY KEY ("id"); - -ALTER TABLE "User" ADD PRIMARY KEY ("username"); - -ALTER TABLE "List" ADD CONSTRAINT fk_list_1 FOREIGN KEY ("user_username") REFERENCES "User" ("username"); - -ALTER TABLE "Task" ADD CONSTRAINT fk_task_2 FOREIGN KEY ("user_username") REFERENCES "User" ("username"); - -ALTER TABLE "Task" ADD CONSTRAINT fk_task_3 FOREIGN KEY ("list_id") REFERENCES "List" ("id"); - diff --git a/bbconf/todo_typemap.json b/bbconf/todo_typemap.json deleted file mode 100644 index 04bad23..0000000 --- a/bbconf/todo_typemap.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "type_list": [ - { - "Object": { - "gql_object": "List", - "sql_table": "List" - } - }, - { - "ObjectField": { - "gql_object": "List", - "gql_field": "id", - "sql_table": "List", - "sql_column": "id" - } - }, - { - "ObjectField": { - "gql_object": "List", - "gql_field": "title", - "sql_table": "List", - "sql_column": "title" - } - }, - { - "Object": { - "gql_object": "Task", - "sql_table": "Task" - } - }, - { - "ObjectField": { - "gql_object": "Task", - "gql_field": "id", - "sql_table": "Task", - "sql_column": "id" - } - }, - { - "ObjectField": { - "gql_object": "Task", - "gql_field": "title", - "sql_table": "Task", - "sql_column": "title" - } - }, - { - "ObjectField": { - "gql_object": "Task", - "gql_field": "description", - "sql_table": "Task", - "sql_column": "description" - } - }, - { - "ObjectField": { - "gql_object": "Task", - "gql_field": "completed", - "sql_table": "Task", - "sql_column": "completed" - } - }, - { - "Object": { - "gql_object": "User", - "sql_table": "User" - } - }, - { - "ObjectField": { - "gql_object": "User", - "gql_field": "username", - "sql_table": "User", - "sql_column": "username" - } - }, - { - "ObjectField": { - "gql_object": "User", - "gql_field": "name", - "sql_table": "User", - "sql_column": "name" - } - }, - { - "Join": { - "gql_object": "List", - "gql_field": "user", - "gql_type": "User", - "sql_join_type": { - "OneToMany": { - "sql_table_of_object": "List", - "sql_table_of_field": "User", - "sql_mapped_columns": [ - [ - "user_username", - "username" - ] - ] - } - } - } - }, - { - "Join": { - "gql_object": "User", - "gql_field": "lists", - "gql_type": "List", - "sql_join_type": { - "ManyToOne": { - "sql_table_of_object": "User", - "sql_table_of_field": "List", - "sql_mapped_columns": [ - [ - "username", - "user_username" - ] - ] - } - } - } - }, - { - "Join": { - "gql_object": "Task", - "gql_field": "user", - "gql_type": "User", - "sql_join_type": { - "OneToMany": { - "sql_table_of_object": "Task", - "sql_table_of_field": "User", - "sql_mapped_columns": [ - [ - "user_username", - "username" - ] - ] - } - } - } - }, - { - "Join": { - "gql_object": "User", - "gql_field": "tasks", - "gql_type": "Task", - "sql_join_type": { - "ManyToOne": { - "sql_table_of_object": "User", - "sql_table_of_field": "Task", - "sql_mapped_columns": [ - [ - "username", - "user_username" - ] - ] - } - } - } - }, - { - "Join": { - "gql_object": "Task", - "gql_field": "list", - "gql_type": "List", - "sql_join_type": { - "OneToMany": { - "sql_table_of_object": "Task", - "sql_table_of_field": "List", - "sql_mapped_columns": [ - [ - "list_id", - "id" - ] - ] - } - } - } - }, - { - "Join": { - "gql_object": "List", - "gql_field": "tasks", - "gql_type": "Task", - "sql_join_type": { - "ManyToOne": { - "sql_table_of_object": "List", - "sql_table_of_field": "Task", - "sql_mapped_columns": [ - [ - "id", - "list_id" - ] - ] - } - } - } - } - ] -} \ No newline at end of file