Skip to content
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

Feat : 크루 탈퇴하기 #74

Merged
merged 3 commits into from
Aug 5, 2024
Merged

Feat : 크루 탈퇴하기 #74

merged 3 commits into from
Aug 5, 2024

Conversation

hd0rable
Copy link
Member

@hd0rable hd0rable commented Aug 4, 2024

요약 (Summary)

  • 크루 탈퇴하기 화면에 대한 api를 구현했습니다. 크루탈퇴 명세서
  • 크루를 탈퇴하고자 하는 Member가 CREW일 경우에만 탈퇴가능하도록 구현했습니다.

🔑 변경 사항 (Key Changes)

  • BaseExceptionResponseStatus 추가 작성 : 크루 탈퇴 관련한 예외를 추가 작성했습니다.
  • CrewService.cancelCrew 작성 : 크루 탈퇴하기 서비스를 작성했습니다.
  • CrewController.deleteCrew 작성 : 크루 탈퇴하기 컨트롤러를 작성했습니다.

📝 리뷰 요구사항 (To Reviewers)

  • 크루 탈퇴가 제대로되는지
  • CAPTAIN 인 멤버가 탈퇴를 하려고할떄 적절한 예외처리가 일어나는지
  • 접근할 수 없는 크루에 대한 예외처리가 제대로 되는지

확인 방법

코드를 실행시키고,mysql workbench에서 다음 쿼리문을 실행시켜주세요.
첫번째 member를 리뷰자의 정보로 수정해야합니다.

use likelion12;

INSERT INTO exercise (created_at, modified_at,exercise_name, status) VALUES
('2024-06-30 12:00:00.000000', '2024-06-30 12:30:00.000000', '축구', 'ACTIVE');
INSERT INTO exercise (created_at, modified_at,exercise_name, status) VALUES
('2024-06-30 12:00:00.000000', '2024-06-30 12:30:00.000000', '농구', 'ACTIVE');

INSERT INTO member (created_at, modified_at, email, member_img, member_name, gender,exercise_id,status) VALUES
('2024-06-30 12:00:00.000000', '2024-06-30 12:30:00.000000', '[email protected]', '프로필 이미지', '강희진', 'F', 1,'ACTIVE'); -- 리뷰자 계정
INSERT INTO member (created_at, modified_at, email, member_img, member_name, gender,exercise_id,status) VALUES
('2024-07-30 12:00:00.000000', '2024-07-30 12:30:00.000000', '[email protected]', '프로필 이미지', '강의진', 'F', 1,'ACTIVE');
INSERT INTO member (created_at, modified_at, email, member_img, member_name, gender,exercise_id,status) VALUES
('2024-07-30 12:00:00.000000', '2024-07-30 12:30:00.000000', 'kanghuijin123@gmail.com', '프로필 이미지', '강', 'F', 2,'ACTIVE');

INSERT INTO activity_region (created_at, modified_at, activity_region_name,status) VALUES
('2024-06-30 12:00:00.000000', '2024-06-30 12:30:00.000000', '광진구','ACTIVE');
INSERT INTO facility (created_at, modified_at, facility_name, facility_city,facility_dong,facility_gu, facility_phone, status) VALUES
('2024-06-30 12:00:00.000000', '2024-06-30 12:30:00.000000', '광진구 체육관', '서울시','화양동','광진구' ,'000-0000','ACTIVE');
INSERT INTO facility (created_at, modified_at, facility_name, facility_city,facility_dong,facility_gu, facility_phone, status) VALUES
('2024-06-30 12:00:00.000000', '2024-06-30 12:30:00.000000', '광진구 체육관2', '서울시2','화양동2','광진구2' ,'000-00002','ACTIVE');

INSERT INTO crew (crew_cost, total_recruits, activity_region_id, created_at, exercise_id, facility_id, modified_at, comment, comment_simple, crew_img, crew_name, gender, level, status) VALUES
(1500, 50, 1, '2024-08-01 09:00:00', 1, 2, '2024-08-01 09:00:00', '크루1입니다~', '크루1', '크루1.png', '크루1', 'M', 'A', 'ACTIVE');
INSERT INTO crew (crew_cost, total_recruits, activity_region_id, created_at, exercise_id, facility_id, modified_at, comment, comment_simple, crew_img, crew_name, gender, level, status) VALUES
(1200, 40, 1, '2024-08-02 10:00:00', 1, 2, '2024-08-02 10:00:00', '크루2입니다~', '크루2', '크루2.png', '크루2', 'F', 'S', 'ACTIVE');
INSERT INTO crew (crew_cost, total_recruits, activity_region_id, created_at, exercise_id, facility_id, modified_at, comment, comment_simple, crew_img, crew_name, gender, level, status) VALUES
(1200, 40, 1, '2024-08-02 10:00:00', 2, 1, '2024-08-02 10:00:00', '크루3입니다~', '크루3', '크루3.png', '크루3', 'F', 'S', 'ACTIVE');

INSERT INTO member_crew (role, status, crew_id, member_id, created_at, modified_at) VALUES
('CAPTAIN', 'ACTIVE', 1, 1, '2024-08-01 09:00:00', '2024-08-01 09:00:00'), -- 첫 번째 크루, 첫 번째 멤버(CAPTAIN)
('CREW', 'ACTIVE', 1, 3, '2024-08-01 09:00:00', '2024-08-01 09:00:00'), -- 첫 번째 크루, 세 번째 멤버
('CREW', 'ACTIVE', 2, 1, '2024-08-02 10:00:00', '2024-08-02 10:00:00'), -- 두 번째 크루, 첫 번째 멤버
('CREW', 'ACTIVE', 2, 2, '2024-08-02 10:00:00', '2024-08-02 10:00:00'), -- 두 번째 크루, 두 번째 멤버
('CAPTAIN', 'ACTIVE', 2, 3, '2024-08-02 10:00:00', '2024-08-02 10:00:00'), -- 두 번째 크루, 세 번째 멤버
('CAPTAIN', 'ACTIVE', 3, 2, '2024-08-02 10:00:00', '2024-08-02 10:00:00'); -- 세 번째 크루, 두 번째 멤버

그 다음 카카오 소셜 로그인을 해주세요.

https://kauth.kakao.com/oauth/authorize?client_id=220ac935aaf5aa43884ee21823d82237&redirect_uri=http://localhost:8080/auth/kakao/callback&response_type=code

엑세스토큰을 postman에 넣고 테스트 해주세요

다음 주소로 PATCH 요청 보내주세요

http://localhost:8080/crew/cancel?crewId=1

crewId값을 변경해 가면서 변경사항을 확인하시면 됩니다!

image

크루 탈퇴전 멤버크루의 데이터베이스 상태입니다.

image

image

크루아이디2 CREW 권한을 가진 멤버아이디1이 크루2 탈퇴를 했을때 정상적으로 상태값이 DELETE로 변경되는것을 확인할 수 있습니다!

image

반면 크루아이디1의 CAPTAIN 권한을 가진 멤버아이디1이 크루1 탈퇴를 하려고하면 위와같은 예외처리가 되어야 성공입니다!

image

크루아이디3에 참여하고 있지않은 멤버아이디1이 크루3 탈퇴를 하려고했을때
위와같은 메세지가 뜨면 성공입니다!

image

크루아이디4 이상부터는 존재하지않는 크루에대한 예외처리 메세지가 뜨면 성공입니다!

크루아이디1 - > 크루탈퇴 불가 (CAPTAIN이라서)
크루아이디2 - > 크루탈퇴
크루아이디3 - > 크루에 참여하지 못한 상태라 삭제 불가
크루아이디4 이상 -> 존재하지 않는 크루에대한 예외처리

@hd0rable hd0rable linked an issue Aug 4, 2024 that may be closed by this pull request
Copy link
Member

@jsilver01 jsilver01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정상작동 포스트맨으로 모두 확인했습니다! 수고하셨습니다~

@jsilver01 jsilver01 merged commit 43fd53b into develop Aug 5, 2024
@jsilver01 jsilver01 deleted the 53-be-크루-탈퇴하기 branch August 5, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BE] 크루 탈퇴하기
2 participants