Unify error handling and HTTP statuses
Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package profile
|
||||
import (
|
||||
profileapischema "honoka-chan/internal/schema/api/profile"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -14,7 +15,7 @@ func cardRanking() (res any, err error) {
|
||||
|
||||
res = profileapischema.CardRankingResp{
|
||||
Result: cardRankingData,
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
profileapischema "honoka-chan/internal/schema/api/profile"
|
||||
"honoka-chan/internal/session"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -89,7 +90,7 @@ func profileInfo(ctx *gin.Context, targetUserID int) (res any, err error) {
|
||||
SettingAwardID: targetPref.AwardID,
|
||||
SettingBackgroundID: targetPref.BackgroundID,
|
||||
},
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
profileapischema "honoka-chan/internal/schema/api/profile"
|
||||
"honoka-chan/internal/session"
|
||||
"net/http"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
@@ -82,7 +83,7 @@ func liveCnt(ctx *gin.Context, targetUserID int) (res any, err error) {
|
||||
|
||||
res = profileapischema.LiveCntResp{
|
||||
Result: result,
|
||||
Status: 200,
|
||||
Status: http.StatusOK,
|
||||
CommandNum: false,
|
||||
TimeStamp: time.Now().Unix(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user