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) {
|
func (s *Store) MeetingUnreadCount(ctx context.Context, userID int64) (int, error) {
|
||||||
var count int
|
var count int
|
||||||
err := s.db.GetContext(ctx, &count, `SELECT COUNT(*) FROM im_system_notifications
|
query := fmt.Sprintf(`SELECT COUNT(*) FROM %s
|
||||||
WHERE tenant_id=? AND user_id=? AND read_at IS NULL AND event_type LIKE 'meeting.%'`, s.tenant(), userID)
|
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) {
|
if isMissingTable(err) {
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
return count, err
|
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) {
|
func (s *Store) Departments(ctx context.Context, userID int64, parentID, cursor string, limit int) ([]OrganizationDepartment, string, error) {
|
||||||
if parentID == "" {
|
if parentID == "" {
|
||||||
parentID = "root"
|
parentID = "root"
|
||||||
|
|||||||
Reference in New Issue
Block a user