Skip to content

Commit

Permalink
[#148] Release v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JoosungKwon authored Mar 12, 2023
2 parents f28564c + ff461b2 commit abfc0d4
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM openjdk:17-oracle
ARG JAR_FILE=build/libs/Mukvengers-1.0.0-SNAPSHOT.jar
ARG JAR_FILE=build/libs/Mukvengers-1.0.1.jar
ENV MY_SERVER=${MY_SERVER} \
AWS_ACCESS_KEY=${AWS_ACCESS_KEY} \
AWS_SECRET_KEY=${AWS_SECRET_KEY} \
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
}

group = 'com.prgrms'
version = '1.0.0-SNAPSHOT'
version = '1.0.1'
sourceCompatibility = '17'

configurations {
Expand Down Expand Up @@ -42,7 +42,7 @@ openapi3 {
setServer(env.MY_SERVER.orElse("http://localhost:8080")) // Swagger 서버 설정
title = "KKINI API Document"
description = "Spring REST Docs with SwaggerUI."
version = "1.0.0 - SNAPSHOT"
version = "1.0.1"
format = "yaml"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public record ProposalResponse(
Long leaderId,
Long crewId,
String content,
ProposalStatus status
ProposalStatus status,
String storeName,
String crewName
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public interface ProposalMapper {

Proposal toProposal(CreateProposalRequest proposalRequest, User user, Long crewId);

ProposalResponse toProposalResponse(Proposal proposal);
ProposalResponse toProposalResponse(Proposal proposal, String storeName, String crewName);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.prgrms.mukvengers.domain.proposal.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -92,33 +93,54 @@ public IdResponse create(CreateProposalRequest proposalRequest, Long userId, Lon

@Override
public ProposalResponse getById(Long proposalId) {

Proposal proposal = proposalRepository.findById(proposalId)
.orElseThrow(() -> new ProposalNotFoundException(proposalId));

return proposalMapper.toProposalResponse(proposal);
Crew crew = crewRepository.findById(proposal.getCrewId())
.orElseThrow(() -> new CrewNotFoundException(proposal.getCrewId()));

String crewName = crew.getName();
String storePlaceName = crew.getStore().getPlaceName();

return proposalMapper.toProposalResponse(proposal, crewName, storePlaceName);
}

@Override
public ProposalResponses getProposalsByLeaderId(Long userId) {
List<Proposal> proposals = proposalRepository.findAllByLeaderIdOrderByCreatedAtDesc(userId);
List<ProposalResponse> proposalResponses = new ArrayList<>();

for (Proposal proposal : proposals) {
Crew crew = crewRepository.findById(proposal.getCrewId())
.orElseThrow(() -> new CrewNotFoundException(proposal.getCrewId()));

List<ProposalResponse> proposals = proposalRepository.findAllByLeaderIdOrderByCreatedAtDesc(userId)
.stream()
.map(proposalMapper::toProposalResponse)
.toList();
String crewName = crew.getName();
String storePlaceName = crew.getStore().getPlaceName();

return new ProposalResponses(proposals);
ProposalResponse proposalResponse = proposalMapper.toProposalResponse(proposal, crewName, storePlaceName);
proposalResponses.add(proposalResponse);
}

return new ProposalResponses(proposalResponses);
}

@Override
public ProposalResponses getProposalsByMemberId(Long userId) {
List<Proposal> proposals = proposalRepository.findAllByUserIdOrderByCreatedAtDesc(userId);
List<ProposalResponse> proposalResponses = new ArrayList<>();

for (Proposal proposal : proposals) {
Crew crew = crewRepository.findById(proposal.getCrewId())
.orElseThrow(() -> new CrewNotFoundException(proposal.getCrewId()));

List<ProposalResponse> proposals = proposalRepository.findAllByUserIdOrderByCreatedAtDesc(userId)
.stream()
.map(proposalMapper::toProposalResponse)
.toList();
String crewName = crew.getName();
String storePlaceName = crew.getStore().getPlaceName();

ProposalResponse proposalResponse = proposalMapper.toProposalResponse(proposal, crewName, storePlaceName);
proposalResponses.add(proposalResponse);
}

return new ProposalResponses(proposals);
return new ProposalResponses(proposalResponses);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public ErrorResponse handleIllegalArgumentException(IllegalArgumentException e)
@SlackNotification
@ResponseStatus(INTERNAL_SERVER_ERROR)
@ExceptionHandler(Exception.class)
public ErrorResponse handleException(Exception e) {
public ErrorResponse handleException(HttpServletRequest request, Exception e) {
logError(e);
return ErrorResponse.of(ErrorCode.INTERNAL_SERVER_ERROR);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ void getById_success() throws Exception {
fieldWithPath("data.status").type(STRING).description("신청서 상태"),
fieldWithPath("data.leaderId").type(NUMBER).description("모임의 방장 아이디"),
fieldWithPath("data.crewId").type(NUMBER).description("모임 아이디"),
fieldWithPath("data.storeName").type(STRING).description("가게 이름"),
fieldWithPath("data.crewName").type(STRING).description("모임 이름"),
fieldWithPath("data.user.id").type(NUMBER).description("유저 ID"),
fieldWithPath("data.user.nickname").type(STRING).description("닉네임"),
fieldWithPath("data.user.profileImgUrl").type(STRING).description("프로필 이미지"),
Expand Down Expand Up @@ -153,6 +155,8 @@ void getProposalsByLeaderId_success() throws Exception {
fieldWithPath("data.responses.[].content").type(STRING).description("신청서 내용"),
fieldWithPath("data.responses.[].status").type(STRING).description("신청서 상태"),
fieldWithPath("data.responses.[].leaderId").type(NUMBER).description("모임의 방장 아이디"),
fieldWithPath("data.responses.[].storeName").type(STRING).description("가게 이름"),
fieldWithPath("data.responses.[].crewName").type(STRING).description("모임 이름"),
fieldWithPath("data.responses.[].crewId").type(NUMBER).description("모임 아이디")
)
.build()
Expand Down Expand Up @@ -252,6 +256,8 @@ void getProposalsByMemberId_success() throws Exception {
fieldWithPath("data.responses.[].content").type(STRING).description("신청서 내용"),
fieldWithPath("data.responses.[].status").type(STRING).description("신청서 상태"),
fieldWithPath("data.responses.[].leaderId").type(NUMBER).description("모임의 방장 아이디"),
fieldWithPath("data.responses.[].storeName").type(STRING).description("가게 이름"),
fieldWithPath("data.responses.[].crewName").type(STRING).description("모임 이름"),
fieldWithPath("data.responses.[].crewId").type(NUMBER).description("모임 아이디")
)
.build()
Expand Down

0 comments on commit abfc0d4

Please sign in to comment.