MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / findWidgetByType

Function findWidgetByType

packages/trpc/src/routers/widget.ts:19–26  ·  view source on GitHub ↗
(projectId: string, type: string)

Source from the content-addressed store, hash-verified

17
18// Helper to find widget by projectId and type
19async function findWidgetByType(projectId: string, type: string) {
20 const widgets = await db.shareWidget.findMany({
21 where: { projectId },
22 });
23 return widgets.find(
24 (w) => (w.options as z.infer<typeof zWidgetOptions>)?.type === type
25 );
26}
27
28export const widgetRouter = createTRPCRouter({
29 // Get widget by projectId and type (returns null if not found or not public)

Callers 1

widget.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected