Files
pengzhan.dev/server/services/comments.js
T
haopengzhan 8c0b04db0e feat: initial release of pengzhan.dev personal editorial blog platform
- Editorial web platform built with Node.js, Express, EJS, and Vanilla CSS
- Markdown content engine with YAML frontmatter, bilingual variants, and hot-reload watcher
- Unified SQLite with FTS5 search indexing, query logging, and schema filters
- Centered editorial post layout with margin-docked left TOC and mobile bottom sheet
- WordPress-grade comment system with moderation dashboard and bulk operations under /guanli
- Complete SEO suite (JSON-LD structured data, RSS/Atom feeds, XML sitemap, robots.txt)
- CI/CD workflows for linting, security audits (Gitleaks), automated tests, and Docker releases
2026-09-16 23:08:53 -07:00

50 lines
956 B
JavaScript

const dbService = require('./db');
class CommentService {
init(contentDir) {
dbService.init(contentDir);
}
getCommentsForPost(postSlug) {
return dbService.getApprovedCommentsForPost(postSlug);
}
addComment(params) {
return dbService.addComment(params);
}
getPendingComments() {
return dbService.getAllComments(0); // 0 = pending
}
getAllComments() {
return dbService.getAllComments();
}
approveComment(id) {
return dbService.updateCommentStatus(id, 1);
}
rejectComment(id) {
return dbService.updateCommentStatus(id, -1);
}
deleteComment(id) {
return dbService.deleteComment(id);
}
batchApproveComments(ids) {
return dbService.batchUpdateCommentStatus(ids, 1);
}
batchRejectComments(ids) {
return dbService.batchUpdateCommentStatus(ids, -1);
}
batchDeleteComments(ids) {
return dbService.batchDeleteComments(ids);
}
}
module.exports = new CommentService();