Updated backend
This commit is contained in:
parent
edf54f4fbc
commit
21ae7356ae
1 changed files with 83 additions and 23 deletions
|
|
@ -1453,6 +1453,19 @@ func connect() {
|
|||
"result": result,
|
||||
})
|
||||
|
||||
case "check-statuspops-local":
|
||||
var resultInt, resultCount int
|
||||
err := dbpop.QueryRow(`SELECT COUNT(OrderPayId) AS resultInt, COUNT(AFNum) AS resultCount FROM orderpaydetail WHERE oprefid = ?`, data).Scan(&resultInt, &resultCount)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"result": resultInt,
|
||||
"result2": resultCount,
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -2322,6 +2335,50 @@ func connect() {
|
|||
}
|
||||
})
|
||||
|
||||
// router.POST("/api/return-approval-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||
// type returnApprovalData struct {
|
||||
// Data string `json:"data"` //electricalNo
|
||||
// }
|
||||
// var returnapprovalData returnApprovalData
|
||||
// if err := c.ShouldBindJSON(&returnapprovalData); err != nil {
|
||||
// c.String(http.StatusBadRequest, "Invalid request body")
|
||||
// return
|
||||
// }
|
||||
|
||||
// c.Writer.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||
// c.Writer.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
// c.Writer.Header().Set("X-DNS-Prefetch-Control", "off")
|
||||
// c.Writer.Header().Set("X-Frame-Options", "DENY")
|
||||
// c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||
// c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||
// c.Writer.Header().Set("Content-Security-Policy", "default-src 'self'; img-src 'self';")
|
||||
// c.Writer.Header().Set("X-Server", "OCBO Server")
|
||||
|
||||
// dbpost, err := db.Prepare("INSERT INTO esign_lock (esign_lockid, referenceNo, lock_code) VALUES (NULL, ?, ?)")
|
||||
// if err != nil {
|
||||
// c.AbortWithError(http.StatusInternalServerError, err)
|
||||
// c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
// return
|
||||
// }
|
||||
// defer dbpost.Close()
|
||||
|
||||
// exec, err := dbpost.Exec(returnapprovalData.Data)
|
||||
// if err != nil {
|
||||
// panic(err.Error())
|
||||
// }
|
||||
|
||||
// affect, err := exec.RowsAffected()
|
||||
// if err != nil {
|
||||
// panic(err.Error())
|
||||
// }
|
||||
|
||||
// if affect > 0 {
|
||||
// c.String(http.StatusOK, "Success on Saving Lock Data")
|
||||
// } else {
|
||||
// c.String(http.StatusInternalServerError, "Failed on Saving Lock Data")
|
||||
// }
|
||||
// })
|
||||
|
||||
router.DELETE("/api/delete-orderofpayment-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||
type DeleteOP struct {
|
||||
Data int `json:"data"`
|
||||
|
|
@ -2455,8 +2512,8 @@ func connect() {
|
|||
c.Writer.Header().Set("Content-Security-Policy", "default-src 'self'; img-src 'self';")
|
||||
c.Writer.Header().Set("X-Server", "OCBO Server")
|
||||
|
||||
var resultCount int
|
||||
checkErr := dbpop.QueryRow("SELECT COUNT(AFNum) AS resultCount FROM orderpaydetail WHERE OPRefId = ?", deleteOpLocal.Data).Scan(&resultCount)
|
||||
var resultId, resultCount int
|
||||
checkErr := dbpop.QueryRow("SELECT COUNT(OrderPayId) AS resultId, COUNT(AFNum) AS resultCount FROM orderpaydetail WHERE OPRefId = ?", deleteOpLocal.Data).Scan(&resultId, &resultCount)
|
||||
if checkErr != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, checkErr)
|
||||
c.String(http.StatusInternalServerError, "Internal Server Error")
|
||||
|
|
@ -2464,10 +2521,11 @@ func connect() {
|
|||
}
|
||||
|
||||
if resultCount > 0 {
|
||||
c.String(http.StatusBadRequest, "Error! Payment already exist.")
|
||||
c.String(http.StatusForbidden, "Error! Payment already exist.")
|
||||
return
|
||||
}
|
||||
|
||||
if resultId > 0 {
|
||||
dbpost, err := dbpop.Prepare("DELETE FROM orderpaydetail WHERE OPRefId = ?")
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
|
|
@ -2491,6 +2549,8 @@ func connect() {
|
|||
} else {
|
||||
c.String(http.StatusInternalServerError, "Failed on Deleting POPS Local")
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
router.DELETE("/api/delete-esigntransactions", func(c *gin.Context) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue