From 19089efb8f197ff7cdd5aba80eeceae4f1a80df1 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 4 Feb 2026 18:38:20 +0800 Subject: [PATCH 1/2] Updated backend dependencies --- backend/go.mod | 2 +- backend/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/go.mod b/backend/go.mod index 307783d..5499b48 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -15,7 +15,7 @@ require ( github.com/bytedance/sonic v1.15.0 // indirect github.com/bytedance/sonic/loader v0.5.0 // indirect github.com/cloudwego/base64x v0.1.6 // indirect - github.com/gabriel-vasile/mimetype v1.4.12 // indirect + github.com/gabriel-vasile/mimetype v1.4.13 // indirect github.com/gin-contrib/sse v1.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect diff --git a/backend/go.sum b/backend/go.sum index 91381ba..cf289eb 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -11,8 +11,8 @@ github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gE github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw= -github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= +github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM= +github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gin-contrib/cors v1.7.6 h1:3gQ8GMzs1Ylpf70y8bMw4fVpycXIeX1ZemuSQIsnQQY= github.com/gin-contrib/cors v1.7.6/go.mod h1:Ulcl+xN4jel9t1Ry8vqph23a60FwH9xVLd+3ykmTjOk= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= From edc40aea6ab9bb77baef6864a7d40fae2666ad72 Mon Sep 17 00:00:00 2001 From: Patrick Alvin Alcala Date: Wed, 4 Feb 2026 18:38:38 +0800 Subject: [PATCH 2/2] Updated backend --- backend/main.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/main.go b/backend/main.go index 491f66b..cb26b7e 100644 --- a/backend/main.go +++ b/backend/main.go @@ -30,16 +30,17 @@ func getCORSConfig(env string) cors.Config { case "dev": return cors.Config{ AllowOrigins: []string{"http://localhost:5173"}, - AllowMethods: []string{"GET", "POST"}, - AllowHeaders: []string{"Origin", "OCBO-Token", "Content-Length", "Content-Type"}, + AllowMethods: []string{"GET", "POST", "OPTIONS"}, + AllowHeaders: []string{"Origin", "OCBO-Token", "Content-Length", "Content-Type", "X-Server"}, ExposeHeaders: []string{"Content-Length"}, AllowCredentials: true, } case "prod": return cors.Config{ - AllowOrigins: []string{"https://ocboapps.davaocity.gov.ph"}, - AllowMethods: []string{"GET", "POST"}, - AllowHeaders: []string{"Origin", "OCBO-Token", "Content-Length", "Content-Type"}, + AllowOrigins: []string{"https://ocboapps.davaocity.gov.ph", "https://esign.patalcala.com"}, + AllowMethods: []string{"GET", "POST", "OPTIONS"}, + // AllowHeaders: []string{"Origin", "OCBO-Token", "Content-Length", "Content-Type", "X-Server", "Authorization"}, + AllowHeaders: []string{"*"}, ExposeHeaders: []string{"Content-Length"}, AllowCredentials: true, } @@ -83,6 +84,7 @@ func connect() { router := gin.Default() router.Use(cors.New(getCORSConfig(env))) + // router.Use(cors.Default()) router.StaticFile("/", "static/index.html") router.StaticFile("/esign.webp", "static/esign.webp") @@ -1363,7 +1365,7 @@ func connect() { array := []string{} array2 := []string{} - results, err := db.Query(`SELECT IFNULL(referenceNo, '') AS result, IFNULL(date_signed, '') AS result2 FROM esign_transactions WHERE esignid = (SELECT esignid FROM esign WHERE employeeid = (SELECT employeeid FROM employee WHERE employeename = ?))`, data) + results, err := db.Query(`SELECT IFNULL(referenceNo, '') AS result, IFNULL(DATE_FORMAT(date_signed, '%M %e, %Y'), '') AS result2 FROM esign_transactions WHERE esignid = (SELECT esignid FROM esign WHERE employeeid = (SELECT employeeid FROM employee WHERE employeename = ?))`, data) if err != nil { c.AbortWithError(http.StatusBadRequest, err) c.String(http.StatusBadRequest, err.Error()) @@ -1392,7 +1394,7 @@ func connect() { return } c.JSON(http.StatusOK, gin.H{ - "result": result, + "result": result, }) }