update http status
This commit is contained in:
@@ -35,7 +35,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
err := c.Bind(&req)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: err.Error(),
|
||||
@@ -43,11 +43,12 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
})
|
||||
return
|
||||
}
|
||||
log.Println(req)
|
||||
|
||||
jadwalLibur, isLibur, errLibur := jadwal.GetJadwalLibur(req.TglRencanaKontrol)
|
||||
if errLibur != nil {
|
||||
log.Println(errLibur)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: errLibur.Error(),
|
||||
@@ -56,7 +57,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
return
|
||||
} else if isLibur {
|
||||
log.Println(jadwalLibur.KeteranganLiburPelayanan)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: jadwalLibur.NamaLiburPelayanan,
|
||||
@@ -68,7 +69,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
reqJson, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: err.Error(),
|
||||
@@ -101,7 +102,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
kunjunganPasien, err := suratkontrol.GetDataKunjunganPasien(req.IDXDaftar)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: err.Error(),
|
||||
@@ -117,7 +118,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
idRuangan, err = lokasiruang.GetDaftarLokasiRuang(req.Ruangan)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusInternalServerError, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: err.Error(),
|
||||
@@ -265,7 +266,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
responJson, err := json.Marshal(res)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: err.Error(),
|
||||
@@ -292,7 +293,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
err = suratkontrol.InsertDataSuratKontrol(reqInsert)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: err.Error(),
|
||||
@@ -310,7 +311,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
err = suratkontrol.UpdateKunjunganPasien(req)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: err.Error(),
|
||||
@@ -339,7 +340,7 @@ func InsertSuratKontrol(c *gin.Context) {
|
||||
err = log_api.InsertLogAPI(reqInsertLog)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
c.JSON(http.StatusPreconditionFailed, &sk.ResponseInsertSuratKontrol{
|
||||
c.JSON(http.StatusOK, &sk.ResponseInsertSuratKontrol{
|
||||
MetaData: sk.MetadataString{
|
||||
Code: "203",
|
||||
Message: err.Error(),
|
||||
|
||||
Reference in New Issue
Block a user