| 148 | } |
| 149 | |
| 150 | func validateUpdateStatusBatchRequest(req UpdateStatusBatchRequest) error { |
| 151 | // Check moderator ID |
| 152 | if req.ModeratorID == "" { |
| 153 | return fmt.Errorf("moderator_id is required") |
| 154 | } |
| 155 | |
| 156 | // Check maximum limit |
| 157 | if len(req.Updates) > 100 { |
| 158 | return fmt.Errorf("maximum of 100 updates allowed, got %d", len(req.Updates)) |
| 159 | } |
| 160 | |
| 161 | // Check for empty updates |
| 162 | if len(req.Updates) == 0 { |
| 163 | return fmt.Errorf("at least one update is required") |
| 164 | } |
| 165 | |
| 166 | // Check for duplicate entity type/ID combinations |
| 167 | seen := make(map[string]bool) |
| 168 | for i, update := range req.Updates { |
| 169 | if update.EntityType == "" { |
| 170 | return fmt.Errorf("entity_type is required for update at index %d", i) |
| 171 | } |
| 172 | if update.EntityID == "" { |
| 173 | return fmt.Errorf("entity_id is required for update at index %d", i) |
| 174 | } |
| 175 | |
| 176 | key := update.EntityType + ":" + update.EntityID |
| 177 | if seen[key] { |
| 178 | return fmt.Errorf("duplicate entity found: entity_type=%s, entity_id=%s", update.EntityType, update.EntityID) |
| 179 | } |
| 180 | seen[key] = true |
| 181 | } |
| 182 | |
| 183 | return nil |
| 184 | } |
| 185 | |
| 186 | func (c *ModerationClient) InvalidateUserCache(ctx context.Context, userID string) error { |
| 187 | if userID == "" { |