(slug: string, userId?: string)
| 109 | } |
| 110 | |
| 111 | async function fetchCompanyProfile(slug: string, userId?: string) { |
| 112 | const supabase = await createClient(); |
| 113 | const query = supabase |
| 114 | .from("companies") |
| 115 | .select( |
| 116 | "id, name, slug, image, location, bio, website, social_x_link, hero, public, owner_id, created_at", |
| 117 | ) |
| 118 | .eq("slug", slug); |
| 119 | |
| 120 | if (userId) { |
| 121 | query.eq("owner_id", userId); |
| 122 | } |
| 123 | |
| 124 | const { data, error } = await query.single(); |
| 125 | |
| 126 | return { data, error }; |
| 127 | } |
| 128 | |
| 129 | async function getPublicCompanyProfile(slug: string) { |
| 130 | "use cache"; |
no test coverage detected