Sb direct reports#130
Open
sbagg wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for displaying a separated employee’s current direct reports on the separation detail page (Issue #127) by allowing direct-report lookup for an arbitrary IAM ID (instead of only the current user).
Changes:
- Extend
EmployeeService.getDirectReports/EmployeeModel.getDirectReportsto accept an optionaliamId. - Add a “Current Direct Reports” panel to the separation single page and fetch direct reports for the separation request’s
iamId. - Update
/api/employees/direct-reportsto optionally acceptiamIdvia query string.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| services/lib/cork/services/EmployeeService.js | Adds optional iamId support to direct reports fetch (but currently needs cache-key fix). |
| services/lib/cork/models/EmployeeModel.js | Plumbs optional iamId parameter through to the service and updates JSDoc (currently inaccurate). |
| services/app/client/src/elements/pages/ucdlib-iam-page-separation-single.tpl.js | Adds “Current Direct Reports” panel (currently has mismatched closing tag and overly broad hide condition). |
| services/app/client/src/elements/pages/ucdlib-iam-page-separation-single.js | Fetches direct reports for separated employee (currently skips too broadly based on removedFromSystems). |
| services/app/api/employees.js | Accepts optional iamId query param (currently needs authorization guard when requesting other users). |
Comments suppressed due to low confidence (1)
services/lib/cork/services/EmployeeService.js:20
getDirectReportsnow accepts aniamId, but the store cache key is still a constant ('directReports'). If this method is called for differentiamIdvalues (e.g. separation page vs permissions page), the results will overwrite each other and callers can receive another employee’s cached direct reports.
async getDirectReports(iamId=''){
const store = this.store.data.directReports;
const id = 'directReports';
await this.checkRequesting(
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
22
to
26
| /** | ||
| * @description Returns all direct reports for the current user | ||
| * @param {String} iamId - optional, defaults to current user | ||
| * @returns {Object} {total, results} | ||
| */ |
| <div><label class='u-inline'>Department:</label> ${this.department}</div> | ||
| <div><label class='u-inline'>Separation Date:</label> ${this.separationDate}</div> | ||
| </div> | ||
| <div class="panel panel--icon panel--icon-custom o-box panel--icon-cabernet" ?hidden=${this.removedFromSystems?.length}> |
Comment on lines
+156
to
+158
| async getDirectReports(){ | ||
| if(this.removedFromSystems?.length) return []; | ||
| const r = await this.EmployeeModel.getDirectReports(this.iamId); |
Comment on lines
10
to
+12
| api.get('/employees/direct-reports', async (req, res) => { | ||
| const iamId = req.auth.token.iamId; | ||
| const iamId = req.query.iamId || req.auth.token.iamId; | ||
|
|
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.
issue #127