Allow TMs to approve timesheet entries - #62
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new manager-name hydration logic can leave blank names when the stored value is an empty/whitespace string, so the backfill behavior is currently incorrect for a real missing-name case.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
This PR adjusts timesheet authorization so Talent Managers (TMs) can approve submitted entries (while remaining unable to edit/submit), and improves timesheet view responses by hydrating manager display names when they’re missing in storage.
Changes:
- Updated approval authorization to block only Members from approving timesheet entries (allowing TMs to approve).
- Enhanced manager list hydration in timesheet views by backfilling missing manager names via the member service.
- Updated error messaging and unit/e2e tests to reflect the new TM permissions and hydration behavior.
| File | Description |
|---|---|
src/timesheets/timesheets.service.ts |
Allows TM approvals and adds manager-name backfill during timesheet view construction. |
src/timesheets/timesheets.service.spec.ts |
Updates unit tests for TM behavior and adds a test for manager-name backfill. |
src/timesheets/timesheet-authorization.e2e.spec.ts |
Updates e2e expectations to allow TM approval (201 instead of 403). |
src/common/constants.ts |
Updates TM read-only error message to reflect “approve-only (no edit/submit)”. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1347
to
+1350
| const hydratedManagers = managers.map((manager) => ({ | ||
| ...manager, | ||
| name: manager.name ?? nameByUserId.get(manager.userId) ?? null, | ||
| })); |
Comment on lines
+174
to
+177
| managerUserId: "2002", | ||
| managerHandle: "maryj", | ||
| managerName: null, | ||
| createdAt: utcDate("2026-09-01"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This pull request updates timesheet approval permissions for Talent Managers (TM) and improves manager name hydration in timesheet responses. The main changes allow TMs to approve submitted timesheet entries (but not edit or submit them), update error messages and tests to reflect this, and ensure manager names are populated even if missing from the database.
Timesheet Approval Permissions
src/timesheets/timesheets.service.ts, src/timesheets/timesheets.service.tsL503-R505)src/common/constants.ts, [1];src/timesheets/timesheets.service.spec.ts, [2] [3] [4]src/timesheets/timesheet-authorization.e2e.spec.ts, [1];src/timesheets/timesheets.service.spec.ts, [2]Manager Name Hydration
src/timesheets/timesheets.service.ts, [1] [2]src/timesheets/timesheets.service.spec.ts, src/timesheets/timesheets.service.spec.tsR170-R197)