Added bridges for POPS
This commit is contained in:
parent
e79646a613
commit
60800d31cd
1 changed files with 45 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
|
@ -1603,6 +1604,50 @@ func connect() {
|
|||
}
|
||||
})
|
||||
|
||||
router.GET("/api/pops/statusOP/:data/check-status-pops", func(c *gin.Context) {
|
||||
data := c.Param("data")
|
||||
url := "https://gateway.davaocity.gov.ph/api/pops/statusOP.ashx?oprefid=" + data
|
||||
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
c.Data(resp.StatusCode, "application/json", body)
|
||||
})
|
||||
|
||||
router.GET("/api/pops/voidOP/:data/void-pops", func(c *gin.Context) {
|
||||
data := c.Param("data")
|
||||
url := "https://gateway.davaocity.gov.ph/api/pops/voidOP.ashx?oprefid=" + data
|
||||
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusBadRequest, err)
|
||||
c.String(http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
c.AbortWithError(http.StatusInternalServerError, err)
|
||||
c.String(http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
c.Data(resp.StatusCode, "application/json", body)
|
||||
})
|
||||
|
||||
router.POST("/api/post-registration", middleware.TokenChecker(), func(c *gin.Context) {
|
||||
type RegistrationData struct {
|
||||
Data int `json:"data"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue