mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
[MM-45052] Add error checking in insights API (#3876)
This commit is contained in:
parent
afb5bf195b
commit
6b28be7043
@ -113,7 +113,12 @@ func (a *API) handleTeamBoardsInsights(w http.ResponseWriter, r *http.Request) {
|
||||
userLocation = time.Now().UTC().Location()
|
||||
}
|
||||
// get unix time for duration
|
||||
startTime := mmModel.StartOfDayForTimeRange(timeRange, userLocation)
|
||||
startTime, appErr := mmModel.GetStartOfDayForTimeRange(timeRange, userLocation)
|
||||
if appErr != nil {
|
||||
a.errorResponse(w, r, model.NewErrBadRequest(appErr.Message))
|
||||
return
|
||||
}
|
||||
|
||||
boardsInsights, err := a.app.GetTeamBoardsInsights(userID, teamID, &mmModel.InsightsOpts{
|
||||
StartUnixMilli: mmModel.GetMillisForTime(*startTime),
|
||||
Page: page,
|
||||
@ -226,7 +231,12 @@ func (a *API) handleUserBoardsInsights(w http.ResponseWriter, r *http.Request) {
|
||||
userLocation = time.Now().UTC().Location()
|
||||
}
|
||||
// get unix time for duration
|
||||
startTime := mmModel.StartOfDayForTimeRange(timeRange, userLocation)
|
||||
startTime, appErr := mmModel.GetStartOfDayForTimeRange(timeRange, userLocation)
|
||||
if appErr != nil {
|
||||
a.errorResponse(w, r, model.NewErrBadRequest(appErr.Message))
|
||||
return
|
||||
}
|
||||
|
||||
boardsInsights, err := a.app.GetUserBoardsInsights(userID, teamID, &mmModel.InsightsOpts{
|
||||
StartUnixMilli: mmModel.GetMillisForTime(*startTime),
|
||||
Page: page,
|
||||
|
Loading…
Reference in New Issue
Block a user