From b54cc23757a440633c62549c406a7db065e2cbca Mon Sep 17 00:00:00 2001 From: Yuje Lee Date: Sun, 28 Jan 2024 16:19:50 +0900 Subject: [PATCH 1/7] =?UTF-8?q?:sparkles:=20feat:=20Organization=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20Response=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/OrganizationDetailGetResponse.java | 56 +++++++++++++++++++ .../dto/OrganizationLinkGetResponse.java | 28 ++++++++++ .../organization/dto/TagGetResponse.java | 24 ++++++++ 3 files changed, 108 insertions(+) create mode 100644 src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationDetailGetResponse.java create mode 100644 src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationLinkGetResponse.java create mode 100644 src/main/java/com/sponus/sponusbe/domain/organization/dto/TagGetResponse.java diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationDetailGetResponse.java b/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationDetailGetResponse.java new file mode 100644 index 00000000..a371408d --- /dev/null +++ b/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationDetailGetResponse.java @@ -0,0 +1,56 @@ +package com.sponus.sponusbe.domain.organization.dto; + +import com.sponus.sponusbe.domain.organization.entity.Organization; +import com.sponus.sponusbe.domain.organization.entity.enums.OrganizationStatus; +import com.sponus.sponusbe.domain.organization.entity.enums.OrganizationType; +import com.sponus.sponusbe.domain.organization.entity.enums.SuborganizationType; + +import java.util.List; + +public record OrganizationDetailGetResponse( + Long organizationId, + String name, + String email, + String password, + String location, + String description, + String imageUrl, + OrganizationType organizationType, + SuborganizationType suborganizationType, + String managerName, + String managerPosition, + String managerEmail, + String managerPhone, + String managerAvailableDay, + String managerAvailableHour, + String managerContactPreference, + OrganizationStatus organizationStatus, + List tags, + List links +) { + public static OrganizationDetailGetResponse from(Organization organization) { + List tagGetResponses = TagGetResponse.getTagResponses(organization); + List linkGetResponses = OrganizationLinkGetResponse.getOrganizationLinkResponses(organization); + return new OrganizationDetailGetResponse( + organization.getId(), + organization.getName(), + organization.getEmail(), + organization.getPassword(), + organization.getLocation(), + organization.getDescription(), + organization.getImageUrl(), + organization.getOrganizationType(), + organization.getSuborganizationType(), + organization.getManagerName(), + organization.getManagerPosition(), + organization.getManagerEmail(), + organization.getManagerPhone(), + organization.getManagerAvailableDay(), + organization.getManagerAvailableHour(), + organization.getManagerContactPreference(), + organization.getOrganizationStatus(), + tagGetResponses, + linkGetResponses + ); + } +} diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationLinkGetResponse.java b/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationLinkGetResponse.java new file mode 100644 index 00000000..e774fe68 --- /dev/null +++ b/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationLinkGetResponse.java @@ -0,0 +1,28 @@ +package com.sponus.sponusbe.domain.organization.dto; + +import com.sponus.sponusbe.domain.organization.entity.Organization; +import com.sponus.sponusbe.domain.organization.entity.OrganizationLink; + +import java.util.List; + +public record OrganizationLinkGetResponse( + Long organizationLinkId, + Long organizationId, + String name, + String url +) { + public static OrganizationLinkGetResponse from(OrganizationLink organizationLink) { + return new OrganizationLinkGetResponse( + organizationLink.getId(), + organizationLink.getOrganization().getId(), + organizationLink.getName(), + organizationLink.getUrl() + ); + } + + public static List getOrganizationLinkResponses(Organization organization) { + return organization.getOrganizationLinks().stream() + .map(OrganizationLinkGetResponse::from) + .toList(); + } +} diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/dto/TagGetResponse.java b/src/main/java/com/sponus/sponusbe/domain/organization/dto/TagGetResponse.java new file mode 100644 index 00000000..3a04642a --- /dev/null +++ b/src/main/java/com/sponus/sponusbe/domain/organization/dto/TagGetResponse.java @@ -0,0 +1,24 @@ +package com.sponus.sponusbe.domain.organization.dto; + +import com.sponus.sponusbe.domain.organization.entity.Organization; +import com.sponus.sponusbe.domain.organization.entity.Tag; + +import java.util.List; +import java.util.stream.Collectors; + +public record TagGetResponse( + Long id, + String name +) { + public static TagGetResponse from(Tag tag) { + return new TagGetResponse(tag.getId(), tag.getName()); + } + + public static List getTagResponses(Organization organization) { + return organization.getOrganizationTags() + .stream() + .map(organizationTag -> TagGetResponse.from(organizationTag.getTag())) + .toList(); + } + +} From 98701769950c06bbf2553e5fa4e58e322405eb38 Mon Sep 17 00:00:00 2001 From: Yuje Lee Date: Sun, 28 Jan 2024 16:20:05 +0900 Subject: [PATCH 2/7] =?UTF-8?q?:sparkles:=20feat:=20Organization=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/controller/OrganizationController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java b/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java index 90c33543..1091aaa1 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java @@ -1,5 +1,6 @@ package com.sponus.sponusbe.domain.organization.controller; +import com.sponus.sponusbe.domain.organization.dto.OrganizationDetailGetResponse; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -34,4 +35,9 @@ public ApiResponse test(@AuthOrganization Organization organization) { Long id = organization.getId(); return ApiResponse.onSuccess(id); } + + @GetMapping("/me") + public ApiResponse getMyOrganization(@AuthOrganization Organization organization){ + return ApiResponse.onSuccess(OrganizationDetailGetResponse.from(organization)); + } } From 0e5cd37a7418db681cfea911c6d67e04e92a6c84 Mon Sep 17 00:00:00 2001 From: Yuje Lee Date: Mon, 29 Jan 2024 00:07:29 +0900 Subject: [PATCH 3/7] =?UTF-8?q?:sparkles:=20feat:=20=EB=82=B4=20=EC=A1=B0?= =?UTF-8?q?=EC=A7=81=20=EC=88=98=EC=A0=95=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OrganizationController.java | 15 ++++++++-- .../dto/OrganizationUpdateRequest.java | 23 +++++++++++++++ .../organization/entity/Organization.java | 28 +++++++++++++++++-- .../service/OrganizationService.java | 11 ++++++++ 4 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationUpdateRequest.java diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java b/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java index 1091aaa1..5c7ce006 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java @@ -1,15 +1,17 @@ package com.sponus.sponusbe.domain.organization.controller; -import com.sponus.sponusbe.domain.organization.dto.OrganizationDetailGetResponse; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.sponus.sponusbe.auth.annotation.AuthOrganization; +import com.sponus.sponusbe.domain.organization.dto.OrganizationDetailGetResponse; import com.sponus.sponusbe.domain.organization.dto.OrganizationJoinRequest; import com.sponus.sponusbe.domain.organization.dto.OrganizationJoinResponse; +import com.sponus.sponusbe.domain.organization.dto.OrganizationUpdateRequest; import com.sponus.sponusbe.domain.organization.entity.Organization; import com.sponus.sponusbe.domain.organization.service.OrganizationService; import com.sponus.sponusbe.global.common.ApiResponse; @@ -37,7 +39,16 @@ public ApiResponse test(@AuthOrganization Organization organization) { } @GetMapping("/me") - public ApiResponse getMyOrganization(@AuthOrganization Organization organization){ + public ApiResponse getMyOrganization(@AuthOrganization Organization organization) { return ApiResponse.onSuccess(OrganizationDetailGetResponse.from(organization)); } + + @PatchMapping("/me") + public ApiResponse updateMyOrganization( + @AuthOrganization Organization organization, + @RequestBody @Valid OrganizationUpdateRequest request + ) { + organizationService.updateOrganization(organization, request); + return ApiResponse.onSuccess(null); + } } diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationUpdateRequest.java b/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationUpdateRequest.java new file mode 100644 index 00000000..7216746d --- /dev/null +++ b/src/main/java/com/sponus/sponusbe/domain/organization/dto/OrganizationUpdateRequest.java @@ -0,0 +1,23 @@ +package com.sponus.sponusbe.domain.organization.dto; + +import com.sponus.sponusbe.domain.organization.entity.enums.OrganizationType; +import com.sponus.sponusbe.domain.organization.entity.enums.SuborganizationType; + +public record OrganizationUpdateRequest( + String name, + String email, + String password, + String location, + String description, + String imageUrl, + OrganizationType organizationType, + SuborganizationType suborganizationType, + String managerName, + String managerPosition, + String managerEmail, + String managerPhone, + String managerAvailableDay, + String managerAvailableHour, + String managerContactPreference +) { +} diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/entity/Organization.java b/src/main/java/com/sponus/sponusbe/domain/organization/entity/Organization.java index 113d864f..352845e4 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/entity/Organization.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/entity/Organization.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import com.sponus.sponusbe.domain.organization.dto.OrganizationUpdateRequest; import com.sponus.sponusbe.domain.organization.entity.enums.OrganizationStatus; import com.sponus.sponusbe.domain.organization.entity.enums.OrganizationType; import com.sponus.sponusbe.domain.organization.entity.enums.SuborganizationType; @@ -12,6 +13,7 @@ import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -88,14 +90,36 @@ public class Organization extends BaseEntity { private OrganizationStatus organizationStatus; @Builder.Default - @OneToMany(mappedBy = "organization") + @OneToMany(mappedBy = "organization", fetch = FetchType.EAGER) private List organizationTags = new ArrayList<>(); @Builder.Default - @OneToMany(mappedBy = "organization") + @OneToMany(mappedBy = "organization", fetch = FetchType.EAGER) private List organizationLinks = new ArrayList<>(); public boolean isStudentOrganization() { return this.organizationType == OrganizationType.STUDENT; } + + public void update(OrganizationUpdateRequest request) { + this.name = request.name() == null ? this.name : request.name(); + this.email = request.email() == null ? this.email : request.email(); + this.password = request.password() == null ? this.password : request.password(); + this.location = request.location() == null ? this.location : request.location(); + this.description = request.description() == null ? this.description : request.description(); + this.imageUrl = request.imageUrl() == null ? this.imageUrl : request.imageUrl(); + this.organizationType = request.organizationType() == null ? this.organizationType : request.organizationType(); + this.suborganizationType = + request.suborganizationType() == null ? this.suborganizationType : request.suborganizationType(); + this.managerName = request.managerName() == null ? this.managerName : request.managerName(); + this.managerPosition = request.managerPosition() == null ? this.managerPosition : request.managerPosition(); + this.managerEmail = request.managerEmail() == null ? this.managerEmail : request.managerEmail(); + this.managerPhone = request.managerPhone() == null ? this.managerPhone : request.managerPhone(); + this.managerAvailableDay = + request.managerAvailableDay() == null ? this.managerAvailableDay : request.managerAvailableDay(); + this.managerAvailableHour = + request.managerAvailableHour() == null ? this.managerAvailableHour : request.managerAvailableHour(); + this.managerContactPreference = request.managerContactPreference() == null ? this.managerContactPreference : + request.managerContactPreference(); + } } diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java b/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java index b94513dc..44422bf5 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java @@ -1,12 +1,16 @@ package com.sponus.sponusbe.domain.organization.service; +import static com.sponus.sponusbe.domain.organization.exception.OrganizationErrorCode.*; + import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.sponus.sponusbe.domain.organization.dto.OrganizationJoinRequest; import com.sponus.sponusbe.domain.organization.dto.OrganizationJoinResponse; +import com.sponus.sponusbe.domain.organization.dto.OrganizationUpdateRequest; import com.sponus.sponusbe.domain.organization.entity.Organization; +import com.sponus.sponusbe.domain.organization.exception.OrganizationException; import com.sponus.sponusbe.domain.organization.repository.OrganizationRepository; import lombok.RequiredArgsConstructor; @@ -25,4 +29,11 @@ public OrganizationJoinResponse join(OrganizationJoinRequest request) { request.toEntity(passwordEncoder.encode(request.password()))); return OrganizationJoinResponse.from(organization); } + + @Transactional + public void updateOrganization(Organization authOrganization, OrganizationUpdateRequest request) { + Organization organization = organizationRepository.findById(authOrganization.getId()) + .orElseThrow(() -> new OrganizationException(ORGANIZATION_NOT_FOUND)); + organization.update(request); + } } From 9f307f410215b83146fb1c32841f86faafc61af0 Mon Sep 17 00:00:00 2001 From: Yuje Lee Date: Mon, 29 Jan 2024 00:09:40 +0900 Subject: [PATCH 4/7] =?UTF-8?q?:white=5Fcheck=5Fmark:=20test:=20=EB=82=B4?= =?UTF-8?q?=20=EC=A1=B0=EC=A7=81=20=EC=A1=B0=ED=9A=8C=20&=20=EC=97=85?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20req?= =?UTF-8?q?uest=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http/test.http | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/http/test.http b/http/test.http index aec25ee7..7706c30e 100644 --- a/http/test.http +++ b/http/test.http @@ -74,3 +74,37 @@ Content-Type: application/json ### 보고서 조회 GET http://localhost:8080/api/v1/reports/0 + +### 내 조직 조회 +GET http://localhost:8080/api/v1/organizations/me +Authorization: Bearer {{matsterToken}} + +### 내 조직 수정 +PATCH http://localhost:8080/api/v1/organizations/me +Authorization: Bearer {{matsterToken}} +Content-Type: application/json + +{ + "name": "팀 스포너스 업데이트!!!!", + "email": "sponus@gmail.com 업데이트!!!!", + "password": "password1234 업데이트!!!!", + "location": "none 업데이트!!!!", + "organizationType": "COMPANY", + "suborganizationType": "CLUB", + "managerName": "이가은", + "managerPosition": "Project Manager", + "managerEmail": "test@gmail.com", + "managerPhone": "01012345678", + "managerAvailableDay": "월-금", + "managerAvailableHour": "15:00-18:00", + "managerContactPreference": "EMAIL 업데이트!!!!" +} + +### 내 조직 수정 2 +PATCH http://localhost:8080/api/v1/organizations/me +Authorization: Bearer {{matsterToken}} +Content-Type: application/json + +{ + "name": "팀 스포너스 업데이트!!!!2" +} From 3ecdd679085ec70ee41dfcc3926e7ff04eba54ec Mon Sep 17 00:00:00 2001 From: Yuje Lee Date: Mon, 29 Jan 2024 00:15:38 +0900 Subject: [PATCH 5/7] =?UTF-8?q?:recycle:=20refactor:=20=EC=A1=B0=EC=A7=81?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20=EB=A7=A4=EC=84=9C=EB=93=9C=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20organization?= =?UTF-8?q?=EC=97=90=EC=84=9C=20organizationId=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Organization을 외부에서 찾은 후 전달해야 하는 불필요한 로직 제거를 위함 --- .../organization/controller/OrganizationController.java | 2 +- .../domain/organization/service/OrganizationService.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java b/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java index 5c7ce006..14370e8c 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java @@ -48,7 +48,7 @@ public ApiResponse updateMyOrganization( @AuthOrganization Organization organization, @RequestBody @Valid OrganizationUpdateRequest request ) { - organizationService.updateOrganization(organization, request); + organizationService.updateOrganization(organization.getId(), request); return ApiResponse.onSuccess(null); } } diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java b/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java index 44422bf5..dc82f2b5 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java @@ -31,9 +31,10 @@ public OrganizationJoinResponse join(OrganizationJoinRequest request) { } @Transactional - public void updateOrganization(Organization authOrganization, OrganizationUpdateRequest request) { - Organization organization = organizationRepository.findById(authOrganization.getId()) + public void updateOrganization(Long organizationId, OrganizationUpdateRequest request) { + Organization organization = organizationRepository.findById(organizationId) .orElseThrow(() -> new OrganizationException(ORGANIZATION_NOT_FOUND)); organization.update(request); } + } From aa0fd36d585e024831b4312c5e0a9602cbd96349 Mon Sep 17 00:00:00 2001 From: Yuje Lee Date: Mon, 29 Jan 2024 00:27:54 +0900 Subject: [PATCH 6/7] =?UTF-8?q?:sparkles:=20feat:=20=EB=82=B4=20=EC=A1=B0?= =?UTF-8?q?=EC=A7=81=20=EC=82=AD=EC=A0=9C(soft=20delete,=20=EB=B9=84?= =?UTF-8?q?=ED=99=9C=EC=84=B1=ED=99=94)=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../organization/controller/OrganizationController.java | 7 +++++++ .../sponusbe/domain/organization/entity/Organization.java | 8 ++++++++ .../domain/organization/service/OrganizationService.java | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java b/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java index 14370e8c..cc949760 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/controller/OrganizationController.java @@ -1,5 +1,6 @@ package com.sponus.sponusbe.domain.organization.controller; +import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -51,4 +52,10 @@ public ApiResponse updateMyOrganization( organizationService.updateOrganization(organization.getId(), request); return ApiResponse.onSuccess(null); } + + @DeleteMapping("/me") + public ApiResponse deleteMyOrganization(@AuthOrganization Organization organization) { + organizationService.deactivateOrganization(organization.getId()); + return ApiResponse.onSuccess(null); + } } diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/entity/Organization.java b/src/main/java/com/sponus/sponusbe/domain/organization/entity/Organization.java index 352845e4..6f30d4c6 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/entity/Organization.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/entity/Organization.java @@ -122,4 +122,12 @@ public void update(OrganizationUpdateRequest request) { this.managerContactPreference = request.managerContactPreference() == null ? this.managerContactPreference : request.managerContactPreference(); } + + public void deactivate() { + this.organizationStatus = OrganizationStatus.INACTIVE; + } + + public void activate() { + this.organizationStatus = OrganizationStatus.ACTIVE; + } } diff --git a/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java b/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java index dc82f2b5..91c1276d 100644 --- a/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java +++ b/src/main/java/com/sponus/sponusbe/domain/organization/service/OrganizationService.java @@ -37,4 +37,10 @@ public void updateOrganization(Long organizationId, OrganizationUpdateRequest re organization.update(request); } + @Transactional + public void deactivateOrganization(Long organizationId) { + Organization organization = organizationRepository.findById(organizationId) + .orElseThrow(() -> new OrganizationException(ORGANIZATION_NOT_FOUND)); + organization.deactivate(); + } } From 11c67c2677441fd87710044a3371320181acd1ee Mon Sep 17 00:00:00 2001 From: Yuje Lee Date: Mon, 29 Jan 2024 00:28:50 +0900 Subject: [PATCH 7/7] =?UTF-8?q?:white=5Fcheck=5Fmark:=20test:=20=EB=82=B4?= =?UTF-8?q?=20=EC=A1=B0=EC=A7=81=20=EC=82=AD=EC=A0=9C(soft=20delete)=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20request=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http/test.http | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/http/test.http b/http/test.http index 7706c30e..0335c325 100644 --- a/http/test.http +++ b/http/test.http @@ -108,3 +108,7 @@ Content-Type: application/json { "name": "팀 스포너스 업데이트!!!!2" } + +### 내 조직 삭제 [soft delete] (OrganizationStatus = INACTIVE) +DELETE http://localhost:8080/api/v1/organizations/me +Authorization: Bearer {{matsterToken}}