pembaruhan baru

This commit is contained in:
2025-05-14 09:44:08 +07:00
parent dc0b822440
commit 1fb1caaf19
20 changed files with 1964 additions and 671 deletions
+29
View File
@@ -0,0 +1,29 @@
package location
import (
"api-poliklinik/internal/database"
"api-poliklinik/pkg/database/mongo"
"github.com/gin-gonic/gin"
"net/http"
"os"
)
func Getlocation(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
}
mongoDB := mongo.NewDatabaseServiceMongo(db)
dataLocation, errSelect := mongoDB.Getlocation()
if errSelect != nil {
c.JSON(http.StatusInternalServerError, gin.H{"message": errSelect.Error()})
return
}
c.JSON(http.StatusOK, gin.H{
"data": dataLocation,
"message": "location Sukses Ter-ambil ",
})
}