fix: read meeting unread from tenant notification shard
This commit is contained in:
@@ -148,14 +148,19 @@ func (s *Store) WorkbenchModules(ctx context.Context, userID int64) ([]Workbench
|
||||
|
||||
func (s *Store) MeetingUnreadCount(ctx context.Context, userID int64) (int, error) {
|
||||
var count int
|
||||
err := s.db.GetContext(ctx, &count, `SELECT COUNT(*) FROM im_system_notifications
|
||||
WHERE tenant_id=? AND user_id=? AND read_at IS NULL AND event_type LIKE 'meeting.%'`, s.tenant(), userID)
|
||||
query := fmt.Sprintf(`SELECT COUNT(*) FROM %s
|
||||
WHERE tenant_id=? AND user_id=? AND read_at IS NULL AND event_type LIKE 'meeting.%%'`, tenantSystemNotificationsTable(s.tenant()))
|
||||
err := s.db.GetContext(ctx, &count, query, s.tenant(), userID)
|
||||
if isMissingTable(err) {
|
||||
return 0, nil
|
||||
}
|
||||
return count, err
|
||||
}
|
||||
|
||||
func tenantSystemNotificationsTable(tenantID int64) string {
|
||||
return fmt.Sprintf("im_%03d_system_notifications", tenantID)
|
||||
}
|
||||
|
||||
func (s *Store) Departments(ctx context.Context, userID int64, parentID, cursor string, limit int) ([]OrganizationDepartment, string, error) {
|
||||
if parentID == "" {
|
||||
parentID = "root"
|
||||
|
||||
Reference in New Issue
Block a user