Skip to content

fix(resources/admin): unblock add-admin + resource search/bookmarks/save-toggle + consultant tags#138

Merged
ma7moudalysalem merged 1 commit into
mainfrom
fix/youssra-five-bugs
Jul 7, 2026
Merged

fix(resources/admin): unblock add-admin + resource search/bookmarks/save-toggle + consultant tags#138
ma7moudalysalem merged 1 commit into
mainfrom
fix/youssra-five-bugs

Conversation

@ma7moudalysalem

Copy link
Copy Markdown
Owner

Verified all five teammate-reported bugs against current code — all real.

  1. Add admin never worked — granting the Admin role is (by design) SuperAdmin-only to stop an Admin minting another Admin, but no SuperAdmin exists (the seeder never created one), so every add-admin 403'd. Bootstrap a SuperAdmin idempotently (role + promote admin@scholarpath.local, incl. ActiveRole). Guard stays intact; also surface the server's reason in the UI.
  2. Saved-tab delete did nothing — bookmarks endpoint returns resourceId, client read r.id (undefined) → unsave hit /resources/undefined/bookmark → 404. Normalize resourceIdid.
  3. Resource search returned nothing for common queries — the term filter was scoped to the UI language and to title+content only. Made it language-agnostic + cover description & tags.
  4. Save toggle never changedResourceDetailDto had no bookmarked flag. Added IsBookmarked (mirrors scholarships/community) + bound the button.
  5. Consultant My Resources tags showed raw slugs, no "#" — now mapped through expertiseTagLabelByLang with a "#" prefix.

tsc/eslint/dotnet build clean; unit tests green.

… consultant tags

All five verified against current code (teammate wasn't sure they were real):

1. ADD ADMIN never worked: granting the Admin role is (intentionally)
   SuperAdmin-only to stop an Admin minting another Admin, but NO SuperAdmin
   exists — the seeder never created one, so every "add admin" 403'd. Bootstrap
   a SuperAdmin idempotently (add the role + promote admin@scholarpath.local,
   incl. ActiveRole so the JWT role claim is SuperAdmin). Keeps the anti-
   self-escalation guard intact. Also surface the server's reason in the UI.

2. STUDENT SAVED delete did nothing: the bookmarks endpoint returns
   ResourceBookmarkDto whose id field is `resourceId`, but the client read `r.id`
   (undefined) → unsave POSTed to /resources/undefined/bookmark → 404. Normalize
   resourceId→id in getMyBookmarks.

3. RESOURCE SEARCH returned nothing for common queries: the term filter was
   scoped to the UI language (only *Ar on the Arabic-default UI) and to
   title+content. Made it language-agnostic and cover description + tags too.

4. SAVE toggle never changed icon/colour: ResourceDetailDto had no bookmarked
   flag, so the button was hardcoded. Added IsBookmarked to the DTO + query
   (mirrors scholarships/community) and bound the button; the existing detail
   invalidation flips it immediately.

5. CONSULTANT My Resources tags showed raw slugs with no "#": the list joined
   raw tag strings. Now maps each through expertiseTagLabelByLang with a "#"
   prefix, like every other tag renderer.

Server build clean; resource/admin unit tests green.
Copilot AI review requested due to automatic review settings July 7, 2026 10:56
@ma7moudalysalem ma7moudalysalem merged commit 90d94ab into main Jul 7, 2026
@ma7moudalysalem ma7moudalysalem deleted the fix/youssra-five-bugs branch July 7, 2026 10:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants