feat: feedback edit/delete buttons and author name on edit
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -44,7 +44,7 @@ router.post('/:taskId', async (req, res, next) => {
|
||||
// PATCH /api/details/item/:id
|
||||
router.patch('/item/:id', async (req, res, next) => {
|
||||
try {
|
||||
const { content } = req.body as Record<string, string>;
|
||||
const { content, authorName } = req.body as Record<string, string>;
|
||||
if (!content?.toString().trim()) throw new AppError(400, '피드백 내용은 필수입니다.');
|
||||
|
||||
const existing = await prisma.taskDetail.findUnique({ where: { id: req.params.id } });
|
||||
@@ -52,7 +52,10 @@ router.patch('/item/:id', async (req, res, next) => {
|
||||
|
||||
const detail = await prisma.taskDetail.update({
|
||||
where: { id: req.params.id },
|
||||
data: { content: content.toString().trim() },
|
||||
data: {
|
||||
content: content.toString().trim(),
|
||||
...(authorName !== undefined && { authorName: authorName?.toString().trim() || null }),
|
||||
},
|
||||
include: { author: { select: { id: true, name: true } } },
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user