update terbaru
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package coverage
|
||||
|
||||
import (
|
||||
"api-poliklinik/internal/database"
|
||||
"api-poliklinik/pkg/database/mongo"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"os"
|
||||
)
|
||||
|
||||
func GetCover(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)
|
||||
dataCover, errSelect := mongoDB.Getcoverage()
|
||||
if errSelect != nil {
|
||||
c.JSON(http.StatusInternalServerError, gin.H{"message": errSelect.Error()})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, dataCover)
|
||||
}
|
||||
Reference in New Issue
Block a user