MM-55295: Improve DB performance of some (Take 2) (#25865)
* Revert "Revert "MM-55295: Improve DB performance of some APIs (#25318)" (#25852)"
This reverts commit 077221a940.
* Fix the issue
```release-note
NONE
```
* lint fix
```release-note
NONE
```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
43cca04f04
Коммит
1d879ed0f4
@@ -2063,6 +2063,21 @@ func (s *Server) getChannelMember(c request.CTX, channelID string, userID string
|
||||
return channelMember, nil
|
||||
}
|
||||
|
||||
func (s *Server) getChannelMemberLastViewedAt(c request.CTX, channelID string, userID string) (int64, *model.AppError) {
|
||||
lastViewedAt, err := s.Store().Channel().GetMemberLastViewedAt(c.Context(), channelID, userID)
|
||||
if err != nil {
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return 0, model.NewAppError("getChannelMemberLastViewedAt", MissingChannelMemberError, nil, "", http.StatusNotFound).Wrap(err)
|
||||
default:
|
||||
return 0, model.NewAppError("getChannelMemberLastViewedAt", "app.channel.get_member.app_error", nil, "", http.StatusInternalServerError).Wrap(err)
|
||||
}
|
||||
}
|
||||
|
||||
return lastViewedAt, nil
|
||||
}
|
||||
|
||||
func (a *App) GetChannelMembersPage(c request.CTX, channelID string, page, perPage int) (model.ChannelMembers, *model.AppError) {
|
||||
channelMembers, err := a.Srv().Store().Channel().GetMembers(channelID, page*perPage, perPage)
|
||||
if err != nil {
|
||||
|
||||
Ссылка в новой задаче
Block a user