perbaikan decompres

This commit is contained in:
2025-09-10 18:08:31 +07:00
parent e61eee5f76
commit 7d03b5d5ef
4 changed files with 386 additions and 47 deletions

View File

@@ -3,6 +3,8 @@ package models
import (
"database/sql"
"database/sql/driver"
"net/http"
"strconv"
"time"
)
@@ -161,6 +163,42 @@ type MetaInfo struct {
ServerTime string `json:"server_time"`
}
func GetStatusCodeFromMeta(metaCode interface{}) int {
statusCode := http.StatusOK
if metaCode != nil {
switch v := metaCode.(type) {
case string:
if code, err := strconv.Atoi(v); err == nil {
if code >= 100 && code <= 599 {
statusCode = code
} else {
statusCode = http.StatusInternalServerError
}
} else {
statusCode = http.StatusInternalServerError
}
case int:
if v >= 100 && v <= 599 {
statusCode = v
} else {
statusCode = http.StatusInternalServerError
}
case float64:
code := int(v)
if code >= 100 && code <= 599 {
statusCode = code
} else {
statusCode = http.StatusInternalServerError
}
default:
statusCode = http.StatusInternalServerError
}
}
return statusCode
}
// Validation constants
const (
StatusDraft = "draft"

View File

@@ -60,6 +60,7 @@ type PesertaData struct {
NoMR string `json:"noMR"`
NoTelepon string `json:"noTelepon"`
} `json:"mr,omitempty"`
RawResponse string `json:"raw_response,omitempty"`
}
// PesertaResponse represents peserta API response