ux improved
This commit is contained in:
47
src/modules/0-ui/handlers/recommendations.js
Normal file
47
src/modules/0-ui/handlers/recommendations.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import {
|
||||
listRecommendations,
|
||||
getRecommendationById,
|
||||
insertRecommendation,
|
||||
updateRecommendation,
|
||||
deleteRecommendation,
|
||||
} from "../db/repo.js";
|
||||
|
||||
export async function handleListRecommendations({ tenantId, q = "", limit = 200 }) {
|
||||
const items = await listRecommendations({ tenantId, q, limit });
|
||||
return { items };
|
||||
}
|
||||
|
||||
export async function handleGetRecommendation({ tenantId, id }) {
|
||||
return getRecommendationById({ tenantId, id });
|
||||
}
|
||||
|
||||
export async function handleCreateRecommendation({
|
||||
tenantId,
|
||||
rule_key,
|
||||
trigger = {},
|
||||
queries = [],
|
||||
boosts = {},
|
||||
ask_slots = [],
|
||||
active = true,
|
||||
priority = 100,
|
||||
}) {
|
||||
return insertRecommendation({ tenantId, rule_key, trigger, queries, boosts, ask_slots, active, priority });
|
||||
}
|
||||
|
||||
export async function handleUpdateRecommendation({
|
||||
tenantId,
|
||||
id,
|
||||
trigger,
|
||||
queries,
|
||||
boosts,
|
||||
ask_slots,
|
||||
active,
|
||||
priority,
|
||||
}) {
|
||||
return updateRecommendation({ tenantId, id, trigger, queries, boosts, ask_slots, active, priority });
|
||||
}
|
||||
|
||||
export async function handleDeleteRecommendation({ tenantId, id }) {
|
||||
const deleted = await deleteRecommendation({ tenantId, id });
|
||||
return { deleted };
|
||||
}
|
||||
Reference in New Issue
Block a user