fix(resources/admin): unblock add-admin + resource search/bookmarks/save-toggle + consultant tags#138
Merged
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verified all five teammate-reported bugs against current code — all real.
admin@scholarpath.local, incl.ActiveRole). Guard stays intact; also surface the server's reason in the UI.resourceId, client readr.id(undefined) → unsave hit/resources/undefined/bookmark→ 404. NormalizeresourceId→id.ResourceDetailDtohad no bookmarked flag. AddedIsBookmarked(mirrors scholarships/community) + bound the button.expertiseTagLabelByLangwith a "#" prefix.tsc/eslint/dotnet buildclean; unit tests green.