feat(server): 라우트 전면 개편 — 반응·가시성·댓글/대댓글·삭제

- GET / : 내 프로젝트/피드 분리, role 도구 필터, 댓글 일괄 조회(commentsByProject)
- 반응(heart/star) AJAX JSON, visibility/delete(본인), 댓글/대댓글(parent_id)
- 댓글 LGTM/🚀 egg 신호 + return_to 복귀, isAjax/safeBack 헬퍼
- res.locals 로 icon/identicon/langColor 노출
- db: listCommentsByProjects 추가, _header: body 시작 신호(toast/egg/open)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Hyemin Lee
2026-06-29 17:26:37 +09:00
parent 6a9cf46db8
commit ace46d2fb8
3 changed files with 115 additions and 32 deletions

View File

@@ -57,6 +57,18 @@ export async function listComments(projectId) {
return rows;
}
// 여러 프로젝트의 댓글을 한 번에 (대시보드 모달 저장소용). parent_id 포함.
export async function listCommentsByProjects(ids) {
if (!ids || !ids.length) return [];
const { rows } = await q(
`SELECT c.*, u.name AS author_name
FROM comments c JOIN users u ON u.sabun=c.author_sabun
WHERE c.project_id = ANY($1::bigint[]) ORDER BY c.created_at ASC`,
[ids]
);
return rows;
}
export async function addProject({ owner, title, description, repoUrl, appUrl, tags, isPublic, lang }) {
const { rows } = await q(
`INSERT INTO projects (owner_sabun, title, description, repo_url, app_url, tags, is_public, lang)