update terbaru

This commit is contained in:
2025-07-01 12:42:28 +07:00
parent fd30463082
commit b01c88e7f5
24 changed files with 759 additions and 134 deletions

No files matched your search

@@ -249,3 +249,31 @@ func DeletePatient(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "Pasien Sukses Ter-hapus"})
}
func GetpasienByID(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
}
id := c.Param("id")
if id == "" {
c.JSON(http.StatusBadRequest, gin.H{"message": "Parameter 'id' dibutuhkan"})
return
}
mongoDB := mongo.NewDatabaseServiceMongo(db)
dataID, err := mongoDB.GetPasienByid(id)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"message": err.Error()})
return
}
c.JSON(http.StatusOK, gin.H{
"data": dataID,
"message": "pasien Dengan ID berhasil di cari",
})
}