Skip to content

Commit 435429f

Browse files
Merge pull request #42 from prgrms-web-devcourse-final-project/feature/EA3-77-study-api
[EA3-77] feature: 스터디 스웨거 작성
2 parents 8017b57 + 8d47ad2 commit 435429f

16 files changed

+349
-14
lines changed

src/main/java/grep/neogul_coder/domain/study/Study.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,5 @@ public class Study extends BaseEntity {
4646
@Column(nullable = false)
4747
private String imageUrl;
4848

49-
private boolean isActivated;
50-
51-
private boolean isDeleted;
49+
private boolean isFinished;
5250
}

src/main/java/grep/neogul_coder/domain/study/StudyMember.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,4 @@ public class StudyMember extends BaseEntity {
1919

2020
@Enumerated(EnumType.STRING)
2121
private StudyMemberRole role;
22-
23-
private Boolean isDeleted = false;
2422
}
Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,85 @@
11
package grep.neogul_coder.domain.study.controller;
22

3+
import grep.neogul_coder.domain.study.controller.dto.request.DelegateLeaderRequest;
4+
import grep.neogul_coder.domain.study.controller.dto.request.ExtendStudyRequest;
35
import grep.neogul_coder.domain.study.controller.dto.request.StudyCreateRequest;
6+
import grep.neogul_coder.domain.study.controller.dto.request.StudyEditRequest;
7+
import grep.neogul_coder.domain.study.controller.dto.response.*;
48
import grep.neogul_coder.global.response.ApiResponse;
59
import org.springframework.web.bind.annotation.*;
610

7-
@RequestMapping("/study")
11+
import java.util.List;
12+
13+
@RequestMapping("/api/studies")
814
@RestController
915
public class StudyController implements StudySpecification {
1016

11-
@PostMapping("/new")
17+
@GetMapping
18+
public ApiResponse<List<StudyListResponse>> getStudyList() {
19+
return ApiResponse.success(List.of(new StudyListResponse()));
20+
}
21+
22+
@GetMapping("/{studyId}/header")
23+
public ApiResponse<StudyHeaderResponse> getStudyHeader(@PathVariable("studyId") Long studyId) {
24+
return ApiResponse.success(new StudyHeaderResponse());
25+
}
26+
27+
@GetMapping("/{studyId}")
28+
public ApiResponse<StudyResponse> getStudy(@PathVariable("studyId") Long studyId) {
29+
return ApiResponse.success(new StudyResponse());
30+
}
31+
32+
@GetMapping("/{studyId}/info")
33+
public ApiResponse<StudyInfoResponse> getStudyInfo(@PathVariable("studyId") Long studyId) {
34+
return ApiResponse.success(new StudyInfoResponse());
35+
}
36+
37+
@GetMapping("/{studyId}/me")
38+
public ApiResponse<StudyMyInfoResponse> getStudyMyInfo(@PathVariable("studyId") Long studyId) {
39+
return ApiResponse.success(new StudyMyInfoResponse());
40+
}
41+
42+
@PostMapping
1243
public ApiResponse<Void> createStudy(@RequestBody StudyCreateRequest request) {
1344
return ApiResponse.noContent("스터디가 생성되었습니다.");
1445
}
46+
47+
@PutMapping("/{studyId}")
48+
public ApiResponse<Void> editStudy(@PathVariable("studyId") Long studyId,
49+
@RequestBody StudyEditRequest request) {
50+
return ApiResponse.noContent("스터디가 수정되었습니다.");
51+
}
52+
53+
@DeleteMapping("/{studyId}")
54+
public ApiResponse<Void> deleteStudy(@PathVariable("studyId") Long studyId) {
55+
return ApiResponse.noContent("스터디가 삭제되었습니다.");
56+
}
57+
58+
@DeleteMapping("/{studyId}/me")
59+
public ApiResponse<Void> leaveStudy(@PathVariable("studyId") Long studyId) {
60+
return ApiResponse.noContent("스터디에서 탈퇴되었습니다.");
61+
}
62+
63+
@DeleteMapping("/{studyId}/users/{userId}")
64+
public ApiResponse<Void> deleteMember(@PathVariable("studyId") Long studyId,
65+
@PathVariable("userId") Long userId) {
66+
return ApiResponse.noContent("해당 스터디원이 강퇴되었습니다.");
67+
}
68+
69+
@PostMapping("/{studyId}/delegate")
70+
public ApiResponse<Void> delegateLeader(@PathVariable("studyId") Long studyId,
71+
@RequestBody DelegateLeaderRequest request) {
72+
return ApiResponse.noContent("스터디장이 위임되었습니다.");
73+
}
74+
75+
@PostMapping("/{studyId}/extend")
76+
public ApiResponse<Void> extendStudy(@PathVariable("studyId") Long studyId,
77+
@RequestBody ExtendStudyRequest request) {
78+
return ApiResponse.noContent("스터디가 연장되었습니다.");
79+
}
80+
81+
@PostMapping("/{studyId}/join")
82+
public ApiResponse<Void> joinExtendStudy(@PathVariable("studyId") Long studyId) {
83+
return ApiResponse.noContent("연장된 스터디에 참여하였습니다.");
84+
}
1585
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,55 @@
11
package grep.neogul_coder.domain.study.controller;
22

3+
import grep.neogul_coder.domain.study.controller.dto.request.DelegateLeaderRequest;
4+
import grep.neogul_coder.domain.study.controller.dto.request.ExtendStudyRequest;
35
import grep.neogul_coder.domain.study.controller.dto.request.StudyCreateRequest;
6+
import grep.neogul_coder.domain.study.controller.dto.request.StudyEditRequest;
7+
import grep.neogul_coder.domain.study.controller.dto.response.*;
48
import grep.neogul_coder.global.response.ApiResponse;
59
import io.swagger.v3.oas.annotations.Operation;
610
import io.swagger.v3.oas.annotations.tags.Tag;
711

12+
import java.util.List;
13+
814
@Tag(name = "Study", description = "스터디 API")
915
public interface StudySpecification {
1016

17+
@Operation(summary = "스터디 목록 조회", description = "가입한 스터디 목록을 조회합니다.")
18+
ApiResponse<List<StudyListResponse>> getStudyList();
19+
20+
@Operation(summary = "스터디 헤더 조회", description = "스터디 헤더 정보를 조회합니다.")
21+
ApiResponse<StudyHeaderResponse> getStudyHeader(Long studyId);
22+
23+
@Operation(summary = "스터디 조회", description = "스터디를 조회합니다.")
24+
ApiResponse<StudyResponse> getStudy(Long studyId);
25+
26+
@Operation(summary = "스터디 정보 조회", description = "스터디장이 스터디 정보를 조회합니다.")
27+
ApiResponse<StudyInfoResponse> getStudyInfo(Long studyId);
28+
29+
@Operation(summary = "스터디 내 정보 조회", description = "스터디의 내 정보를 조회합니다.")
30+
ApiResponse<StudyMyInfoResponse> getStudyMyInfo(Long studyId);
31+
1132
@Operation(summary = "스터디 생성", description = "새로운 스터디를 생성합니다.")
1233
ApiResponse<Void> createStudy(StudyCreateRequest request);
34+
35+
@Operation(summary = "스터디 수정", description = "스터디를 수정합니다.")
36+
ApiResponse<Void> editStudy(Long studyId, StudyEditRequest request);
37+
38+
@Operation(summary = "스터디 삭제", description = "스터디를 삭제합니다.")
39+
ApiResponse<Void> deleteStudy(Long studyId);
40+
41+
@Operation(summary = "스터디 탈퇴", description = "스터디를 탈퇴합니다.")
42+
ApiResponse<Void> leaveStudy(Long studyId);
43+
44+
@Operation(summary = "스터디원 강퇴", description = "스터디원을 강퇴합니다.")
45+
ApiResponse<Void> deleteMember(Long studyId, Long userId);
46+
47+
@Operation(summary = "스터디장 위임", description = "스터디원에게 스터디장을 위임합니다.")
48+
ApiResponse<Void> delegateLeader(Long studyId, DelegateLeaderRequest request);
49+
50+
@Operation(summary = "스터디 연장", description = "스터디장이 스터디를 연장합니다.")
51+
ApiResponse<Void> extendStudy(Long studyId, ExtendStudyRequest request);
52+
53+
@Operation(summary = "연장 스터디 참여", description = "스터디원이 연장된 스터디에 참여합니다.")
54+
ApiResponse<Void> joinExtendStudy(Long studyId);
1355
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package grep.neogul_coder.domain.study.controller.dto.request;
2+
3+
import io.swagger.v3.oas.annotations.media.Schema;
4+
import lombok.Getter;
5+
6+
@Getter
7+
public class DelegateLeaderRequest {
8+
9+
@Schema(description = "스터디장을 위임할 회원 번호", example = "5")
10+
private Long newLeaderId;
11+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package grep.neogul_coder.domain.study.controller.dto.request;
2+
3+
import io.swagger.v3.oas.annotations.media.Schema;
4+
import lombok.Getter;
5+
6+
import java.time.LocalDate;
7+
8+
@Getter
9+
public class ExtendStudyRequest {
10+
11+
@Schema(description = "연장 스터디의 종료일", example = "2025-07-15")
12+
private LocalDate newEndDate;
13+
}

src/main/java/grep/neogul_coder/domain/study/controller/dto/request/StudyCreateRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class StudyCreateRequest {
3838
@Schema(description = "종료일", example = "2025-07-28")
3939
private LocalDate endDate;
4040

41-
@Schema(description = "스터디 소개", example = "자바 스터디")
41+
@Schema(description = "스터디 소개", example = "자바 스터디입니다.")
4242
private String introduction;
4343

4444
@NotBlank
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package grep.neogul_coder.domain.study.controller.dto.request;
2+
3+
import grep.neogul_coder.domain.study.enums.Category;
4+
import grep.neogul_coder.domain.study.enums.StudyType;
5+
import io.swagger.v3.oas.annotations.media.Schema;
6+
import jakarta.validation.constraints.NotBlank;
7+
import jakarta.validation.constraints.NotNull;
8+
import lombok.Getter;
9+
10+
import java.time.LocalDate;
11+
12+
@Getter
13+
public class StudyEditRequest {
14+
15+
@NotBlank
16+
@Schema(description = "스터디 이름", example = "자바 스터디")
17+
private String name;
18+
19+
@NotNull
20+
@Schema(description = "카테고리", example = "IT")
21+
private Category category;
22+
23+
@Schema(description = "정원", example = "4")
24+
private int capacity;
25+
26+
@NotNull
27+
@Schema(description = "타입", example = "ONLINE")
28+
private StudyType studyType;
29+
30+
@Schema(description = "지역", example = "서울")
31+
private String location;
32+
33+
@Schema(description = "시작일", example = "2025-07-15")
34+
private LocalDate startDate;
35+
36+
@Schema(description = "스터디 소개", example = "자바 스터디입니다.")
37+
private String introduction;
38+
39+
@NotBlank
40+
@Schema(description = "대표 이미지", example = "http://localhost:8083/image.jpg")
41+
private String imageUrl;
42+
}

src/main/java/grep/neogul_coder/domain/study/controller/dto/response/StudyCreateResponse.java

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package grep.neogul_coder.domain.study.controller.dto.response;
2+
3+
import grep.neogul_coder.domain.study.enums.StudyType;
4+
import io.swagger.v3.oas.annotations.media.Schema;
5+
import lombok.Getter;
6+
7+
@Getter
8+
public class StudyHeaderResponse {
9+
10+
@Schema(description = "스터디 이름", example = "자바 스터디")
11+
private String name;
12+
13+
@Schema(description = "스터디 소개", example = "자바 스터디")
14+
private String introduction;
15+
16+
@Schema(description = "대표 이미지", example = "http://localhost:8083/image.jpg")
17+
private String imageUrl;
18+
19+
@Schema(description = "타입", example = "ONLINE")
20+
private StudyType studyType;
21+
22+
@Schema(description = "지역", example = "서울")
23+
private String location;
24+
}

0 commit comments

Comments
 (0)