function mapCommentToDealCommentResponse(comment) { return { id: comment.id, text: comment.text, // eğer DB'de content ise burada text'e çevir createdAt: comment.createdAt, user: { id: comment.user.id, username: comment.user.username, avatarUrl: comment.user.avatarUrl ?? null, }, } } function mapCommentsToDealCommentResponse(comments) { return comments.map(mapCommentToDealCommentResponse) } function mapCommentToUserCommentResponse(c) { return { ...mapCommentToDealCommentResponse(c), deal: { id: c.deal.id, title: c.deal.title }, } } module.exports = { mapCommentToDealCommentResponse, mapCommentsToDealCommentResponse, mapCommentToUserCommentResponse }