fix: add showDate to backend POST/PATCH handlers
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -56,7 +56,7 @@ router.get('/:id', async (req, res, next) => {
|
|||||||
router.post('/', async (req, res, next) => {
|
router.post('/', async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
const { title, description, status, priority, quarter, category,
|
const { title, description, status, priority, quarter, category,
|
||||||
section, tag, taskType, progress, issueNote, startDate, dueDate, assigneeId } =
|
section, tag, taskType, progress, issueNote, startDate, dueDate, assigneeId, showDate } =
|
||||||
req.body as Record<string, string>;
|
req.body as Record<string, string>;
|
||||||
|
|
||||||
if (!title || !quarter) {
|
if (!title || !quarter) {
|
||||||
@@ -78,6 +78,7 @@ router.post('/', async (req, res, next) => {
|
|||||||
issueNote: issueNote || null,
|
issueNote: issueNote || null,
|
||||||
startDate: startDate ? new Date(startDate) : undefined,
|
startDate: startDate ? new Date(startDate) : undefined,
|
||||||
dueDate: dueDate ? new Date(dueDate) : undefined,
|
dueDate: dueDate ? new Date(dueDate) : undefined,
|
||||||
|
showDate: showDate !== undefined ? showDate === 'true' || showDate === true : true,
|
||||||
assigneeId: assigneeId || null,
|
assigneeId: assigneeId || null,
|
||||||
creatorId: (req.body as Record<string, string>).creatorId ?? 'system',
|
creatorId: (req.body as Record<string, string>).creatorId ?? 'system',
|
||||||
},
|
},
|
||||||
@@ -96,8 +97,8 @@ router.patch('/:id', async (req, res, next) => {
|
|||||||
if (!existing) throw new AppError(404, '업무를 찾을 수 없습니다.');
|
if (!existing) throw new AppError(404, '업무를 찾을 수 없습니다.');
|
||||||
|
|
||||||
const { title, description, status, priority, quarter, category,
|
const { title, description, status, priority, quarter, category,
|
||||||
section, tag, taskType, progress, issueNote, startDate, dueDate, assigneeId } =
|
section, tag, taskType, progress, issueNote, startDate, dueDate, assigneeId, showDate } =
|
||||||
req.body as Record<string, string>;
|
req.body as Record<string, any>;
|
||||||
|
|
||||||
const task = await prisma.task.update({
|
const task = await prisma.task.update({
|
||||||
where: { id: req.params.id },
|
where: { id: req.params.id },
|
||||||
@@ -116,6 +117,7 @@ router.patch('/:id', async (req, res, next) => {
|
|||||||
...(startDate !== undefined && { startDate: startDate ? new Date(startDate) : null }),
|
...(startDate !== undefined && { startDate: startDate ? new Date(startDate) : null }),
|
||||||
...(dueDate !== undefined && { dueDate: dueDate ? new Date(dueDate) : null }),
|
...(dueDate !== undefined && { dueDate: dueDate ? new Date(dueDate) : null }),
|
||||||
...(assigneeId !== undefined && { assigneeId: assigneeId || null }),
|
...(assigneeId !== undefined && { assigneeId: assigneeId || null }),
|
||||||
|
...(showDate !== undefined && { showDate: showDate === true || showDate === 'true' }),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user