Compare commits

...

3 commits

4 changed files with 68 additions and 18 deletions

View file

@ -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"`

View file

@ -37,7 +37,7 @@
"@biomejs/biome": "^2.4.6",
"@nanostores/solid": "^1.1.1",
"@types/crypto-js": "^4.2.2",
"@types/node": "^24.11.2",
"@types/node": "^24.12.0",
"sass-embedded": "^1.97.3",
"typescript": "~5.8.3",
"vite": "^7.3.1",

28
pnpm-lock.yaml generated
View file

@ -85,8 +85,8 @@ importers:
specifier: ^4.2.2
version: 4.2.2
'@types/node':
specifier: ^24.11.2
version: 24.11.2
specifier: ^24.12.0
version: 24.12.0
sass-embedded:
specifier: ^1.97.3
version: 1.97.3
@ -95,13 +95,13 @@ importers:
version: 5.8.3
vite:
specifier: ^7.3.1
version: 7.3.1(@types/node@24.11.2)(sass-embedded@1.97.3)(sass@1.97.3)
version: 7.3.1(@types/node@24.12.0)(sass-embedded@1.97.3)(sass@1.97.3)
vite-plugin-compression2:
specifier: ^2.5.0
version: 2.5.0(rollup@4.52.1)
vite-plugin-solid:
specifier: ^2.11.10
version: 2.11.10(solid-js@1.9.11)(vite@7.3.1(@types/node@24.11.2)(sass-embedded@1.97.3)(sass@1.97.3))
version: 2.11.10(solid-js@1.9.11)(vite@7.3.1(@types/node@24.12.0)(sass-embedded@1.97.3)(sass@1.97.3))
packages:
@ -1084,8 +1084,8 @@ packages:
'@types/node@16.9.1':
resolution: {integrity: sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==}
'@types/node@24.11.2':
resolution: {integrity: sha512-HTsxyfkxTNxOXBsEdgIOzbMgBjDGPvkTfw0B1m09j1LFPk8u3tSL8SNBRTSc381wXXX/Wp93qPi1kQXwnWuHgA==}
'@types/node@24.12.0':
resolution: {integrity: sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ==}
'@types/pako@2.0.4':
resolution: {integrity: sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==}
@ -2762,7 +2762,7 @@ snapshots:
'@types/node@16.9.1': {}
'@types/node@24.11.2':
'@types/node@24.12.0':
dependencies:
undici-types: 7.16.0
@ -3516,7 +3516,7 @@ snapshots:
transitivePeerDependencies:
- rollup
vite-plugin-solid@2.11.10(solid-js@1.9.11)(vite@7.3.1(@types/node@24.11.2)(sass-embedded@1.97.3)(sass@1.97.3)):
vite-plugin-solid@2.11.10(solid-js@1.9.11)(vite@7.3.1(@types/node@24.12.0)(sass-embedded@1.97.3)(sass@1.97.3)):
dependencies:
'@babel/core': 7.28.4
'@types/babel__core': 7.20.5
@ -3524,12 +3524,12 @@ snapshots:
merge-anything: 5.1.7
solid-js: 1.9.11
solid-refresh: 0.6.3(solid-js@1.9.11)
vite: 7.3.1(@types/node@24.11.2)(sass-embedded@1.97.3)(sass@1.97.3)
vitefu: 1.1.1(vite@7.3.1(@types/node@24.11.2)(sass-embedded@1.97.3)(sass@1.97.3))
vite: 7.3.1(@types/node@24.12.0)(sass-embedded@1.97.3)(sass@1.97.3)
vitefu: 1.1.1(vite@7.3.1(@types/node@24.12.0)(sass-embedded@1.97.3)(sass@1.97.3))
transitivePeerDependencies:
- supports-color
vite@7.3.1(@types/node@24.11.2)(sass-embedded@1.97.3)(sass@1.97.3):
vite@7.3.1(@types/node@24.12.0)(sass-embedded@1.97.3)(sass@1.97.3):
dependencies:
esbuild: 0.27.2
fdir: 6.5.0(picomatch@4.0.3)
@ -3538,14 +3538,14 @@ snapshots:
rollup: 4.52.1
tinyglobby: 0.2.15
optionalDependencies:
'@types/node': 24.11.2
'@types/node': 24.12.0
fsevents: 2.3.3
sass: 1.97.3
sass-embedded: 1.97.3
vitefu@1.1.1(vite@7.3.1(@types/node@24.11.2)(sass-embedded@1.97.3)(sass@1.97.3)):
vitefu@1.1.1(vite@7.3.1(@types/node@24.12.0)(sass-embedded@1.97.3)(sass@1.97.3)):
optionalDependencies:
vite: 7.3.1(@types/node@24.11.2)(sass-embedded@1.97.3)(sass@1.97.3)
vite: 7.3.1(@types/node@24.12.0)(sass-embedded@1.97.3)(sass@1.97.3)
webworkify@1.5.0: {}

View file

@ -1,10 +1,15 @@
import { ofetch } from 'ofetch';
import { ofetch } from 'ofetch'
const STATUS = "https://gateway.davaocity.gov.ph/api/pops/statusOP.ashx?oprefid="
// const STATUS = 'https://gateway.davaocity.gov.ph/api/pops/statusOP.ashx?oprefid='
const API = import.meta.env.VITE_BACKEND
export default async (application: string) => {
try {
const fetch = await ofetch(STATUS + application, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
// const fetch = await ofetch(STATUS + application, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
// const result = fetch
// return result
const fetch = await ofetch(API + `pops/statusOP/${application}/check-status-pops`, { parseResponse: JSON.parse, retry: 3, retryDelay: 500, retryStatusCodes: [400, 404, 405, 500, 502] })
const result = fetch
return result
} catch {