-
Notifications
You must be signed in to change notification settings - Fork 15
[김희성] sprint 10 #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The head ref may contain hidden characters: "express-\uAE40\uD76C\uC131-10"
[김희성] sprint 10 #31
Conversation
article Article? @relation(fields: [articleId], references: [id], onDelete: Cascade) | ||
product Product? @relation(fields: [productId], references: [id], onDelete: Cascade) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
userId 도 다른 외래키들과 마찬가지로 index 로 색인을 달아두는 것이 좋겠습니다. 댓글정보를 불러올때 조회성능을 높일 수 있겠습니다.
userId String? | ||
productId String? | ||
id String @id @default(uuid()) | ||
userId String? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
댓글은 로그인을 한 유저만 등록할 수 있기 때문에, userId 는 필수값으로 설정되어야 합니다. productId 와 articleId 는 댓글 모델을 공유하고 있기 때문에 옵셔널로 되어있는 것이 맞습니다.
import multer from "multer"; | ||
import { validateProduct } from "../middlewares/validateProduct.js"; | ||
import asyncHandler from "../middlewares/asyncHandler.js"; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multer 의 경우, 이미지를 저장하려는 경로에 해당하는 폴더가 존재하지 않는 경우, 자동으로 생성해주는 로직이 내장되어 있지 않습니다. 그래서 multer 로 이미지를 서버 내 특정 경로에 저장하는 경우 보통 아래 코드를 먼저 사용합니다.
// uploads 폴더가 없으면 생성
const uploadDir = "uploads/";
if (!fs.existsSync(uploadDir)) {
fs.mkdirSync(uploadDir, { recursive: true });
}
희성님 스프린트 10 수행하시느라 고생하셨습니다! 프로젝트 준비중에도 성실하게 스프린트에 임해주셔서 감사합니다.
|
요구사항
기본
상품 등록
상품 상세
좋아요 기능
에러 처리
라우트 중복 제거
인증
상품 기능 인가
게시글 기능 인가
댓글 기능 인가
심화
인증
주요 변경사항
멘토에게