-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8주차/수콩] 워크북 제출합니다.
- Loading branch information
Showing
65 changed files
with
1,054 additions
and
26 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
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
38 changes: 38 additions & 0 deletions
38
src/main/java/javalab/umc7th_mission/study/config/SwaggerConfig.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,38 @@ | ||
package javalab.umc7th_mission.study.config; | ||
|
||
import io.swagger.v3.oas.models.Components; | ||
import io.swagger.v3.oas.models.OpenAPI; | ||
import io.swagger.v3.oas.models.info.Info; | ||
import io.swagger.v3.oas.models.security.SecurityRequirement; | ||
import io.swagger.v3.oas.models.security.SecurityScheme; | ||
import io.swagger.v3.oas.models.servers.Server; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
@Bean | ||
public OpenAPI UMCstudyAPI() { | ||
Info info = new Info() | ||
.title("UMC Server WorkBook API") | ||
.description("UMC Server WorkBook API 명세서") | ||
.version("1.0.0"); | ||
|
||
String jwtSchemeName = "JWT TOKEN"; | ||
SecurityRequirement securityRequirement = new SecurityRequirement().addList(jwtSchemeName); | ||
|
||
Components components = new Components() | ||
.addSecuritySchemes(jwtSchemeName, new SecurityScheme() | ||
.name(jwtSchemeName) | ||
.type(SecurityScheme.Type.HTTP) | ||
.scheme("bearer") | ||
.bearerFormat("JWT")); | ||
|
||
return new OpenAPI() | ||
.addServersItem(new Server().url("/")) | ||
.info(info) | ||
.addSecurityItem(securityRequirement) | ||
.components(components); | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
src/main/java/javalab/umc7th_mission/study/converter/MemberConverter.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,26 @@ | ||
package javalab.umc7th_mission.study.converter; | ||
|
||
import javalab.umc7th_mission.study.domain.Member; | ||
import javalab.umc7th_mission.study.web.dto.member.MemberRequestDTO; | ||
import javalab.umc7th_mission.study.web.dto.member.MemberResponseDTO; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
|
||
public class MemberConverter { | ||
public static MemberResponseDTO.JoinResultDTO toJoinResultDTO(Member member) { | ||
return MemberResponseDTO.JoinResultDTO.builder() | ||
.memberId(member.getId()) | ||
.createdAt(LocalDateTime.now()) | ||
.build(); | ||
} | ||
|
||
public static Member toMember(MemberRequestDTO.JoinDto request){ | ||
return Member.builder() | ||
.name(request.getName()) | ||
.birth(request.getBirth()) | ||
.address(request.getAddress()) | ||
.memberFoodList(new ArrayList<>()) | ||
.build(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/javalab/umc7th_mission/study/converter/MemberFoodConverter.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,17 @@ | ||
package javalab.umc7th_mission.study.converter; | ||
|
||
import javalab.umc7th_mission.study.domain.Food; | ||
import javalab.umc7th_mission.study.domain.mapping.MemberFood; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public class MemberFoodConverter { | ||
public static List<MemberFood> toMemberFoodList(List<Food> foodList){ | ||
return foodList.stream() | ||
.map(food -> MemberFood.builder() | ||
.food(food) | ||
.build() | ||
).collect(Collectors.toList()); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/javalab/umc7th_mission/study/converter/MemberMissionConverter.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,26 @@ | ||
package javalab.umc7th_mission.study.converter; | ||
|
||
import javalab.umc7th_mission.study.domain.Member; | ||
import javalab.umc7th_mission.study.domain.Mission; | ||
import javalab.umc7th_mission.study.domain.mapping.MemberMission; | ||
import javalab.umc7th_mission.study.web.dto.member_mission.MemberMissionRequestDTO; | ||
import javalab.umc7th_mission.study.web.dto.member_mission.MemberMissionResponseDTO; | ||
|
||
import java.time.LocalDate; | ||
|
||
public class MemberMissionConverter { | ||
public static MemberMissionResponseDTO.AddMemberMissionResultDTO toAddMemberMissionResultDTO(MemberMission memberMission){ | ||
return MemberMissionResponseDTO.AddMemberMissionResultDTO.builder() | ||
.memberMissionId(memberMission.getId()) | ||
.createdAt(LocalDate.now()) | ||
.build(); | ||
} | ||
|
||
public static MemberMission toMemberMission(Member member, Mission mission){ | ||
return MemberMission.builder() | ||
.member(member) | ||
.mission(mission) | ||
.startDate(LocalDate.now()) | ||
.build(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/javalab/umc7th_mission/study/converter/MissionConverter.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,26 @@ | ||
package javalab.umc7th_mission.study.converter; | ||
|
||
import javalab.umc7th_mission.study.domain.Mission; | ||
import javalab.umc7th_mission.study.domain.Restaurant; | ||
import javalab.umc7th_mission.study.web.dto.mission.MissionRequestDTO; | ||
import javalab.umc7th_mission.study.web.dto.mission.MissionResponseDTO; | ||
|
||
import java.time.LocalDate; | ||
|
||
public class MissionConverter { | ||
public static MissionResponseDTO.AddMissionResultDTO toAddMissionResultDTO(Mission mission){ | ||
return new MissionResponseDTO.AddMissionResultDTO().builder() | ||
.missionId(mission.getId()) | ||
.createdAt(LocalDate.now()) | ||
.build(); | ||
} | ||
public static Mission toMission(MissionRequestDTO.AddMissionDto request, Restaurant restaurant){ | ||
return Mission.builder() | ||
.name(request.getName()) | ||
.content(request.getContent()) | ||
.point(request.getPoint()) | ||
.deadline(request.getDeadline()) | ||
.restaurant(restaurant) | ||
.build(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/javalab/umc7th_mission/study/converter/RestaurantConverter.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,25 @@ | ||
package javalab.umc7th_mission.study.converter; | ||
|
||
import javalab.umc7th_mission.study.domain.Region; | ||
import javalab.umc7th_mission.study.domain.Restaurant; | ||
import javalab.umc7th_mission.study.web.dto.restaurant.RestaurantRequestDTO; | ||
import javalab.umc7th_mission.study.web.dto.restaurant.RestaurantResponseDTO; | ||
|
||
import java.time.LocalDate; | ||
|
||
public class RestaurantConverter { | ||
public static RestaurantResponseDTO.AddRestaurantResultDTO toAddRestaurantResultDTO(Restaurant restaurant) { | ||
return RestaurantResponseDTO.AddRestaurantResultDTO.builder() | ||
.restaurantId(restaurant.getId()) | ||
.createdAt(LocalDate.now()) | ||
.build(); | ||
} | ||
public static Restaurant toRestaurant(RestaurantRequestDTO.AddRestaurantDto request, Region region){ | ||
return Restaurant.builder() | ||
.name(request.getName()) | ||
.address(request.getAddress()) | ||
.type(request.getType()) | ||
.region(region) | ||
.build(); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/javalab/umc7th_mission/study/converter/ReviewConverter.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,27 @@ | ||
package javalab.umc7th_mission.study.converter; | ||
|
||
import javalab.umc7th_mission.study.domain.Member; | ||
import javalab.umc7th_mission.study.domain.Restaurant; | ||
import javalab.umc7th_mission.study.domain.Review; | ||
import javalab.umc7th_mission.study.web.dto.review.ReviewRequestDTO; | ||
import javalab.umc7th_mission.study.web.dto.review.ReviewResponseDTO; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
public class ReviewConverter { | ||
public static ReviewResponseDTO.AddReviewResultDTO toAddReviewResultDTO(Review review) { | ||
return ReviewResponseDTO.AddReviewResultDTO.builder() | ||
.reviewId(review.getId()) | ||
.createdAt(LocalDateTime.now()) | ||
.build(); | ||
} | ||
|
||
public static Review toReview(ReviewRequestDTO.AddReviewDto request, Member member, Restaurant restaurant) { | ||
return Review.builder() | ||
.score(request.getScore()) | ||
.content(request.getContent()) | ||
.member(member) | ||
.restaurant(restaurant) | ||
.build(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/javalab/umc7th_mission/study/converter/TempConverter.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
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
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
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
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
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
4 changes: 0 additions & 4 deletions
4
src/main/java/javalab/umc7th_mission/study/dto/TempRequest.java
This file was deleted.
Oops, something went wrong.
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
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
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
Oops, something went wrong.