Compare commits

..

No commits in common. "edc40aea6ab9bb77baef6864a7d40fae2666ad72" and "6545d115fab6bdb4708750ad2759d70f49d9efbb" have entirely different histories.

3 changed files with 10 additions and 12 deletions

View file

@ -15,7 +15,7 @@ require (
github.com/bytedance/sonic v1.15.0 // indirect github.com/bytedance/sonic v1.15.0 // indirect
github.com/bytedance/sonic/loader v0.5.0 // indirect github.com/bytedance/sonic/loader v0.5.0 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect github.com/cloudwego/base64x v0.1.6 // indirect
github.com/gabriel-vasile/mimetype v1.4.13 // indirect github.com/gabriel-vasile/mimetype v1.4.12 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect github.com/gin-contrib/sse v1.1.0 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect

View file

@ -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.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 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gabriel-vasile/mimetype v1.4.13 h1:46nXokslUBsAJE/wMsp5gtO500a4F3Nkz9Ufpk2AcUM= github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw=
github.com/gabriel-vasile/mimetype v1.4.13/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s=
github.com/gin-contrib/cors v1.7.6 h1:3gQ8GMzs1Ylpf70y8bMw4fVpycXIeX1ZemuSQIsnQQY= 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/cors v1.7.6/go.mod h1:Ulcl+xN4jel9t1Ry8vqph23a60FwH9xVLd+3ykmTjOk=
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w= github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=

View file

@ -30,17 +30,16 @@ func getCORSConfig(env string) cors.Config {
case "dev": case "dev":
return cors.Config{ return cors.Config{
AllowOrigins: []string{"http://localhost:5173"}, AllowOrigins: []string{"http://localhost:5173"},
AllowMethods: []string{"GET", "POST", "OPTIONS"}, AllowMethods: []string{"GET", "POST"},
AllowHeaders: []string{"Origin", "OCBO-Token", "Content-Length", "Content-Type", "X-Server"}, AllowHeaders: []string{"Origin", "OCBO-Token", "Content-Length", "Content-Type"},
ExposeHeaders: []string{"Content-Length"}, ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true, AllowCredentials: true,
} }
case "prod": case "prod":
return cors.Config{ return cors.Config{
AllowOrigins: []string{"https://ocboapps.davaocity.gov.ph", "https://esign.patalcala.com"}, AllowOrigins: []string{"https://ocboapps.davaocity.gov.ph"},
AllowMethods: []string{"GET", "POST", "OPTIONS"}, AllowMethods: []string{"GET", "POST"},
// AllowHeaders: []string{"Origin", "OCBO-Token", "Content-Length", "Content-Type", "X-Server", "Authorization"}, AllowHeaders: []string{"Origin", "OCBO-Token", "Content-Length", "Content-Type"},
AllowHeaders: []string{"*"},
ExposeHeaders: []string{"Content-Length"}, ExposeHeaders: []string{"Content-Length"},
AllowCredentials: true, AllowCredentials: true,
} }
@ -84,7 +83,6 @@ func connect() {
router := gin.Default() router := gin.Default()
router.Use(cors.New(getCORSConfig(env))) router.Use(cors.New(getCORSConfig(env)))
// router.Use(cors.Default())
router.StaticFile("/", "static/index.html") router.StaticFile("/", "static/index.html")
router.StaticFile("/esign.webp", "static/esign.webp") router.StaticFile("/esign.webp", "static/esign.webp")
@ -1365,7 +1363,7 @@ func connect() {
array := []string{} array := []string{}
array2 := []string{} array2 := []string{}
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) 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)
if err != nil { if err != nil {
c.AbortWithError(http.StatusBadRequest, err) c.AbortWithError(http.StatusBadRequest, err)
c.String(http.StatusBadRequest, err.Error()) c.String(http.StatusBadRequest, err.Error())
@ -1394,7 +1392,7 @@ func connect() {
return return
} }
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"result": result, "result": result,
}) })
} }