({
onlyPremium,
}: {
onlyPremium?: boolean;
} = {})
| 206 | } |
| 207 | |
| 208 | export async function getFeaturedMCPs({ |
| 209 | onlyPremium, |
| 210 | }: { |
| 211 | onlyPremium?: boolean; |
| 212 | } = {}) { |
| 213 | "use cache"; |
| 214 | cacheLife("hours"); |
| 215 | cacheTag("mcps"); |
| 216 | |
| 217 | const supabase = await createClient(); |
| 218 | const { data, error } = await supabase |
| 219 | .from("mcps") |
| 220 | .select("*") |
| 221 | .limit(100) |
| 222 | .order("created_at", { ascending: false }) |
| 223 | .order("order", { ascending: false }) |
| 224 | .eq("active", true) |
| 225 | .or(onlyPremium ? "plan.eq.premium" : "plan.eq.featured,plan.eq.premium"); |
| 226 | |
| 227 | return { |
| 228 | // Shuffle so featured placement rotates between cache revalidations. |
| 229 | data: data?.sort(() => Math.random() - 0.5), |
| 230 | error, |
| 231 | }; |
| 232 | } |
| 233 | |
| 234 | export async function getTotalUsers() { |
| 235 | "use cache"; |
nothing calls this directly
no test coverage detected