21 lines
571 B
JavaScript
21 lines
571 B
JavaScript
import { helpCatalog, helpCategories, helpSearch } from '../data/helpCatalog.js';
|
|
|
|
export function listHelp({ query = '', category = '' } = {}) {
|
|
const articles = helpSearch(query, category);
|
|
return {
|
|
categories: helpCategories(),
|
|
total: articles.length,
|
|
articles: articles.map((item) => ({
|
|
id: item.id,
|
|
category: item.category,
|
|
title: item.title,
|
|
summary: item.summary,
|
|
tags: item.tags || []
|
|
}))
|
|
};
|
|
}
|
|
|
|
export function getHelpArticle(articleId) {
|
|
return helpCatalog().find((item) => item.id === articleId) || null;
|
|
}
|