25 lines
426 B
Go
25 lines
426 B
Go
|
|
package controller
|
||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
|
||
|
|
"github.com/QuantumNous/new-api/service"
|
||
|
|
"github.com/gin-gonic/gin"
|
||
|
|
)
|
||
|
|
|
||
|
|
func GetRankings(c *gin.Context) {
|
||
|
|
result, err := service.GetRankingsSnapshot(c.DefaultQuery("period", "week"))
|
||
|
|
if err != nil {
|
||
|
|
c.JSON(http.StatusBadRequest, gin.H{
|
||
|
|
"success": false,
|
||
|
|
"message": err.Error(),
|
||
|
|
})
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
c.JSON(http.StatusOK, gin.H{
|
||
|
|
"success": true,
|
||
|
|
"data": result,
|
||
|
|
})
|
||
|
|
}
|