Migrate `facility` to the new Resource-layer methods
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Migrate the facility plugin to the new resource-layer methods, following the shared recipe in #15057.
Complexity: Medium Target branch: develop
Context
facility currently uses the old resource methods. This task applies the migration recipe from #15057 to this plugin only. The new methods already exist (#15056), and the old ones still work, so this change is isolated to facility.
The Change
Apply the #15057 recipe to every resource usage in facility:
- Replace old base-method calls with the new ones (
fetchModel→retrieve,fetchCollection→list,saveModel→create/update,deleteModel→delete,saveCollection→bulkCreate,deleteCollection→bulkDelete, rawget/list/create). - Remove cache-management calls (
clearCache,getModel,getCollection,addModel, …). - Custom methods: rewrite onto
requestif the resource is defined and used only withinfacility; otherwise add/point at a_v2shared method (see #15057). - Use
useRetrieve/useListfor reactive reads, if possible.
Acceptance Criteria
- [ ] No code in
facilitycalls the old base methods or cache-management helpers. - [ ] Custom methods handled per the recipe (in-place rewrite for target-only resources, or shared
_v2with the original left intact). - [ ] Reactive reads use
useRetrieve/useListwhere possible. - [ ] Tests that call/mock replaced methods are updated;
pnpm test-jestpasses forfacility.
AI usage
I used Claude Code to help draft this issue from the resource-layer refactor plan. I reviewed and edited it and confirmed the scope myself.
Watching for resolution on behalf of learningequality/kolibri#15065.
Hey @rtibblesbot! I have unmarked the kolibri-common issue as blocker, could you start implementing this task now?
Plan: Move every resource call in kolibri/plugins/facility off the legacy Model/Collection methods onto the Resource methods added in #15056.
- [ ] Baseline, then the user-management Vuex module
- [ ] The class Vuex modules
- [ ] The data page — CSV task polling and the facility list
- [ ] One-shot page reads and writes
- [ ] Trash modals, and
restoreCollectionrewritten in place - [ ] The class side panels
- [ ] The UserCreate side panel
- [ ]
useFacilityEditor, copied verbatim from PR #15163 - [ ]
useUserManagementontouseList - [ ] Delete the dead plugin-local
PortalResource - [ ] Self-review the produced code
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
- Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
- Ran the project's full test suite and linter before committing
- For UI changes: captured live screenshots to verify rendering
- For backend changes: verified with example API/CLI output
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.