Skip to content

Add paginated cached resources with file upload/delete and mobile-first UI#31

Closed
thughari wants to merge 11 commits intofeat/career-resourcefrom
codex/implement-resource-caching-and-file-upload
Closed

Add paginated cached resources with file upload/delete and mobile-first UI#31
thughari wants to merge 11 commits intofeat/career-resourcefrom
codex/implement-resource-caching-and-file-upload

Conversation

@thughari
Copy link
Owner

Motivation

  • Avoid refetching the entire resource catalog by caching paginated results so the app scales with many resources.
  • Allow users to contribute files (PDF/DOC/DOCX/TXT) in addition to links and ensure uploaded files are removed from storage when deleted.
  • Keep resources connected to the application after login and show ownership-aware controls for delete operations.
  • Provide a clean, mobile-first UI and client-side file validation (type + 10MB limit) to improve UX.

Description

  • Backend: extended CareerResource with resourceType, originalFileName, and fileSizeBytes, added CareerResourceDTO fields and a new CareerResourcePageResponse model, added paginated repository method and a GET /api/resources?page&size endpoint that returns cached pages via @Cacheable and supports anonymous/authenticated viewers.
  • Backend: added POST /api/resources/upload to accept multipart file uploads and DELETE /api/resources/{id} to remove resources, implemented createResourceFromFile and deleteResource in CareerResourceService with @CacheEvict and storage cleanup via the existing StorageService (works for R2 and local mock).
  • Frontend: ResourceService now uses an in-memory page cache (Map keyed by page:size), exposes getResources(page,size,forceRefresh), uploadResourceFile(...), deleteResource(...) and invalidates cache on mutations.
  • Frontend UI: reworked ResourcesComponent and template for mobile-first layout, added link vs file contribution modes, client-side file type/size checks (10MB max), a “Load more” paginated flow, file metadata display and an owner-only delete button; updated unit test mocks to the paged API shape and new methods.

Testing

  • npm --prefix frontend run start -- --host 0.0.0.0 --port 4200 started successfully and a mobile screenshot was captured for visual verification.
  • npm --prefix frontend run test -- --watch=false --browsers=ChromeHeadless failed in this environment because a ChromeHeadless binary is not available.
  • npm --prefix frontend run build failed here due to inlining Google Fonts returning HTTP 403 during the build (external resource policy in this environment).
  • mvn -q test could not run in this environment because Maven could not resolve the parent POM from Maven Central (HTTP 403); component unit test mocks were updated to reflect the new paged API and added methods.

Codex Task

@thughari thughari closed this Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant