diff --git a/pkg/schemas/user.go b/pkg/schemas/user.go index e75332f..de31522 100644 --- a/pkg/schemas/user.go +++ b/pkg/schemas/user.go @@ -6,6 +6,6 @@ type Channel struct { } type AccountStats struct { - ChannelID int64 `json:"channelId"` + ChannelID int64 `json:"channelId,omitempty"` Bots []string `json:"bots"` } diff --git a/pkg/services/user.go b/pkg/services/user.go index 45a8d0b..65950db 100644 --- a/pkg/services/user.go +++ b/pkg/services/user.go @@ -85,14 +85,8 @@ func (us *UserService) GetStats(c *gin.Context) (*schemas.AccountStats, *types.A channelId int64 err error ) - if c.Param("channelId") != "" { - channelId, _ = strconv.ParseInt(c.Param("channelId"), 10, 64) - } else { - channelId, err = GetDefaultChannel(c, us.db, userID) - if err != nil { - return nil, &types.AppError{Error: err, Code: http.StatusInternalServerError} - } - } + + channelId, _ = GetDefaultChannel(c, us.db, userID) tokens, err := getBotsToken(c, us.db, userID, channelId)