From c14ca0f43101d79ecde203b9b5a629445b297434 Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Sat, 4 Jan 2025 22:27:39 +0300 Subject: [PATCH] FIX: Image not being saved on ToDo drag&drop category change; FEATURE: Using emails instead of logins --- pages/category.html | 12 +++++----- pages/login.html | 24 ++++++++++---------- pages/register.html | 29 +++++------------------- src/db/db.go | 14 ++++++------ src/db/db_test.go | 10 ++++----- src/db/group.go | 26 +++++++++------------- src/db/todo.go | 36 +++++++++++++++--------------- src/db/user.go | 36 ++++++++++++++++-------------- src/server/api_test.go | 8 +++---- src/server/endpoints.go | 48 ++++++++++++++++++++-------------------- src/server/validation.go | 48 +++++++++++++++------------------------- 11 files changed, 128 insertions(+), 163 deletions(-) diff --git a/pages/category.html b/pages/category.html index 979aad7..d5d4633 100644 --- a/pages/category.html +++ b/pages/category.html @@ -111,9 +111,9 @@ {{ if not .Image }} - + {{ else }} - + {{ end }} {{ .Text }} {{ .TimeCreated }} @@ -240,15 +240,15 @@ async function drop(event) { return; } - // Add a copy of this ToDo in the corresponding group - let result = await postNewTodo({ + // Update todo's group ID + let result = await updateTodo(todoId, { text: draggedTodo.getElementsByClassName("todo-text")[0].innerText, groupId: Number(targetGroupId), dueUnix: Number(draggedTodo.getElementsByClassName("todo-due-unix")[0].innerText), + image: Array.from(draggedTodo.getElementsByClassName("todo-image")[0].src, char => char.charCodeAt(0)) }); - // Delete this ToDo in this group - await deleteTodoRefresh(todoId); + window.location.reload(); } document.addEventListener('DOMContentLoaded', async function() { diff --git a/pages/login.html b/pages/login.html index 2b0d35a..88c73f0 100644 --- a/pages/login.html +++ b/pages/login.html @@ -8,14 +8,14 @@

Log in

- Login + Email
@@ -42,21 +42,21 @@