|
1 | 1 | package com.ODG.ODG_back.controller; |
2 | 2 |
|
| 3 | +import com.ODG.ODG_back.dto.participant.request.ParticipantDeletionRequestDto; |
| 4 | +import com.ODG.ODG_back.dto.participant.request.ParticipantRegisterRequestDto; |
| 5 | +import com.ODG.ODG_back.dto.participant.request.ParticipantUpdateRequestDto; |
| 6 | +import com.ODG.ODG_back.dto.participant.response.ParticipantListResponseDto; |
| 7 | +import com.ODG.ODG_back.dto.participant.response.ParticipantRegisterResponseDto; |
| 8 | +import com.ODG.ODG_back.service.MeetingService; |
| 9 | +import com.ODG.ODG_back.service.ParticipantService; |
| 10 | +import lombok.RequiredArgsConstructor; |
| 11 | +import org.springframework.http.ResponseEntity; |
| 12 | +import org.springframework.web.bind.annotation.*; |
| 13 | + |
| 14 | +import java.util.List; |
| 15 | + |
| 16 | + |
| 17 | +@RestController |
| 18 | +@RequestMapping("/meetings/{linkCode}/participants") |
| 19 | +@RequiredArgsConstructor |
3 | 20 | public class ParticipantController { |
| 21 | + |
| 22 | + private final ParticipantService participantService; |
| 23 | + private final MeetingService meetingService; |
| 24 | + |
| 25 | + @PostMapping("/register") |
| 26 | + public ResponseEntity<ParticipantRegisterResponseDto> addParticipant(@PathVariable String linkCode, @RequestBody ParticipantRegisterRequestDto participantRegisterRequestDto){ |
| 27 | + ParticipantRegisterResponseDto participantRegisterResponseDto = participantService.addParticipant(linkCode, participantRegisterRequestDto); |
| 28 | + return ResponseEntity.ok(participantRegisterResponseDto); |
| 29 | + } |
| 30 | + |
| 31 | + @DeleteMapping("/delete") |
| 32 | + public ResponseEntity<Void> deleteParticipant(@PathVariable String linkCode, @RequestBody ParticipantDeletionRequestDto participantDeletionRequestDto){ |
| 33 | + participantService.deleteParticipant(linkCode, participantDeletionRequestDto); |
| 34 | + return ResponseEntity.ok().build(); |
| 35 | + } |
| 36 | + |
| 37 | + @PutMapping("/update") |
| 38 | + public ResponseEntity<Void> updateParticipant(@PathVariable String linkCode, @RequestBody ParticipantUpdateRequestDto participantUpdateRequestDto){ |
| 39 | + participantService.modifyParticipant(linkCode, participantUpdateRequestDto); |
| 40 | + return ResponseEntity.ok().build(); |
| 41 | + } |
| 42 | + |
| 43 | + @GetMapping("/") |
| 44 | + public ResponseEntity<List<ParticipantListResponseDto>> getParticipants(@PathVariable String linkCode){ |
| 45 | + List<ParticipantListResponseDto> participants = meetingService.getParticipants(linkCode); |
| 46 | + return ResponseEntity.ok(participants); |
| 47 | + } |
4 | 48 | } |
0 commit comments