From c6cfcf273ce961befe347dacfef8f671bf008a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=9A=A9=EC=88=98?= Date: Sun, 15 Sep 2024 22:38:15 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20Image=20=EA=B6=8C=ED=95=9C=EC=B2=B4?= =?UTF-8?q?=ED=81=AC=20=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/image/service/ImageService.java | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/com/worlabel/domain/image/service/ImageService.java b/backend/src/main/java/com/worlabel/domain/image/service/ImageService.java index 1083533..29ad4d5 100644 --- a/backend/src/main/java/com/worlabel/domain/image/service/ImageService.java +++ b/backend/src/main/java/com/worlabel/domain/image/service/ImageService.java @@ -31,7 +31,6 @@ public class ImageService { private final S3UploadService s3UploadService; private final ImageRepository imageRepository; private final FolderRepository folderRepository; - private final ParticipantService participantService; /** * 이미지 리스트 업로드 @@ -50,23 +49,18 @@ public class ImageService { /** * 아이디 기반 이미지 조회 */ + @CheckPrivilege(PrivilegeType.VIEWER) @Transactional(readOnly = true) public ImageResponse getImageById(final Integer projectId, final Integer folderId, final Long imageId, final Integer memberId) { - // 참가에 존재하는지 확인 - participantService.checkViewerUnauthorized(memberId, projectId); - - // 이미지가 해당 프로젝트에 속하는지 확인 - Image image = getImageAndValidateProject(folderId, imageId, projectId); + Image image = getImageAndValidateProject(folderId, imageId, projectId); // 이미지가 해당 프로젝트에 속하는지 확인 return ImageResponse.from(image); } /** * 이미지 폴더 위치 변경 */ + @CheckPrivilege(PrivilegeType.EDITOR) public void moveFolder(final Integer projectId, final Integer folderId, final Integer moveFolderId, final Long imageId, final Integer memberId) { - // 권한이 편집자 이상인지 확인 - participantService.checkEditorUnauthorized(memberId, projectId); - Folder folder = null; if (moveFolderId != null) { folder = getFolder(moveFolderId); @@ -80,10 +74,8 @@ public class ImageService { /** * 이미지 삭제 */ + @CheckPrivilege(PrivilegeType.EDITOR) public void deleteImage(final Integer projectId, final Integer folderId, final Long imageId, final Integer memberId) { - // 권한이 편집자 이상인지 확인 - participantService.checkEditorUnauthorized(memberId, projectId); - // 이미지가 해당 프로젝트에 속하는지 확인 Image image = getImageAndValidateProject(folderId, imageId, projectId); @@ -94,10 +86,8 @@ public class ImageService { /** * 이미지 상태 변경 */ + @CheckPrivilege(PrivilegeType.VIEWER) public ImageResponse changeImageStatus(final Integer projectId, final Integer folderId, final Long imageId, final Integer memberId, final ImageStatusRequest imageStatusRequest) { - // 참가에 존재하는지 확인 - participantService.checkViewerUnauthorized(memberId, projectId); - // 이미지가 해당 프로젝트에 속하는지 확인 Image image = getImageAndValidateProject(folderId, imageId, projectId);