Closed ericbolikowski closed 2 months ago
[!CAUTION]
Review failed
The pull request is closed.
These updates to the ConProfilesService
in the NestJS API involve enhancements to handle user profiles more effectively. The service now imports the groupBy
function from the lodash
library. The findAll
method has been updated to call a new method, selectLatestActiveProfilePerUser
, which selects the latest active profile for each user, excluding any deactivated profiles when multiple profiles are present.
Files | Change Summary |
---|---|
apps/nestjs-api/src/con-profiles/con-profiles.service.ts |
Added import { groupBy } from 'lodash' . Modified findAll to call selectLatestActiveProfilePerUser . Added selectLatestActiveProfilePerUser method. |
In the code's vast, evolving sea,
Profiles sort with glee,
Deactivated ones set aside,
Active, latest, now our guide.
Grouping with lodash's might,
We ensure the data's right.
To cleaner code, we cheer, delight!
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@katamatata I pushed our WiP work here
@coderabbit review
But, if there are two or more active profiles (Drafting
, Submitted for Review
or Approved
status), the system will use the one that was created last.
Thank you, guys, for your work! I posted the update with your comments in slack channel connect-talent-pool-salesforce-support.
Thank you!
What Github issue does this PR relate to? Insert link.
792
What should the reviewer know?
In nestjs-api, all loading of
ReDI Connect Profile
records from Salesforce go via theConProfilesService.findAll()
method (checked by searching code and checking function references).That method now calls a new helper method
whenMultipleProfilesExcludeDeactivatedOnes
that:Deactivated
This has the effect that if for instance a
Contact
has three profiles with statuses Deactivated, Deactivated, and Approved, only the one with status Approved will be kept and returned.This solves the issue described in #792.
Summary by CodeRabbit