[MM-25652] Add /integrity endpoint to local mode API (#15033)

* Fix direct/group channel false positives

* Move public structures to model package

* Expose CheckIntegrity as a local API method

* Remove extra file

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Claudio Costa
2020-07-27 10:20:22 +02:00
коммит произвёл GitHub
родитель c0fa478cdd
Коммит e5edf2683d
10 изменённых файлов: 367 добавлений и 212 удалений

Просмотреть файл

@@ -5357,3 +5357,18 @@ func (c *Client4) UpdateSidebarCategoryForTeamForUser(userID, teamID, categoryID
return cat, BuildResponse(r)
}
// CheckIntegrity performs a database integrity check.
func (c *Client4) CheckIntegrity() ([]IntegrityCheckResult, *Response) {
r, err := c.DoApiPost("/integrity", "")
if err != nil {
return nil, BuildErrorResponse(r, err)
}
defer closeBody(r)
var results []IntegrityCheckResult
if err := json.NewDecoder(r.Body).Decode(&results); err != nil {
appErr := NewAppError("Api4.CheckIntegrity", "api.marshal_error", nil, err.Error(), http.StatusInternalServerError)
return nil, BuildErrorResponse(r, appErr)
}
return results, BuildResponse(r)
}