diff --git a/backend/src/configs/typeorm.config.ts b/backend/src/configs/typeorm.config.ts index b57d47c..8b69555 100644 --- a/backend/src/configs/typeorm.config.ts +++ b/backend/src/configs/typeorm.config.ts @@ -13,7 +13,7 @@ export class typeORMConfig implements TypeOrmOptionsFactory { database: process.env.TYPEORM_DATABASE, timezone: '+09:00', entities: [__dirname + '/../**/*.entity.{js,ts}'], - synchronize: true, + synchronize: false, }; } } diff --git a/backend/src/game/game.service.ts b/backend/src/game/game.service.ts index c59d111..9074f0e 100644 --- a/backend/src/game/game.service.ts +++ b/backend/src/game/game.service.ts @@ -31,7 +31,10 @@ export class GameService { page: number; limit: number; }): Promise { - const offset = page * limit; + // page와 limit이 음수가 되지 않도록 보정 + const validPage = Math.max(0, page); + const validLimit = Math.max(1, limit); // 최소 1개의 항목이 반환되도록 보정 + const offset = validPage * validLimit; // Game과 관련된 Item들을 JOIN const games = await this.gamesRepository @@ -39,7 +42,7 @@ export class GameService { .leftJoinAndSelect('game.items', 'item') .orderBy('game.created_at', 'DESC') .skip(offset) - .take(limit) + .take(validLimit) .getMany(); return games.map((game) => { diff --git a/backend/src/item/item.controller.ts b/backend/src/item/item.controller.ts index 609645d..8f94d32 100644 --- a/backend/src/item/item.controller.ts +++ b/backend/src/item/item.controller.ts @@ -68,6 +68,7 @@ export class ItemController { ): Promise { const token = req.cookies['accessToken']; // 쿠키에서 accessToken 읽기 let userId: string | null = null; + if (token) { try { const decoded = this.jwtService.verify(token, { diff --git a/backend/src/main.ts b/backend/src/main.ts index f4afe0d..21b3e89 100644 --- a/backend/src/main.ts +++ b/backend/src/main.ts @@ -9,7 +9,6 @@ async function bootstrap() { const port = process.env.PORT || 80; const app = await NestFactory.create(AppModule); app.enableCors({ - origin: true, methods: 'GET,HEAD,PUT,PATCH,POST,DELETE,OPTIONS', credentials: true, }); diff --git a/frontend/src/components/comments/comment/Comment.jsx b/frontend/src/components/comments/comment/Comment.jsx index 3a4bee5..a593ede 100644 --- a/frontend/src/components/comments/comment/Comment.jsx +++ b/frontend/src/components/comments/comment/Comment.jsx @@ -10,6 +10,7 @@ export default function Comment(props) { const { mutate: bestCommentLikeMutate } = useBestCommentLike(props.commentId, props.itemId); const { mutate: commentLikeMutate } = useCommentLike(props.commentId, props.itemId); const { mutate: deleteCommentMutate } = useDeleteComment(props.commentId, props.itemId); + const handleClick = () => { if (props.isBest) { bestCommentLikeMutate({ isHeart: props.isHeart }); diff --git a/frontend/src/pages/LoginPage/LoginPage.jsx b/frontend/src/pages/LoginPage/LoginPage.jsx index 645ef3c..772d9a9 100644 --- a/frontend/src/pages/LoginPage/LoginPage.jsx +++ b/frontend/src/pages/LoginPage/LoginPage.jsx @@ -8,18 +8,11 @@ export default function LoginPage() { }&redirect_uri=${import.meta.env.VITE_KAKAO_REDIRECT_URI}`; }; - const handleCreateUser = () => { - fetch('http://localhost/user/create', { - method: 'POST', - credentials: 'include', - }); - }; return ( <> 로그인 시 댓글 작성과 밸런스게임 제작이 가능합니다 -
);