feat(posts): filter posts by blocked users
Add functionality to filter out posts from blocked users in post listing endpoints. Includes a new `IsBlockedBatch` method for efficient batch checking of blocked relationships and `is_blocked` field in API responses when viewing a blocked user's posts.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import (
|
||||
"context"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"with_you/internal/model"
|
||||
"with_you/internal/pkg/cursor"
|
||||
@@ -88,7 +89,7 @@ func (r *systemNotificationRepository) GetUnreadCount(receiverID string) (int64,
|
||||
|
||||
// MarkAsRead 标记单条通知为已读
|
||||
func (r *systemNotificationRepository) MarkAsRead(id int64, receiverID string) error {
|
||||
now := model.SystemNotification{}.UpdatedAt
|
||||
now := time.Now()
|
||||
return r.db.Model(&model.SystemNotification{}).
|
||||
Where("id = ? AND receiver_id = ?", id, receiverID).
|
||||
Updates(map[string]any{
|
||||
@@ -99,7 +100,7 @@ func (r *systemNotificationRepository) MarkAsRead(id int64, receiverID string) e
|
||||
|
||||
// MarkAllAsRead 标记用户所有通知为已读
|
||||
func (r *systemNotificationRepository) MarkAllAsRead(receiverID string) error {
|
||||
now := model.SystemNotification{}.UpdatedAt
|
||||
now := time.Now()
|
||||
return r.db.Model(&model.SystemNotification{}).
|
||||
Where("receiver_id = ? AND is_read = ?", receiverID, false).
|
||||
Updates(map[string]any{
|
||||
|
||||
Reference in New Issue
Block a user