From b6f85461147666f8ecc8f4c479cc9e5c55dafbdd Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Tue, 30 Sep 2025 09:37:48 +0800 Subject: [PATCH] Updated backend --- backend/main.go | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/backend/main.go b/backend/main.go index 8757460..5b692b6 100644 --- a/backend/main.go +++ b/backend/main.go @@ -158,6 +158,26 @@ func connect() { "result2": array2, }) + case "get-list-registered": + array := []string{} + + results, err := db.Query("SELECT IFNULL(employeeid, 0) AS result FROM esign WHERE employeeid <> ?", 276) + if err != nil { + c.AbortWithError(http.StatusBadRequest, err) + c.String(http.StatusBadRequest, err.Error()) + } + for results.Next() { + err = results.Scan(&result) + if err != nil { + c.AbortWithError(http.StatusBadRequest, err) + c.String(http.StatusBadRequest, err.Error()) + } + array = append(array, result) + } + c.JSON(http.StatusOK, gin.H{ + "result": array, + }) + } }) @@ -466,7 +486,7 @@ func connect() { "result": result, }) - case "get-password": + case "get-password": err := db.QueryRow("SELECT IFNULL(password, '') AS result FROM esign WHERE employeeid = ?", data).Scan(&result) if err != nil { if err == sql.ErrNoRows { @@ -480,6 +500,17 @@ func connect() { c.JSON(http.StatusOK, gin.H{ "result": result, }) + + case "get-employeename": + err := db.QueryRow("SELECT IFNULL(employeename, '') AS result FROM employee WHERE employeeid = ?", data).Scan(&result) + if err != nil { + c.AbortWithError(http.StatusBadRequest, err) + c.String(http.StatusBadRequest, err.Error()) + } + c.JSON(http.StatusOK, gin.H{ + "result": result, + }) + } })