Skip to content

Commit

Permalink
#82 fix : 팀장 검증 parameter 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
rivkode committed Apr 29, 2024
1 parent 1e4ed61 commit c0adf20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ public class ApplyController {

@Operation(summary = "프로젝트 지원 생성", description = "프로젝트와 user가 매핑되어 지원됩니다.")
@PostMapping(value = "/{projectId}")
public ResponseEntity<String> createApply(@PathVariable("projectId") String projectId, @LoginUser String userId) {
public ResponseEntity<GetApplyResponse> createApply(@PathVariable("projectId") String projectId, @LoginUser String userId) {

return ResponseEntity.status(HttpStatus.CREATED).body(applyService.createApply(userId, projectId));
}

@Operation(summary = "프로젝트 지원 삭제", description = "지원이 삭제됩니다.")
@DeleteMapping(value = "/{applyId}")
public ResponseEntity<Void> deleteApply(@PathVariable("applyId") String applyId, @LoginUser String userId) {
applyService.deleteApply(applyId);
applyService.deleteApply(userId, applyId);

return ResponseEntity.noContent().build();
}

@Operation(summary = "프로젝트 지원 수락", description = "프로젝트의 팀장이 지원을 수락합니다.")
@PostMapping(value = "/accept/{projectId}")
public ResponseEntity<Void> acceptApply(@PathVariable("projectId") String projectId, @Valid @RequestBody CreateApplyRequest request) {
applyService.updateApplyStatusToAccept(request.userId(), projectId);
public ResponseEntity<Void> acceptApply(@PathVariable("projectId") String projectId, @RequestParam("applyUserId") String applyUserId, @LoginUser String leaderId) {
applyService.updateApplyStatusToAccept(leaderId, applyUserId, projectId);
return ResponseEntity.noContent().build();
}

@Operation(summary = "프로젝트 지원 거절", description = "프로젝트의 팀장이 지원을 거절합니다.")
@DeleteMapping("/reject/{projectId}")
public ResponseEntity<Void> rejectApply(@PathVariable("projectId") String projectId, @Valid @RequestBody CreateApplyRequest request) {
applyService.updateApplyStatusToReject(request.userId(), projectId);
public ResponseEntity<Void> rejectApply(@PathVariable("projectId") String projectId, @RequestParam("applyUserId") String applyUserId, @LoginUser String leaderId) {
applyService.updateApplyStatusToReject(leaderId, applyUserId, projectId);
return ResponseEntity.noContent().build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import com.seoultech.synergybe.domain.apply.dto.response.GetApplyUserResponse;
import com.seoultech.synergybe.domain.apply.dto.response.GetListApplyResponse;
import com.seoultech.synergybe.domain.apply.dto.response.GetListApplyUserResponse;
import com.seoultech.synergybe.domain.common.PageInfo;
import com.seoultech.synergybe.domain.user.User;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Pageable;

import java.util.List;

Expand All @@ -21,7 +23,8 @@ public static GetListApplyResponse applyListToResponse(
result.getId(),
result.getStatus()))
.toList();
return new GetListApplyResponse(getApplyResponses);
PageInfo pageInfo = PageInfo.of(applyList.size());
return new GetListApplyResponse(getApplyResponses, pageInfo);
}

public static GetListApplyUserResponse userListToResponse(
Expand All @@ -30,6 +33,7 @@ public static GetListApplyUserResponse userListToResponse(
List<GetApplyUserResponse> getApplyUserResponses = userList.stream()
.map(GetApplyUserResponse::new)
.toList();
return new GetListApplyUserResponse(getApplyUserResponses);
PageInfo pageInfo = PageInfo.of(getApplyUserResponses.size());
return new GetListApplyUserResponse(getApplyUserResponses, pageInfo);
}
}

0 comments on commit c0adf20

Please sign in to comment.