Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hellol77 committed Oct 1, 2024
1 parent 78c40a9 commit d8bece6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion backend/src/configs/typeorm.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}
}
7 changes: 5 additions & 2 deletions backend/src/game/game.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ export class GameService {
page: number;
limit: number;
}): Promise<GameUnitDto[]> {
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
.createQueryBuilder('game')
.leftJoinAndSelect('game.items', 'item')
.orderBy('game.created_at', 'DESC')
.skip(offset)
.take(limit)
.take(validLimit)
.getMany();

return games.map((game) => {
Expand Down
1 change: 1 addition & 0 deletions backend/src/item/item.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class ItemController {
): Promise<CommentDto[]> {
const token = req.cookies['accessToken']; // 쿠키에서 accessToken 읽기
let userId: string | null = null;

if (token) {
try {
const decoded = this.jwtService.verify(token, {
Expand Down
1 change: 0 additions & 1 deletion backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/comments/comment/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
7 changes: 0 additions & 7 deletions frontend/src/pages/LoginPage/LoginPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<S.LoginText>로그인 시 댓글 작성과 밸런스게임 제작이 가능합니다</S.LoginText>
<S.Kakaologin>
<S.KakaoImage src={KakaoImage} alt="kakao image" onClick={handleKakaoRedirect} />
<div onClick={handleCreateUser}></div>
</S.Kakaologin>
</>
);
Expand Down

0 comments on commit d8bece6

Please sign in to comment.