feat (vclaim/bpjs/jkn): add several endpoint

This commit is contained in:
dpurbosakti
2025-12-01 12:43:23 +07:00
parent 2a39301563
commit 2a979f60a6
24 changed files with 561 additions and 27 deletions
@@ -0,0 +1,37 @@
package controlplan
import (
"encoding/json"
"fmt"
"io"
"net/http"
e "simrs-vx/internal/domain/bpjs-entities/control-plan"
"gorm.io/gorm"
)
func ReadList(input *e.ReadListDto, data *e.Response, tx *gorm.DB) error {
endpoint := endpointMapper(input)
req, err := http.NewRequest("GET", endpoint, nil)
if err != nil {
return err
}
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
return err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return err
}
if err := json.Unmarshal(body, &data); err != nil {
return fmt.Errorf("failed to parse response JSON: %w", err)
}
return nil
}