Adopted to current basebox BETA

This commit is contained in:
Markus Thielen 2023-05-08 13:12:59 +02:00
parent de9e33418f
commit 0b115d1e4e
3 changed files with 70 additions and 60 deletions

View File

@ -1,20 +1,33 @@
[resolvers.createList] [resolvers.createTask]
operation_name = "createList" operation_name = "createTask"
[resolvers.createList.resolver] [resolvers.createTask.resolver]
command_type = "SQLInsert" command_type = "SQLInsert"
[resolvers.createList.resolver.command] [resolvers.createTask.resolver.command]
table = "List" table = "Task"
columns = [] columns = []
nested_modify_tables = []
where_clauses = [] where_clauses = []
aggregate_result = true aggregate_result = true
[[resolvers.createList.resolver.command.modify_values]] [[resolvers.createTask.resolver.command.modify_values]]
column = "title" column = "title"
value = "'$title'" value = "'$title'"
[[resolvers.createList.resolver.command.modify_values]] [[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" column = "user_username"
value = "'$user.$username'" value = "'$user.$username'"
@ -27,6 +40,7 @@ command_type = "SQLInsert"
[resolvers.createUser.resolver.command] [resolvers.createUser.resolver.command]
table = "User" table = "User"
columns = [] columns = []
nested_modify_tables = []
where_clauses = [] where_clauses = []
aggregate_result = true aggregate_result = true
@ -48,6 +62,7 @@ command_type = "SQLDelete"
table = "Task" table = "Task"
columns = [] columns = []
modify_values = [] modify_values = []
nested_modify_tables = []
aggregate_result = true aggregate_result = true
[[resolvers.deleteTask.resolver.command.where_clauses]] [[resolvers.deleteTask.resolver.command.where_clauses]]
@ -56,27 +71,46 @@ column = "id"
condition_str = "= '$id'" condition_str = "= '$id'"
index = "" index = ""
[resolvers.updateList] [resolvers.deleteList]
operation_name = "updateList" operation_name = "deleteList"
[resolvers.updateList.resolver] [resolvers.deleteList.resolver]
command_type = "SQLUpdate" command_type = "SQLDelete"
[resolvers.updateList.resolver.command] [resolvers.deleteList.resolver.command]
table = "List" table = "List"
columns = [] columns = []
modify_values = []
nested_modify_tables = []
aggregate_result = true aggregate_result = true
[[resolvers.updateList.resolver.command.modify_values]] [[resolvers.deleteList.resolver.command.where_clauses]]
column = "title"
value = "'$title'"
[[resolvers.updateList.resolver.command.where_clauses]]
table = "List" table = "List"
column = "id" column = "id"
condition_str = "= '$id'" condition_str = "= '$id'"
index = "" index = ""
[resolvers.createList]
operation_name = "createList"
[resolvers.createList.resolver]
command_type = "SQLInsert"
[resolvers.createList.resolver.command]
table = "List"
columns = []
nested_modify_tables = []
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'"
[resolvers.updateTask] [resolvers.updateTask]
operation_name = "updateTask" operation_name = "updateTask"
@ -86,6 +120,7 @@ command_type = "SQLUpdate"
[resolvers.updateTask.resolver.command] [resolvers.updateTask.resolver.command]
table = "Task" table = "Task"
columns = [] columns = []
nested_modify_tables = []
aggregate_result = true aggregate_result = true
[[resolvers.updateTask.resolver.command.modify_values]] [[resolvers.updateTask.resolver.command.modify_values]]
@ -110,38 +145,6 @@ column = "id"
condition_str = "= '$id'" condition_str = "= '$id'"
index = "" 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.getUser] [resolvers.getUser]
operation_name = "getUser" operation_name = "getUser"
@ -152,6 +155,7 @@ command_type = "SQLSelect"
table = "User" table = "User"
columns = [] columns = []
modify_values = [] modify_values = []
nested_modify_tables = []
aggregate_result = true aggregate_result = true
[[resolvers.getUser.resolver.command.where_clauses]] [[resolvers.getUser.resolver.command.where_clauses]]
@ -160,19 +164,23 @@ column = "username"
condition_str = "= '$username'" condition_str = "= '$username'"
index = "" index = ""
[resolvers.deleteList] [resolvers.updateList]
operation_name = "deleteList" operation_name = "updateList"
[resolvers.deleteList.resolver] [resolvers.updateList.resolver]
command_type = "SQLDelete" command_type = "SQLUpdate"
[resolvers.deleteList.resolver.command] [resolvers.updateList.resolver.command]
table = "List" table = "List"
columns = [] columns = []
modify_values = [] nested_modify_tables = []
aggregate_result = true aggregate_result = true
[[resolvers.deleteList.resolver.command.where_clauses]] [[resolvers.updateList.resolver.command.modify_values]]
column = "title"
value = "'$title'"
[[resolvers.updateList.resolver.command.where_clauses]]
table = "List" table = "List"
column = "id" column = "id"
condition_str = "= '$id'" condition_str = "= '$id'"

View File

@ -141,7 +141,9 @@ export default {
request request
).then(data => { ).then(data => {
/* Save the task's id in case it was just created */ /* Save the task's id in case it was just created */
task.id = data.Task.id; if (!task.id) {
task.id = data.createTask.id;
}
}).catch(e => { }).catch(e => {
const errMsg = `Failed to save task: ${e}`; const errMsg = `Failed to save task: ${e}`;
console.error(errMsg); console.error(errMsg);

View File

@ -13,7 +13,7 @@ export const store = reactive({
userName: "stranger", userName: "stranger",
/** base URL of basebox broker host */ /** base URL of basebox broker host */
baseboxHost: process.env.BASEBOX_HOST || "http://127.0.0.1:8080", baseboxHost: import.meta.env.BASEBOX_HOST || "http://127.0.0.1:8080",
/** basebox session data */ /** basebox session data */
session: {}, session: {},
@ -118,8 +118,8 @@ export async function storeInit(session) {
} }
} }
}`).then(data => { }`).then(data => {
store.lists = data.User.lists ? data.User.lists : []; store.lists = data.getUser.lists ? data.getUser.lists : [];
store.tasks = data.User.tasks ? data.User.tasks : []; store.tasks = data.getUser.tasks ? data.getUser.tasks : [];
/* create default list if necessary */ /* create default list if necessary */
if (store.lists.length === 0) { if (store.lists.length === 0) {
gqlQuery(`mutation { gqlQuery(`mutation {