Skip to content

Resolve frontend backend fields#5

Open
LiChenyang-GZ wants to merge 3 commits into
SkillSwapClub:mainfrom
LiChenyang-GZ:resolve-frontend-backend-fields
Open

Resolve frontend backend fields#5
LiChenyang-GZ wants to merge 3 commits into
SkillSwapClub:mainfrom
LiChenyang-GZ:resolve-frontend-backend-fields

Conversation

@LiChenyang-GZ
Copy link
Copy Markdown
Collaborator

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)

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.

1 participant