From 5f0ce622daeebf7ec92fc5652618f0ce0ea21347 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:07 +0900 Subject: [PATCH 01/83] =?UTF-8?q?fix:=20Agenda=EC=99=80=20Member=20?= =?UTF-8?q?=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/entity/Agenda.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index c7b76d3..60495fb 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,16 +1,9 @@ package com.umc.naoman.domain.agenda.entity; +import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -35,4 +28,7 @@ public class Agenda extends BaseTimeEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "share_group_id") private ShareGroup shareGroup; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; } From e8fe87a3666889de5aab26aedf7f28019147bc3e Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 02/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/code/AgendaErrorCode.java | 16 ++++++++++++++++ .../global/error/code/PhotoErrorCode.java | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java create mode 100644 src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java new file mode 100644 index 0000000..5f29d41 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -0,0 +1,16 @@ +package com.umc.naoman.global.error.code; + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaErrorCode implements ErrorCode { + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java new file mode 100644 index 0000000..00acda8 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java @@ -0,0 +1,17 @@ +package com.umc.naoman.global.error.code; + + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum PhotoErrorCode implements ErrorCode { + PHOTO_NOT_FOUND_BY_PHOTO_ID(404, "EP001", "해당 photoId를 가진 사진이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} From 3c2b7793b7041d446b96d354605a1b91171c898d Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 03/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 68cb0a21d243b06b98fc8dff41fd03dd6f132c95 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:55 +0900 Subject: [PATCH 04/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=84=B1=EA=B3=B5=20resultCode=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/result/code/AgendaResultCode.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java diff --git a/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java new file mode 100644 index 0000000..b19acd2 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java @@ -0,0 +1,15 @@ +package com.umc.naoman.global.result.code; + +import com.umc.naoman.global.result.ResultCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaResultCode implements ResultCode { + CREATE_AGENDA(200, "SA001", "새로운 안건을 성공적으로 생성하였습니다."), + ; + private final int status; + private final String code; + private final String message; +} From bcf43251e30de472348c12bf82ec068042624ea9 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:15:04 +0900 Subject: [PATCH 05/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agenda/controller/AgendaController.java | 59 +++++++++++++++++++ .../agenda/converter/AgendaConverter.java | 24 ++++++++ .../converter/AgendaPhotoConverter.java | 15 +++++ .../domain/agenda/dto/AgendaRequest.java | 26 ++++++++ .../domain/agenda/dto/AgendaResponse.java | 18 ++++++ .../repository/AgendaPhotoRepository.java | 9 +++ .../agenda/repository/AgendaRepository.java | 12 ++++ .../agenda/service/AgendaPhotoService.java | 9 +++ .../service/AgendaPhotoServiceImpl.java | 33 +++++++++++ .../domain/agenda/service/AgendaService.java | 10 ++++ .../agenda/service/AgendaServiceImpl.java | 36 +++++++++++ 11 files changed, 251 insertions(+) create mode 100644 src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java new file mode 100644 index 0000000..10791f4 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -0,0 +1,59 @@ +package com.umc.naoman.domain.agenda.controller; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.service.AgendaPhotoService; +import com.umc.naoman.domain.agenda.service.AgendaService; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.global.error.ErrorResponse; +import com.umc.naoman.global.result.ResultResponse; +import com.umc.naoman.global.result.code.AgendaResultCode; +import com.umc.naoman.global.security.annotation.LoginMember; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@Slf4j +public class AgendaController { + + private final AgendaService agendaService; + private final AgendaPhotoService agendaPhotoService; + + @PostMapping("/agendas") + @Operation(summary = "안건 생성 API", description = "[request]\n shareGroupId, title, 안건에 올릴 PhotoId 리스트" + + "\n[response]\n 생성된 안건의 agendaId, 생성시간 createdAt") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SA001",description = "안건 생성 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG005",description = "해당 shareGroupId를 가진 그룹이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EP001",description = "해당 phtoId를 가진 사진이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + }) + @Parameters(value = { + @Parameter(name = "shareGroupId",description = "안건이 생성되는 공유그룹의 Id"), + @Parameter(name = "title",description = "안건의 제목"), + @Parameter(name = "agendasPhotoList",description = "안건에 올릴 사진의 photoId 리스트") + }) + public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, + @LoginMember Member member) { + Long shareGroupId = request.getShareGroupId(); + String title = request.getTitle(); + Agenda agenda = agendaService.createAgenda(member,shareGroupId, title); + agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); + return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); + } +} + diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java new file mode 100644 index 0000000..1793889 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -0,0 +1,24 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; + +public class AgendaConverter { + + public static AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ + return AgendaResponse.CreateAgenda.builder() + .agendaId(agenda.getId()) + .createdAt(agenda.getCreatedAt()) + .build(); + } + + public static Agenda toAgenda(Member member, String title, ShareGroup shareGroup){ + return Agenda.builder() + .member(member) + .title(title) + .shareGroup(shareGroup) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java new file mode 100644 index 0000000..6282550 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java @@ -0,0 +1,15 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import com.umc.naoman.domain.photo.entity.Photo; + +public class AgendaPhotoConverter { + + public static AgendaPhoto toAgendaPhoto(Agenda agenda, Photo photo) { + return AgendaPhoto.builder() + .agenda(agenda) + .photo(photo) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java new file mode 100644 index 0000000..d9d14b6 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java @@ -0,0 +1,26 @@ +package com.umc.naoman.domain.agenda.dto; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +public abstract class AgendaRequest { + + @Builder + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class CreateAgendaRequest { + @NotNull + private Long shareGroupId; + @NotNull + private String title; + @Size(min = 2, max = 6) + private List agendasPhotoList; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java new file mode 100644 index 0000000..56d09b3 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -0,0 +1,18 @@ +package com.umc.naoman.domain.agenda.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +import java.time.LocalDateTime; + +public abstract class AgendaResponse { + + @Builder + @Getter + @AllArgsConstructor + public static class CreateAgenda { + Long agendaId; + LocalDateTime createdAt; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java new file mode 100644 index 0000000..8c29521 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AgendaPhotoRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java new file mode 100644 index 0000000..3d1fbfb --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java @@ -0,0 +1,12 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface AgendaRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java new file mode 100644 index 0000000..da411de --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; + +import java.util.List; + +public interface AgendaPhotoService { + void saveAgendasPhotos(Agenda agenda, List photos); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java new file mode 100644 index 0000000..e432572 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -0,0 +1,33 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaPhotoConverter; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaPhotoRepository; +import com.umc.naoman.domain.photo.entity.Photo; +import com.umc.naoman.domain.photo.repository.PhotoRepository; +import com.umc.naoman.global.error.BusinessException; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static com.umc.naoman.global.error.code.PhotoErrorCode.PHOTO_NOT_FOUND_BY_PHOTO_ID; + +@Service +@RequiredArgsConstructor +public class AgendaPhotoServiceImpl implements AgendaPhotoService { + + private final AgendaPhotoRepository agendaPhotoRepository; + private final PhotoRepository photoRepository; + + @Override + @Transactional + public void saveAgendasPhotos(Agenda agenda, List photos) { + for (Long photoId : photos) { + Photo photo = photoRepository.findById(photoId). + orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND_BY_PHOTO_ID)); + agendaPhotoRepository.save(AgendaPhotoConverter.toAgendaPhoto(agenda, photo)); + } + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java new file mode 100644 index 0000000..a6ead9d --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -0,0 +1,10 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; + +public interface AgendaService { + + public Agenda findAgenda(Long agendaId); + public Agenda createAgenda(Member member, Long shareGroupId, String title); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java new file mode 100644 index 0000000..4a86a39 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -0,0 +1,36 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaRepository; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; +import com.umc.naoman.global.error.BusinessException; +import com.umc.naoman.global.error.code.AgendaErrorCode; +import com.umc.naoman.global.error.code.ShareGroupErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class AgendaServiceImpl implements AgendaService { + + private final AgendaRepository agendaRepository; + private final ShareGroupRepository shareGroupRepository; + + @Override + public Agenda findAgenda(Long agendaId) { + return agendaRepository.findById(agendaId) + .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); + } + + @Override + public Agenda createAgenda(Member member, Long shareGroupId, String title) { + ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) + .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); + Agenda newAgenda = AgendaConverter.toAgenda(member,title,shareGroup); + return agendaRepository.save(newAgenda); + } +} From 37543e6aa3269609929644ca1dd50c6a049395f1 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:30:39 +0900 Subject: [PATCH 06/83] =?UTF-8?q?fix:=20@Transactional=20=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index 4a86a39..ec7622a 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -1,7 +1,6 @@ package com.umc.naoman.domain.agenda.service; import com.umc.naoman.domain.agenda.converter.AgendaConverter; -import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.member.entity.Member; @@ -12,6 +11,7 @@ import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @@ -21,12 +21,14 @@ public class AgendaServiceImpl implements AgendaService { private final ShareGroupRepository shareGroupRepository; @Override + @Transactional(readOnly = true) public Agenda findAgenda(Long agendaId) { return agendaRepository.findById(agendaId) .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); } @Override + @Transactional public Agenda createAgenda(Member member, Long shareGroupId, String title) { ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); From f61f0f411be68b69a648c9f07b07133ee51acf7d Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:07 +0900 Subject: [PATCH 07/83] =?UTF-8?q?fix:=20Agenda=EC=99=80=20Member=20?= =?UTF-8?q?=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/entity/Agenda.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index c7b76d3..60495fb 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,16 +1,9 @@ package com.umc.naoman.domain.agenda.entity; +import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -35,4 +28,7 @@ public class Agenda extends BaseTimeEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "share_group_id") private ShareGroup shareGroup; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; } From 9b5f209237fcad2c2c9050dcbf148fc44f61969b Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 08/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/code/AgendaErrorCode.java | 16 ++++++++++++++++ .../global/error/code/PhotoErrorCode.java | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java create mode 100644 src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java new file mode 100644 index 0000000..5f29d41 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -0,0 +1,16 @@ +package com.umc.naoman.global.error.code; + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaErrorCode implements ErrorCode { + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java new file mode 100644 index 0000000..00acda8 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java @@ -0,0 +1,17 @@ +package com.umc.naoman.global.error.code; + + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum PhotoErrorCode implements ErrorCode { + PHOTO_NOT_FOUND_BY_PHOTO_ID(404, "EP001", "해당 photoId를 가진 사진이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} From 8c8ecac5661841b29cd22495d65ea7942cca9e33 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 09/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From c3b5ab0207bee4e8a88fb8f536026b042dc92f56 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:55 +0900 Subject: [PATCH 10/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=84=B1=EA=B3=B5=20resultCode=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/result/code/AgendaResultCode.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java diff --git a/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java new file mode 100644 index 0000000..b19acd2 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java @@ -0,0 +1,15 @@ +package com.umc.naoman.global.result.code; + +import com.umc.naoman.global.result.ResultCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaResultCode implements ResultCode { + CREATE_AGENDA(200, "SA001", "새로운 안건을 성공적으로 생성하였습니다."), + ; + private final int status; + private final String code; + private final String message; +} From 8bd6c7bac9260f745d753c48fdc3fe5c943c39a5 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:15:04 +0900 Subject: [PATCH 11/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agenda/controller/AgendaController.java | 59 +++++++++++++++++++ .../agenda/converter/AgendaConverter.java | 24 ++++++++ .../converter/AgendaPhotoConverter.java | 15 +++++ .../domain/agenda/dto/AgendaRequest.java | 26 ++++++++ .../domain/agenda/dto/AgendaResponse.java | 18 ++++++ .../repository/AgendaPhotoRepository.java | 9 +++ .../agenda/repository/AgendaRepository.java | 12 ++++ .../agenda/service/AgendaPhotoService.java | 9 +++ .../service/AgendaPhotoServiceImpl.java | 33 +++++++++++ .../domain/agenda/service/AgendaService.java | 10 ++++ .../agenda/service/AgendaServiceImpl.java | 36 +++++++++++ 11 files changed, 251 insertions(+) create mode 100644 src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java new file mode 100644 index 0000000..10791f4 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -0,0 +1,59 @@ +package com.umc.naoman.domain.agenda.controller; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.service.AgendaPhotoService; +import com.umc.naoman.domain.agenda.service.AgendaService; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.global.error.ErrorResponse; +import com.umc.naoman.global.result.ResultResponse; +import com.umc.naoman.global.result.code.AgendaResultCode; +import com.umc.naoman.global.security.annotation.LoginMember; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@Slf4j +public class AgendaController { + + private final AgendaService agendaService; + private final AgendaPhotoService agendaPhotoService; + + @PostMapping("/agendas") + @Operation(summary = "안건 생성 API", description = "[request]\n shareGroupId, title, 안건에 올릴 PhotoId 리스트" + + "\n[response]\n 생성된 안건의 agendaId, 생성시간 createdAt") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SA001",description = "안건 생성 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG005",description = "해당 shareGroupId를 가진 그룹이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EP001",description = "해당 phtoId를 가진 사진이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + }) + @Parameters(value = { + @Parameter(name = "shareGroupId",description = "안건이 생성되는 공유그룹의 Id"), + @Parameter(name = "title",description = "안건의 제목"), + @Parameter(name = "agendasPhotoList",description = "안건에 올릴 사진의 photoId 리스트") + }) + public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, + @LoginMember Member member) { + Long shareGroupId = request.getShareGroupId(); + String title = request.getTitle(); + Agenda agenda = agendaService.createAgenda(member,shareGroupId, title); + agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); + return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); + } +} + diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java new file mode 100644 index 0000000..1793889 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -0,0 +1,24 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; + +public class AgendaConverter { + + public static AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ + return AgendaResponse.CreateAgenda.builder() + .agendaId(agenda.getId()) + .createdAt(agenda.getCreatedAt()) + .build(); + } + + public static Agenda toAgenda(Member member, String title, ShareGroup shareGroup){ + return Agenda.builder() + .member(member) + .title(title) + .shareGroup(shareGroup) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java new file mode 100644 index 0000000..6282550 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java @@ -0,0 +1,15 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import com.umc.naoman.domain.photo.entity.Photo; + +public class AgendaPhotoConverter { + + public static AgendaPhoto toAgendaPhoto(Agenda agenda, Photo photo) { + return AgendaPhoto.builder() + .agenda(agenda) + .photo(photo) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java new file mode 100644 index 0000000..d9d14b6 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java @@ -0,0 +1,26 @@ +package com.umc.naoman.domain.agenda.dto; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +public abstract class AgendaRequest { + + @Builder + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class CreateAgendaRequest { + @NotNull + private Long shareGroupId; + @NotNull + private String title; + @Size(min = 2, max = 6) + private List agendasPhotoList; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java new file mode 100644 index 0000000..56d09b3 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -0,0 +1,18 @@ +package com.umc.naoman.domain.agenda.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +import java.time.LocalDateTime; + +public abstract class AgendaResponse { + + @Builder + @Getter + @AllArgsConstructor + public static class CreateAgenda { + Long agendaId; + LocalDateTime createdAt; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java new file mode 100644 index 0000000..8c29521 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AgendaPhotoRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java new file mode 100644 index 0000000..3d1fbfb --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java @@ -0,0 +1,12 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface AgendaRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java new file mode 100644 index 0000000..da411de --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; + +import java.util.List; + +public interface AgendaPhotoService { + void saveAgendasPhotos(Agenda agenda, List photos); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java new file mode 100644 index 0000000..e432572 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -0,0 +1,33 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaPhotoConverter; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaPhotoRepository; +import com.umc.naoman.domain.photo.entity.Photo; +import com.umc.naoman.domain.photo.repository.PhotoRepository; +import com.umc.naoman.global.error.BusinessException; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static com.umc.naoman.global.error.code.PhotoErrorCode.PHOTO_NOT_FOUND_BY_PHOTO_ID; + +@Service +@RequiredArgsConstructor +public class AgendaPhotoServiceImpl implements AgendaPhotoService { + + private final AgendaPhotoRepository agendaPhotoRepository; + private final PhotoRepository photoRepository; + + @Override + @Transactional + public void saveAgendasPhotos(Agenda agenda, List photos) { + for (Long photoId : photos) { + Photo photo = photoRepository.findById(photoId). + orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND_BY_PHOTO_ID)); + agendaPhotoRepository.save(AgendaPhotoConverter.toAgendaPhoto(agenda, photo)); + } + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java new file mode 100644 index 0000000..a6ead9d --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -0,0 +1,10 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; + +public interface AgendaService { + + public Agenda findAgenda(Long agendaId); + public Agenda createAgenda(Member member, Long shareGroupId, String title); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java new file mode 100644 index 0000000..4a86a39 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -0,0 +1,36 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaRepository; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; +import com.umc.naoman.global.error.BusinessException; +import com.umc.naoman.global.error.code.AgendaErrorCode; +import com.umc.naoman.global.error.code.ShareGroupErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class AgendaServiceImpl implements AgendaService { + + private final AgendaRepository agendaRepository; + private final ShareGroupRepository shareGroupRepository; + + @Override + public Agenda findAgenda(Long agendaId) { + return agendaRepository.findById(agendaId) + .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); + } + + @Override + public Agenda createAgenda(Member member, Long shareGroupId, String title) { + ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) + .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); + Agenda newAgenda = AgendaConverter.toAgenda(member,title,shareGroup); + return agendaRepository.save(newAgenda); + } +} From cbdb687295c8698e20743383edae1feff76683c4 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:30:39 +0900 Subject: [PATCH 12/83] =?UTF-8?q?fix:=20@Transactional=20=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index 4a86a39..ec7622a 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -1,7 +1,6 @@ package com.umc.naoman.domain.agenda.service; import com.umc.naoman.domain.agenda.converter.AgendaConverter; -import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.member.entity.Member; @@ -12,6 +11,7 @@ import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @@ -21,12 +21,14 @@ public class AgendaServiceImpl implements AgendaService { private final ShareGroupRepository shareGroupRepository; @Override + @Transactional(readOnly = true) public Agenda findAgenda(Long agendaId) { return agendaRepository.findById(agendaId) .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); } @Override + @Transactional public Agenda createAgenda(Member member, Long shareGroupId, String title) { ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); From 265e4d3633d1d1ddccabe42c096760b29061c167 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Thu, 1 Aug 2024 17:49:05 +0900 Subject: [PATCH 13/83] =?UTF-8?q?fix:=20Member=20=EC=97=B0=EA=B4=80?= =?UTF-8?q?=EA=B4=80=EA=B3=84=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20Profile?= =?UTF-8?q?=20=EC=97=B0=EA=B4=80=EA=B3=BC=EA=B3=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 60495fb..55b7f8d 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,6 +1,7 @@ package com.umc.naoman.domain.agenda.entity; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; import jakarta.persistence.*; @@ -30,5 +31,5 @@ public class Agenda extends BaseTimeEntity { private ShareGroup shareGroup; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id") - private Member member; + private Profile profile; } From a4e61928393359635dfeb760d6c8a4dede274cb0 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:07 +0900 Subject: [PATCH 14/83] =?UTF-8?q?fix:=20Agenda=EC=99=80=20Member=20?= =?UTF-8?q?=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/entity/Agenda.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index c7b76d3..60495fb 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,16 +1,9 @@ package com.umc.naoman.domain.agenda.entity; +import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -35,4 +28,7 @@ public class Agenda extends BaseTimeEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "share_group_id") private ShareGroup shareGroup; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; } From f921639a088eddcfe5520ad1ec26b5beb3764e18 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 15/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/code/AgendaErrorCode.java | 16 ++++++++++++++++ .../global/error/code/PhotoErrorCode.java | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java create mode 100644 src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java new file mode 100644 index 0000000..5f29d41 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -0,0 +1,16 @@ +package com.umc.naoman.global.error.code; + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaErrorCode implements ErrorCode { + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java new file mode 100644 index 0000000..00acda8 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java @@ -0,0 +1,17 @@ +package com.umc.naoman.global.error.code; + + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum PhotoErrorCode implements ErrorCode { + PHOTO_NOT_FOUND_BY_PHOTO_ID(404, "EP001", "해당 photoId를 가진 사진이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} From 96bc3345ed05b330ded70d87217f9568491ff003 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 16/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 5e059c86b60607776fe215bad76ebcda4228b485 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:55 +0900 Subject: [PATCH 17/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=84=B1=EA=B3=B5=20resultCode=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/result/code/AgendaResultCode.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java diff --git a/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java new file mode 100644 index 0000000..b19acd2 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java @@ -0,0 +1,15 @@ +package com.umc.naoman.global.result.code; + +import com.umc.naoman.global.result.ResultCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaResultCode implements ResultCode { + CREATE_AGENDA(200, "SA001", "새로운 안건을 성공적으로 생성하였습니다."), + ; + private final int status; + private final String code; + private final String message; +} From 05dd806cdb4ee682df2170af235105635521814a Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:15:04 +0900 Subject: [PATCH 18/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agenda/controller/AgendaController.java | 59 +++++++++++++++++++ .../agenda/converter/AgendaConverter.java | 24 ++++++++ .../converter/AgendaPhotoConverter.java | 15 +++++ .../domain/agenda/dto/AgendaRequest.java | 26 ++++++++ .../domain/agenda/dto/AgendaResponse.java | 18 ++++++ .../repository/AgendaPhotoRepository.java | 9 +++ .../agenda/repository/AgendaRepository.java | 12 ++++ .../agenda/service/AgendaPhotoService.java | 9 +++ .../service/AgendaPhotoServiceImpl.java | 33 +++++++++++ .../domain/agenda/service/AgendaService.java | 10 ++++ .../agenda/service/AgendaServiceImpl.java | 36 +++++++++++ 11 files changed, 251 insertions(+) create mode 100644 src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java new file mode 100644 index 0000000..10791f4 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -0,0 +1,59 @@ +package com.umc.naoman.domain.agenda.controller; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.service.AgendaPhotoService; +import com.umc.naoman.domain.agenda.service.AgendaService; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.global.error.ErrorResponse; +import com.umc.naoman.global.result.ResultResponse; +import com.umc.naoman.global.result.code.AgendaResultCode; +import com.umc.naoman.global.security.annotation.LoginMember; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@Slf4j +public class AgendaController { + + private final AgendaService agendaService; + private final AgendaPhotoService agendaPhotoService; + + @PostMapping("/agendas") + @Operation(summary = "안건 생성 API", description = "[request]\n shareGroupId, title, 안건에 올릴 PhotoId 리스트" + + "\n[response]\n 생성된 안건의 agendaId, 생성시간 createdAt") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SA001",description = "안건 생성 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG005",description = "해당 shareGroupId를 가진 그룹이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EP001",description = "해당 phtoId를 가진 사진이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + }) + @Parameters(value = { + @Parameter(name = "shareGroupId",description = "안건이 생성되는 공유그룹의 Id"), + @Parameter(name = "title",description = "안건의 제목"), + @Parameter(name = "agendasPhotoList",description = "안건에 올릴 사진의 photoId 리스트") + }) + public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, + @LoginMember Member member) { + Long shareGroupId = request.getShareGroupId(); + String title = request.getTitle(); + Agenda agenda = agendaService.createAgenda(member,shareGroupId, title); + agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); + return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); + } +} + diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java new file mode 100644 index 0000000..1793889 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -0,0 +1,24 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; + +public class AgendaConverter { + + public static AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ + return AgendaResponse.CreateAgenda.builder() + .agendaId(agenda.getId()) + .createdAt(agenda.getCreatedAt()) + .build(); + } + + public static Agenda toAgenda(Member member, String title, ShareGroup shareGroup){ + return Agenda.builder() + .member(member) + .title(title) + .shareGroup(shareGroup) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java new file mode 100644 index 0000000..6282550 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java @@ -0,0 +1,15 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import com.umc.naoman.domain.photo.entity.Photo; + +public class AgendaPhotoConverter { + + public static AgendaPhoto toAgendaPhoto(Agenda agenda, Photo photo) { + return AgendaPhoto.builder() + .agenda(agenda) + .photo(photo) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java new file mode 100644 index 0000000..d9d14b6 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java @@ -0,0 +1,26 @@ +package com.umc.naoman.domain.agenda.dto; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +public abstract class AgendaRequest { + + @Builder + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class CreateAgendaRequest { + @NotNull + private Long shareGroupId; + @NotNull + private String title; + @Size(min = 2, max = 6) + private List agendasPhotoList; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java new file mode 100644 index 0000000..56d09b3 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -0,0 +1,18 @@ +package com.umc.naoman.domain.agenda.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +import java.time.LocalDateTime; + +public abstract class AgendaResponse { + + @Builder + @Getter + @AllArgsConstructor + public static class CreateAgenda { + Long agendaId; + LocalDateTime createdAt; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java new file mode 100644 index 0000000..8c29521 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AgendaPhotoRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java new file mode 100644 index 0000000..3d1fbfb --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java @@ -0,0 +1,12 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface AgendaRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java new file mode 100644 index 0000000..da411de --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; + +import java.util.List; + +public interface AgendaPhotoService { + void saveAgendasPhotos(Agenda agenda, List photos); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java new file mode 100644 index 0000000..e432572 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -0,0 +1,33 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaPhotoConverter; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaPhotoRepository; +import com.umc.naoman.domain.photo.entity.Photo; +import com.umc.naoman.domain.photo.repository.PhotoRepository; +import com.umc.naoman.global.error.BusinessException; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static com.umc.naoman.global.error.code.PhotoErrorCode.PHOTO_NOT_FOUND_BY_PHOTO_ID; + +@Service +@RequiredArgsConstructor +public class AgendaPhotoServiceImpl implements AgendaPhotoService { + + private final AgendaPhotoRepository agendaPhotoRepository; + private final PhotoRepository photoRepository; + + @Override + @Transactional + public void saveAgendasPhotos(Agenda agenda, List photos) { + for (Long photoId : photos) { + Photo photo = photoRepository.findById(photoId). + orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND_BY_PHOTO_ID)); + agendaPhotoRepository.save(AgendaPhotoConverter.toAgendaPhoto(agenda, photo)); + } + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java new file mode 100644 index 0000000..a6ead9d --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -0,0 +1,10 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; + +public interface AgendaService { + + public Agenda findAgenda(Long agendaId); + public Agenda createAgenda(Member member, Long shareGroupId, String title); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java new file mode 100644 index 0000000..4a86a39 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -0,0 +1,36 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaRepository; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; +import com.umc.naoman.global.error.BusinessException; +import com.umc.naoman.global.error.code.AgendaErrorCode; +import com.umc.naoman.global.error.code.ShareGroupErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class AgendaServiceImpl implements AgendaService { + + private final AgendaRepository agendaRepository; + private final ShareGroupRepository shareGroupRepository; + + @Override + public Agenda findAgenda(Long agendaId) { + return agendaRepository.findById(agendaId) + .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); + } + + @Override + public Agenda createAgenda(Member member, Long shareGroupId, String title) { + ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) + .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); + Agenda newAgenda = AgendaConverter.toAgenda(member,title,shareGroup); + return agendaRepository.save(newAgenda); + } +} From 42fc28a09e9d5accedb3697b58281391f5c362e5 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:30:39 +0900 Subject: [PATCH 19/83] =?UTF-8?q?fix:=20@Transactional=20=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index 4a86a39..ec7622a 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -1,7 +1,6 @@ package com.umc.naoman.domain.agenda.service; import com.umc.naoman.domain.agenda.converter.AgendaConverter; -import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.member.entity.Member; @@ -12,6 +11,7 @@ import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @@ -21,12 +21,14 @@ public class AgendaServiceImpl implements AgendaService { private final ShareGroupRepository shareGroupRepository; @Override + @Transactional(readOnly = true) public Agenda findAgenda(Long agendaId) { return agendaRepository.findById(agendaId) .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); } @Override + @Transactional public Agenda createAgenda(Member member, Long shareGroupId, String title) { ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); From a4109b5ef61c5e7e0758db5da5a37583b76b15f0 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 20/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index c14042e..5f29d41 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), ; private final int status; From c508fa9ddaf47c2fb90a900ed58ec942b56ff909 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 21/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 31101104c8dd9b4729a1509983996b4358da4470 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Thu, 1 Aug 2024 17:49:05 +0900 Subject: [PATCH 22/83] =?UTF-8?q?fix:=20Member=20=EC=97=B0=EA=B4=80?= =?UTF-8?q?=EA=B4=80=EA=B3=84=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20Profile?= =?UTF-8?q?=20=EC=97=B0=EA=B4=80=EA=B3=BC=EA=B3=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 60495fb..55b7f8d 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,6 +1,7 @@ package com.umc.naoman.domain.agenda.entity; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; import jakarta.persistence.*; @@ -30,5 +31,5 @@ public class Agenda extends BaseTimeEntity { private ShareGroup shareGroup; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id") - private Member member; + private Profile profile; } From e6cb37c3ecb23d6b4d4aad1c2c32af7290703919 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:07 +0900 Subject: [PATCH 23/83] =?UTF-8?q?fix:=20Agenda=EC=99=80=20Member=20?= =?UTF-8?q?=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/entity/Agenda.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index c7b76d3..60495fb 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,16 +1,9 @@ package com.umc.naoman.domain.agenda.entity; +import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -35,4 +28,7 @@ public class Agenda extends BaseTimeEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "share_group_id") private ShareGroup shareGroup; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; } From b51bde0e2b7202c0959177bcd76632f6e4003ab6 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 24/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/code/AgendaErrorCode.java | 16 ++++++++++++++++ .../global/error/code/PhotoErrorCode.java | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java create mode 100644 src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java new file mode 100644 index 0000000..5f29d41 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -0,0 +1,16 @@ +package com.umc.naoman.global.error.code; + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaErrorCode implements ErrorCode { + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java new file mode 100644 index 0000000..00acda8 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java @@ -0,0 +1,17 @@ +package com.umc.naoman.global.error.code; + + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum PhotoErrorCode implements ErrorCode { + PHOTO_NOT_FOUND_BY_PHOTO_ID(404, "EP001", "해당 photoId를 가진 사진이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} From 7f6ab05d1acc2999414e2bae1b82ceb974a479aa Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 25/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From a0330fc509ff4eefef43c74586fa994b22a89d6f Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:55 +0900 Subject: [PATCH 26/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=84=B1=EA=B3=B5=20resultCode=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/result/code/AgendaResultCode.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java diff --git a/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java new file mode 100644 index 0000000..b19acd2 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java @@ -0,0 +1,15 @@ +package com.umc.naoman.global.result.code; + +import com.umc.naoman.global.result.ResultCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaResultCode implements ResultCode { + CREATE_AGENDA(200, "SA001", "새로운 안건을 성공적으로 생성하였습니다."), + ; + private final int status; + private final String code; + private final String message; +} From 9796bc645ee7b5c6ccbf538020b2ca0d880e04f5 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:15:04 +0900 Subject: [PATCH 27/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agenda/controller/AgendaController.java | 59 +++++++++++++++++++ .../agenda/converter/AgendaConverter.java | 24 ++++++++ .../converter/AgendaPhotoConverter.java | 15 +++++ .../domain/agenda/dto/AgendaRequest.java | 26 ++++++++ .../domain/agenda/dto/AgendaResponse.java | 18 ++++++ .../repository/AgendaPhotoRepository.java | 9 +++ .../agenda/repository/AgendaRepository.java | 12 ++++ .../agenda/service/AgendaPhotoService.java | 9 +++ .../service/AgendaPhotoServiceImpl.java | 33 +++++++++++ .../domain/agenda/service/AgendaService.java | 10 ++++ .../agenda/service/AgendaServiceImpl.java | 36 +++++++++++ 11 files changed, 251 insertions(+) create mode 100644 src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java new file mode 100644 index 0000000..10791f4 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -0,0 +1,59 @@ +package com.umc.naoman.domain.agenda.controller; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.service.AgendaPhotoService; +import com.umc.naoman.domain.agenda.service.AgendaService; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.global.error.ErrorResponse; +import com.umc.naoman.global.result.ResultResponse; +import com.umc.naoman.global.result.code.AgendaResultCode; +import com.umc.naoman.global.security.annotation.LoginMember; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@Slf4j +public class AgendaController { + + private final AgendaService agendaService; + private final AgendaPhotoService agendaPhotoService; + + @PostMapping("/agendas") + @Operation(summary = "안건 생성 API", description = "[request]\n shareGroupId, title, 안건에 올릴 PhotoId 리스트" + + "\n[response]\n 생성된 안건의 agendaId, 생성시간 createdAt") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SA001",description = "안건 생성 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG005",description = "해당 shareGroupId를 가진 그룹이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EP001",description = "해당 phtoId를 가진 사진이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + }) + @Parameters(value = { + @Parameter(name = "shareGroupId",description = "안건이 생성되는 공유그룹의 Id"), + @Parameter(name = "title",description = "안건의 제목"), + @Parameter(name = "agendasPhotoList",description = "안건에 올릴 사진의 photoId 리스트") + }) + public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, + @LoginMember Member member) { + Long shareGroupId = request.getShareGroupId(); + String title = request.getTitle(); + Agenda agenda = agendaService.createAgenda(member,shareGroupId, title); + agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); + return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); + } +} + diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java new file mode 100644 index 0000000..1793889 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -0,0 +1,24 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; + +public class AgendaConverter { + + public static AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ + return AgendaResponse.CreateAgenda.builder() + .agendaId(agenda.getId()) + .createdAt(agenda.getCreatedAt()) + .build(); + } + + public static Agenda toAgenda(Member member, String title, ShareGroup shareGroup){ + return Agenda.builder() + .member(member) + .title(title) + .shareGroup(shareGroup) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java new file mode 100644 index 0000000..6282550 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java @@ -0,0 +1,15 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import com.umc.naoman.domain.photo.entity.Photo; + +public class AgendaPhotoConverter { + + public static AgendaPhoto toAgendaPhoto(Agenda agenda, Photo photo) { + return AgendaPhoto.builder() + .agenda(agenda) + .photo(photo) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java new file mode 100644 index 0000000..d9d14b6 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java @@ -0,0 +1,26 @@ +package com.umc.naoman.domain.agenda.dto; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +public abstract class AgendaRequest { + + @Builder + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class CreateAgendaRequest { + @NotNull + private Long shareGroupId; + @NotNull + private String title; + @Size(min = 2, max = 6) + private List agendasPhotoList; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java new file mode 100644 index 0000000..56d09b3 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -0,0 +1,18 @@ +package com.umc.naoman.domain.agenda.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +import java.time.LocalDateTime; + +public abstract class AgendaResponse { + + @Builder + @Getter + @AllArgsConstructor + public static class CreateAgenda { + Long agendaId; + LocalDateTime createdAt; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java new file mode 100644 index 0000000..8c29521 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AgendaPhotoRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java new file mode 100644 index 0000000..3d1fbfb --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java @@ -0,0 +1,12 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface AgendaRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java new file mode 100644 index 0000000..da411de --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; + +import java.util.List; + +public interface AgendaPhotoService { + void saveAgendasPhotos(Agenda agenda, List photos); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java new file mode 100644 index 0000000..e432572 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -0,0 +1,33 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaPhotoConverter; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaPhotoRepository; +import com.umc.naoman.domain.photo.entity.Photo; +import com.umc.naoman.domain.photo.repository.PhotoRepository; +import com.umc.naoman.global.error.BusinessException; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static com.umc.naoman.global.error.code.PhotoErrorCode.PHOTO_NOT_FOUND_BY_PHOTO_ID; + +@Service +@RequiredArgsConstructor +public class AgendaPhotoServiceImpl implements AgendaPhotoService { + + private final AgendaPhotoRepository agendaPhotoRepository; + private final PhotoRepository photoRepository; + + @Override + @Transactional + public void saveAgendasPhotos(Agenda agenda, List photos) { + for (Long photoId : photos) { + Photo photo = photoRepository.findById(photoId). + orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND_BY_PHOTO_ID)); + agendaPhotoRepository.save(AgendaPhotoConverter.toAgendaPhoto(agenda, photo)); + } + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java new file mode 100644 index 0000000..a6ead9d --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -0,0 +1,10 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; + +public interface AgendaService { + + public Agenda findAgenda(Long agendaId); + public Agenda createAgenda(Member member, Long shareGroupId, String title); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java new file mode 100644 index 0000000..4a86a39 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -0,0 +1,36 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaRepository; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; +import com.umc.naoman.global.error.BusinessException; +import com.umc.naoman.global.error.code.AgendaErrorCode; +import com.umc.naoman.global.error.code.ShareGroupErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class AgendaServiceImpl implements AgendaService { + + private final AgendaRepository agendaRepository; + private final ShareGroupRepository shareGroupRepository; + + @Override + public Agenda findAgenda(Long agendaId) { + return agendaRepository.findById(agendaId) + .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); + } + + @Override + public Agenda createAgenda(Member member, Long shareGroupId, String title) { + ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) + .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); + Agenda newAgenda = AgendaConverter.toAgenda(member,title,shareGroup); + return agendaRepository.save(newAgenda); + } +} From d347c94247bb09423a30a0f6a2e26c96546affd3 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:30:39 +0900 Subject: [PATCH 28/83] =?UTF-8?q?fix:=20@Transactional=20=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index 4a86a39..ec7622a 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -1,7 +1,6 @@ package com.umc.naoman.domain.agenda.service; import com.umc.naoman.domain.agenda.converter.AgendaConverter; -import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.member.entity.Member; @@ -12,6 +11,7 @@ import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @@ -21,12 +21,14 @@ public class AgendaServiceImpl implements AgendaService { private final ShareGroupRepository shareGroupRepository; @Override + @Transactional(readOnly = true) public Agenda findAgenda(Long agendaId) { return agendaRepository.findById(agendaId) .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); } @Override + @Transactional public Agenda createAgenda(Member member, Long shareGroupId, String title) { ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); From d637d80687364909594fc5678cab3fce50df40b0 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 29/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index c14042e..5f29d41 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), ; private final int status; From 457a64379f0799f149a488ce53cbc73a303caef7 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 30/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 395209c771906c3693f742fc486993392b2b1460 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Thu, 1 Aug 2024 17:49:05 +0900 Subject: [PATCH 31/83] =?UTF-8?q?fix:=20Member=20=EC=97=B0=EA=B4=80?= =?UTF-8?q?=EA=B4=80=EA=B3=84=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20Profile?= =?UTF-8?q?=20=EC=97=B0=EA=B4=80=EA=B3=BC=EA=B3=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 60495fb..55b7f8d 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,6 +1,7 @@ package com.umc.naoman.domain.agenda.entity; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; import jakarta.persistence.*; @@ -30,5 +31,5 @@ public class Agenda extends BaseTimeEntity { private ShareGroup shareGroup; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id") - private Member member; + private Profile profile; } From 6b1f9d24af83933ed3ec36f275da5fd2af88eb7b Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:07 +0900 Subject: [PATCH 32/83] =?UTF-8?q?fix:=20Agenda=EC=99=80=20Profile=20?= =?UTF-8?q?=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 55b7f8d..9b0a404 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,6 +1,5 @@ package com.umc.naoman.domain.agenda.entity; -import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; @@ -30,6 +29,6 @@ public class Agenda extends BaseTimeEntity { @JoinColumn(name = "share_group_id") private ShareGroup shareGroup; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "member_id") + @JoinColumn(name = "profile_id") private Profile profile; } From ba6a469e4aacf6727629208d1eea68ac446c937b Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 33/83] =?UTF-8?q?feat:=20Agenda=20Errorcode=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 --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index c14042e..5f29d41 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), ; private final int status; From 53d36a13b1b10878e73e7159cb7881ee9e4822a9 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 34/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 9bf6c713a803274f401521319c2b59f196090890 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 35/83] =?UTF-8?q?feat:=20Agenda=20Errorcode=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 --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index c14042e..5f29d41 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), ; private final int status; From a2edcd8cf3c716b414da7027fa22e9f02e43e8d2 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 36/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 6905233a7a55e7e7c576882ae975cde0b38bd10e Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 20:35:14 +0900 Subject: [PATCH 37/83] =?UTF-8?q?feat:=20memberId=EC=99=80=20shareGroupId?= =?UTF-8?q?=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=B4=20=EA=B3=B5=EC=9C=A0?= =?UTF-8?q?=EA=B7=B8=EB=A3=B9=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/shareGroup/service/ShareGroupService.java | 2 +- .../naoman/domain/shareGroup/service/ShareGroupServiceImpl.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java index c33959c..da5f138 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java @@ -16,6 +16,6 @@ public interface ShareGroupService { List findProfileList(Long shareGroupId); ShareGroup joinShareGroup(Long shareGroupId, Long profileId, Member member); Profile findProfile(Long profileId); - Profile findProfile(Long shareGroupId, Long memberID); Page getMyShareGroupList(Member member, Pageable pageable); + Profile findProfile(Long memberId, Long shareGroupId); } diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java index 0cb5129..3e85844 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java @@ -12,6 +12,7 @@ import com.umc.naoman.domain.shareGroup.repository.ProfileRepository; import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; import com.umc.naoman.global.error.BusinessException; +import com.umc.naoman.global.error.code.MemberErrorCode; import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -37,6 +38,7 @@ public class ShareGroupServiceImpl implements ShareGroupService { @Transactional @Override public ShareGroup createShareGroup(ShareGroupRequest.createShareGroupRequest request, Member member) { + // 초대링크를 위한 고유번호 생성 (UUID) String inviteCode = UUID.randomUUID().toString().replace("-", "").toUpperCase(); From bba597394911255b2c9285a6406c3c0ece34e2ec Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 20:36:25 +0900 Subject: [PATCH 38/83] =?UTF-8?q?fix:=20import=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/domain/agenda/entity/Agenda.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 9b0a404..0fd9b9d 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -4,11 +4,7 @@ import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; import jakarta.persistence.*; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; +import lombok.*; import org.hibernate.annotations.SQLRestriction; @Entity From 69f62eaf24c97c39267fe6cd6e5910bd84096746 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 20:38:02 +0900 Subject: [PATCH 39/83] =?UTF-8?q?fix:=20=EC=97=B0=EA=B4=80=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=A5=B8=20=EC=83=88=20=EC=95=88=EA=B1=B4=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20api=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/controller/AgendaController.java | 8 +++++++- .../naoman/domain/agenda/converter/AgendaConverter.java | 7 ++++--- .../umc/naoman/domain/agenda/service/AgendaService.java | 3 ++- .../naoman/domain/agenda/service/AgendaServiceImpl.java | 5 +++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index 10791f4..32a6f3f 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -7,6 +7,8 @@ import com.umc.naoman.domain.agenda.service.AgendaPhotoService; import com.umc.naoman.domain.agenda.service.AgendaService; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; +import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.ErrorResponse; import com.umc.naoman.global.result.ResultResponse; import com.umc.naoman.global.result.code.AgendaResultCode; @@ -31,6 +33,7 @@ public class AgendaController { private final AgendaService agendaService; private final AgendaPhotoService agendaPhotoService; + private final ShareGroupService shareGroupService; @PostMapping("/agendas") @Operation(summary = "안건 생성 API", description = "[request]\n shareGroupId, title, 안건에 올릴 PhotoId 리스트" + @@ -41,6 +44,8 @@ public class AgendaController { content = @Content(schema = @Schema(implementation = ErrorResponse.class))), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EP001",description = "해당 phtoId를 가진 사진이 없습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG006",description = "그룹에 속한 회원의 프로필이 없습니다..", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), }) @Parameters(value = { @Parameter(name = "shareGroupId",description = "안건이 생성되는 공유그룹의 Id"), @@ -51,7 +56,8 @@ public ResultResponse createAgenda(@RequestBody @Va @LoginMember Member member) { Long shareGroupId = request.getShareGroupId(); String title = request.getTitle(); - Agenda agenda = agendaService.createAgenda(member,shareGroupId, title); + Profile profile = shareGroupService.findProfile(member.getId(), shareGroupId); + Agenda agenda = agendaService.createAgenda(profile,shareGroupId, title); agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java index 1793889..f9f3993 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -2,7 +2,7 @@ import com.umc.naoman.domain.agenda.dto.AgendaResponse; import com.umc.naoman.domain.agenda.entity.Agenda; -import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; public class AgendaConverter { @@ -14,11 +14,12 @@ public static AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ .build(); } - public static Agenda toAgenda(Member member, String title, ShareGroup shareGroup){ + public static Agenda toAgenda(Profile profile, String title, ShareGroup shareGroup){ return Agenda.builder() - .member(member) + .profile(profile) .title(title) .shareGroup(shareGroup) .build(); } + } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java index a6ead9d..f2188e7 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -2,9 +2,10 @@ import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; public interface AgendaService { public Agenda findAgenda(Long agendaId); - public Agenda createAgenda(Member member, Long shareGroupId, String title); + public Agenda createAgenda(Profile profile, Long shareGroupId, String title); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index ec7622a..59ef2d7 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -4,6 +4,7 @@ import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; import com.umc.naoman.global.error.BusinessException; @@ -29,10 +30,10 @@ public Agenda findAgenda(Long agendaId) { @Override @Transactional - public Agenda createAgenda(Member member, Long shareGroupId, String title) { + public Agenda createAgenda(Profile profile, Long shareGroupId, String title) { ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); - Agenda newAgenda = AgendaConverter.toAgenda(member,title,shareGroup); + Agenda newAgenda = AgendaConverter.toAgenda(profile,title,shareGroup); return agendaRepository.save(newAgenda); } } From 2facced23b1e1ab9371337dc8e2361e095c4cfc2 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 20:55:26 +0900 Subject: [PATCH 40/83] =?UTF-8?q?fix:=20=EA=B5=AC=ED=98=84=EB=90=9C=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EC=9D=B8?= =?UTF-8?q?=EC=9E=90=20=EC=88=9C=EC=84=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/controller/AgendaController.java | 2 +- .../umc/naoman/domain/shareGroup/service/ShareGroupService.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index 32a6f3f..0ea8906 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -56,7 +56,7 @@ public ResultResponse createAgenda(@RequestBody @Va @LoginMember Member member) { Long shareGroupId = request.getShareGroupId(); String title = request.getTitle(); - Profile profile = shareGroupService.findProfile(member.getId(), shareGroupId); + Profile profile = shareGroupService.findProfile(shareGroupId,member.getId()); Agenda agenda = agendaService.createAgenda(profile,shareGroupId, title); agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java index da5f138..6db9f62 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupService.java @@ -17,5 +17,5 @@ public interface ShareGroupService { ShareGroup joinShareGroup(Long shareGroupId, Long profileId, Member member); Profile findProfile(Long profileId); Page getMyShareGroupList(Member member, Pageable pageable); - Profile findProfile(Long memberId, Long shareGroupId); + Profile findProfile(Long shareGroupId, Long memberId); } From a7fec4a16f04c5c85cfc08d862c6d8d5ecff9411 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 22:02:01 +0900 Subject: [PATCH 41/83] =?UTF-8?q?fix:=20=EC=A0=91=EA=B7=BC=EC=A0=9C?= =?UTF-8?q?=EC=96=B4=EC=9E=90=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java index 56d09b3..0450044 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -12,7 +12,7 @@ public abstract class AgendaResponse { @Getter @AllArgsConstructor public static class CreateAgenda { - Long agendaId; - LocalDateTime createdAt; + private Long agendaId; + private LocalDateTime createdAt; } } From b0f190a6852517bb8790f92f5ddab3441de73560 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 22:02:40 +0900 Subject: [PATCH 42/83] =?UTF-8?q?fix:=20=EC=A0=91=EA=B7=BC=EC=A0=9C?= =?UTF-8?q?=EC=96=B4=EC=9E=90=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/umc/naoman/domain/agenda/service/AgendaService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java index 8340428..2b3dc2e 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -5,6 +5,6 @@ public interface AgendaService { - public Agenda findAgenda(Long agendaId); - public Agenda createAgenda(Profile profile, Long shareGroupId, String title); + Agenda findAgenda(Long agendaId); + Agenda createAgenda(Profile profile, Long shareGroupId, String title); } From 433dbfcfd8b05ad24753e48e8b5b01010e6d4906 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 22:03:35 +0900 Subject: [PATCH 43/83] =?UTF-8?q?fix:=20ShareGroupRepository=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A=EA=B3=A0=20Sha?= =?UTF-8?q?reGroupService=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8A=94?= =?UTF-8?q?=20=EA=B2=83=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/service/AgendaServiceImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index d1bee5b..e90cbf0 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -5,10 +5,9 @@ import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; -import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; +import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.BusinessException; import com.umc.naoman.global.error.code.AgendaErrorCode; -import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -18,7 +17,7 @@ public class AgendaServiceImpl implements AgendaService { private final AgendaRepository agendaRepository; - private final ShareGroupRepository shareGroupRepository; + private final ShareGroupService shareGroupService; @Override @Transactional(readOnly = true) @@ -30,8 +29,7 @@ public Agenda findAgenda(Long agendaId) { @Override @Transactional public Agenda createAgenda(Profile profile, Long shareGroupId, String title) { - ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) - .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); + ShareGroup shareGroup = shareGroupService.findShareGroup(shareGroupId); Agenda newAgenda = AgendaConverter.toAgenda(profile,title,shareGroup); return agendaRepository.save(newAgenda); } From 3ed2fb4a8010cb3f4f8bbf16cba96b46dd1ae9b8 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:07 +0900 Subject: [PATCH 44/83] =?UTF-8?q?fix:=20Agenda=EC=99=80=20Member=20?= =?UTF-8?q?=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/entity/Agenda.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index c7b76d3..60495fb 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,16 +1,9 @@ package com.umc.naoman.domain.agenda.entity; +import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; @@ -35,4 +28,7 @@ public class Agenda extends BaseTimeEntity { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "share_group_id") private ShareGroup shareGroup; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "member_id") + private Member member; } From cd1beb2ab204a00cb85d064e7e0529536eb207f8 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 45/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/code/AgendaErrorCode.java | 16 ++++++++++++++++ .../global/error/code/PhotoErrorCode.java | 17 +++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java create mode 100644 src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java new file mode 100644 index 0000000..5f29d41 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -0,0 +1,16 @@ +package com.umc.naoman.global.error.code; + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaErrorCode implements ErrorCode { + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} diff --git a/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java new file mode 100644 index 0000000..00acda8 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/error/code/PhotoErrorCode.java @@ -0,0 +1,17 @@ +package com.umc.naoman.global.error.code; + + +import com.umc.naoman.global.error.ErrorCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum PhotoErrorCode implements ErrorCode { + PHOTO_NOT_FOUND_BY_PHOTO_ID(404, "EP001", "해당 photoId를 가진 사진이 존재하지 않습니다."), + ; + + private final int status; + private final String code; + private final String message; +} From 5179488708731ceea73578877f9b2e816f628787 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 46/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 196051cf50069ec21d7604ae0d2e83b29f9d67d6 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:55 +0900 Subject: [PATCH 47/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EC=84=B1=EA=B3=B5=20resultCode=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/result/code/AgendaResultCode.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java diff --git a/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java new file mode 100644 index 0000000..b19acd2 --- /dev/null +++ b/src/main/java/com/umc/naoman/global/result/code/AgendaResultCode.java @@ -0,0 +1,15 @@ +package com.umc.naoman.global.result.code; + +import com.umc.naoman.global.result.ResultCode; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum AgendaResultCode implements ResultCode { + CREATE_AGENDA(200, "SA001", "새로운 안건을 성공적으로 생성하였습니다."), + ; + private final int status; + private final String code; + private final String message; +} From db64098f6a3602e2c376a41820f972e87b5e32a8 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:15:04 +0900 Subject: [PATCH 48/83] =?UTF-8?q?feat:=20=EC=83=88=20=EC=95=88=EA=B1=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20API=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agenda/controller/AgendaController.java | 59 +++++++++++++++++++ .../agenda/converter/AgendaConverter.java | 24 ++++++++ .../converter/AgendaPhotoConverter.java | 15 +++++ .../domain/agenda/dto/AgendaRequest.java | 26 ++++++++ .../domain/agenda/dto/AgendaResponse.java | 18 ++++++ .../repository/AgendaPhotoRepository.java | 9 +++ .../agenda/repository/AgendaRepository.java | 12 ++++ .../agenda/service/AgendaPhotoService.java | 9 +++ .../service/AgendaPhotoServiceImpl.java | 33 +++++++++++ .../domain/agenda/service/AgendaService.java | 10 ++++ .../agenda/service/AgendaServiceImpl.java | 36 +++++++++++ 11 files changed, 251 insertions(+) create mode 100644 src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java create mode 100644 src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java new file mode 100644 index 0000000..10791f4 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -0,0 +1,59 @@ +package com.umc.naoman.domain.agenda.controller; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.service.AgendaPhotoService; +import com.umc.naoman.domain.agenda.service.AgendaService; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.global.error.ErrorResponse; +import com.umc.naoman.global.result.ResultResponse; +import com.umc.naoman.global.result.code.AgendaResultCode; +import com.umc.naoman.global.security.annotation.LoginMember; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@Slf4j +public class AgendaController { + + private final AgendaService agendaService; + private final AgendaPhotoService agendaPhotoService; + + @PostMapping("/agendas") + @Operation(summary = "안건 생성 API", description = "[request]\n shareGroupId, title, 안건에 올릴 PhotoId 리스트" + + "\n[response]\n 생성된 안건의 agendaId, 생성시간 createdAt") + @ApiResponses({ + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SA001",description = "안건 생성 성공"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG005",description = "해당 shareGroupId를 가진 그룹이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EP001",description = "해당 phtoId를 가진 사진이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + }) + @Parameters(value = { + @Parameter(name = "shareGroupId",description = "안건이 생성되는 공유그룹의 Id"), + @Parameter(name = "title",description = "안건의 제목"), + @Parameter(name = "agendasPhotoList",description = "안건에 올릴 사진의 photoId 리스트") + }) + public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, + @LoginMember Member member) { + Long shareGroupId = request.getShareGroupId(); + String title = request.getTitle(); + Agenda agenda = agendaService.createAgenda(member,shareGroupId, title); + agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); + return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); + } +} + diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java new file mode 100644 index 0000000..1793889 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -0,0 +1,24 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.dto.AgendaResponse; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; + +public class AgendaConverter { + + public static AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ + return AgendaResponse.CreateAgenda.builder() + .agendaId(agenda.getId()) + .createdAt(agenda.getCreatedAt()) + .build(); + } + + public static Agenda toAgenda(Member member, String title, ShareGroup shareGroup){ + return Agenda.builder() + .member(member) + .title(title) + .shareGroup(shareGroup) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java new file mode 100644 index 0000000..6282550 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java @@ -0,0 +1,15 @@ +package com.umc.naoman.domain.agenda.converter; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import com.umc.naoman.domain.photo.entity.Photo; + +public class AgendaPhotoConverter { + + public static AgendaPhoto toAgendaPhoto(Agenda agenda, Photo photo) { + return AgendaPhoto.builder() + .agenda(agenda) + .photo(photo) + .build(); + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java new file mode 100644 index 0000000..d9d14b6 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java @@ -0,0 +1,26 @@ +package com.umc.naoman.domain.agenda.dto; + +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.List; + +public abstract class AgendaRequest { + + @Builder + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class CreateAgendaRequest { + @NotNull + private Long shareGroupId; + @NotNull + private String title; + @Size(min = 2, max = 6) + private List agendasPhotoList; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java new file mode 100644 index 0000000..56d09b3 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -0,0 +1,18 @@ +package com.umc.naoman.domain.agenda.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; + +import java.time.LocalDateTime; + +public abstract class AgendaResponse { + + @Builder + @Getter + @AllArgsConstructor + public static class CreateAgenda { + Long agendaId; + LocalDateTime createdAt; + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java new file mode 100644 index 0000000..8c29521 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaPhotoRepository.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.AgendaPhoto; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AgendaPhotoRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java new file mode 100644 index 0000000..3d1fbfb --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java @@ -0,0 +1,12 @@ +package com.umc.naoman.domain.agenda.repository; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +import java.util.Optional; + +@Repository +public interface AgendaRepository extends JpaRepository { +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java new file mode 100644 index 0000000..da411de --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java @@ -0,0 +1,9 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; + +import java.util.List; + +public interface AgendaPhotoService { + void saveAgendasPhotos(Agenda agenda, List photos); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java new file mode 100644 index 0000000..e432572 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -0,0 +1,33 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaPhotoConverter; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaPhotoRepository; +import com.umc.naoman.domain.photo.entity.Photo; +import com.umc.naoman.domain.photo.repository.PhotoRepository; +import com.umc.naoman.global.error.BusinessException; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static com.umc.naoman.global.error.code.PhotoErrorCode.PHOTO_NOT_FOUND_BY_PHOTO_ID; + +@Service +@RequiredArgsConstructor +public class AgendaPhotoServiceImpl implements AgendaPhotoService { + + private final AgendaPhotoRepository agendaPhotoRepository; + private final PhotoRepository photoRepository; + + @Override + @Transactional + public void saveAgendasPhotos(Agenda agenda, List photos) { + for (Long photoId : photos) { + Photo photo = photoRepository.findById(photoId). + orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND_BY_PHOTO_ID)); + agendaPhotoRepository.save(AgendaPhotoConverter.toAgendaPhoto(agenda, photo)); + } + } +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java new file mode 100644 index 0000000..a6ead9d --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -0,0 +1,10 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; + +public interface AgendaService { + + public Agenda findAgenda(Long agendaId); + public Agenda createAgenda(Member member, Long shareGroupId, String title); +} diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java new file mode 100644 index 0000000..4a86a39 --- /dev/null +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -0,0 +1,36 @@ +package com.umc.naoman.domain.agenda.service; + +import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; +import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.agenda.repository.AgendaRepository; +import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; +import com.umc.naoman.global.error.BusinessException; +import com.umc.naoman.global.error.code.AgendaErrorCode; +import com.umc.naoman.global.error.code.ShareGroupErrorCode; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class AgendaServiceImpl implements AgendaService { + + private final AgendaRepository agendaRepository; + private final ShareGroupRepository shareGroupRepository; + + @Override + public Agenda findAgenda(Long agendaId) { + return agendaRepository.findById(agendaId) + .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); + } + + @Override + public Agenda createAgenda(Member member, Long shareGroupId, String title) { + ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) + .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); + Agenda newAgenda = AgendaConverter.toAgenda(member,title,shareGroup); + return agendaRepository.save(newAgenda); + } +} From 57309fdafc20f7d7f87d7a05450826e4940327cc Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:30:39 +0900 Subject: [PATCH 49/83] =?UTF-8?q?fix:=20@Transactional=20=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index 4a86a39..ec7622a 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -1,7 +1,6 @@ package com.umc.naoman.domain.agenda.service; import com.umc.naoman.domain.agenda.converter.AgendaConverter; -import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.member.entity.Member; @@ -12,6 +11,7 @@ import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @@ -21,12 +21,14 @@ public class AgendaServiceImpl implements AgendaService { private final ShareGroupRepository shareGroupRepository; @Override + @Transactional(readOnly = true) public Agenda findAgenda(Long agendaId) { return agendaRepository.findById(agendaId) .orElseThrow(() -> new BusinessException(AgendaErrorCode.AGENDA_NOT_FOUND_BY_AGENDA_ID)); } @Override + @Transactional public Agenda createAgenda(Member member, Long shareGroupId, String title) { ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); From d1028620ed5e25e276ffd92aba4532855326bac8 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 50/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index c14042e..5f29d41 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), ; private final int status; From d4ad4c2bde3b62cddfb90405d5eb7899aa7ab8d9 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 51/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From db66d6be24eb1210d92c804d1b0adf01222e92df Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Thu, 1 Aug 2024 17:49:05 +0900 Subject: [PATCH 52/83] =?UTF-8?q?fix:=20Member=20=EC=97=B0=EA=B4=80?= =?UTF-8?q?=EA=B4=80=EA=B3=84=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20Profile?= =?UTF-8?q?=20=EC=97=B0=EA=B4=80=EA=B3=BC=EA=B3=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 60495fb..55b7f8d 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,6 +1,7 @@ package com.umc.naoman.domain.agenda.entity; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; import jakarta.persistence.*; @@ -30,5 +31,5 @@ public class Agenda extends BaseTimeEntity { private ShareGroup shareGroup; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id") - private Member member; + private Profile profile; } From 27122e6326fe005ed875b264473df96841dd2d40 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:07 +0900 Subject: [PATCH 53/83] =?UTF-8?q?fix:=20Agenda=EC=99=80=20Profile=20?= =?UTF-8?q?=EC=97=B0=EA=B4=80=EA=B4=80=EA=B3=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 55b7f8d..9b0a404 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -1,6 +1,5 @@ package com.umc.naoman.domain.agenda.entity; -import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; @@ -30,6 +29,6 @@ public class Agenda extends BaseTimeEntity { @JoinColumn(name = "share_group_id") private ShareGroup shareGroup; @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "member_id") + @JoinColumn(name = "profile_id") private Profile profile; } From 45f4768343b6e00101cf0d3e21adf1669d38605f Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 54/83] =?UTF-8?q?feat:=20Agenda=20Errorcode=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 --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index c14042e..5f29d41 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), ; private final int status; From 88acb44ae37992d4ac4e266922006b385c16e9e8 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 55/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 11a4be53352c03d4a020cc5cafffa79a00c6be60 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 56/83] =?UTF-8?q?feat:=20Agenda=20Errorcode=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 --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index c14042e..5f29d41 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), ; private final int status; From b2defa4e29531b0c13f913691911e1e1144c751c Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 57/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From 52a7065a9c7bd56de40b6ed35f7a4bcbeeddaf23 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 20:35:14 +0900 Subject: [PATCH 58/83] rebase --- .../naoman/domain/shareGroup/service/ShareGroupServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java index a3574f3..693c654 100644 --- a/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/shareGroup/service/ShareGroupServiceImpl.java @@ -9,6 +9,7 @@ import com.umc.naoman.domain.shareGroup.repository.ProfileRepository; import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; import com.umc.naoman.global.error.BusinessException; +import com.umc.naoman.global.error.code.MemberErrorCode; import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -33,6 +34,7 @@ public class ShareGroupServiceImpl implements ShareGroupService { @Transactional @Override public ShareGroup createShareGroup(ShareGroupRequest.createShareGroupRequest request, Member member) { + // 초대링크를 위한 고유번호 생성 (UUID) String inviteCode = UUID.randomUUID().toString().replace("-", "").toUpperCase(); From 91d22edf4febee04e942676e2f730210c01ba3f5 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 20:36:25 +0900 Subject: [PATCH 59/83] =?UTF-8?q?fix:=20import=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/domain/agenda/entity/Agenda.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 9b0a404..0fd9b9d 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -4,11 +4,7 @@ import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; import jakarta.persistence.*; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; +import lombok.*; import org.hibernate.annotations.SQLRestriction; @Entity From b708de89bca65532fdf9ce7a97a99ae04f52178a Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 20:38:02 +0900 Subject: [PATCH 60/83] =?UTF-8?q?fix:=20=EC=97=B0=EA=B4=80=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EB=B3=80=EA=B2=BD=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=A5=B8=20=EC=83=88=20=EC=95=88=EA=B1=B4=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20api=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/controller/AgendaController.java | 8 +++++++- .../naoman/domain/agenda/converter/AgendaConverter.java | 7 ++++--- .../umc/naoman/domain/agenda/service/AgendaService.java | 3 ++- .../naoman/domain/agenda/service/AgendaServiceImpl.java | 5 +++-- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index 10791f4..32a6f3f 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -7,6 +7,8 @@ import com.umc.naoman.domain.agenda.service.AgendaPhotoService; import com.umc.naoman.domain.agenda.service.AgendaService; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; +import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.ErrorResponse; import com.umc.naoman.global.result.ResultResponse; import com.umc.naoman.global.result.code.AgendaResultCode; @@ -31,6 +33,7 @@ public class AgendaController { private final AgendaService agendaService; private final AgendaPhotoService agendaPhotoService; + private final ShareGroupService shareGroupService; @PostMapping("/agendas") @Operation(summary = "안건 생성 API", description = "[request]\n shareGroupId, title, 안건에 올릴 PhotoId 리스트" + @@ -41,6 +44,8 @@ public class AgendaController { content = @Content(schema = @Schema(implementation = ErrorResponse.class))), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EP001",description = "해당 phtoId를 가진 사진이 없습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG006",description = "그룹에 속한 회원의 프로필이 없습니다..", + content = @Content(schema = @Schema(implementation = ErrorResponse.class))), }) @Parameters(value = { @Parameter(name = "shareGroupId",description = "안건이 생성되는 공유그룹의 Id"), @@ -51,7 +56,8 @@ public ResultResponse createAgenda(@RequestBody @Va @LoginMember Member member) { Long shareGroupId = request.getShareGroupId(); String title = request.getTitle(); - Agenda agenda = agendaService.createAgenda(member,shareGroupId, title); + Profile profile = shareGroupService.findProfile(member.getId(), shareGroupId); + Agenda agenda = agendaService.createAgenda(profile,shareGroupId, title); agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java index 1793889..f9f3993 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -2,7 +2,7 @@ import com.umc.naoman.domain.agenda.dto.AgendaResponse; import com.umc.naoman.domain.agenda.entity.Agenda; -import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; public class AgendaConverter { @@ -14,11 +14,12 @@ public static AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ .build(); } - public static Agenda toAgenda(Member member, String title, ShareGroup shareGroup){ + public static Agenda toAgenda(Profile profile, String title, ShareGroup shareGroup){ return Agenda.builder() - .member(member) + .profile(profile) .title(title) .shareGroup(shareGroup) .build(); } + } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java index a6ead9d..f2188e7 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -2,9 +2,10 @@ import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; public interface AgendaService { public Agenda findAgenda(Long agendaId); - public Agenda createAgenda(Member member, Long shareGroupId, String title); + public Agenda createAgenda(Profile profile, Long shareGroupId, String title); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index ec7622a..59ef2d7 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -4,6 +4,7 @@ import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.member.entity.Member; +import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; import com.umc.naoman.global.error.BusinessException; @@ -29,10 +30,10 @@ public Agenda findAgenda(Long agendaId) { @Override @Transactional - public Agenda createAgenda(Member member, Long shareGroupId, String title) { + public Agenda createAgenda(Profile profile, Long shareGroupId, String title) { ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); - Agenda newAgenda = AgendaConverter.toAgenda(member,title,shareGroup); + Agenda newAgenda = AgendaConverter.toAgenda(profile,title,shareGroup); return agendaRepository.save(newAgenda); } } From 4e514a9c389b9c96eea21e6cc45bac1ffed7971d Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 20:55:26 +0900 Subject: [PATCH 61/83] =?UTF-8?q?fix:=20=EA=B5=AC=ED=98=84=EB=90=9C=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EC=9D=B8?= =?UTF-8?q?=EC=9E=90=20=EC=88=9C=EC=84=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/controller/AgendaController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index 32a6f3f..0ea8906 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -56,7 +56,7 @@ public ResultResponse createAgenda(@RequestBody @Va @LoginMember Member member) { Long shareGroupId = request.getShareGroupId(); String title = request.getTitle(); - Profile profile = shareGroupService.findProfile(member.getId(), shareGroupId); + Profile profile = shareGroupService.findProfile(shareGroupId,member.getId()); Agenda agenda = agendaService.createAgenda(profile,shareGroupId, title); agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); From cf31cec3e519946334a690483158c5b69cbd5774 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:07 +0900 Subject: [PATCH 62/83] rebase --- .../umc/naoman/domain/agenda/entity/Agenda.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 0fd9b9d..5011013 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -3,8 +3,20 @@ import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; -import jakarta.persistence.*; -import lombok.*; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; import org.hibernate.annotations.SQLRestriction; @Entity From 9f306b9f341e1969e1c6ffe9cf505a102a0bfbb5 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:15:04 +0900 Subject: [PATCH 63/83] rebase --- .../umc/naoman/domain/agenda/converter/AgendaConverter.java | 1 - .../com/umc/naoman/domain/agenda/service/AgendaService.java | 5 ++--- .../umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java index f9f3993..6b2edbc 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -21,5 +21,4 @@ public static Agenda toAgenda(Profile profile, String title, ShareGroup shareGro .shareGroup(shareGroup) .build(); } - } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java index f2188e7..2b3dc2e 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -1,11 +1,10 @@ package com.umc.naoman.domain.agenda.service; import com.umc.naoman.domain.agenda.entity.Agenda; -import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.Profile; public interface AgendaService { - public Agenda findAgenda(Long agendaId); - public Agenda createAgenda(Profile profile, Long shareGroupId, String title); + Agenda findAgenda(Long agendaId); + Agenda createAgenda(Profile profile, Long shareGroupId, String title); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index 59ef2d7..d1bee5b 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -3,7 +3,6 @@ import com.umc.naoman.domain.agenda.converter.AgendaConverter; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; -import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; From 4cba85991e63c92f56bf61eb916def2ff7f9b6cb Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:01:36 +0900 Subject: [PATCH 64/83] =?UTF-8?q?feat:=20Photo,=20Agenda=20Errorcode=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index c14042e..5f29d41 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), ; private final int status; From d36d731f0e765f4b316bc62159323aca9a32a8eb Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Wed, 31 Jul 2024 18:13:23 +0900 Subject: [PATCH 65/83] =?UTF-8?q?fix:=20AgendaErrorCode=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/global/error/code/AgendaErrorCode.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java index 5f29d41..c14042e 100644 --- a/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java +++ b/src/main/java/com/umc/naoman/global/error/code/AgendaErrorCode.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor public enum AgendaErrorCode implements ErrorCode { - AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 회의록이 존재하지 않습니다."), + AGENDA_NOT_FOUND_BY_AGENDA_ID(404, "EA001", "해당 agendaId를 가진 안건이 존재하지 않습니다."), ; private final int status; From e7a2671fb6ca5f01710d03e07f21aec18a744d57 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 22:02:01 +0900 Subject: [PATCH 66/83] =?UTF-8?q?fix:=20=EC=A0=91=EA=B7=BC=EC=A0=9C?= =?UTF-8?q?=EC=96=B4=EC=9E=90=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java index 56d09b3..0450044 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -12,7 +12,7 @@ public abstract class AgendaResponse { @Getter @AllArgsConstructor public static class CreateAgenda { - Long agendaId; - LocalDateTime createdAt; + private Long agendaId; + private LocalDateTime createdAt; } } From f62e832d7d9aed7e12622cbb3d2f895d6789b956 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Fri, 2 Aug 2024 22:03:35 +0900 Subject: [PATCH 67/83] =?UTF-8?q?fix:=20ShareGroupRepository=EB=A5=BC=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A=EA=B3=A0=20Sha?= =?UTF-8?q?reGroupService=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8A=94?= =?UTF-8?q?=20=EA=B2=83=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/service/AgendaServiceImpl.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index d1bee5b..e90cbf0 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -5,10 +5,9 @@ import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; -import com.umc.naoman.domain.shareGroup.repository.ShareGroupRepository; +import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.BusinessException; import com.umc.naoman.global.error.code.AgendaErrorCode; -import com.umc.naoman.global.error.code.ShareGroupErrorCode; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -18,7 +17,7 @@ public class AgendaServiceImpl implements AgendaService { private final AgendaRepository agendaRepository; - private final ShareGroupRepository shareGroupRepository; + private final ShareGroupService shareGroupService; @Override @Transactional(readOnly = true) @@ -30,8 +29,7 @@ public Agenda findAgenda(Long agendaId) { @Override @Transactional public Agenda createAgenda(Profile profile, Long shareGroupId, String title) { - ShareGroup shareGroup = shareGroupRepository.findById(shareGroupId) - .orElseThrow(() -> new BusinessException(ShareGroupErrorCode.SHARE_GROUP_NOT_FOUND)); + ShareGroup shareGroup = shareGroupService.findShareGroup(shareGroupId); Agenda newAgenda = AgendaConverter.toAgenda(profile,title,shareGroup); return agendaRepository.save(newAgenda); } From 7d7f398720a86aef881b71db80ef7c2b85bc02bd Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 16:39:30 +0900 Subject: [PATCH 68/83] =?UTF-8?q?fix:=20jsonFormat=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java index 0450044..b7fe2c6 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -1,5 +1,6 @@ package com.umc.naoman.domain.agenda.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; @@ -13,6 +14,7 @@ public abstract class AgendaResponse { @AllArgsConstructor public static class CreateAgenda { private Long agendaId; + @JsonFormat(pattern = "yyyy-MM-dd") private LocalDateTime createdAt; } } From 0f65003d8b99c4150844639ee1c87d81b69ea55d Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 16:41:02 +0900 Subject: [PATCH 69/83] =?UTF-8?q?fix:=20swagger=20@parameter=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/controller/AgendaController.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index 0ea8906..b675ed9 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -47,11 +47,6 @@ public class AgendaController { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG006",description = "그룹에 속한 회원의 프로필이 없습니다..", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), }) - @Parameters(value = { - @Parameter(name = "shareGroupId",description = "안건이 생성되는 공유그룹의 Id"), - @Parameter(name = "title",description = "안건의 제목"), - @Parameter(name = "agendasPhotoList",description = "안건에 올릴 사진의 photoId 리스트") - }) public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, @LoginMember Member member) { Long shareGroupId = request.getShareGroupId(); From a0ea59794f5e9ee49cba8c4832bff08b4fd29914 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 16:50:58 +0900 Subject: [PATCH 70/83] =?UTF-8?q?fix:=20service=EB=8B=A8=EC=9C=BC=EB=A1=9C?= =?UTF-8?q?=20=EC=97=AD=ED=95=A0=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/agenda/controller/AgendaController.java | 8 ++------ .../naoman/domain/agenda/service/AgendaService.java | 3 ++- .../domain/agenda/service/AgendaServiceImpl.java | 11 ++++++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index b675ed9..e75783c 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -32,7 +32,6 @@ public class AgendaController { private final AgendaService agendaService; - private final AgendaPhotoService agendaPhotoService; private final ShareGroupService shareGroupService; @PostMapping("/agendas") @@ -49,11 +48,8 @@ public class AgendaController { }) public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, @LoginMember Member member) { - Long shareGroupId = request.getShareGroupId(); - String title = request.getTitle(); - Profile profile = shareGroupService.findProfile(shareGroupId,member.getId()); - Agenda agenda = agendaService.createAgenda(profile,shareGroupId, title); - agendaPhotoService.saveAgendasPhotos(agenda,request.getAgendasPhotoList()); + Profile profile = shareGroupService.findProfile(request.getShareGroupId(),member.getId()); + Agenda agenda = agendaService.createAgenda(profile,request); return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); } } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java index 2b3dc2e..2633786 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -1,10 +1,11 @@ package com.umc.naoman.domain.agenda.service; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.shareGroup.entity.Profile; public interface AgendaService { Agenda findAgenda(Long agendaId); - Agenda createAgenda(Profile profile, Long shareGroupId, String title); + Agenda createAgenda(Profile profile, AgendaRequest.CreateAgendaRequest request); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index e90cbf0..073d014 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -1,6 +1,7 @@ package com.umc.naoman.domain.agenda.service; import com.umc.naoman.domain.agenda.converter.AgendaConverter; +import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; import com.umc.naoman.domain.shareGroup.entity.Profile; @@ -18,6 +19,8 @@ public class AgendaServiceImpl implements AgendaService { private final AgendaRepository agendaRepository; private final ShareGroupService shareGroupService; + private final AgendaPhotoService agendaPhotoService; + @Override @Transactional(readOnly = true) @@ -28,9 +31,11 @@ public Agenda findAgenda(Long agendaId) { @Override @Transactional - public Agenda createAgenda(Profile profile, Long shareGroupId, String title) { - ShareGroup shareGroup = shareGroupService.findShareGroup(shareGroupId); - Agenda newAgenda = AgendaConverter.toAgenda(profile,title,shareGroup); + public Agenda createAgenda(Profile profile, AgendaRequest.CreateAgendaRequest request) { + ShareGroup shareGroup = shareGroupService.findShareGroup(request.getShareGroupId()); + Agenda newAgenda = AgendaConverter.toAgenda(profile,request.getTitle(),shareGroup); + agendaPhotoService.saveAgendasPhotos(newAgenda,request.getAgendasPhotoList()); + return agendaRepository.save(newAgenda); } } From d70bbadf4d40442ac9791dcddfe37d43afe0f4a0 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 16:55:10 +0900 Subject: [PATCH 71/83] =?UTF-8?q?fix:=20Converter=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20Component=EB=A1=9C=20=EB=93=B1=EB=A1=9D=20=EB=B0=8F?= =?UTF-8?q?=20static=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/controller/AgendaController.java | 3 ++- .../umc/naoman/domain/agenda/converter/AgendaConverter.java | 6 ++++-- .../domain/agenda/service/AgendaPhotoServiceImpl.java | 2 +- .../umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index e75783c..bec6f2f 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -33,6 +33,7 @@ public class AgendaController { private final AgendaService agendaService; private final ShareGroupService shareGroupService; + private final AgendaConverter agendaConverter; @PostMapping("/agendas") @Operation(summary = "안건 생성 API", description = "[request]\n shareGroupId, title, 안건에 올릴 PhotoId 리스트" + @@ -50,7 +51,7 @@ public ResultResponse createAgenda(@RequestBody @Va @LoginMember Member member) { Profile profile = shareGroupService.findProfile(request.getShareGroupId(),member.getId()); Agenda agenda = agendaService.createAgenda(profile,request); - return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, AgendaConverter.toCreateAgenda(agenda)); + return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, agendaConverter.toCreateAgenda(agenda)); } } diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java index 6b2edbc..5c7bd58 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -4,17 +4,19 @@ import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; +import org.springframework.stereotype.Component; +@Component public class AgendaConverter { - public static AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ + public AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ return AgendaResponse.CreateAgenda.builder() .agendaId(agenda.getId()) .createdAt(agenda.getCreatedAt()) .build(); } - public static Agenda toAgenda(Profile profile, String title, ShareGroup shareGroup){ + public Agenda toEntity(Profile profile, String title, ShareGroup shareGroup){ return Agenda.builder() .profile(profile) .title(title) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java index e432572..822f47f 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -27,7 +27,7 @@ public void saveAgendasPhotos(Agenda agenda, List photos) { for (Long photoId : photos) { Photo photo = photoRepository.findById(photoId). orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND_BY_PHOTO_ID)); - agendaPhotoRepository.save(AgendaPhotoConverter.toAgendaPhoto(agenda, photo)); + agendaPhotoRepository.save(AgendaPhotoConverter.toEntity(agenda, photo)); } } } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index 073d014..8f61dc1 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -20,7 +20,7 @@ public class AgendaServiceImpl implements AgendaService { private final AgendaRepository agendaRepository; private final ShareGroupService shareGroupService; private final AgendaPhotoService agendaPhotoService; - + private final AgendaConverter agendaConverter; @Override @Transactional(readOnly = true) @@ -33,7 +33,7 @@ public Agenda findAgenda(Long agendaId) { @Transactional public Agenda createAgenda(Profile profile, AgendaRequest.CreateAgendaRequest request) { ShareGroup shareGroup = shareGroupService.findShareGroup(request.getShareGroupId()); - Agenda newAgenda = AgendaConverter.toAgenda(profile,request.getTitle(),shareGroup); + Agenda newAgenda = agendaConverter.toEntity(profile,request.getTitle(),shareGroup); agendaPhotoService.saveAgendasPhotos(newAgenda,request.getAgendasPhotoList()); return agendaRepository.save(newAgenda); From c08ab90df45bc2b96e25dd3d3577c3b676a8924e Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 16:55:31 +0900 Subject: [PATCH 72/83] =?UTF-8?q?fix:=20converter=20=EB=A9=94=EC=86=8C?= =?UTF-8?q?=EB=93=9C=20=EB=AA=85=EC=9D=84=20toEntity=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/converter/AgendaPhotoConverter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java index 6282550..1e3faf5 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaPhotoConverter.java @@ -6,7 +6,7 @@ public class AgendaPhotoConverter { - public static AgendaPhoto toAgendaPhoto(Agenda agenda, Photo photo) { + public static AgendaPhoto toEntity(Agenda agenda, Photo photo) { return AgendaPhoto.builder() .agenda(agenda) .photo(photo) From 5e90e090d764dc39439bd51ceedd988d29ac95e0 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 16:56:43 +0900 Subject: [PATCH 73/83] =?UTF-8?q?fix:=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20?= =?UTF-8?q?=EA=B2=80=EC=A6=9D=20=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4?= =?UTF-8?q?=EC=85=98=EC=97=90=20=EC=84=A4=EB=AA=85=EC=9D=84=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20message=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java index d9d14b6..78520c1 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaRequest.java @@ -20,7 +20,7 @@ public static class CreateAgendaRequest { private Long shareGroupId; @NotNull private String title; - @Size(min = 2, max = 6) + @Size(min = 2, max = 6, message = "안건에 등록하는 사진은 최소 2개 최대 6개로 한정 시켜 주세요.") private List agendasPhotoList; } } From 9358e232cf80c6b00a93bc1ddc06a0e49219eb79 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 16:57:28 +0900 Subject: [PATCH 74/83] =?UTF-8?q?fix:=20CreateAgenda=20->=20AgendaInfo?= =?UTF-8?q?=EB=A1=9C=20=ED=81=B4=EB=9E=98=EC=8A=A4=EB=AA=85=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/controller/AgendaController.java | 7 ++----- .../naoman/domain/agenda/converter/AgendaConverter.java | 4 ++-- .../com/umc/naoman/domain/agenda/dto/AgendaResponse.java | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index bec6f2f..c60c098 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -4,7 +4,6 @@ import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.dto.AgendaResponse; import com.umc.naoman.domain.agenda.entity.Agenda; -import com.umc.naoman.domain.agenda.service.AgendaPhotoService; import com.umc.naoman.domain.agenda.service.AgendaService; import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.Profile; @@ -14,8 +13,6 @@ import com.umc.naoman.global.result.code.AgendaResultCode; import com.umc.naoman.global.security.annotation.LoginMember; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponses; @@ -47,8 +44,8 @@ public class AgendaController { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG006",description = "그룹에 속한 회원의 프로필이 없습니다..", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), }) - public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, - @LoginMember Member member) { + public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, + @LoginMember Member member) { Profile profile = shareGroupService.findProfile(request.getShareGroupId(),member.getId()); Agenda agenda = agendaService.createAgenda(profile,request); return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, agendaConverter.toCreateAgenda(agenda)); diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java index 5c7bd58..ad336d6 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -9,8 +9,8 @@ @Component public class AgendaConverter { - public AgendaResponse.CreateAgenda toCreateAgenda(Agenda agenda){ - return AgendaResponse.CreateAgenda.builder() + public AgendaResponse.AgendaInfo toCreateAgenda(Agenda agenda){ + return AgendaResponse.AgendaInfo.builder() .agendaId(agenda.getId()) .createdAt(agenda.getCreatedAt()) .build(); diff --git a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java index b7fe2c6..6448275 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java +++ b/src/main/java/com/umc/naoman/domain/agenda/dto/AgendaResponse.java @@ -12,7 +12,7 @@ public abstract class AgendaResponse { @Builder @Getter @AllArgsConstructor - public static class CreateAgenda { + public static class AgendaInfo { private Long agendaId; @JsonFormat(pattern = "yyyy-MM-dd") private LocalDateTime createdAt; From fa3f8aa95b81d6b878056f0d4d5237116e92dcdf Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 16:58:59 +0900 Subject: [PATCH 75/83] =?UTF-8?q?fix:=20=EC=99=80=EC=9D=BC=EB=93=9C?= =?UTF-8?q?=EC=B9=B4=EB=93=9C=20=ED=92=80=EC=96=B4=EC=84=9C=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/umc/naoman/domain/agenda/entity/Agenda.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java index 9b0a404..db0ad56 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/Agenda.java @@ -3,7 +3,16 @@ import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; -import jakarta.persistence.*; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.GenerationType; +import jakarta.persistence.FetchType; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; From 9c28fc207c4e88250ed31c28ed93c0ec3c176bfb Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 17:00:19 +0900 Subject: [PATCH 76/83] =?UTF-8?q?fix:=20=EC=97=94=ED=8B=B0=ED=8B=B0?= =?UTF-8?q?=EB=AA=85=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/service/AgendaPhotoService.java | 2 +- .../naoman/domain/agenda/service/AgendaPhotoServiceImpl.java | 2 +- .../com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java index da411de..82c9c80 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java @@ -5,5 +5,5 @@ import java.util.List; public interface AgendaPhotoService { - void saveAgendasPhotos(Agenda agenda, List photos); + void saveAgendaPhotos(Agenda agenda, List photos); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java index 822f47f..785d184 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -23,7 +23,7 @@ public class AgendaPhotoServiceImpl implements AgendaPhotoService { @Override @Transactional - public void saveAgendasPhotos(Agenda agenda, List photos) { + public void saveAgendaPhotos(Agenda agenda, List photos) { for (Long photoId : photos) { Photo photo = photoRepository.findById(photoId). orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND_BY_PHOTO_ID)); diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index 8f61dc1..b0eecca 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -34,7 +34,7 @@ public Agenda findAgenda(Long agendaId) { public Agenda createAgenda(Profile profile, AgendaRequest.CreateAgendaRequest request) { ShareGroup shareGroup = shareGroupService.findShareGroup(request.getShareGroupId()); Agenda newAgenda = agendaConverter.toEntity(profile,request.getTitle(),shareGroup); - agendaPhotoService.saveAgendasPhotos(newAgenda,request.getAgendasPhotoList()); + agendaPhotoService.saveAgendaPhotos(newAgenda,request.getAgendasPhotoList()); return agendaRepository.save(newAgenda); } From 27115a3d08941a19a98c3d2209fe746a61899689 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Sun, 4 Aug 2024 17:06:41 +0900 Subject: [PATCH 77/83] =?UTF-8?q?fix:=20import=EB=AC=B8=20=EC=A0=95?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/repository/AgendaRepository.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java index 3d1fbfb..6e4875f 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java +++ b/src/main/java/com/umc/naoman/domain/agenda/repository/AgendaRepository.java @@ -1,12 +1,9 @@ package com.umc.naoman.domain.agenda.repository; import com.umc.naoman.domain.agenda.entity.Agenda; -import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -import java.util.Optional; - @Repository public interface AgendaRepository extends JpaRepository { } From 6612d5ff6165754a5b821e4d6f2aa71ff76b791d Mon Sep 17 00:00:00 2001 From: Donghoon Jeong <112836685+jjeongdong@users.noreply.github.com> Date: Sun, 4 Aug 2024 23:10:16 +0900 Subject: [PATCH 78/83] =?UTF-8?q?feat=20:=20=EC=82=AC=EC=A7=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/umc/naoman/domain/photo/service/PhotoService.java | 2 ++ .../umc/naoman/domain/photo/service/PhotoServiceImpl.java | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/umc/naoman/domain/photo/service/PhotoService.java b/src/main/java/com/umc/naoman/domain/photo/service/PhotoService.java index afd1185..d76e23d 100644 --- a/src/main/java/com/umc/naoman/domain/photo/service/PhotoService.java +++ b/src/main/java/com/umc/naoman/domain/photo/service/PhotoService.java @@ -18,4 +18,6 @@ public interface PhotoService { Page getAllPhotoList(Long shareGroupId, Member member, Pageable pageable); List deletePhotoList(PhotoRequest.PhotoDeletedRequest request, Member member); + + Photo findPhoto(Long photoId); } diff --git a/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java index 520c06d..1179715 100644 --- a/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/photo/service/PhotoServiceImpl.java @@ -42,7 +42,6 @@ public class PhotoServiceImpl implements PhotoService { private final PhotoRepository photoRepository; private final ShareGroupService shareGroupService; private final PhotoConverter photoConverter; - private final ProfileRepository profileRepository; @Value("${spring.cloud.aws.s3.bucket}") private String bucketName; @@ -185,4 +184,9 @@ private void deletePhoto(Photo photo) { photoRepository.delete(photo); } + @Override + @Transactional(readOnly = true) + public Photo findPhoto(Long photoId) { + return photoRepository.findById(photoId).orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND)); + } } From bd7f52aa5751787b3b7a57880c9965b559377fd9 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Mon, 5 Aug 2024 13:14:55 +0900 Subject: [PATCH 79/83] =?UTF-8?q?fix:=20photoService.findPhoto=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=20=EB=B0=8F=20swagger=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/controller/AgendaController.java | 2 +- .../domain/agenda/service/AgendaPhotoServiceImpl.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index c60c098..9617f57 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -39,7 +39,7 @@ public class AgendaController { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "SA001",description = "안건 생성 성공"), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG005",description = "해당 shareGroupId를 가진 그룹이 없습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EP001",description = "해당 phtoId를 가진 사진이 없습니다.", + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "ES3005",description = "해당 photoId를 가진 사진이 없습니다.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "EG006",description = "그룹에 속한 회원의 프로필이 없습니다..", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java index 785d184..fcd70dd 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -5,6 +5,7 @@ import com.umc.naoman.domain.agenda.repository.AgendaPhotoRepository; import com.umc.naoman.domain.photo.entity.Photo; import com.umc.naoman.domain.photo.repository.PhotoRepository; +import com.umc.naoman.domain.photo.service.PhotoService; import com.umc.naoman.global.error.BusinessException; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -19,14 +20,13 @@ public class AgendaPhotoServiceImpl implements AgendaPhotoService { private final AgendaPhotoRepository agendaPhotoRepository; - private final PhotoRepository photoRepository; + private final PhotoService photoService; @Override @Transactional public void saveAgendaPhotos(Agenda agenda, List photos) { for (Long photoId : photos) { - Photo photo = photoRepository.findById(photoId). - orElseThrow(() -> new BusinessException(PHOTO_NOT_FOUND_BY_PHOTO_ID)); + Photo photo = photoService.findPhoto(photoId); agendaPhotoRepository.save(AgendaPhotoConverter.toEntity(agenda, photo)); } } From eaf7d98f2f422294eca9e5cf5b6037ecb9309088 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Mon, 5 Aug 2024 13:16:20 +0900 Subject: [PATCH 80/83] =?UTF-8?q?fix:=20dto=20=ED=81=B4=EB=9E=98=EC=8A=A4?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../umc/naoman/domain/agenda/controller/AgendaController.java | 2 +- .../com/umc/naoman/domain/agenda/converter/AgendaConverter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index 9617f57..400d6f5 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -48,7 +48,7 @@ public ResultResponse createAgenda(@RequestBody @Vali @LoginMember Member member) { Profile profile = shareGroupService.findProfile(request.getShareGroupId(),member.getId()); Agenda agenda = agendaService.createAgenda(profile,request); - return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, agendaConverter.toCreateAgenda(agenda)); + return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, agendaConverter.toAgendaInfo(agenda)); } } diff --git a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java index ad336d6..45f0cf7 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java +++ b/src/main/java/com/umc/naoman/domain/agenda/converter/AgendaConverter.java @@ -9,7 +9,7 @@ @Component public class AgendaConverter { - public AgendaResponse.AgendaInfo toCreateAgenda(Agenda agenda){ + public AgendaResponse.AgendaInfo toAgendaInfo(Agenda agenda){ return AgendaResponse.AgendaInfo.builder() .agendaId(agenda.getId()) .createdAt(agenda.getCreatedAt()) From 78875ffbab44078a374b2423a40df47b9f088f20 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Mon, 5 Aug 2024 13:18:15 +0900 Subject: [PATCH 81/83] =?UTF-8?q?fix:=20=EC=95=88=EA=B1=B4=EC=97=90=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=EB=90=98=EB=8A=94=20=EC=82=AC=EC=A7=84=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=ED=95=A8=EC=88=98=EB=AA=85=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/service/AgendaPhotoService.java | 2 +- .../domain/agenda/service/AgendaPhotoServiceImpl.java | 6 +----- .../umc/naoman/domain/agenda/service/AgendaServiceImpl.java | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java index 82c9c80..a41722e 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoService.java @@ -5,5 +5,5 @@ import java.util.List; public interface AgendaPhotoService { - void saveAgendaPhotos(Agenda agenda, List photos); + void saveAgendaPhotoList(Agenda agenda, List photos); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java index fcd70dd..48324b3 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaPhotoServiceImpl.java @@ -4,17 +4,13 @@ import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaPhotoRepository; import com.umc.naoman.domain.photo.entity.Photo; -import com.umc.naoman.domain.photo.repository.PhotoRepository; import com.umc.naoman.domain.photo.service.PhotoService; -import com.umc.naoman.global.error.BusinessException; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; -import static com.umc.naoman.global.error.code.PhotoErrorCode.PHOTO_NOT_FOUND_BY_PHOTO_ID; - @Service @RequiredArgsConstructor public class AgendaPhotoServiceImpl implements AgendaPhotoService { @@ -24,7 +20,7 @@ public class AgendaPhotoServiceImpl implements AgendaPhotoService { @Override @Transactional - public void saveAgendaPhotos(Agenda agenda, List photos) { + public void saveAgendaPhotoList(Agenda agenda, List photos) { for (Long photoId : photos) { Photo photo = photoService.findPhoto(photoId); agendaPhotoRepository.save(AgendaPhotoConverter.toEntity(agenda, photo)); diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index b0eecca..e3b31ca 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -34,7 +34,7 @@ public Agenda findAgenda(Long agendaId) { public Agenda createAgenda(Profile profile, AgendaRequest.CreateAgendaRequest request) { ShareGroup shareGroup = shareGroupService.findShareGroup(request.getShareGroupId()); Agenda newAgenda = agendaConverter.toEntity(profile,request.getTitle(),shareGroup); - agendaPhotoService.saveAgendaPhotos(newAgenda,request.getAgendasPhotoList()); + agendaPhotoService.saveAgendaPhotoList(newAgenda,request.getAgendasPhotoList()); return agendaRepository.save(newAgenda); } From 633fba317e438b2bf8a60c543e4e06874b0fe7fd Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Mon, 5 Aug 2024 13:32:31 +0900 Subject: [PATCH 82/83] =?UTF-8?q?fix:=20findProfile=EC=9D=84=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=EB=8B=A8=EC=97=90=EC=84=9C=20=EC=8B=A4?= =?UTF-8?q?=ED=96=89=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../naoman/domain/agenda/controller/AgendaController.java | 6 +----- .../umc/naoman/domain/agenda/service/AgendaService.java | 3 ++- .../naoman/domain/agenda/service/AgendaServiceImpl.java | 7 +++++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java index 400d6f5..c4f0131 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java +++ b/src/main/java/com/umc/naoman/domain/agenda/controller/AgendaController.java @@ -6,8 +6,6 @@ import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.service.AgendaService; import com.umc.naoman.domain.member.entity.Member; -import com.umc.naoman.domain.shareGroup.entity.Profile; -import com.umc.naoman.domain.shareGroup.service.ShareGroupService; import com.umc.naoman.global.error.ErrorResponse; import com.umc.naoman.global.result.ResultResponse; import com.umc.naoman.global.result.code.AgendaResultCode; @@ -29,7 +27,6 @@ public class AgendaController { private final AgendaService agendaService; - private final ShareGroupService shareGroupService; private final AgendaConverter agendaConverter; @PostMapping("/agendas") @@ -46,8 +43,7 @@ public class AgendaController { }) public ResultResponse createAgenda(@RequestBody @Valid AgendaRequest.CreateAgendaRequest request, @LoginMember Member member) { - Profile profile = shareGroupService.findProfile(request.getShareGroupId(),member.getId()); - Agenda agenda = agendaService.createAgenda(profile,request); + Agenda agenda = agendaService.createAgenda(member,request); return ResultResponse.of(AgendaResultCode.CREATE_AGENDA, agendaConverter.toAgendaInfo(agenda)); } } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java index 2633786..df17f67 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -2,10 +2,11 @@ import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; +import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.Profile; public interface AgendaService { Agenda findAgenda(Long agendaId); - Agenda createAgenda(Profile profile, AgendaRequest.CreateAgendaRequest request); + Agenda createAgenda(Member member, AgendaRequest.CreateAgendaRequest request); } diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java index e3b31ca..17d9091 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaServiceImpl.java @@ -4,6 +4,7 @@ import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.agenda.repository.AgendaRepository; +import com.umc.naoman.domain.member.entity.Member; import com.umc.naoman.domain.shareGroup.entity.Profile; import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.domain.shareGroup.service.ShareGroupService; @@ -31,8 +32,10 @@ public Agenda findAgenda(Long agendaId) { @Override @Transactional - public Agenda createAgenda(Profile profile, AgendaRequest.CreateAgendaRequest request) { - ShareGroup shareGroup = shareGroupService.findShareGroup(request.getShareGroupId()); + public Agenda createAgenda(Member member, AgendaRequest.CreateAgendaRequest request) { + Long shareGroupId = request.getShareGroupId(); + ShareGroup shareGroup = shareGroupService.findShareGroup(shareGroupId); + Profile profile = shareGroupService.findProfile(shareGroupId, member.getId()); Agenda newAgenda = agendaConverter.toEntity(profile,request.getTitle(),shareGroup); agendaPhotoService.saveAgendaPhotoList(newAgenda,request.getAgendasPhotoList()); From 334fc08aa3375e2ef5993adb692d0e1cf5d2ebd4 Mon Sep 17 00:00:00 2001 From: "LEE K.S" Date: Mon, 5 Aug 2024 13:34:25 +0900 Subject: [PATCH 83/83] =?UTF-8?q?fix:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20import=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/agenda/entity/AgendaPhoto.java | 17 ++--------------- .../domain/agenda/service/AgendaService.java | 1 - 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/umc/naoman/domain/agenda/entity/AgendaPhoto.java b/src/main/java/com/umc/naoman/domain/agenda/entity/AgendaPhoto.java index d23c1c0..026298a 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/entity/AgendaPhoto.java +++ b/src/main/java/com/umc/naoman/domain/agenda/entity/AgendaPhoto.java @@ -1,22 +1,9 @@ package com.umc.naoman.domain.agenda.entity; import com.umc.naoman.domain.photo.entity.Photo; -import com.umc.naoman.domain.shareGroup.entity.ShareGroup; import com.umc.naoman.global.entity.BaseTimeEntity; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; +import jakarta.persistence.*; +import lombok.*; import org.hibernate.annotations.SQLRestriction; @Entity diff --git a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java index df17f67..8d6a1c4 100644 --- a/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java +++ b/src/main/java/com/umc/naoman/domain/agenda/service/AgendaService.java @@ -3,7 +3,6 @@ import com.umc.naoman.domain.agenda.dto.AgendaRequest; import com.umc.naoman.domain.agenda.entity.Agenda; import com.umc.naoman.domain.member.entity.Member; -import com.umc.naoman.domain.shareGroup.entity.Profile; public interface AgendaService {