22 lines
593 B
Go
22 lines
593 B
Go
package handler
|
|
|
|
import (
|
|
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg/database"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/sirupsen/logrus"
|
|
"net/http"
|
|
)
|
|
|
|
func GetSummary(c *gin.Context) {
|
|
logger := c.MustGet("LOGGER").(*logrus.Entry)
|
|
databaseRepo := c.MustGet("REPOSITORY").(database.DatabaseRepository)
|
|
|
|
summary, err := databaseRepo.GetSummary(c)
|
|
if err != nil {
|
|
logger.Errorln("An error occurred while retrieving summary", err)
|
|
c.JSON(http.StatusInternalServerError, gin.H{"success": false})
|
|
return
|
|
}
|
|
c.JSON(http.StatusOK, gin.H{"success": true, "data": summary})
|
|
}
|