chore: refresh gramsrv public release
This commit is contained in:
parent
75cebe8dbf
commit
70b6820474
1274 changed files with 378751 additions and 59919 deletions
30
internal/rpc/dialogs_pinned.go
Normal file
30
internal/rpc/dialogs_pinned.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
func (r *Router) pinnedDialogsList(ctx context.Context, userID int64, folderID int) (domain.DialogList, error) {
|
||||
if r == nil || r.deps.Dialogs == nil {
|
||||
return domain.DialogList{}, nil
|
||||
}
|
||||
key := fmt.Sprintf("%d:%d", userID, folderID)
|
||||
value, err, _ := r.dialogsPinnedSF.Do(key, func() (any, error) {
|
||||
return r.deps.Dialogs.GetDialogs(ctx, userID, domain.DialogFilter{
|
||||
PinnedOnly: true,
|
||||
HasFolderID: true,
|
||||
FolderID: folderID,
|
||||
Limit: 100,
|
||||
})
|
||||
})
|
||||
if err != nil {
|
||||
return domain.DialogList{}, err
|
||||
}
|
||||
if list, ok := value.(domain.DialogList); ok {
|
||||
return list, nil
|
||||
}
|
||||
return domain.DialogList{}, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue