Merge pull request 'master-mirza' (#1) from master-mirza into master

Reviewed-on: mirza.millahsyafiq.0912/bridging-rssa#1
This commit was merged in pull request #1.
This commit is contained in:
2024-09-18 02:47:42 +00:00
17 changed files with 666 additions and 231 deletions

No files matched your search

+12 -1
View File
@@ -1 +1,12 @@
POSTGRES_DSN="postgres://sa:password@localhost:5432/postgres?sslmode=disable"
# POSTGRES_DSN="postgres://sa:password@localhost:5432/postgres?sslmode=disable"
DB_HOST=localhost
DB_USERNAME=sa
DB_PASSWORD=password
DB_NAME=postgres
DB_PORT=5432
SATUDATA_HOST=10.10.123.165
SATUDATA_USERNAME=stim
SATUDATA_PASSWORD=stim*RS54
SATUDATA_NAME=satu_db
SATUDATA_PORT=5000
+31 -6
View File
@@ -1,6 +1,7 @@
package database
import (
"fmt"
"log"
"os"
@@ -9,16 +10,40 @@ import (
)
var DB *gorm.DB
var SatuDataDB *gorm.DB
var err error
func ConnectDB() {
dsn := os.Getenv("POSTGRES_DSN")
if dsn == "" {
log.Fatal("POSTGRES_DSN environment variable not set")
}
// host := os.Getenv("DB_HOST")
// userName := os.Getenv("DB_USERNAME")
// password := os.Getenv("DB_PASSWORD")
// dbName := os.Getenv("DB_NAME")
// port := os.Getenv("DB_PORT")
DB, err = gorm.Open(postgres.Open(dsn), &gorm.Config{})
hostSatuData := os.Getenv("SATUDATA_HOST")
userNameSatuData := os.Getenv("SATUDATA_USERNAME")
passwordSatuData := os.Getenv("SATUDATA_PASSWORD")
dbNameSatuData := os.Getenv("SATUDATA_NAME")
portSatuData := os.Getenv("SATUDATA_PORT")
// dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", host, userName, password, dbName, port)
// if dsn == "" {
// log.Fatal("POSTGRES_DSN environment variable not set")
// }
satuData := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", hostSatuData, userNameSatuData, passwordSatuData, dbNameSatuData, portSatuData)
// DB, err = gorm.Open(postgres.Open(dsn), &gorm.Config{})
// if err != nil {
// log.Fatal("Failed to connect to database: ", err)
// } else {
// log.Println("Successfully connected to the database")
// }
SatuDataDB, err = gorm.Open(postgres.Open(satuData), &gorm.Config{})
if err != nil {
log.Fatal("Failed to connect to database: ", err)
log.Fatal("Failed to connect to Satu Data database: ", err)
} else {
log.Println("Successfully connected to the database")
}
}
+63 -1
View File
@@ -15,7 +15,7 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/v1/user": {
"/api/user": {
"get": {
"description": "returs list of all users from the database",
"tags": [
@@ -31,9 +31,71 @@ const docTemplate = `{
}
}
}
},
"/api/user/create": {
"post": {
"description": "Insert Data User",
"tags": [
"Users"
],
"summary": "Insert Data User",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Response"
}
}
}
}
},
"/api/user/delete/:id": {
"delete": {
"description": "Delete Data User",
"tags": [
"Users"
],
"summary": "Delete Data User",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Response"
}
}
}
}
},
"/api/user/update/:id": {
"put": {
"description": "Update Data User",
"tags": [
"Users"
],
"summary": "Update Data User",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Response"
}
}
}
}
}
},
"definitions": {
"models.Response": {
"type": "object",
"properties": {
"response_code": {
"type": "string"
},
"response_message": {
"type": "string"
}
}
},
"models.User": {
"type": "object",
"properties": {
+111
View File
@@ -0,0 +1,111 @@
package docs
import (
"errors"
"math"
"unicode/utf8"
)
//
// Decompress uri encoded lz-string
// http://pieroxy.net/blog/pages/lz-string/index.html
// https://github.com/pieroxy/lz-string/
//
// map of "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$"
var keyStrUriSafe map[byte]int = map[byte]int{74: 9, 78: 13, 83: 18, 36: 64, 109: 38, 114: 43, 116: 45, 101: 30, 45: 63, 73: 8, 81: 16, 113: 42, 49: 53, 50: 54, 54: 58, 76: 11, 100: 29, 107: 36, 121: 50, 77: 12, 89: 24, 105: 34, 66: 1, 69: 4, 85: 20, 48: 52, 119: 48, 117: 46, 120: 49, 52: 56, 56: 60, 110: 39, 112: 41, 70: 5, 71: 6, 79: 14, 88: 23, 97: 26, 102: 31, 103: 32, 67: 2, 118: 47, 65: 0, 68: 3, 72: 7, 108: 37, 51: 55, 57: 61, 82: 17, 90: 25, 98: 27, 115: 44, 122: 51, 53: 57, 86: 21, 106: 35, 111: 40, 55: 59, 43: 62, 75: 10, 80: 15, 84: 19, 87: 22, 99: 28, 104: 33}
type dataStruct struct {
input string
val int
position int
index int
dictionary []string
enlargeIn float64
numBits int
}
func getBaseValue(char byte) int {
return keyStrUriSafe[char]
}
// Input is composed of ASCII characters, so accessing it by array has no UTF-8 pb.
func readBits(nb int, data *dataStruct) int {
result := 0
power := 1
for i := 0; i < nb; i++ {
respB := data.val & data.position
data.position = data.position / 2
if data.position == 0 {
data.position = 32
data.val = getBaseValue(data.input[data.index])
data.index += 1
}
if respB > 0 {
result |= power
}
power *= 2
}
return result
}
func appendValue(data *dataStruct, str string) {
data.dictionary = append(data.dictionary, str)
data.enlargeIn -= 1
if data.enlargeIn == 0 {
data.enlargeIn = math.Pow(2, float64(data.numBits))
data.numBits += 1
}
}
func getString(last string, data *dataStruct) (string, bool, error) {
c := readBits(data.numBits, data)
switch c {
case 0:
str := string(readBits(8, data))
appendValue(data, str)
return str, false, nil
case 1:
str := string(readBits(16, data))
appendValue(data, str)
return str, false, nil
case 2:
return "", true, nil
}
if c < len(data.dictionary) {
return data.dictionary[c], false, nil
}
if c == len(data.dictionary) {
return concatWithFirstRune(last, last), false, nil
}
return "", false, errors.New("Bad character encoding.")
}
// Need to handle UTF-8, so we need to use rune to concatenate
func concatWithFirstRune(str string, getFirstRune string) string {
r, _ := utf8.DecodeRuneInString(getFirstRune)
return str + string(r)
}
func DecompressFromEncodedUriComponent(input string) (string, error) {
data := dataStruct{input, getBaseValue(input[0]), 32, 1, []string{"0", "1", "2"}, 5, 2}
result, isEnd, err := getString("", &data)
if err != nil || isEnd {
return result, err
}
last := result
data.numBits += 1
for {
str, isEnd, err := getString(last, &data)
if err != nil || isEnd {
return result, err
}
result = result + str
appendValue(&data, concatWithFirstRune(last, str))
last = str
}
return "", errors.New("Unexpected end of buffer reached.")
}
+25
View File
@@ -0,0 +1,25 @@
package docs
import "errors"
func Pad(buf []byte, size int) ([]byte, error) {
bufLen := len(buf)
padLen := size - bufLen%size
padded := make([]byte, bufLen+padLen)
copy(padded, buf)
for i := 0; i < padLen; i++ {
padded[bufLen+i] = byte(padLen)
}
return padded, nil
}
func Unpad(padded []byte, size int) ([]byte, error) {
if len(padded)%size != 0 {
return nil, errors.New("pkcs7: Padded value wasn't in correct size.")
}
bufLen := len(padded) - int(padded[len(padded)-1])
buf := make([]byte, bufLen)
copy(buf, padded[:bufLen])
return buf, nil
}
+63 -1
View File
@@ -8,7 +8,7 @@
},
"host": "localhost:8080",
"paths": {
"/api/v1/user": {
"/api/user": {
"get": {
"description": "returs list of all users from the database",
"tags": [
@@ -24,9 +24,71 @@
}
}
}
},
"/api/user/create": {
"post": {
"description": "Insert Data User",
"tags": [
"Users"
],
"summary": "Insert Data User",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Response"
}
}
}
}
},
"/api/user/delete/:id": {
"delete": {
"description": "Delete Data User",
"tags": [
"Users"
],
"summary": "Delete Data User",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Response"
}
}
}
}
},
"/api/user/update/:id": {
"put": {
"description": "Update Data User",
"tags": [
"Users"
],
"summary": "Update Data User",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Response"
}
}
}
}
}
},
"definitions": {
"models.Response": {
"type": "object",
"properties": {
"response_code": {
"type": "string"
},
"response_message": {
"type": "string"
}
}
},
"models.User": {
"type": "object",
"properties": {
+41 -1
View File
@@ -1,4 +1,11 @@
definitions:
models.Response:
properties:
response_code:
type: string
response_message:
type: string
type: object
models.User:
properties:
agama:
@@ -21,7 +28,7 @@ info:
title: Crud User
version: "1"
paths:
/api/v1/user:
/api/user:
get:
description: returs list of all users from the database
responses:
@@ -32,4 +39,37 @@ paths:
summary: return list of all
tags:
- Users
/api/user/create:
post:
description: Insert Data User
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Response'
summary: Insert Data User
tags:
- Users
/api/user/delete/:id:
delete:
description: Delete Data User
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Response'
summary: Delete Data User
tags:
- Users
/api/user/update/:id:
put:
description: Update Data User
responses:
"200":
description: OK
schema:
$ref: '#/definitions/models.Response'
summary: Update Data User
tags:
- Users
swagger: "2.0"
+24
View File
@@ -0,0 +1,24 @@
package bpjs
import (
"bridging-rssa/database"
"bridging-rssa/models"
"net/http"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
func GetAllSubspesialis(c *gin.Context) {
var subspesialis []models.DaftarSubspesialis
result := database.SatuDataDB.Debug().Raw(`SELECT * FROM "daftar_subspesialis"`).Find(&subspesialis)
if result.Error != nil {
if result.Error == gorm.ErrRecordNotFound {
c.JSON(http.StatusNotFound, result.Error)
} else {
c.JSON(http.StatusInternalServerError, result.Error)
}
return
}
c.JSON(http.StatusOK, subspesialis)
}
+26 -6
View File
@@ -1,10 +1,10 @@
package ginHandlers
import (
"bridging-rssa/database"
"bridging-rssa/models"
"encoding/json"
"net/http"
"tes-rssa/database"
"tes-rssa/models"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
@@ -15,7 +15,7 @@ import (
// @Description returs list of all users from the database
// @Tags Users
// @Success 200 {object} models.User
// @Router /api/v1/user [get]
// @Router /api/user [get]
func GetAllUser(c *gin.Context) {
var users []models.User
result := database.DB.Debug().Raw(`SELECT * FROM "user"`).Find(&users)
@@ -31,7 +31,7 @@ func GetAllUser(c *gin.Context) {
}
func GetUserId(c *gin.Context) {
id := c.Request.URL.Query()
id := c.Param("id")
var user models.User
query := `select * from "user" where id = ?`
@@ -48,6 +48,12 @@ func GetUserId(c *gin.Context) {
c.JSON(http.StatusOK, user)
}
// CreateUser Insert Data User
// @Summary Insert Data User
// @Description Insert Data User
// @Tags Users
// @Success 200 {object} models.Response
// @Router /api/user/create [post]
func CreateUser(c *gin.Context) {
var u models.InsertUser
err := json.NewDecoder(c.Request.Body).Decode(&u)
@@ -77,8 +83,14 @@ func CreateUser(c *gin.Context) {
c.JSON(http.StatusOK, res)
}
// CreateUser Update Data User
// @Summary Update Data User
// @Description Update Data User
// @Tags Users
// @Success 200 {object} models.Response
// @Router /api/user/update/:id [put]
func UpdateUser(c *gin.Context) {
id := c.Request.URL.Query()
id := c.Param("id")
var u models.UpdateUser
err := json.NewDecoder(c.Request.Body).Decode(&u)
@@ -111,8 +123,16 @@ func UpdateUser(c *gin.Context) {
c.JSON(http.StatusOK, res)
}
// CreateUser Delete Data User
// @Summary Delete Data User
// @Description Delete Data User
// @Tags Users
// @Success 200 {object} models.Response
// @Router /api/user/delete/:id [delete]
func DeleteUser(c *gin.Context) {
id := c.Request.URL.Query()
id := c.Param("id")
res := &models.Response{
ResponseCode: "00",
ResponseMessage: "Berhasil Delete Data",
+39
View File
@@ -0,0 +1,39 @@
package Vclaim
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"encoding/hex"
"fmt"
"log"
"time"
)
type ConfigBpjs struct {
Cons_id string
Secret_key string
User_key string
}
func SetHeader(cfg ConfigBpjs) (string, string, string, string, string) {
timenow := time.Now().UTC()
t, err := time.Parse(time.RFC3339, "1970-01-01T00:00:00Z")
if err != nil {
log.Fatal(err)
}
tstamp := timenow.Unix() - t.Unix()
secret := []byte(cfg.Secret_key)
message := []byte(cfg.Cons_id + "&" + fmt.Sprint(tstamp))
hash := hmac.New(sha256.New, secret)
hash.Write(message)
// to lowercase hexits
hex.EncodeToString(hash.Sum(nil))
// to base64
X_signature := base64.StdEncoding.EncodeToString(hash.Sum(nil))
return cfg.Cons_id, cfg.Secret_key, cfg.User_key, fmt.Sprint(tstamp), X_signature
}
+49
View File
@@ -0,0 +1,49 @@
package Vclaim
import (
"crypto/aes"
"crypto/cipher"
"crypto/sha256"
"encoding/base64"
"errors"
"github.com/andrean360/bridging-bpjs-go/helper"
)
func ResponseVclaim(encrypted string, key string) (string, error) {
cipherText, err := base64.StdEncoding.DecodeString(encrypted)
if err != nil {
return "", err
}
hash := sha256.Sum256([]byte(key))
block, err := aes.NewCipher(hash[:])
if err != nil {
return "", err
}
if len(cipherText) < aes.BlockSize {
return "", errors.New("cipherText too short")
}
iv := hash[:aes.BlockSize]
if len(cipherText)%aes.BlockSize != 0 {
return "", errors.New("cipherText is not a multiple of the block size")
}
mode := cipher.NewCBCDecrypter(block, iv)
mode.CryptBlocks(cipherText, cipherText)
// cipherText, _ = pkcs7.Unpad(cipherText, aes.BlockSize)
cipherText, _ = helper.Unpad(cipherText, aes.BlockSize)
// data, err := lzstring.DecompressFromEncodedUriComponent(string(cipherText))
data, err := helper.DecompressFromEncodedUriComponent(string(cipherText))
if err != nil {
return "", err
}
return data, nil
}
+121
View File
@@ -0,0 +1,121 @@
package Vclaim
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/mashingan/smapping"
)
type Respon_MentahDTO struct {
MetaData struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"metaData"`
Response string `json:"response"`
}
type Respon_DTO struct {
MetaData struct {
Code string `json:"code"`
Message string `json:"message"`
} `json:"metaData"`
Response interface{} `json:"response"`
}
func GetRequest(endpoint string, cfg interface{}) interface{} {
conf := ConfigBpjs{}
err := smapping.FillStruct(&conf, smapping.MapFields(&cfg))
if err != nil {
log.Fatalf("Failed map %v: ", err)
}
cons_id, Secret_key, User_key, tstamp, X_signature := SetHeader(conf)
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Add("Content-Type", "Application/x-www-form-urlencoded")
req.Header.Add("X-cons-id", cons_id)
req.Header.Add("X-timestamp", tstamp)
req.Header.Add("X-signature", X_signature)
req.Header.Add("user_key", User_key)
res, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println(err)
}
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
}
var resp_mentah Respon_MentahDTO
var resp Respon_DTO
json.Unmarshal([]byte(body), &resp_mentah)
resp_decrypt, _ := ResponseVclaim(string(resp_mentah.Response), string(cons_id+Secret_key+tstamp))
resp.MetaData = resp_mentah.MetaData
json.Unmarshal([]byte(resp_decrypt), &resp.Response)
return &resp
}
func PostRequest(endpoint string, cfg interface{}, data interface{}) interface{} {
conf := ConfigBpjs{}
err := smapping.FillStruct(&conf, smapping.MapFields(&cfg))
if err != nil {
log.Fatalf("Failed map %v: ", err)
}
cons_id, Secret_key, User_key, tstamp, X_signature := SetHeader(conf)
var buf bytes.Buffer
err = json.NewEncoder(&buf).Encode(data)
if err != nil {
log.Fatal(err)
}
req, _ := http.NewRequest("POST", endpoint, &buf)
req.Header.Add("Content-Type", "Application/x-www-form-urlencoded")
req.Header.Add("X-cons-id", cons_id)
req.Header.Add("X-timestamp", tstamp)
req.Header.Add("X-signature", X_signature)
req.Header.Add("user_key", User_key)
res, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println(err)
}
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(body))
var resp_mentah Respon_MentahDTO
var resp Respon_DTO
json.Unmarshal([]byte(body), &resp_mentah)
resp_decrypt, _ := ResponseVclaim(string(resp_mentah.Response), string(cons_id+Secret_key+tstamp))
resp.MetaData = resp_mentah.MetaData
json.Unmarshal([]byte(resp_decrypt), &resp.Response)
return &resp
}
+12 -18
View File
@@ -1,28 +1,28 @@
module tes-rssa
module bridging-rssa
go 1.22.0
toolchain go1.23.1
go 1.23.0
require (
github.com/gorilla/mux v1.8.1
github.com/andrean360/bridging-bpjs-go v1.0.1
github.com/gin-gonic/gin v1.10.0
github.com/joho/godotenv v1.5.1
gorm.io/driver/mysql v1.5.7
github.com/mashingan/smapping v0.1.19
github.com/rs/cors v1.11.1
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.3
gorm.io/gorm v1.25.11
)
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.2.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/bytedance/sonic v1.12.2 // indirect
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/gabriel-vasile/mimetype v1.4.5 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/gin-gonic/gin v1.10.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/spec v0.21.0 // indirect
@@ -30,7 +30,6 @@ require (
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.22.1 // indirect
github.com/go-swagger/go-swagger v0.31.0 // indirect
github.com/goccy/go-json v0.10.3 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
@@ -45,10 +44,8 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
github.com/rs/cors v1.11.1 // indirect
github.com/swaggo/files v1.0.1 // indirect
github.com/swaggo/gin-swagger v1.6.0 // indirect
github.com/swaggo/swag v1.16.3 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
golang.org/x/arch v0.10.0 // indirect
@@ -58,13 +55,10 @@ require (
golang.org/x/sys v0.25.0 // indirect
golang.org/x/tools v0.25.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
golang.org/x/text v0.18.0 // indirect
+25 -35
View File
@@ -1,31 +1,24 @@
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/PuerkitoBio/purell v1.2.1 h1:QsZ4TjvwiMpat6gBCBxEQI0rcS9ehtkKtSpiUnd9N28=
github.com/PuerkitoBio/purell v1.2.1/go.mod h1:ZwHcC/82TOaovDi//J/804umJFFmbOHPngi8iYYv/Eo=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
github.com/andrean360/bridging-bpjs-go v1.0.1 h1:06eJ23vcI2tNyPryr8p3jxJ+Vy4P4/nneNPWuUrgnLg=
github.com/andrean360/bridging-bpjs-go v1.0.1/go.mod h1:sRBG5zI4Ky/UMCI7u/QuMTlrzREV2UQn043lhrejfFE=
github.com/bytedance/sonic v1.12.2 h1:oaMFuRTpMHYLpCntGca65YWt5ny+wAceDERTkT2L9lg=
github.com/bytedance/sonic v1.12.2/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM=
github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gabriel-vasile/mimetype v1.4.5 h1:J7wGKdGu33ocBOhGy0z653k/lFKLFDPJMG8Gql0kxn4=
github.com/gabriel-vasile/mimetype v1.4.5/go.mod h1:ibHel+/kbxn9x2407k1izTA1S81ku1z/DlgOW2QE0M4=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
@@ -38,23 +31,19 @@ github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9Z
github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk=
github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE=
github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA=
github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
github.com/go-swagger/go-swagger v0.31.0 h1:H8eOYQnY2u7vNKWDNykv2xJP3pBhRG/R+SOCAmKrLlc=
github.com/go-swagger/go-swagger v0.31.0/go.mod h1:WSigRRWEig8zV6t6Sm8Y+EmUjlzA/HoaZJ5edupq7po=
github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA=
github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
@@ -77,11 +66,16 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
github.com/klauspost/cpuid/v2 v2.2.8 h1:+StwCXwm9PdpiEkPyzBXIy+M9KUb4ODm0Zarf1kS5BM=
github.com/klauspost/cpuid/v2 v2.2.8/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mashingan/smapping v0.1.19 h1:SsEtuPn2UcM1croIupPtGLgWgpYRuS0rSQMvKD9g2BQ=
github.com/mashingan/smapping v0.1.19/go.mod h1:FjfiwFxGOuNxL/OT1WcrNAwTPx0YJeg5JiXwBB1nyig=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -92,6 +86,10 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA=
github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -102,6 +100,8 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
@@ -113,16 +113,15 @@ github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.10.0 h1:S3huipmSclq3PJMNe76NGwkBR504WFkQ5dhzWzP8ZW8=
golang.org/x/arch v0.10.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A=
golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
@@ -131,8 +130,6 @@ golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -151,8 +148,6 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -161,21 +156,16 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc
golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
gorm.io/driver/postgres v1.5.9 h1:DkegyItji119OlcaLjqN11kHoUgZ/j13E0jkJZgD6A8=
gorm.io/driver/postgres v1.5.9/go.mod h1:DX3GReXH+3FPWGrrgffdvCk3DQ1dwDPdmbenSkweRGI=
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg=
gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
-154
View File
@@ -1,154 +0,0 @@
package handlers
import (
"encoding/json"
"fmt"
"net/http"
"tes-rssa/database"
"tes-rssa/models"
"github.com/gorilla/mux"
"gorm.io/gorm"
)
func GetUser(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
fmt.Println(vars)
column := vars["req"]
value := r.URL.Query().Get("value")
var user []models.User
query := fmt.Sprintf(`select * from "user" where %s like ?`, column)
result := database.DB.Debug().Raw(query, "%"+value+"%").Find(&user)
if result.Error != nil {
if result.Error == gorm.ErrRecordNotFound {
http.Error(w, "User not found", http.StatusNotFound)
} else {
http.Error(w, result.Error.Error(), http.StatusInternalServerError)
}
return
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(user)
}
func GetUserId(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
id := params["id"]
var user models.User
query := `select * from "user" where id = ?`
result := database.DB.Debug().Raw(query, id).Find(&user)
if result.Error != nil {
if result.Error == gorm.ErrRecordNotFound {
http.Error(w, "User not found", http.StatusNotFound)
} else {
http.Error(w, result.Error.Error(), http.StatusInternalServerError)
}
return
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(user)
}
func GetAllUser(w http.ResponseWriter, r *http.Request) {
var users []models.User
result := database.DB.Debug().Raw(`SELECT * FROM "user"`).Find(&users)
if result.Error != nil {
if result.Error == gorm.ErrRecordNotFound {
http.Error(w, "Users not found", http.StatusNotFound)
} else {
http.Error(w, result.Error.Error(), http.StatusInternalServerError)
}
return
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(users)
}
func CreateUser(w http.ResponseWriter, r *http.Request) {
var u models.InsertUser
err := json.NewDecoder(r.Body).Decode(&u)
if err != nil {
http.Error(w, "Invalid request payload", http.StatusBadRequest)
return
}
insertData := &models.InsertUser{
Nama: u.Nama,
Umur: u.Umur,
Alamat: u.Alamat,
Agama: u.Agama,
JenisKelamin: u.JenisKelamin,
}
queryInsert := `INSERT INTO "user" (nama, umur, alamat, agama, jenis_kelamin) VALUES (?, ?, ?, ?, ?)`
result := database.DB.Debug().Exec(queryInsert, insertData.Nama, insertData.Umur, insertData.Alamat, insertData.Agama, insertData.JenisKelamin)
if result.Error != nil {
http.Error(w, result.Error.Error(), http.StatusInternalServerError)
return
}
res := &models.Response{
ResponseCode: "00",
ResponseMessage: "Berhasil Insert Data",
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(res)
}
func UpdateUser(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
id := params["id"]
var u models.UpdateUser
err := json.NewDecoder(r.Body).Decode(&u)
if err != nil {
http.Error(w, "Invalid request payload", http.StatusBadRequest)
return
}
update := &models.UpdateUser{
Nama: u.Nama,
Umur: u.Umur,
Alamat: u.Alamat,
Agama: u.Agama,
JenisKelamin: u.JenisKelamin,
}
res := &models.Response{
ResponseCode: "00",
ResponseMessage: "Berhasil Update Data",
}
result := database.DB.Debug().Exec(`UPDATE "user" SET nama = ?, umur = ?, alamat = ?, agama = ?, jenis_kelamin = ? WHERE ID = ?`, update.Nama, update.Umur, update.Alamat, update.Agama, update.JenisKelamin, id)
if result.RowsAffected == 0 {
res = &models.Response{
ResponseCode: "99",
ResponseMessage: "Gagal update data",
}
} else if result.Error != nil {
http.Error(w, result.Error.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(res)
}
func DeleteUser(w http.ResponseWriter, r *http.Request) {
params := mux.Vars(r)
id := params["id"]
result := database.DB.Debug().Exec(`DELETE from "user" where id = ?`, id)
if result.Error != nil {
http.Error(w, result.Error.Error(), http.StatusInternalServerError)
return
}
res := &models.Response{
ResponseCode: "00",
ResponseMessage: "Berhasil Delete Data",
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(res)
}
+16 -8
View File
@@ -1,12 +1,13 @@
package main
import (
"bridging-rssa/database"
"bridging-rssa/ginHandlers"
"bridging-rssa/ginHandlers/bpjs"
"log"
"net/http"
"tes-rssa/database"
"tes-rssa/ginHandlers"
_ "tes-rssa/docs"
_ "bridging-rssa/docs"
"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
@@ -36,19 +37,26 @@ func main() {
user := v1.Group("/user")
{
user.GET("/", ginHandlers.GetAllUser)
user.GET("/{id}", ginHandlers.GetUserId)
user.POST("/create")
user.PUT("/update/{id}")
user.DELETE("/delete/{id}")
user.GET("/:id", ginHandlers.GetUserId)
user.POST("/create", ginHandlers.CreateUser)
user.PUT("/update/:id", ginHandlers.UpdateUser)
user.DELETE("/delete/:id", ginHandlers.DeleteUser)
}
subspesialis := v1.Group("/subspesialis")
{
subspesialis.GET("/", bpjs.GetAllSubspesialis)
}
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
r.POST("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
r.PUT("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
r.DELETE("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
err = r.Run()
if err != nil {
log.Fatal(err)
}
c := cors.New(cors.Options{
AllowedOrigins: []string{"*"}, // Or specify the domain(s) allowed
AllowedOrigins: []string{"*"},
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE"},
AllowedHeaders: []string{"Content-Type"},
AllowCredentials: true,
+8
View File
@@ -0,0 +1,8 @@
package models
type DaftarSubspesialis struct {
ID int `json:"id"`
Kode string `json:"Kode"`
Subspesialis string `json:"Subspesialis"`
FKDaftarSpesialisID int `json:"FK_daftar_spesialis_ID" gorm:"column:FK_daftar_spesialis_ID"`
}