import { getDbClient } from "./client.server.js"; export type LegacyWidget = { id: string; createdAt: Date; updatedAt: Date; tenantId: string | null; name: string; appearance: string; metadata: string; }; export type LegacyWidgetReaderClient = { widget: { findFirst(args: { where: { id: string; tenantId: string }; }): Promise; }; }; export type LegacyWidgetLookup = { widgetId: string; tenantId: string; }; export async function findLegacyWidgetById( { widgetId, tenantId }: LegacyWidgetLookup, client: LegacyWidgetReaderClient = getDbClient(), ): Promise { return client.widget.findFirst({ where: { id: widgetId, tenantId }, }); }