From 0c273b85da64ac59f459dba66a06ce0296807df6 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Mon, 5 Jan 2026 17:31:21 +0800 Subject: [PATCH] Added get-headname api --- backend/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/main.go b/backend/main.go index cf54c0b..bcef4a2 100644 --- a/backend/main.go +++ b/backend/main.go @@ -423,6 +423,17 @@ func connect() { "result": array, }) + case "get-headname": + err = db.QueryRow("SELECT IFNULL(employeename, '') AS result FROM employee WHERE is_head = 1").Scan(&result) + if err != nil { + c.AbortWithError(http.StatusBadRequest, err) + c.String(http.StatusBadRequest, err.Error()) + return + } + c.JSON(http.StatusOK, gin.H{ + "result": result, + }) + } })