Resolve frontend backend fields#5
Open
LiChenyang-GZ wants to merge 3 commits into
Open
Conversation
use mock user to login
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.
Overview
The backend Workshop/User API has been repaired and stabilised, enabling the frontend to replace most mocks with real data.
Fixed several null/type-related 500 errors, resolved lazy loading issues, addressed frontend type errors, and standardised certain field names.
Backend (Completed)
API Validation
GET /api/v1/workshops Successful (List)
GET /api/v1/workshops/{id} successful (single entry)
Bug Fixes
Handled null collections/fields to prevent NPE (WorkshopServiceImpl)
Converted certain primitive types in Workshop entity to wrapper types (Integer/Boolean), permitting DB null returns (duration/isOnline/maxParticipants/creditCost/creditReward)
Resolved PropertyAccessException caused by primitive -> null conversion
Addressed LazyInitializationException due to lazy loading (applied @transactional to required service methods)
Repository Adjustments
WorkshopRepository: Added/revised countByFacilitatorId query (by facilitator.id)
WorkshopParticipantRepository: Implemented countByUserId query by p.user.id
UserService fixes: Statistical queries now interface with Repository to prevent type/method name mismatches
DTO updates: WorkshopResponseDto uses wrapper types (Integer/Boolean) and includes facilitator DTO, tags/materials/requirements fields
Frontend (Completed / Resolved)
Types and mock data
Unify field names to backend format (username, avatarUrl, creditCost/creditReward/creditBalance etc.)
Update mockUser to correspond with real database users (facilitating mock login)
API layer
Adjusted to prioritise backend API calls (workshop and user retrieval); authentication/write operations remain mocked/pending implementation
Simplified and removed extensive field conversion logic (for greater consistency with backend fields)
Component fixes
CreateWorkshop.tsx: Resolved TypeScript errors (explicitly annotated Select/Switch/onChange, removed unused imports, form state types)
ExploreWorkshops / Credits / Other components: Addressed multiple nullable warnings and field name references (currentParticipants, creditCost/creditReward, user?.creditBalance, etc.)
AppContext.tsx: Updated mapSupabaseUser (adapted to new field names/types)
Verified
Tested using Postman: GET list and single-item interfaces return 200 (no 500 errors)
Frontend compiled and major TS errors resolved (key pages like CreateWorkshop)