Skip to content

Issue: Update dbFieldMapper Utility for New Schema Fields #152

Description

@NahomAlemu

Description

The dbFieldMapper.ts utility needs to handle the new field mappings between backendresponse and frontend types. The cover photo and document fields now return Media objects or UUIDs instead of direct URLs. Without this update, events won't display cover photos or documents correctly.

Components Affected:

  • EventCard.tsx
  • HomeEventsCard.tsx
  • UpcomingEvent.tsx
  • EventGetter.tsx
  • event-detail/page.tsx

Tasks

  • Add mapping for coverPhotoIdeventCoverPhoto (backward compatibility)
  • Add mapping for documentIdeventDocument (backward compatibility)
  • Handle nested coverPhoto and document Media objects in response
  • Extract s3Url from Media objects for display components
  • Update nsc-events-nextjs/tests/unit/dbFieldMapper.test.tsx with new test
    cases
  • Ensure 100% test coverage maintained

Visual Aids

Expand ⬇️
**Transformation Example:**
```typescript
// Backend Response
{
  coverPhotoId: "uuid-123",
  coverPhoto: {
    id: "uuid-123",
    s3Url: "https://s3.../image.jpg",
    originalName: "photo.jpg"
  }
}

// Frontend Needs
{
  eventCoverPhoto: "https://s3.../image.jpg"  // For backward compat
  coverPhotoId: "uuid-123"                     // New field
}

Metadata

Metadata

Assignees

Labels

choreRoutine maintenance or configuration update

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions