fix: sync production DB schema for task detail API
Always run prisma db push on Render build and start so milestones/files columns exist for GET /tasks/:id.
This commit is contained in:
@@ -22,5 +22,12 @@ export function errorHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.error('[Error]', err);
|
console.error('[Error]', err);
|
||||||
|
|
||||||
|
const prismaCode = (err as { code?: string }).code;
|
||||||
|
if (prismaCode === 'P2022') {
|
||||||
|
res.status(500).json({ message: 'DB 스키마가 최신이 아닙니다. 배포 후 다시 시도해 주세요.' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
res.status(500).json({ message: '서버 오류가 발생했습니다.' });
|
res.status(500).json({ message: '서버 오류가 발생했습니다.' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ router.get('/', async (req, res, next) => {
|
|||||||
// GET /api/tasks/:id — 단건 상세 조회
|
// GET /api/tasks/:id — 단건 상세 조회
|
||||||
router.get('/:id', async (req, res, next) => {
|
router.get('/:id', async (req, res, next) => {
|
||||||
try {
|
try {
|
||||||
|
const taskId = String(req.params.id);
|
||||||
const task = await prisma.task.findUnique({
|
const task = await prisma.task.findUnique({
|
||||||
where: { id: req.params.id },
|
where: { id: taskId },
|
||||||
include: {
|
include: {
|
||||||
assignee: { select: { id: true, name: true, department: true } },
|
assignee: { select: { id: true, name: true, department: true } },
|
||||||
creator: { select: { id: true, name: true } },
|
creator: { select: { id: true, name: true } },
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ services:
|
|||||||
name: eene-dashboard-backend
|
name: eene-dashboard-backend
|
||||||
runtime: node
|
runtime: node
|
||||||
rootDir: backend
|
rootDir: backend
|
||||||
buildCommand: npm install --include=dev && npx prisma migrate deploy || npx prisma db push && npx prisma generate && npm run build
|
buildCommand: npm install --include=dev && (npx prisma migrate deploy || true) && npx prisma db push && npx prisma generate && npm run build
|
||||||
startCommand: npm start
|
startCommand: npx prisma db push && npm start
|
||||||
envVars:
|
envVars:
|
||||||
- key: DATABASE_URL
|
- key: DATABASE_URL
|
||||||
sync: false # Render 대시보드에서 직접 입력
|
sync: false # Render 대시보드에서 직접 입력
|
||||||
|
|||||||
Reference in New Issue
Block a user