HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
♥️
2기 최종 프로젝트 팀별 공간
/
👩‍👩‍👦‍👦
[팀01] 김팽박이
/
🔴
API 명세
/
💰
스터디 그룹 API
💰

스터디 그룹 API


study-group-domain-api.html
114.1KB
스터디 그룹 생성 APIPOST /api/v1/study-groupsRequestResponse메인 페이지 스터디 그룹 리스트 APIGET /api/v1/study-groupsRequestParams * size 미 입력시 디폴트 20RequestResponse멤버스 스터디 그룹 리스트 APIGET /api/v1/study-groups/members/{memberId}RequestParamsRequestResponse스터디 그룹 상세 APIGET /api/v1/study-groups/{studyGroupId}RequestResponse스터디 그룹 수정 APIPATCH /api/v1/study-groups/{studyGroupId}RequestResponse스터디 그룹 삭제 APIDELETE /api/v1/study-groups/{studyGroupId}RequestResponse스터디 그룹 문의댓글 생성 APIPOST /api/v1/study-groups/{studyGroupId}/questionsRequestResponse스터디 그룹 문의댓글 리스트 APIGET /api/v1/study-groups/{studyGroupId}/questionsRequestParamsRequestResponse스터디 그룹 문의댓글 수정 APIPATCH /api/v1/study-groups/{studyGroupId}/questions/{studyGroupQuestionId}RequestResponse스터디 그룹 문의댓글 삭제 APIDELETE /api/v1/study-groups/{studyGroupId}/questions/{studyGroupQuestionId}RequestResponse 스터디 그룹 가입 신청 APIPOST /api/v1/study-groups/{studyGroupId}/membersRequestResponse스터디 그룹 멤버 관리 페이지 APIGET /api/v1/study-groups/{studyGroupId}/membersRequestResponse스터디 그룹 가입수락 APIPATCH /api/v1/study-groups/{studyGroupId}/members/{studyGroupMemberId} RequestResponse스터디 그룹 멤버 삭제 APIDELETE /api/v1/study-groups/{studyGroupId}/members/{studyGroupMemberId} RequestResponse에러 리스폰스 (공통 형식)ENUM 타입스터디 주제 (topic)지역 정보 (region)Mbti(mbti)스터디 멤버 역할(studyGroupMemberRole)위 목록에 없는 ENUM 값을 보내주면 다음과 같이 변환할 수 없다는 에러가 발생하게됨스터디 그룹 에러코드

스터디 그룹 생성 API

POST /api/v1/study-groups

 

Request

notion image
{ "imageFile": "이미지 파일", "title": "스터디명", "topic": "스터디 주제", "isOnline": false, "region": "SEOUL", "preferredMBTIs": ["IIII", "EEEE", "IIEE"], "numberOfRecruits": 5, "startDateTime": "2000-02-22 10:00:00", "endDateTime": "2000-02-22 10:00:00", "description": "this is new study group" }
 

Response

notion image
header { "Location": "/api/v1/study-groups/{studyGroupId} } body { "studyGroupId": 1 }
 

메인 페이지 스터디 그룹 리스트 API

GET /api/v1/study-groups

 

RequestParams * size 미 입력시 디폴트 20

* 나머지 조건들은 입력되면 해당 조건에 맞게 조회해서 결과 반환
mbti, topic, region, studyGroupMemberRole, lastStudyGroupId, size
 

Request

바디 데이터 None
 

Response

notion image
{ "contents": [ { "studyGroupId": 1, "memberId": 2, "thumnailUrl": "www.aws.s3.blabla.png", "topic": "자바스크립트", "title": "자바스크립트 헬로우 월드", "preferredMBTIs": ["IIII", "EEEE", "FFFF"], "region": "서울시", "startDateTime": "2000-02-22 10:00:00", "endDateTime": "2000-02-22 10:00:00", "numberOfMembers": 0, "numberOfRecruits": 5 // }, ... ], "hasNext": true }
 

멤버스 스터디 그룹 리스트 API

GET /api/v1/study-groups/members/{memberId}

 

RequestParams

* studyGroupMemberRole 미입력시 자기가 참여했던, 생성했던 스터디 목록 전부 가져옴. studyGroupMemberRole=STUDY_MEMBER 선택시 참여했던 스터디 목록, studyGroupMemberRole=STUDY_LEADER 선택시 생성했던 스터디 목록을 반환 * size 미 입력시 디폴트 20
* 나머지 조건들은 입력되면 해당 조건에 맞게 조회해서 결과 반환
mbti, topic, region, studyGroupMemberRole, lastStudyGroupId, size
 

Request

바디 데이터 None
 

Response

notion image
{ "contents": [ { "studyGroupId": 1, "memberId": 2, "imageUrl": "www.aws.s3.blabla.png", "topic": "자바스크립트", "title": "자바스크립트 헬로우 월드", "preferredMBTIs": ["IIII", "EEEE", "FFFF"], "region": "서울시", "startDateTime": "2000-02-22 10:00:00", "endDateTime": "2000-02-22 10:00:00", "numberOfMembers": 0, "numberOfRecruits": 5 // }, ... ], "hasNext": true }
 

스터디 그룹 상세 API

GET /api/v1/study-groups/{studyGroupId}

 

Request

바디 데이터 None
 

Response

notion image
{ "studyGroupId": 1, "topic": "자바스크립트", "title": "자바스크립트 헬로우 월드", "imageUrl": "www.aws.s3.blabla.png", "leader": { "memberId": 1, "profileImageUrl": "imageUrl", "nickname": "프룽이", "field": "프론트엔드", "career": "N년차", "mbti": "INTP", "studyGroupMemberRole": "리더" }, "preferredMbtis": ["IIII", "EEEE", "FFFF"], "isOnline": false, "region": "서울시", "startDateTime": "2000-02-22 10:00:00", "endDateTime": "2000-02-22 10:00:00" "numberOfMembers": 0, "numberOfRecruits": 5, "description": "blablabla" }
 

스터디 그룹 수정 API

PATCH /api/v1/study-groups/{studyGroupId}

 

Request

notion image
{ "title": "수정 제목", "imageFile": "asdf.PNG" "description": "수정 상세설명" }
 

Response

notion image
body { "studyGroupId": 1 }
 

스터디 그룹 삭제 API

DELETE /api/v1/study-groups/{studyGroupId}

 

Request

바디 데이터 None
 

Response

notion image
바디 데이터 None

스터디 그룹 문의댓글 생성 API

POST /api/v1/study-groups/{studyGroupId}/questions

 

Request

notion image
{ "parentId": null, //상위 댓글이 있으면 상위 댓글의 studyGroupQuestionId "contents": "blabla" }
 

Response

notion image
{ "studyGroupQuestionId": 1, "parentId": null, "profileImageUrl": "http://prgrms.stuti/image1.jpg", "memberId": 1, "nickname": "팽", "contents": "글이 좋네요 어떤스터디에 참여하고 계신가요?", "updatedAt": "2000-02-22 10:00:00" }
 

스터디 그룹 문의댓글 리스트 API

GET /api/v1/study-groups/{studyGroupId}/questions

 

RequestParams

size, lastStudyGroupQuestionId
 

Request

바디 데이터 None
 

Response

notion image
notion image
"contents": [ { "studyGroupQuestionId": 1, //댓글 "parentId": null, "profileImageUrl": "www.aws.s3.png", "memberId": 2, "nickname": "프룽이", "contents": "참여하고 싶어요!", "updatedAt": "2022-02-22 10:00", "children": [ "studyGroupQuestionId": 4, "parentId": 1, "profileImageUrl": "www.aws.s3.png", "memberId": 3, "nickname": "프룽이", "contents": "참여하고 싶어요!", "updatedAt": "2022-02-22 00:00:00" ] }, ... ], "hasNext": true, "totalElements": 50
 

스터디 그룹 문의댓글 수정 API

PATCH /api/v1/study-groups/{studyGroupId}/questions/{studyGroupQuestionId}

 

Request

notion image
{ "contents": "update contents" }
 

Response

notion image
{ "studyGroupQuestionId": 1, "parentId": null, "profileImageUrl": "http://prgrms.stuti/image1.jpg", "memberId": 1, "nickname": "팽", "contents": "글이 좋네요 어떤스터디에 참여하고 계신가요?", "updatedAt": "2000-02-22 10:00:00" }
 

스터디 그룹 문의댓글 삭제 API

DELETE /api/v1/study-groups/{studyGroupId}/questions/{studyGroupQuestionId}

 

Request

바디 데이터 None
 

Response

notion image
{ "studyGroupQuestionId": 1, "parentId": null, "profileImageUrl": "http://prgrms.stuti/image1.jpg", "memberId": 1, "nickname": "팽", "contents": "글이 좋네요 어떤스터디에 참여하고 계신가요?", "updatedAt": "2000-02-22 10:00:00" }
 

스터디 그룹 가입 신청 API

POST /api/v1/study-groups/{studyGroupId}/members

 

Request

바디 데이터 None
 

Response

notion image
바디 { "studyGroupMemberId": 1 }
 

스터디 그룹 멤버 관리 페이지 API

GET /api/v1/study-groups/{studyGroupId}/members

 

Request

바디 데이터 None
 

Response

사진이 옛날거라 변경할게요
notion image
 
{ "studyGroupId": 1, "topic": "프론트엔드", "title": "자바스크립트 헬로우 월드", "numberOfMembers": 2, "numberOfRecruits": 5, "studyMembers": [ { "studyGroupMemberId": 1, "profileImageUrl": "www.aws.s3.png", "nickname": "프룽이", "field": "프론트엔드", "career": "N년차", "mbti": "INTP", "studyGroupMemberRole": "MEMBER" }, ... ], "numberOfApplicant": 2, "studyApplicants": [ { "studyGroupMemberId": 2, "profileImageUrl": "imageUrl", "nickname": "프룽이", "field": "프론트엔드", "career": "N년차", "mbti": "INTP", "studyGroupMemberRole": "APPLICANT" }, ... ] }
 

스터디 그룹 가입수락 API

PATCH /api/v1/study-groups/{studyGroupId}/members/{studyGroupMemberId}

 

Request

바디 데이터 None
 

Response

notion image
body { "studyGroupMemberId": 1 }
 

스터디 그룹 멤버 삭제 API

DELETE /api/v1/study-groups/{studyGroupId}/members/{studyGroupMemberId}

 

Request

바디 데이터 None
 

Response

notion image
바디 데이터 None
 

에러 리스폰스 (공통 형식)

notion image
//필드 에러가 생길 경우 { "code": "C001", //커스텀 에러 코드 "message": "empty input value", //간단한 에러 메시지 "errors": [ { "field": "name", //에러가 발생한 필드 "value": " ", //사용자가 입력한 값 "cause": "빈 값이 입력됨" //간단한 메세지 }, ... ] } //필드 에러가 없는 경우 { "code": "C001", "message": "empty input value", "errors": [] }
 

ENUM 타입

스터디 주제 (topic)

FRONTEND("프론트엔드"), BACKEND("백엔드"), IOS("IOS"), ANDROID("안드로이드"), AI("인공지능"), CS("컴퓨터 사이언스"), INFRA("인프라"), DEV_OPS("데브옵스"), BIG_DATA("빅 데이터"), EMBEDDED("임베디드"), SECURITY("보안"), NETWORK("네트워크")
 

지역 정보 (region)

ONLINE("온라인"), SEOUL("서울"), BUSAN("부산"), DAEGU("대구"), INCHEON("인천"), GWANGJU("광주"), DAEJEON("대전"), ULSAN("울산"), JEJU("제주");
 

Mbti(mbti)

ENFJ, ENTJ, ENFP, ENTP, ESFP, ESFJ, ESTP, ESTJ, INFP, INFJ, INTP, ISTP, ISFP, ISFJ, ISTJ, INTJ
 

스터디 멤버 역할(studyGroupMemberRole)

STUDY_LEADER("리더"), STUDY_MEMBER("멤버"), STUDY_APPLICANT("신청자")
 

위 목록에 없는 ENUM 값을 보내주면 다음과 같이 변환할 수 없다는 에러가 발생하게됨

notion image
 

스터디 그룹 에러코드

//스터디 그룹 시작, 종료 일자가 올바르지 않은 경우 INVALID_STUDY_PERIOD("SG001", "Invalid study period", HttpStatus.BAD_REQUEST), //스터디 그룹을 찾지 못한 경우 NOT_FOUND_STUDY_GROUP("SG002", "Not found study group", HttpStatus.NOT_FOUND), //스터디 그룹의 리더의 권한이 필요한 페이지에 리더가 아닌 멤버가 접근하는 경우 NOT_STUDY_LEADER("SG003", "Not study leader", HttpStatus.BAD_REQUEST), //이미 스터디 그룹에 신청 또는 참여하고 있는 멤버가 다시 해당 스터디 그룹에 신청하게 될 경우 EXISTING_STUDY_GROUP_MEMBER("SG004", "Existing study group member", HttpStatus.BAD_REQUEST), //스터디 그룹 멤버를 찾지 못한 경우 NOT_FOUND_STUDY_GROUP_MEMBER("SG005", "Not found study group member", HttpStatus.NOT_FOUND), //스터디 그룹 문의댓글을 찾지 못한 경우 NOT_FOUND_STUDY_GROUP_QUESTION("SG006", "Not found study group question", HttpStatus.NOT_FOUND), //스터디 그룹 문의댓글을 작성하지 않은 사람이 수정 또는 삭제를 하려고 접근하는 경우 NOT_MATCH_WRITER("SG007", "Not match writer", HttpStatus.BAD_REQUEST), //스터디 그룹 문의댓글이 작성되어있는 스터디 그룹의 아이디와 일치하지 않는 경우 NOT_MATCH_STUDY_GROUP("SG008", "Not match study group", HttpStatus.BAD_REQUEST),
 
 
notion image
 
 
개행, 예외 처리 대 소문자, 에러 코드 메시지 대 소문자, Custom 레포 이름, 테스트 메소드 이름, no offset cursor 네이밍 뭘로, 도메인 당 예외 익셉션 하나, 주석 제거