feat: add art component

This commit is contained in:
2026-02-04 13:40:52 -08:00
parent d338c8b52f
commit cbd6499079
12 changed files with 1162 additions and 0 deletions
+27
View File
@@ -63,6 +63,7 @@ export class CommentService {
gameId: comment.gameId || undefined,
bookId: comment.bookId || undefined,
musicId: comment.musicId || undefined,
artId: comment.artId || undefined,
createdAt: comment.createdAt,
updatedAt: comment.updatedAt,
};
@@ -146,6 +147,32 @@ export class CommentService {
return this.mapComment(comment);
}
async getCommentsForArt(artId: string): Promise<Comment[]> {
const comments = await this.prisma.comment.findMany({
where: { artId },
include: { user: true },
orderBy: { createdAt: "desc" },
});
return comments.map((c) => this.mapComment(c));
}
async createCommentForArt(
artId: string,
userId: string,
data: CreateCommentDto
): Promise<Comment> {
const sanitizedContent = this.sanitizeMarkdown(data.content);
const comment = await this.prisma.comment.create({
data: {
content: sanitizedContent,
userId,
artId,
},
include: { user: true },
});
return this.mapComment(comment);
}
async deleteComment(commentId: string): Promise<void> {
await this.prisma.comment.delete({
where: { id: commentId },