fix(activity): filter the MikroORM activity list by the requested period

Merged
CE
7d ago
+45-0

Problem

The MikroORM branch of ActivityService.getActivities destructures startDate / endDate but never uses them: GET /timesheet/activity for one day listed (and paged) the employee's activities of every day. The TypeORM branch filters recordedAt BETWEEN :startDate AND :endDate.

Fix

where.recordedAt = { $gte: startDate, $lte: endDate } when both bounds are given.

Tests

New activity.service.mikro-orm-date-range.spec.ts: the range reaches the where; no filter without both bounds.

Notes

Not built or run locally.


Summary by cubic

Fixes the MikroORM branch of ActivityService.getActivities so requests for a specific date list only activities in that period instead of every day's activities.

When both startDate and endDate are provided, recordedAt is now filtered between the bounds, matching the TypeORM branch. Adds a spec asserting the range reaches the query and that no date filter is applied without both bounds.