Returned middleware and added new api
This commit is contained in:
parent
85a83288b5
commit
f1dfe0884d
1 changed files with 31 additions and 33 deletions
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"ocbo-esign-backend/connections"
|
"ocbo-esign-backend/connections"
|
||||||
// "ocbo-esign-backend/middleware"
|
"ocbo-esign-backend/middleware"
|
||||||
|
|
||||||
"github.com/gin-contrib/cors"
|
"github.com/gin-contrib/cors"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
@ -1492,16 +1492,14 @@ func connect() {
|
||||||
})
|
})
|
||||||
|
|
||||||
case "check-esigntransaction":
|
case "check-esigntransaction":
|
||||||
var resultInt, resultCount int
|
err := db.QueryRow("SELECT COUNT(esign_transactionsid) FROM esign_transactions WHERE referenceNo = ?", data).Scan(&result)
|
||||||
err := dbpop.QueryRow(`SELECT COUNT(OrderPayId) AS resultInt, COUNT(AFNum) AS resultCount FROM orderpaydetail WHERE oprefid = ?`, data).Scan(&resultInt, &resultCount)
|
|
||||||
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())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"result": resultInt,
|
"result": result,
|
||||||
"result2": resultCount,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1675,7 +1673,7 @@ func connect() {
|
||||||
c.Data(resp.StatusCode, "application/json", body)
|
c.Data(resp.StatusCode, "application/json", body)
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/post-registration", func(c *gin.Context) {
|
router.POST("/api/post-registration", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type RegistrationData struct {
|
type RegistrationData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -1721,7 +1719,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/post-newstatus-occupancy", func(c *gin.Context) {
|
router.POST("/api/post-newstatus-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type NewstatusData struct {
|
type NewstatusData struct {
|
||||||
Data int `json:"data"` //occuapancyid
|
Data int `json:"data"` //occuapancyid
|
||||||
Data2 string `json:"data2"` //date
|
Data2 string `json:"data2"` //date
|
||||||
|
|
@ -1771,7 +1769,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/post-newstatus-electrical", func(c *gin.Context) {
|
router.POST("/api/post-newstatus-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type NewstatusData struct {
|
type NewstatusData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -1821,7 +1819,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-docflow-occupancy", func(c *gin.Context) {
|
router.POST("/api/update-docflow-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type UpdateDocflowData struct {
|
type UpdateDocflowData struct {
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -1870,7 +1868,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-docflow-electrical", func(c *gin.Context) {
|
router.POST("/api/update-docflow-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type UpdateDocflowData struct {
|
type UpdateDocflowData struct {
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -1919,7 +1917,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-opprinted-occupancy", func(c *gin.Context) {
|
router.POST("/api/update-opprinted-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -1961,7 +1959,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-opprinted-electrical", func(c *gin.Context) {
|
router.POST("/api/update-opprinted-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -2003,7 +2001,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-foropreprint-electrical", func(c *gin.Context) {
|
router.POST("/api/update-foropreprint-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -2045,7 +2043,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/post-esigntransaction", func(c *gin.Context) {
|
router.POST("/api/post-esigntransaction", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
Data2 string `json:"data2"`
|
Data2 string `json:"data2"`
|
||||||
|
|
@ -2193,7 +2191,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-opapproved-bldgadditional", func(c *gin.Context) {
|
router.POST("/api/update-opapproved-bldgadditional", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -2242,7 +2240,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-opapproved-electrical", func(c *gin.Context) {
|
router.POST("/api/update-opapproved-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type UpdateOpData struct {
|
type UpdateOpData struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -2291,7 +2289,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-name", func(c *gin.Context) {
|
router.POST("/api/update-name", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type NewnameData struct {
|
type NewnameData struct {
|
||||||
Data int `json:"data"` //employeeid
|
Data int `json:"data"` //employeeid
|
||||||
Data2 string `json:"data2"` //new name
|
Data2 string `json:"data2"` //new name
|
||||||
|
|
@ -2337,7 +2335,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-password", func(c *gin.Context) {
|
router.POST("/api/update-password", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type NewnameData struct {
|
type NewnameData struct {
|
||||||
Data int `json:"data"` //employeeid
|
Data int `json:"data"` //employeeid
|
||||||
Data2 string `json:"data2"` //new password
|
Data2 string `json:"data2"` //new password
|
||||||
|
|
@ -2383,7 +2381,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/save-lockdata", func(c *gin.Context) {
|
router.POST("/api/save-lockdata", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type saveLockData struct {
|
type saveLockData struct {
|
||||||
Data string `json:"data"` //referenceNo
|
Data string `json:"data"` //referenceNo
|
||||||
Data2 string `json:"data2"` //lock_data
|
Data2 string `json:"data2"` //lock_data
|
||||||
|
|
@ -2428,7 +2426,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.POST("/api/update-opforapproval-electrical", func(c *gin.Context) {
|
router.POST("/api/update-opforapproval-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type forApprovalData struct {
|
type forApprovalData struct {
|
||||||
Data string `json:"data"` //electricalNo
|
Data string `json:"data"` //electricalNo
|
||||||
}
|
}
|
||||||
|
|
@ -2516,7 +2514,7 @@ func connect() {
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
|
|
||||||
router.DELETE("/api/delete-orderofpayment-electrical", func(c *gin.Context) {
|
router.DELETE("/api/delete-orderofpayment-electrical", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type DeleteOP struct {
|
type DeleteOP struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -2573,7 +2571,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.DELETE("/api/delete-orderofpayment-occupancy", func(c *gin.Context) {
|
router.DELETE("/api/delete-orderofpayment-occupancy", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type DeleteOP struct {
|
type DeleteOP struct {
|
||||||
Data int `json:"data"`
|
Data int `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -2630,7 +2628,7 @@ func connect() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
router.DELETE("/api/void-op-local", func(c *gin.Context) {
|
router.DELETE("/api/void-op-local", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type DeleteOPLocal struct {
|
type DeleteOPLocal struct {
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
@ -2690,7 +2688,7 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
router.DELETE("/api/delete-esigntransactions", func(c *gin.Context) {
|
router.DELETE("/api/delete-esigntransactions", middleware.TokenChecker(), func(c *gin.Context) {
|
||||||
type DeleteOPLocal struct {
|
type DeleteOPLocal struct {
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue