-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/#38 조직 맴버 관리 - 조직 맴버 권한 변경 #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
1333989
4cb4ebc
c1c35e0
5233625
b1e026c
9fffcdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,4 +125,15 @@ public ResponseEntity<DataResponse<String>> removeMember( | |
| orgService.removeMemberFromOrg(userId, orgId, memberId); | ||
| return ResponseEntity.ok(DataResponse.from("해당 맴버가 조직에서 제외되었습니다.")); | ||
| } | ||
|
|
||
| @PatchMapping("/members/{orgId}/{memberId}") | ||
| public ResponseEntity<DataResponse<OrgResponse.OrgMemberDTO>> updateOrgMembersRole( | ||
| @AuthenticationPrincipal(expression = "userId") Long userId, | ||
| @PathVariable Long orgId, | ||
| @PathVariable Long memberId, | ||
| @RequestBody OrgRequest.UpdateRole dto | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: Controller 메서드에서 OrgRequest.UpdateRole 필드에 Valid 어노테이션 달아서 NotNull 검사 적용되게 해주면 좋을 것 같아요! |
||
| ) { | ||
| OrgResponse.OrgMemberDTO response = orgService.updateOrgMembersRole(userId, orgId, memberId, dto); | ||
| return ResponseEntity.ok(DataResponse.from(response)); | ||
| } | ||
|
Comment on lines
+129
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚨
현재 엔드포인트는 클라이언트가
🐛 수정 방법- `@RequestBody` OrgRequest.UpdateRole dto
+ `@RequestBody` `@Valid` OrgRequest.UpdateRole dto🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -134,4 +134,21 @@ public ResponseEntity<DataResponse<String>> removeMember( | |||||
| @PathVariable Long orgId, | ||||||
| @PathVariable Long memberId | ||||||
| ); | ||||||
|
|
||||||
| @Operation( | ||||||
| summary = "조직 맴버 권한 변경 API", | ||||||
| description = "맴버 권한 변경을 요청한 유저의 권한이 ADMIN인 경우 실행이 가능합니다. memberId에 해당하는 맴버의 권한을 변경시킵니다." | ||||||
| ) | ||||||
| @ApiResponses({ | ||||||
| @ApiResponse(responseCode = "200", description = "성공 (totalCount: 전체 멤버 수)"), | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 200 응답 설명이 잘못된 값으로 복붙되었습니다.
📝 수정 제안-@ApiResponse(responseCode = "200", description = "성공 (totalCount: 전체 멤버 수)"),
+@ApiResponse(responseCode = "200", description = "성공 (변경된 멤버 정보 반환)"),📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| @ApiResponse(responseCode = "401", description = "잘못된 요청을 보낸 경우(ADMIN의 권한 변경)"), | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 잘못된 HTTP 상태 코드: 401이 아니라 400이 맞습니다. HTTP 예시:
📝 수정 제안-@ApiResponse(responseCode = "401", description = "잘못된 요청을 보낸 경우(ADMIN의 권한 변경)"),
+@ApiResponse(responseCode = "400", description = "잘못된 요청을 보낸 경우(ADMIN의 권한 변경)"),📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| @ApiResponse(responseCode = "403", description = "권한이 부족한 경우(요청을 보낸 유저의 권한이 ADMIN이 아닌 경우)"), | ||||||
| @ApiResponse(responseCode = "404", description = "해당 id의 데이터 존재 X") | ||||||
| }) | ||||||
| ResponseEntity<DataResponse<OrgResponse.OrgMemberDTO>> updateOrgMembersRole( | ||||||
| @AuthenticationPrincipal(expression = "userId") Long userId, | ||||||
| @PathVariable Long orgId, | ||||||
| @PathVariable Long memberId, | ||||||
| @RequestBody OrgRequest.UpdateRole dto | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
AI 요약에 따르면 다른 메서드들(예: Line 24 🛡️ 수정 제안-@RequestBody OrgRequest.UpdateRole dto
+@RequestBody `@Valid` OrgRequest.UpdateRole dto🤖 Prompt for AI Agents |
||||||
| ); | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
소프트 삭제된 조직에 대한 권한 변경이 가능합니다 —
OrgStatus.DELETED체크가 누락되었습니다.Organization organization변수를 할당했지만 이후 한 번도 사용하지 않습니다. 기존getOrganizationDetail메서드를 보면:이 체크가 존재합니다. 현재
updateOrgMembersRole에서는 이 체크가 없어서 소프트 삭제된 조직(status = DELETED)에서도 멤버 권한이 변경 가능합니다.🐛 소프트 삭제 체크 추가 제안
Organization organization = orgRepository.findById(orgId) .orElseThrow(() -> new OrgHandler(OrgErrorCode.ORG_NOT_FOUND)); + +// Soft Delete 된 조직이면 예외처리 +if (organization.getStatus() == OrgStatus.DELETED) { + throw new OrgHandler(OrgErrorCode.ORG_SOFT_DELETED); +}🤖 Prompt for AI Agents