-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Task
Implement POST /lamps/bulk-toggle with request-scoped caching to avoid querying the same room multiple times.
Endpoint
POST /lamps/bulk-toggle
{
"lampIds": ["uuid1", "uuid2", "uuid3"],
"status": true
}Functional Requirement
Must not query the same room multiple times even if multiple lamps belong to the same room.
Implementation Hints
- Use a
map[uuid.UUID]*Roomas request-scoped cache - Check map before querying database
- Store fetched rooms for reuse within same request
- Pass cache through context or as parameter
Acceptance Criteria
- Bulk toggle updates all specified lamps
- Room validation occurs for each lamp (room must be active)
- Same room is only queried once per request (verify with SQL logging)
- Returns 422 if any lamp belongs to deleted room
Parent Issue
Relates to #289
Reactions are currently unavailable