diff --git a/bbconf/bb_todo_resolvers.toml b/bbconf/bb_todo_resolvers.toml index 71eeed9..92a1574 100644 --- a/bbconf/bb_todo_resolvers.toml +++ b/bbconf/bb_todo_resolvers.toml @@ -24,17 +24,17 @@ modify_table = ["Task", ""] modify_values = [["title", "'$title'"], ["description", "'$description'"], ["completed", "$completed"], ["list_id", "'$list.$id'"]] aggregate_final_json_result = true -[resolvers.getUser] -operation_name = "getUser" +[resolvers.createUser] +operation_name = "createUser" -[resolvers.getUser.resolver] -command_type = "SQLSelect" +[resolvers.createUser.resolver] +command_type = "SQLInsert" columns = [] -tables = [["User", ""]] -where_clauses = [["User", "username", "= '$username'"]] +tables = [] +where_clauses = [] join_clauses = [] -modify_table = ["", ""] -modify_values = [] +modify_table = ["User", ""] +modify_values = [["username", "'$username'"], ["name", "'$name'"]] aggregate_final_json_result = true [resolvers.createList] @@ -62,3 +62,16 @@ join_clauses = [] modify_table = ["Task", ""] modify_values = [["title", "'$title'"], ["description", "'$description'"], ["completed", "$completed"], ["list_id", "'$list.$id'"], ["user_username", "'$user.$username'"]] aggregate_final_json_result = true + +[resolvers.getUser] +operation_name = "getUser" + +[resolvers.getUser.resolver] +command_type = "SQLSelect" +columns = [] +tables = [["User", ""]] +where_clauses = [["User", "username", "= '$username'"]] +join_clauses = [] +modify_table = ["", ""] +modify_values = [] +aggregate_final_json_result = true diff --git a/bbconf/broker-config.toml b/bbconf/broker-config.toml index f6bd92d..846aada 100644 --- a/bbconf/broker-config.toml +++ b/bbconf/broker-config.toml @@ -4,7 +4,7 @@ log_level = "trace" [graphql] # path and file name to GraphQL schema file -schema_file = "todo5_schema.graphql" +schema_file = "todo_schema.graphql" [proxy] # host name or IP of basebox DB proxy diff --git a/bbconf/compile_schema.sh b/bbconf/compile_schema.sh new file mode 100755 index 0000000..c9d2a5b --- /dev/null +++ b/bbconf/compile_schema.sh @@ -0,0 +1,3 @@ +#!/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 2373c3d..52bef23 100644 --- a/bbconf/dbproxy-config.toml +++ b/bbconf/dbproxy-config.toml @@ -20,7 +20,7 @@ acc_aud = "account" [graphql] # path and file name to GraphQL schema file -schema_file = "todo5_schema.graphql" +schema_file = "todo_schema.graphql" # Path and file name of the resolver map file resolver_map_file = "bb_todo_resolvers.toml" # Path and file name of the type map file diff --git a/bbconf/install-config.toml b/bbconf/install-config.toml new file mode 100644 index 0000000..718ebd7 --- /dev/null +++ b/bbconf/install-config.toml @@ -0,0 +1,18 @@ +# Sample toml file; for testing only + +[generic] +# the name of the project +project_name = "bb_todo" +# the folder where the generated files will be placed. If not specifed, the project name will be +# used to create a folder by that name in the current directory. Note that the folder must not exist +# yet in order to make ensure that an existing installation will not be overwritten by accident. +output = "output" + +[log] +# log level; can be off, error, warn, info, debug, trace +log_level = "info" + +[graphql] +schema = "todo_schema.graphql" + +[database] diff --git a/bbconf/todo5_schema.graphql b/bbconf/todo_schema.graphql similarity index 91% rename from bbconf/todo5_schema.graphql rename to bbconf/todo_schema.graphql index 08212c1..6fd796e 100644 --- a/bbconf/todo5_schema.graphql +++ b/bbconf/todo_schema.graphql @@ -44,6 +44,11 @@ type Query { type Mutation { + createUser( + username: String!, + name: String! + ): User @bb_resolver(_type: insert, _object: User, _fields: { username: "$username", name: "$name" }) + createList( title: String! user: User! # username needs to be specified as it's non-nullable diff --git a/src/components/OAUthError.vue b/src/components/OAUthError.vue index 1e23dff..c0bbc43 100644 --- a/src/components/OAUthError.vue +++ b/src/components/OAUthError.vue @@ -1,3 +1,9 @@ +