lengkap belum account
This commit is contained in:
@@ -44,3 +44,31 @@ func GetDataPractitioner(c *gin.Context) {
|
||||
"data": dataPractitioner,
|
||||
})
|
||||
}
|
||||
|
||||
func Getdatadokter(c *gin.Context) {
|
||||
local := os.Getenv("MONGODB_DEV_LOCAL")
|
||||
db := database.New(local).GetMongoDB()
|
||||
if db == nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": "Database connection failed"})
|
||||
return
|
||||
}
|
||||
|
||||
display := c.Param("display")
|
||||
value := c.Param("value")
|
||||
if display == "" || value == "" {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"message": "Parameter 'display' dan 'value' dibutuhkan"})
|
||||
return
|
||||
}
|
||||
|
||||
mongoDB := mongo.NewDatabaseServiceMongo(db)
|
||||
dataSMF, err := mongoDB.GetDokterBySMF(display, value)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"data": dataSMF,
|
||||
"message": "Practitioner Dengan SMF berhasil di cari",
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user