GC Digital Talent is the new recruitment platform for digital and tech jobs in the Government of Canada. // Talents numériques du GC est la nouvelle plateforme de recrutement pour les emplois numériques et technologiques au gouvernement du Canada.
ExperienceSkills, the pivots between experiences and UserSkills, should be soft-deleted instead of deleted by default. Connecting a skill/userSkill to an experience should restore the appropriate soft-deleted entry, if one exists.
🕵️ Details
UserSkills already use soft-delete, and the syncSkills and connectSkills methods of Experience will restore the appropriate UserSkill if a soft-deleted row exists, before linking to it.
Now we want the ExperienceSkill entry itself to also use soft-delete. The main goal is to preserve the details field on the pivot table in the following situation:
I link a skill to an experience, and write out details for it. This creates a UserSkill, and an ExperienceSkill which links to it.
I delete the skill from my library, which automatically (soft-)deletes any linked ExperienceSkills (see #6942)
I re-add the skill to the experience. This restores the soft-deleted UserSkill and ExperienceSkill.
I see the details text I previously wrote without having to re-write it.
🙋♀️ Proposed Implementation
The tricky thing here is that ExperienceSkill is implemented using Laravel pivot table features, and...
Pivot models may not use the SoftDeletes trait. If you need to soft delete pivot records consider converting your pivot model to an actual Eloquent model.
So if we want to use built-in soft-delete features we'll need to convert ExperienceSkill into an actual model, and make sure it doesn't affect the API. If that's too hard, we might be able to fudge it with some clever global scopes.
Besides that, this will mostly involve code changes to the syncSkills, connectSkills and deleteSkills methods of the Experience.php class.
✅ Acceptance Criteria
A set of assumptions which, when tested, verify that the feature was properly implemented.
[ ] ExperienceSkills deleted with the deleteSkills or syncSkills methods are soft-deleted
[ ] When creating experienceSkills with syncSkills or connectSkills, if a soft-deleted experienceSkill already exists for the relevant UserSkill, restore it instead of creating a new record.
[ ] The functionality of the API from an outside perspective is not affected at all.
✨ Feature
ExperienceSkills, the pivots between experiences and UserSkills, should be soft-deleted instead of deleted by default. Connecting a skill/userSkill to an experience should restore the appropriate soft-deleted entry, if one exists.
🕵️ Details
UserSkills already use soft-delete, and the
syncSkills
andconnectSkills
methods of Experience will restore the appropriate UserSkill if a soft-deleted row exists, before linking to it.Now we want the ExperienceSkill entry itself to also use soft-delete. The main goal is to preserve the details field on the pivot table in the following situation:
🙋♀️ Proposed Implementation
The tricky thing here is that ExperienceSkill is implemented using Laravel pivot table features, and...
So if we want to use built-in soft-delete features we'll need to convert ExperienceSkill into an actual model, and make sure it doesn't affect the API. If that's too hard, we might be able to fudge it with some clever global scopes.
Besides that, this will mostly involve code changes to the
syncSkills
,connectSkills
anddeleteSkills
methods of the Experience.php class.✅ Acceptance Criteria
A set of assumptions which, when tested, verify that the feature was properly implemented.
deleteSkills
orsyncSkills
methods are soft-deletedsyncSkills
orconnectSkills
, if a soft-deleted experienceSkill already exists for the relevant UserSkill, restore it instead of creating a new record.