[민지영] sprint08#29
Hidden character warning
[민지영] sprint08#29Obsessive-Curiosity wants to merge 19 commits intocodeit-sprint-fullstack:express-민지영from
Conversation
Sprint mission08 backend
메시지 띄우기
req, res 타입 지정
tsconfig.json 수정 완료
재설치
remove
dist folder 추가
remove dist
rename
update app.ts
There was a problem hiding this comment.
Pull Request Overview
Sprint 08 backend implementation creating a TypeScript/Express API with Prisma ORM for article and comment management. The PR establishes a complete backend infrastructure with database models, API endpoints, and error handling.
- TypeScript configuration and Express server setup with CORS and error handling
- Database schema design with Article and ArticleComment models using PostgreSQL
- RESTful API endpoints for article CRUD operations and comment management
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | TypeScript configuration for ES2020 target with CommonJS modules |
| src/app.ts | Express application setup with CORS, middleware, and error handling |
| src/routes/ | Route controllers and service layers for article and comment operations |
| src/utils/requestHandler.ts | Higher-order function for async error handling |
| src/middlewares/index.ts | Error handling middleware for Prisma and validation errors |
| prisma/ | Database schema, migrations, and seed data for articles and comments |
| package.json | Dependencies including Prisma, Express, and TypeScript tooling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| const { id } = req.params; | ||
| const { content } = req.body; | ||
|
|
||
| console.log("id: ", id, "content: ", content); |
There was a problem hiding this comment.
This console.log statement should be removed from production code. Consider using a proper logging library or remove it entirely.
| return; | ||
| } | ||
|
|
||
| res.status(203).send(updatedArticle); |
There was a problem hiding this comment.
HTTP status code 203 (Non-Authoritative Information) is incorrect for successful updates. Use 200 (OK) instead.
| res.status(203).send(updatedArticle); | |
| res.status(200).send(updatedArticle); |
| where: { id }, | ||
| }); | ||
|
|
||
| res.status(204).send({ message: "게시글이 삭제되었습니다." }); |
There was a problem hiding this comment.
HTTP status code 204 (No Content) should not include a response body. Either use 200 with the message or use 204 without any body.
| res.status(204).send({ message: "게시글이 삭제되었습니다." }); | |
| res.status(204).send(); |
| cacheStrategy: { ttl: 60, swr: 30 }, | ||
| }); | ||
|
|
||
| if (!articleList) { |
There was a problem hiding this comment.
This condition will never be true. Prisma's findMany() returns an empty array [], not null/undefined when no records are found. Check articleList.length === 0 instead.
| if (!articleList) { | |
| if (articleList.length === 0) { |
| if (!newArticle) { | ||
| res.status(400).send({ message: "게시글 작성에 실패했습니다." }); | ||
| return; | ||
| } |
There was a problem hiding this comment.
This condition will never be true. Prisma's create() either succeeds and returns the created object or throws an error. This null check is unnecessary and unreachable.
| if (!newArticle) { | |
| res.status(400).send({ message: "게시글 작성에 실패했습니다." }); | |
| return; | |
| } |
| if (!updatedArticle) { | ||
| res.status(400).send({ message: "게시글 수정에 실패했습니다." }); | ||
| return; | ||
| } | ||
|
|
There was a problem hiding this comment.
This condition will never be true. Prisma's update() either succeeds and returns the updated object or throws an error. This null check is unnecessary and unreachable.
| if (!updatedArticle) { | |
| res.status(400).send({ message: "게시글 수정에 실패했습니다." }); | |
| return; | |
| } |
Sprint mission08 backend
요구사항
기본
심화
주요 변경사항
스크린샷
멘토에게