feat: implement workload heatmap module
- Backend (FastAPI):
- Workload heatmap API with load level calculation
- User workload detail endpoint with task breakdown
- Redis caching for workload calculations (1hr TTL)
- Department isolation and access control
- WorkloadSnapshot model for historical data
- Alembic migration for workload_snapshots table
- API Endpoints:
- GET /api/workload/heatmap - Team workload overview
- GET /api/workload/user/{id} - User workload detail
- GET /api/workload/me - Current user workload
- Load Levels:
- normal: <80%, warning: 80-99%, overloaded: >=100%
- Tests:
- 26 unit/API tests
- 15 E2E automated tests
- 77 total tests passing
- OpenSpec:
- add-resource-workload change archived
- resource-management spec updated
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,9 @@ class MockRedis:
|
||||
def get(self, key):
|
||||
return self.store.get(key)
|
||||
|
||||
def set(self, key, value):
|
||||
self.store[key] = value
|
||||
|
||||
def setex(self, key, seconds, value):
|
||||
self.store[key] = value
|
||||
|
||||
@@ -36,6 +39,17 @@ class MockRedis:
|
||||
if key in self.store:
|
||||
del self.store[key]
|
||||
|
||||
def scan_iter(self, match=None):
|
||||
"""Iterate over keys matching a pattern."""
|
||||
import fnmatch
|
||||
if match is None:
|
||||
yield from self.store.keys()
|
||||
else:
|
||||
pattern = match.replace("*", "**")
|
||||
for key in self.store.keys():
|
||||
if fnmatch.fnmatch(key, match):
|
||||
yield key
|
||||
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
def db():
|
||||
|
||||
Reference in New Issue
Block a user