diff --git a/Dockerfile b/Dockerfile index b32a33b..2f55591 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,5 +24,5 @@ WORKDIR /root/ COPY --from=builder /app/main . COPY --from=builder /app/.env . -EXPOSE 8080 +EXPOSE 8082 CMD ["./main"] \ No newline at end of file diff --git a/config/config.go b/config/config.go index 645b102..0e21cc4 100644 --- a/config/config.go +++ b/config/config.go @@ -36,20 +36,20 @@ func ConnectDB() { log.Println("Successfully connected to the database") } - hostSimrs := os.Getenv("SIMRS_HOST") - userNameSimrs := os.Getenv("SIMRS_USERNAME") - passwordSimrs := os.Getenv("SIMRS_PASSWORD") - dbNameSimrs := os.Getenv("SIMRS_NAME") - portSimrs := os.Getenv("SIMRS_PORT") + // hostSimrs := os.Getenv("SIMRS_HOST") + // userNameSimrs := os.Getenv("SIMRS_USERNAME") + // passwordSimrs := os.Getenv("SIMRS_PASSWORD") + // dbNameSimrs := os.Getenv("SIMRS_NAME") + // portSimrs := os.Getenv("SIMRS_PORT") - simrs := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", hostSimrs, userNameSimrs, passwordSimrs, dbNameSimrs, portSimrs) + // simrs := fmt.Sprintf("host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Jakarta", hostSimrs, userNameSimrs, passwordSimrs, dbNameSimrs, portSimrs) - SimrsDB, err = gorm.Open(postgres.Open(simrs), &gorm.Config{}) - if err != nil { - log.Fatal("Failed to connect to Satu Data database: ", err) - } else { - log.Println("Successfully connected to the database") - } + // SimrsDB, err = gorm.Open(postgres.Open(simrs), &gorm.Config{}) + // if err != nil { + // log.Fatal("Failed to connect to Satu Data database: ", err) + // } else { + // log.Println("Successfully connected to the database") + // } } func SetHeader(isIcare bool, cfg config.ConfigBpjs) *config.Header { diff --git a/docker-compose.yml b/docker-compose.yml index e3cc9d6..3551d27 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: container_name: api-rssa restart: always ports: - - 8080:8080 + - 8082:8082 volumes: - .:/app - /etc/localtime:/etc/localtime:ro diff --git a/handlers/bpjs/jadwal_dokter/jadwal_dokter.go b/handlers/bpjs/jadwal_dokter/jadwal_dokter.go index 16acaa0..d60e1e9 100644 --- a/handlers/bpjs/jadwal_dokter/jadwal_dokter.go +++ b/handlers/bpjs/jadwal_dokter/jadwal_dokter.go @@ -510,21 +510,21 @@ func GetAllJadwalDokter(c *gin.Context) { var res *[]jadwal_dokter.ListDokter for _, value := range spesialis { - // tanggal := time.Now().Format("2006-01-02") - tanggal := "2025-01-08" - // for i := 0; i < 7; i++ { + tanggal := time.Now().Format("2006-01-02") + // tanggal := "2025-01-08" + for i := 0; i < 7; i++ { kdPoly := value.Kode res, err = JadwalDokterGetResponseApi(url, header, kdPoly, tanggal, headers) if err != nil { log.Println("Error making external API request: %v", err) c.JSON(http.StatusInternalServerError, err) } - // date, errParse := time.Parse("2006-01-02", tanggal) - // if errParse != nil { - // c.JSON(http.StatusInternalServerError, errParse) - // return - // } - // tanggal = date.AddDate(0, 0, 1).Format("2006-01-02") + date, errParse := time.Parse("2006-01-02", tanggal) + if errParse != nil { + c.JSON(http.StatusInternalServerError, errParse) + return + } + tanggal = date.AddDate(0, 0, 1).Format("2006-01-02") log.Println("Tanggal :", tanggal) if res == nil { log.Println("Skip Proses") @@ -558,7 +558,7 @@ func GetAllJadwalDokter(c *gin.Context) { } } } - // } + } } c.JSON(http.StatusOK, res) } diff --git a/main.go b/main.go index 2a25a7a..aa2866a 100644 --- a/main.go +++ b/main.go @@ -142,8 +142,8 @@ func main() { url := baseUrl + endpoint log.Println("url", url) - log.Println("JALAN DI PORT : 8083") - err = r.Run(":8083") + log.Println("JALAN DI PORT : 8082") + err = r.Run(":8082") if err != nil { log.Fatal(err) }