35 lines
638 B
Go
35 lines
638 B
Go
|
package api
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"git.sp4ke.com/sp4ke/bit4sat/storage"
|
||
|
"git.sp4ke.com/sp4ke/bit4sat/utils"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
func adminGetInfo(c *gin.Context) {
|
||
|
|
||
|
adminToken := c.Param("adminToken")
|
||
|
|
||
|
// Get upload payments
|
||
|
//upInfo, err := storage.GetUploadInfoByToken(adminToken)
|
||
|
//if err != nil {
|
||
|
//utils.JSONErrPriv(c, http.StatusInternalServerError, err)
|
||
|
//return
|
||
|
//}
|
||
|
|
||
|
// Sum of payments
|
||
|
paySum, err := storage.GetMsatBalanceByAdminToken(adminToken)
|
||
|
if err != nil {
|
||
|
utils.JSONErrPriv(c, http.StatusInternalServerError, err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
c.JSON(http.StatusOK, gin.H{
|
||
|
"msat_avail": paySum,
|
||
|
})
|
||
|
|
||
|
return
|
||
|
}
|