feat: redesign detail page with stage modal and milestone APIs
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -16,15 +16,26 @@ router.post('/upload/:taskId', upload.single('file'), async (req, res, next) =>
|
||||
const task = await prisma.task.findUnique({ where: { id: taskId } });
|
||||
if (!task) throw new AppError(404, '업무를 찾을 수 없습니다.');
|
||||
|
||||
const body = req.body as Record<string, string>;
|
||||
const milestoneId = body.milestoneId?.trim() || null;
|
||||
|
||||
if (milestoneId) {
|
||||
const milestone = await prisma.milestone.findFirst({
|
||||
where: { id: milestoneId, taskId },
|
||||
});
|
||||
if (!milestone) throw new AppError(404, '단계를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
const fileRecord = await prisma.file.create({
|
||||
data: {
|
||||
taskId,
|
||||
milestoneId,
|
||||
filename: req.file.filename,
|
||||
originalName: req.file.originalname,
|
||||
mimetype: req.file.mimetype,
|
||||
size: req.file.size,
|
||||
path: req.file.path,
|
||||
uploadedBy: (req.body as Record<string, string>).uploadedBy ?? 'system',
|
||||
uploadedBy: body.uploadedBy ?? 'system',
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user