Add public API for methods and values

This commit is contained in:
adilallo
2026-05-22 14:32:15 -06:00
parent cef7c98205
commit 9e11063a11
14 changed files with 727 additions and 134 deletions
+17
View File
@@ -45,6 +45,23 @@ export async function listRuleTemplatesFromDb(): Promise<RuleTemplateDto[]> {
}
}
/** Single curated template by slug; `null` when missing or DB unavailable. */
export async function getRuleTemplateBySlug(
slug: string,
): Promise<RuleTemplateDto | null> {
if (!isDatabaseConfigured()) {
return null;
}
try {
return await prisma.ruleTemplate.findUnique({
where: { slug },
select: TEMPLATE_SELECT,
});
} catch {
return null;
}
}
export type TemplateScore = {
score: number;
matchedFacets: string[];