* Create a new member profile
(input: CreateMemberProfileInput)
| 48 | * Create a new member profile |
| 49 | */ |
| 50 | async createProfile(input: CreateMemberProfileInput): Promise<MemberProfile> { |
| 51 | const agents = input.agents || []; |
| 52 | const publishers = input.publishers || []; |
| 53 | const data_providers = input.data_providers || []; |
| 54 | |
| 55 | const result = await query<MemberProfile>( |
| 56 | `INSERT INTO member_profiles ( |
| 57 | workos_organization_id, display_name, slug, tagline, description, |
| 58 | primary_brand_domain, |
| 59 | contact_email, contact_website, contact_phone, |
| 60 | linkedin_url, twitter_url, |
| 61 | offerings, agents, publishers, data_providers, headquarters, markets, metadata, tags, |
| 62 | is_public, show_in_carousel |
| 63 | ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) |
| 64 | RETURNING *`, |
| 65 | [ |
| 66 | input.workos_organization_id, |
| 67 | input.display_name, |
| 68 | input.slug, |
| 69 | input.tagline || null, |
| 70 | input.description || null, |
| 71 | input.primary_brand_domain || null, |
| 72 | input.contact_email || null, |
| 73 | input.contact_website || null, |
| 74 | input.contact_phone || null, |
| 75 | input.linkedin_url || null, |
| 76 | input.twitter_url || null, |
| 77 | input.offerings || [], |
| 78 | JSON.stringify(agents), |
| 79 | JSON.stringify(publishers), |
| 80 | JSON.stringify(data_providers), |
| 81 | input.headquarters || null, |
| 82 | input.markets || [], |
| 83 | JSON.stringify(input.metadata || {}), |
| 84 | input.tags || [], |
| 85 | input.is_public ?? false, |
| 86 | input.show_in_carousel ?? false, |
| 87 | ] |
| 88 | ); |
| 89 | |
| 90 | return this.deserializeProfile(result.rows[0]); |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Get profile by ID |