* Deserialize database row (parse JSONB fields)
(row: any)
| 381 | * Deserialize database row (parse JSONB fields) |
| 382 | */ |
| 383 | private deserializeProfile(row: any): MemberProfile { |
| 384 | // Parse agents JSONB |
| 385 | let agents: AgentConfig[] = []; |
| 386 | if (row.agents) { |
| 387 | const raw = typeof row.agents === 'string' |
| 388 | ? JSON.parse(row.agents) |
| 389 | : row.agents; |
| 390 | agents = Array.isArray(raw) ? raw.map(normalizeAgentConfig) : []; |
| 391 | } |
| 392 | |
| 393 | // Parse publishers JSONB |
| 394 | let publishers: PublisherConfig[] = []; |
| 395 | if (row.publishers) { |
| 396 | publishers = typeof row.publishers === 'string' |
| 397 | ? JSON.parse(row.publishers) |
| 398 | : row.publishers; |
| 399 | } |
| 400 | |
| 401 | // Parse brands JSONB |
| 402 | let brands: BrandConfig[] = []; |
| 403 | if (row.brands) { |
| 404 | brands = typeof row.brands === 'string' |
| 405 | ? JSON.parse(row.brands) |
| 406 | : row.brands; |
| 407 | } |
| 408 | |
| 409 | // Parse data_providers JSONB |
| 410 | let data_providers: DataProviderConfig[] = []; |
| 411 | if (row.data_providers) { |
| 412 | data_providers = typeof row.data_providers === 'string' |
| 413 | ? JSON.parse(row.data_providers) |
| 414 | : row.data_providers; |
| 415 | } |
| 416 | |
| 417 | return { |
| 418 | ...row, |
| 419 | agents, |
| 420 | publishers, |
| 421 | brands, |
| 422 | data_providers, |
| 423 | markets: row.markets || [], |
| 424 | metadata: typeof row.metadata === 'string' |
| 425 | ? JSON.parse(row.metadata) |
| 426 | : row.metadata || {}, |
| 427 | }; |
| 428 | } |
| 429 | |
| 430 | } |
no outgoing calls
no test coverage detected