Skip to content

DoCurious API Reference / adapters / adaptChallenge

Function: adaptChallenge()

adaptChallenge(sql): Partial<Challenge>

Defined in: adapters/challengeAdapter.ts:107

Adapt a SQL challenge row to a partial FE Challenge type.

Only maps fields that come from the SQL challenges table. FE-only fields (milestones, verification config, cover image, etc.) are set to safe defaults or left undefined.

Parameters

sql

SqlChallenge

Raw SQL challenge row

Returns

Partial<Challenge>

Partial FE Challenge with mapped fields

Example

ts
const feChallenge = adaptChallenge(sqlRow)
// { id: 'uuid-...', title: 'Pottery 101', status: 'approved', isFree: true, ... }

DoCurious Platform Documentation