Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: 유저관련 temp API 추가 #359

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,6 @@ ResponseEntity<CommentV2GetCommentsResponseDto> getComments(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request,
Principal principal);

@Operation(summary = "[TEMP] 모임 게시글 댓글 리스트 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(
responseCode = "200",
description = "성공"),
})
@Parameters({
@Parameter(name = "page", description = "페이지, default = 1", example = "1", schema = @Schema(type = "integer", format = "int32")),
@Parameter(name = "take", description = "가져올 데이터 개수, default = 12", example = "50", schema = @Schema(type = "integer", format = "int32")),
@Parameter(name = "postId", description = "게시글 id", example = "3", schema = @Schema(type = "integer", format = "int32"))})
ResponseEntity<TempResponseDto<CommentV2GetCommentsResponseDto>> getCommentsTemp(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request,
Principal principal);

@Operation(summary = "모임 게시글 댓글 좋아요 토글")
@ResponseStatus(HttpStatus.CREATED)
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,6 @@ public ResponseEntity<CommentV2GetCommentsResponseDto> getComments(
return ResponseEntity.status(HttpStatus.OK).body(commentDtos);
}

@Override
@GetMapping("/temp")
public ResponseEntity<TempResponseDto<CommentV2GetCommentsResponseDto>> getCommentsTemp(
@Valid @ModelAttribute @Parameter(hidden = true) CommentV2GetCommentsQueryDto request,
Principal principal) {

Integer userId = UserUtil.getUserId(principal);
CommentV2GetCommentsResponseDto commentDtos = commentV2Service.getComments(request.getPostId(),
request.getPage(), request.getTake(), userId);

return ResponseEntity.status(HttpStatus.OK).body(TempResponseDto.of(commentDtos));
}

@Override
@PostMapping("/{commentId}/like")
public ResponseEntity<CommentV2SwitchCommentLikeResponseDto> switchCommentLike(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,6 @@ ResponseEntity<AppliesCsvFileUrlResponseDto> getAppliesCsvFileUrl(
@ModelAttribute @Valid @Parameter(hidden = true) MeetingGetAppliesCsvQueryDto queryCommand,
Principal principal);

@Operation(summary = "[TEMP] 모임 지원자 목록 csv 파일 다운로드", description = "모임 지원자 목록 csv 파일 다운로드")
@Parameters({
@Parameter(name = "status", description = "0: 대기, 1: 승인된 신청자, 2: 거절된 신청자", example = "0,1", required = true, schema = @Schema(type = "string")),
@Parameter(name = "type", description = "0: 지원, 1: 초대", example = "0,1", required = true, schema = @Schema(type = "string")),
@Parameter(name = "order", description = "정렬순", example = "desc", schema = @Schema(type = "string", format = "string"))})
ResponseEntity<TempResponseDto<AppliesCsvFileUrlResponseDto>> getAppliesCsvFileUrlTemp(
@PathVariable Integer meetingId,
@ModelAttribute @Valid @Parameter(hidden = true) MeetingGetAppliesCsvQueryDto queryCommand,
Principal principal);

@Operation(summary = "모임 상세 조회", description = "모임 상세 조회")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "모임 상세 조회 성공"),
@ApiResponse(responseCode = "400", description = "모임이 없습니다.", content = @Content),})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,23 +188,6 @@ public ResponseEntity<AppliesCsvFileUrlResponseDto> getAppliesCsvFileUrl(
return ResponseEntity.ok(responseDto);
}

@Override
@GetMapping("/{meetingId}/list/csv/temp")
public ResponseEntity<TempResponseDto<AppliesCsvFileUrlResponseDto>> getAppliesCsvFileUrlTemp(
@PathVariable Integer meetingId,
@ModelAttribute @Valid MeetingGetAppliesCsvQueryDto queryCommand,
Principal principal) {
Integer userId = UserUtil.getUserId(principal);

// TODO: FE 에서 request 값 변경하도록 요청 필요
List<Integer> statuses = List.of(0, 1, 2);

AppliesCsvFileUrlResponseDto responseDto = meetingV2Service.getAppliesCsvFileUrl(meetingId, statuses,
queryCommand.getOrder(), userId);

return ResponseEntity.ok(TempResponseDto.of(responseDto));
}

@Override
@GetMapping("/{meetingId}")
public ResponseEntity<MeetingV2GetMeetingByIdResponseDto> getMeetingById(@PathVariable Integer meetingId,
Expand Down
93 changes: 58 additions & 35 deletions main/src/main/java/org/sopt/makers/crew/main/user/v2/UserV2Api.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;

import java.security.Principal;
import java.util.List;

import org.sopt.makers.crew.main.common.dto.TempResponseDto;
import org.sopt.makers.crew.main.user.v2.dto.response.UserV2GetAllMeetingByUserMeetingDto;
import org.sopt.makers.crew.main.user.v2.dto.response.UserV2GetAllMentionUserDto;
import org.sopt.makers.crew.main.user.v2.dto.response.UserV2GetAppliedMeetingByUserResponseDto;
Expand All @@ -20,43 +22,64 @@
@Tag(name = "사용자")
public interface UserV2Api {

@Operation(summary = "내가 속한 모임 조회")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공"),
@ApiResponse(responseCode = "204", description = "내가 속한 모임 리스트가 없는 경우", content = @Content),
})
ResponseEntity<List<UserV2GetAllMeetingByUserMeetingDto>> getAllMeetingByUser(Principal principal);

@Operation(summary = "멘션 사용자 조회")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")})
ResponseEntity<List<UserV2GetAllMentionUserDto>> getAllMentionUser(Principal principal);

@Operation(summary = "유저 본인 프로필 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공"),
@ApiResponse(responseCode = "400", description = "해당 유저가 없는 경우", content = @Content),
})
ResponseEntity<UserV2GetUserOwnProfileResponseDto> getUserOwnProfile(Principal principal);

@Operation(summary = "내가 신청한 모임 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
ResponseEntity<UserV2GetAppliedMeetingByUserResponseDto> getAppliedMeetingByUser(
Principal principal);

@Operation(summary = "내가 만든 모임 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
ResponseEntity<UserV2GetCreatedMeetingByUserResponseDto> getCreatedMeetingByUser(
Principal principal);
@Operation(summary = "내가 속한 모임 조회")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공"),
@ApiResponse(responseCode = "204", description = "내가 속한 모임 리스트가 없는 경우", content = @Content),
})
ResponseEntity<List<UserV2GetAllMeetingByUserMeetingDto>> getAllMeetingByUser(Principal principal);

@Operation(summary = "멘션 사용자 조회")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")})
ResponseEntity<List<UserV2GetAllMentionUserDto>> getAllMentionUser(Principal principal);

@Operation(summary = "유저 본인 프로필 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공"),
@ApiResponse(responseCode = "400", description = "해당 유저가 없는 경우", content = @Content),
})
ResponseEntity<UserV2GetUserOwnProfileResponseDto> getUserOwnProfile(Principal principal);

@Operation(summary = "[TEMP] 유저 본인 프로필 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공"),
@ApiResponse(responseCode = "400", description = "해당 유저가 없는 경우", content = @Content),
})
ResponseEntity<TempResponseDto<UserV2GetUserOwnProfileResponseDto>> getUserOwnProfileTemp(Principal principal);

@Operation(summary = "내가 신청한 모임 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
ResponseEntity<UserV2GetAppliedMeetingByUserResponseDto> getAppliedMeetingByUser(
Principal principal);

@Operation(summary = "[TEMP] 내가 신청한 모임 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
ResponseEntity<TempResponseDto<UserV2GetAppliedMeetingByUserResponseDto>> getAppliedMeetingByUserTemp(
Principal principal);

@Operation(summary = "내가 만든 모임 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
ResponseEntity<UserV2GetCreatedMeetingByUserResponseDto> getCreatedMeetingByUser(
Principal principal);

@Operation(summary = "[TEMP] 내가 만든 모임 조회")
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "성공")
})
ResponseEntity<TempResponseDto<UserV2GetCreatedMeetingByUserResponseDto>> getCreatedMeetingByUserTemp(
Principal principal);

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import lombok.RequiredArgsConstructor;

import org.sopt.makers.crew.main.common.dto.TempResponseDto;
import org.sopt.makers.crew.main.common.util.UserUtil;
import org.sopt.makers.crew.main.user.v2.dto.response.UserV2GetAllMeetingByUserMeetingDto;
import org.sopt.makers.crew.main.user.v2.dto.response.UserV2GetAllMentionUserDto;
Expand Down Expand Up @@ -51,6 +52,14 @@ public ResponseEntity<UserV2GetUserOwnProfileResponseDto> getUserOwnProfile(Prin
return ResponseEntity.ok().body(userV2Service.getUserOwnProfile(userId));
}

@Override
@GetMapping("/profile/me/temp")
public ResponseEntity<TempResponseDto<UserV2GetUserOwnProfileResponseDto>> getUserOwnProfileTemp(
Principal principal) {
Integer userId = UserUtil.getUserId(principal);
return ResponseEntity.ok().body(TempResponseDto.of(userV2Service.getUserOwnProfile(userId)));
}

@Override
@GetMapping("/apply")
public ResponseEntity<UserV2GetAppliedMeetingByUserResponseDto> getAppliedMeetingByUser(Principal principal) {
Expand All @@ -59,6 +68,14 @@ public ResponseEntity<UserV2GetAppliedMeetingByUserResponseDto> getAppliedMeetin
return ResponseEntity.ok().body(userV2Service.getAppliedMeetingByUser(userId));
}

@Override
@GetMapping("/apply/temp")
public ResponseEntity<TempResponseDto<UserV2GetAppliedMeetingByUserResponseDto>> getAppliedMeetingByUserTemp(
Principal principal) {
Integer userId = UserUtil.getUserId(principal);
return ResponseEntity.ok().body(TempResponseDto.of(userV2Service.getAppliedMeetingByUser(userId)));
}

@Override
@GetMapping("/meeting")
public ResponseEntity<UserV2GetCreatedMeetingByUserResponseDto> getCreatedMeetingByUser(Principal principal) {
Expand All @@ -67,5 +84,12 @@ public ResponseEntity<UserV2GetCreatedMeetingByUserResponseDto> getCreatedMeetin
return ResponseEntity.ok().body(userV2Service.getCreatedMeetingByUser(userId));
}

@Override
@GetMapping("/meeting/temp")
public ResponseEntity<TempResponseDto<UserV2GetCreatedMeetingByUserResponseDto>> getCreatedMeetingByUserTemp(
Principal principal) {
Integer userId = UserUtil.getUserId(principal);
return ResponseEntity.ok().body(TempResponseDto.of(userV2Service.getCreatedMeetingByUser(userId)));
}

}
Loading