fix: user stats listing

This commit is contained in:
divyam234 2024-04-19 11:43:30 +05:30
parent b82dac8820
commit 7a7743c63f
2 changed files with 3 additions and 9 deletions

View file

@ -6,6 +6,6 @@ type Channel struct {
}
type AccountStats struct {
ChannelID int64 `json:"channelId"`
ChannelID int64 `json:"channelId,omitempty"`
Bots []string `json:"bots"`
}

View file

@ -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)