Initial
This commit is contained in:
20
server/models/helpModel.js
Normal file
20
server/models/helpModel.js
Normal file
@@ -0,0 +1,20 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user