Skip to content

Sb direct reports#130

Open
sbagg wants to merge 2 commits into
sandboxfrom
sb-direct-reports
Open

Sb direct reports#130
sbagg wants to merge 2 commits into
sandboxfrom
sb-direct-reports

Conversation

@sbagg

@sbagg sbagg commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

issue #127

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.getDirectReports to accept an optional iamId.
  • 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-reports to optionally accept iamId via 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

  • getDirectReports now accepts an iamId, but the store cache key is still a constant ('directReports'). If this method is called for different iamId values (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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants