-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from NOzigak/feature/recruitt
feat:studymember조회
- Loading branch information
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,4 +119,6 @@ public ResponseEntity<ResultDto<String>> approveMember(@PathVariable Long study_ | |
|
||
|
||
} | ||
|
||
|
||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/hamsung/hamsung_project/controller/StudyMemberController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,34 @@ | ||
package hamsung.hamsung_project.controller; | ||
|
||
import hamsung.hamsung_project.dto.ApplyingSummaryDto; | ||
import hamsung.hamsung_project.dto.MemberSummaryDto; | ||
import hamsung.hamsung_project.service.StudyMemberService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
||
import java.util.List; | ||
|
||
@Controller | ||
@RequiredArgsConstructor | ||
public class StudyMemberController { | ||
private final StudyMemberService studyMemberService; | ||
|
||
//스터디 멤버 조회 | ||
@GetMapping("studymember/{study_id}") | ||
public ResponseEntity<List<MemberSummaryDto>> findAllMembers(@PathVariable Long study_id) { | ||
try { | ||
List<MemberSummaryDto> memberList = studyMemberService.findAllMembers(study_id); | ||
return ResponseEntity.status(HttpStatus.OK).body(memberList); | ||
} catch (IllegalArgumentException e) { | ||
return new ResponseEntity<>(HttpStatus.NOT_FOUND); | ||
} | ||
// List<ApplySummaryDto> appliedList=studyMemberService.findAllAppliers(study_id); | ||
// return ResponseEntity.status(HttpStatus.OK).body(appliedList); | ||
} | ||
|
||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/hamsung/hamsung_project/dto/MemberSummaryDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package hamsung.hamsung_project.dto; | ||
|
||
import hamsung.hamsung_project.entity.StudyMember; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Getter | ||
@Setter | ||
@ToString | ||
@AllArgsConstructor | ||
public class MemberSummaryDto { | ||
private Long id; | ||
private String username; | ||
|
||
public static MemberSummaryDto createSummaryDto (StudyMember studyMember){ | ||
if (studyMember == null || studyMember.getUsers() == null) { | ||
throw new IllegalArgumentException("스터디 멤버나 스터디는 null이 될 수 없음"); | ||
} | ||
|
||
return new MemberSummaryDto( | ||
studyMember.getUsers().getId(), | ||
studyMember.getUsers().getUsername() | ||
); | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters