teldrive/pkg/controller/user.go

84 lines
1.6 KiB
Go
Raw Normal View History

2023-12-03 03:47:23 +08:00
package controller
import (
"net/http"
"github.com/divyam234/teldrive/pkg/httputil"
"github.com/gin-gonic/gin"
)
2023-12-03 05:46:53 +08:00
func (uc *Controller) GetStats(c *gin.Context) {
res, err := uc.UserService.GetStats(c)
2023-12-03 03:47:23 +08:00
if err != nil {
httputil.NewError(c, err.Code, err.Error)
return
}
c.JSON(http.StatusOK, res)
}
func (uc *Controller) UpdateChannel(c *gin.Context) {
res, err := uc.UserService.UpdateChannel(c)
if err != nil {
httputil.NewError(c, err.Code, err.Error)
return
}
c.JSON(http.StatusOK, res)
}
func (uc *Controller) ListChannels(c *gin.Context) {
res, err := uc.UserService.ListChannels(c)
if err != nil {
httputil.NewError(c, err.Code, err.Error)
return
}
c.JSON(http.StatusOK, res)
}
func (uc *Controller) AddBots(c *gin.Context) {
res, err := uc.UserService.AddBots(c)
if err != nil {
httputil.NewError(c, err.Code, err.Error)
return
}
c.JSON(http.StatusOK, res)
}
2024-06-11 00:16:41 +08:00
func (uc *Controller) ListSessions(c *gin.Context) {
res, err := uc.UserService.ListSessions(c)
if err != nil {
httputil.NewError(c, err.Code, err.Error)
return
}
c.JSON(http.StatusOK, res)
}
func (uc *Controller) RemoveSession(c *gin.Context) {
res, err := uc.UserService.RemoveSession(c)
if err != nil {
httputil.NewError(c, err.Code, err.Error)
return
}
c.JSON(http.StatusOK, res)
}
2023-12-03 03:47:23 +08:00
func (uc *Controller) RemoveBots(c *gin.Context) {
res, err := uc.UserService.RemoveBots(c)
if err != nil {
httputil.NewError(c, err.Code, err.Error)
return
}
c.JSON(http.StatusOK, res)
}
func (uc *Controller) GetProfilePhoto(c *gin.Context) {
if c.Query("photo") != "" {
uc.UserService.GetProfilePhoto(c)
}
}