From 07f6295f865691d70fad402a2a86cc496f2fc24d Mon Sep 17 00:00:00 2001 From: rkdgusdnr99 <112935900+rkdgusdnr99@users.noreply.github.com> Date: Tue, 28 May 2024 21:45:35 +0900 Subject: [PATCH 01/10] =?UTF-8?q?=EB=A0=88=EC=8B=9C=ED=94=BC=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=ED=8C=90=20=EC=97=B0=EB=8F=99=20=20*=20=EC=9E=90?= =?UTF-8?q?=EC=8B=A0=EC=9D=98=20=EB=A0=88=EC=8B=9C=ED=94=BC=EB=A7=8C=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=20=EA=B0=80=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/hello/aimju/controller/RecipeController.java | 4 ++-- .../java/hello/aimju/recipe/service/RecipeService.java | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/hello/aimju/controller/RecipeController.java b/backend/src/main/java/hello/aimju/controller/RecipeController.java index 0f43331a..4f6cf8a0 100644 --- a/backend/src/main/java/hello/aimju/controller/RecipeController.java +++ b/backend/src/main/java/hello/aimju/controller/RecipeController.java @@ -35,8 +35,8 @@ public List getRecipes(HttpSession session) { } @RequestMapping(value = "/recipe/{recipeId}", method = RequestMethod.GET) - public GetRecipeResponseDto getRecipeDetails(@PathVariable("recipeId") Long recipeId) { - GetRecipeResponseDto recipeDetails = recipeService.getRecipeDetails(recipeId); + public GetRecipeResponseDto getRecipeDetails(@PathVariable("recipeId") Long recipeId ,HttpSession session) { + GetRecipeResponseDto recipeDetails = recipeService.getRecipeDetails(recipeId, session); return recipeDetails; } diff --git a/backend/src/main/java/hello/aimju/recipe/service/RecipeService.java b/backend/src/main/java/hello/aimju/recipe/service/RecipeService.java index 95979231..9faea5a3 100644 --- a/backend/src/main/java/hello/aimju/recipe/service/RecipeService.java +++ b/backend/src/main/java/hello/aimju/recipe/service/RecipeService.java @@ -109,10 +109,13 @@ public List getAllRecipes(HttpSession session) { return responseDtoList; } - public GetRecipeResponseDto getRecipeDetails(Long recipeId) { + public GetRecipeResponseDto getRecipeDetails(Long recipeId, HttpSession session) { + User user = getUserFromSession(session); Recipe recipe = recipeRepository.findById(recipeId) .orElseThrow(() -> new IllegalArgumentException("레시피를 찾을 수 없습니다. ID: " + recipeId)); - + if (!Objects.equals(user.getId(), recipe.getUser().getId())){ + throw new IllegalArgumentException("접근 권한이 없습니다"); + } GetRecipeResponseDto responseDto = new GetRecipeResponseDto(); responseDto.setRecipeId(recipeId); responseDto.setMenu(recipe.getMenu()); From bfbafc8ab06a8d5686cca821cddcf1283f5962a1 Mon Sep 17 00:00:00 2001 From: rkdgusdnr99 <112935900+rkdgusdnr99@users.noreply.github.com> Date: Tue, 28 May 2024 21:47:23 +0900 Subject: [PATCH 02/10] =?UTF-8?q?Board=20Table=20=EC=88=98=EC=A0=95=20=20*?= =?UTF-8?q?=20content:=20varChar=20->=20Text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/hello/aimju/Board/domain/Board.java | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/src/main/java/hello/aimju/Board/domain/Board.java b/backend/src/main/java/hello/aimju/Board/domain/Board.java index 022f5eb5..59fb9a89 100644 --- a/backend/src/main/java/hello/aimju/Board/domain/Board.java +++ b/backend/src/main/java/hello/aimju/Board/domain/Board.java @@ -22,6 +22,7 @@ public class Board { private Long id; private String title; private LocalDate createdTime = LocalDate.now(); + @Column(columnDefinition = "TEXT") private String content; @OneToMany(mappedBy = "board",cascade = CascadeType.ALL) private List comments = new ArrayList<>(); From 48f1ffd890f9aec4ad9d39f41d57f503224a67d9 Mon Sep 17 00:00:00 2001 From: rkdgusdnr99 <112935900+rkdgusdnr99@users.noreply.github.com> Date: Tue, 28 May 2024 21:48:28 +0900 Subject: [PATCH 03/10] =?UTF-8?q?content=20=EC=A4=84=EB=A7=9E=EC=B6=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/app/boards/[boardId]/page.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/src/app/boards/[boardId]/page.tsx b/frontend/src/app/boards/[boardId]/page.tsx index 9b396000..fd635317 100755 --- a/frontend/src/app/boards/[boardId]/page.tsx +++ b/frontend/src/app/boards/[boardId]/page.tsx @@ -154,9 +154,7 @@ export default function BoardDetail({params}: {params: {boardId: string}}) {

{title}

-

- {content} -

+
')}}/>

From 9266b5ab291187717668a3b27d30799b1dd2be36 Mon Sep 17 00:00:00 2001 From: rkdgusdnr99 <112935900+rkdgusdnr99@users.noreply.github.com> Date: Tue, 28 May 2024 21:49:28 +0900 Subject: [PATCH 04/10] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=ED=94=BC=20=EC=97=B0=EB=8F=99=20=20*=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=9E=A9=20=ED=8E=98=EC=9D=B4=EC=A7=80:=20=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=EC=93=B0=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/app/scrap/page.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/scrap/page.tsx b/frontend/src/app/scrap/page.tsx index 15ddad00..2f1f5363 100755 --- a/frontend/src/app/scrap/page.tsx +++ b/frontend/src/app/scrap/page.tsx @@ -99,6 +99,10 @@ export default function Scrap() { } }; + const handleRoutingBoards = (recipeId: number) => { + router.push(`/boards/writing/${recipeId}`); + }; + const openModal = (recipeId: number) => { setRecipeToDelete(recipeId); setIsModalOpen(true); @@ -148,8 +152,11 @@ export default function Scrap() { }}> {selectedRecipe && selectedRecipe.recipeId === recipe.recipeId ? "숨기기" : "레시피 보기"} - + )} + From 8b120400d14a212e01e887b40cefdbfda0720f67 Mon Sep 17 00:00:00 2001 From: rkdgusdnr99 <112935900+rkdgusdnr99@users.noreply.github.com> Date: Tue, 28 May 2024 21:50:45 +0900 Subject: [PATCH 05/10] =?UTF-8?q?=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=ED=94=BC=20=EC=97=B0=EB=8F=99=20=20*=20=EA=B2=8C?= =?UTF-8?q?=EC=8B=9C=EA=B8=80=20=EC=9E=91=EC=84=B1=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=B3=80=EA=B2=BD:=20boards/writing=20->=20boards/?= =?UTF-8?q?writing/0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/app/boards/page.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/boards/page.tsx b/frontend/src/app/boards/page.tsx index 6dcc9b76..0fee16aa 100755 --- a/frontend/src/app/boards/page.tsx +++ b/frontend/src/app/boards/page.tsx @@ -20,7 +20,7 @@ To read more about using these font, please visit the Next.js documentation: 'use client' import { Button } from "@/components/ui/button" import Link from "next/link" -import { CardTitle, CardDescription, CardHeader, CardContent, CardFooter, Card } from "@/components/ui/card" +import { CardTitle, CardDescription, CardHeader, CardFooter, Card } from "@/components/ui/card" import {Header} from "@/components/ui/header"; import React, {useEffect, useState} from "react"; import axios from "axios"; @@ -122,7 +122,7 @@ export default function Board() {
- +