Updated backend

This commit is contained in:
Patrick Alvin Alcala 2025-09-30 09:37:48 +08:00
parent 69a64879b6
commit b6f8546114

View file

@ -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,
})
}
})
@ -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,
})
}
})