code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,69 @@
+package christmas.controller;
+
+import christmas.domain.Bill;
+import christmas.domain.Order;
+import christmas.domain.ReservationDay;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+public class PlannerController {
+ private final Order order;
+ private final Reservatio... | Java | ์์ธ ๋ฉ์์ง ์ถ๋ ฅ๋ `OutputView` ์์ ์ฒ๋ฆฌํ๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,69 @@
+package christmas.controller;
+
+import christmas.domain.Bill;
+import christmas.domain.Order;
+import christmas.domain.ReservationDay;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+public class PlannerController {
+ private final Order order;
+ private final Reservatio... | Java | ํ๋๊ฐ ์์ฑ์๊ฐ ์๋ ๋ค๋ฅธ ๋ฉ์๋์์ ์ด๊ธฐํ๋๋๊ฒ ์ด์ํ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,35 @@
+package christmas.domain;
+
+import java.math.BigDecimal;
+
+public enum Badge {
+ SANTA_BADGE("์ฐํ", new BigDecimal(20000)),
+ TREE_BADGE("ํธ๋ฆฌ", new BigDecimal(10000)),
+ STAR_BADGE("๋ณ", new BigDecimal(5000));
+
+ private final String name;
+ private final BigDecimal standardAmount;
+
+ ... | Java | ์ด๋ฆ์ด `null`์ด ๋๋ ๊ฒฝ์ฐ๊ฐ ์์๊น์? |
@@ -0,0 +1,110 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.utils.EventSettings;
+import christmas.parser.EventDetailsParser;
+import christmas.view.EventView;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class ChristmasEventController implements EventController ... | Java | `BigDecimal` ์ ๊ฒฝ์ฐ ์ผ๋ถ ๊ฐ์ ์บ์ฑํ๊ณ ์์ด ์์ฑ์ ๋์ `valueOf()` ๋ฉ์๋๋ฅผ ํตํด ๊ฐ์ฒด๋ฅผ ์ป๋๊ฒ ๋ ํจ์จ์ ์
๋๋ค! |
@@ -0,0 +1,35 @@
+package christmas.domain;
+
+import java.math.BigDecimal;
+
+public enum Badge {
+ SANTA_BADGE("์ฐํ", new BigDecimal(20000)),
+ TREE_BADGE("ํธ๋ฆฌ", new BigDecimal(10000)),
+ STAR_BADGE("๋ณ", new BigDecimal(5000));
+
+ private final String name;
+ private final BigDecimal standardAmount;
+
+ ... | Java | `null` ๋ฐํ์ด ์ํํ ๊ฒ ๊ฐ์์! `NONE` ๊ณผ ๊ฐ์ ์ธ์คํด์ค๋ฅผ ์ถ๊ฐํ์ฌ ์ด๋ฅผ ๋ฐํํ๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,32 @@
+package christmas.domain;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class Bill {
+ private final Map<Menu, Integer> orderDetails;
+
+ private BigDecimal totalPrice = new BigDecimal(0);
+
+ public Bill(Order order) {
+ this.orderDetails = order.getOrderDetails();
... | Java | ๋ฉ๋ด ์
๋ ฅ ์ ์ด๋ฆ, ์๋ ์ธ์ ๋ค๋ฅธ ๊ฐ์ด ์ถ๊ฐ๋๋๊ฑธ ๊ฐ์ํ์ฌ `Map<K, V>` ๋์ ๋ณ๋์ ํด๋์ค ์ฌ์ฉ์ ์ด๋จ๊น์? |
@@ -0,0 +1,29 @@
+package christmas.domain;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class DecemberCalendar {
+ private final List<Integer> weekdays = Stream.of(3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 24, 25, 26, 27, 28, 31)
+ ... | Java | `Arrays.asList()` ๋์ Stream์ ์ฌ์ฉํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,62 @@
+package christmas.domain;
+
+import christmas.utils.ErrorMessage;
+import christmas.parser.Parser;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static christmas.domain.validator.OrderValidator.*;
+
+public class Order {
+ private final Map<Menu, Integer> ord... | Java | `int`์ ๊ฒฝ์ฐ ํ๋์์ ๊ฐ์ ๋์
ํ์ง ์์๋ ๊ฐ์ฒด ์์ฑ์ 0์ผ๋ก ์ด๊ธฐํ ๋ฉ๋๋ค! |
@@ -0,0 +1,62 @@
+package christmas.domain;
+
+import christmas.utils.ErrorMessage;
+import christmas.parser.Parser;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static christmas.domain.validator.OrderValidator.*;
+
+public class Order {
+ private final Map<Menu, Integer> ord... | Java | ๋๋ฉ์ธ์ด View์ ์์กดํ๋ ๊ฒ ๊ฐ์ต๋๋ค! `OutputView`์์ `Order`์ ๋ํ ๊ฐ์ ๊ฐ์ ธ์จ ํ ์ถ๋ ฅํ๋๊ฑด ์ด๋จ๊น์? |
@@ -6,13 +6,14 @@ import ReviewContent from "./ReviewContent";
import ArrowDown from "@/assets/images/icons/arrow_down.svg";
import MenuCircle from "@/assets/images/icons/menu-circle.svg";
import Dropdown from "@/components/common/Dropdown";
+import useReviewModals from "@/hooks/review/useReviewModals";
import { ty... | Unknown | @ITHPARK ๋ฆฌ๋ทฐ ์ญ์ api ์ฐ๊ฒฐํ๋ฉด์ ํด๋น ์ปดํฌ๋ํธ ์ผ๋ถ ์์ ๋์์ต๋๋ค! |
@@ -11,6 +11,8 @@ export interface ReviewInfo {
isMyWritten?: boolean;
eventId?: number;
eventType?: string;
+ reviewId: number;
+ editable?: boolean;
}
export interface ReviewInfoProps { | TypeScript | ๋ฆฌ๋ทฐ ํ์
์ `reviewId`, `editable` ์ถ๊ฐํ์ต๋๋ค |
@@ -2,13 +2,30 @@ package com.petqua.application.product.review
import com.amazonaws.services.s3.AmazonS3
import com.ninjasquad.springmockk.SpykBean
+import com.petqua.application.product.dto.MemberProductReviewReadQuery
import com.petqua.application.product.dto.ProductReviewCreateCommand
import com.petqua.common... | Kotlin | ์ฌ๊ธฐ ์๋ memberProductReviews๊ฒ์ฆํ๋ ์ฝ๋๊ฐ ์กฐํผ ๊ธด๋ฐ
์... ๋ฉ์๋๋ก ๋ถ๋ฆฌํ๋ฉด ์ด๋จ๊น์??
valdiateMemberProductReview(memberProductReviewB, productReivewB, orderB); |
@@ -6,6 +6,10 @@ import com.linecorp.kotlinjdsl.render.jpql.JpqlRenderer
import com.petqua.common.domain.dto.CursorBasedPaging
import com.petqua.common.util.createQuery
import com.petqua.domain.member.Member
+import com.petqua.domain.order.Order
+import com.petqua.domain.order.OrderPayment
+import com.petqua.domain.... | Kotlin | createdAt ๋์ id๋ก ์ ๋ ฌํด๋ ๋ฌด๋ฐฉํ ๊ฑฐ ๋ง์๊น์??
id๊ฐ ์ธ๋ฑ์ค๋ผ ๋ ํจ์จ์ ์ผ ๊ฒ ๊ฐ์์์! |
@@ -1,12 +1,14 @@
package com.petqua.application.product.review
+import com.petqua.application.product.dto.MemberProductReviewReadQuery
+import com.petqua.application.product.dto.MemberProductReviewResponse
+import com.petqua.application.product.dto.MemberProductReviewsResponse
import com.petqua.application.product... | Kotlin | ids๋ฅผ ๋ฐ๊ฒ ๋ฐ๊พธ๊ณ ์ฌํ์ฉ ๋ ์ข๋ค์!! |
@@ -1,5 +1,6 @@
package com.petqua.presentation.product
+import com.petqua.application.product.dto.MemberProductReviewsResponse
import com.petqua.application.product.dto.ProductReviewStatisticsResponse
import com.petqua.application.product.dto.ProductReviewsResponse
import com.petqua.application.product.review.Pr... | Kotlin | URI ์ข๋ค์ฉ๐ |
@@ -2,13 +2,30 @@ package com.petqua.application.product.review
import com.amazonaws.services.s3.AmazonS3
import com.ninjasquad.springmockk.SpykBean
+import com.petqua.application.product.dto.MemberProductReviewReadQuery
import com.petqua.application.product.dto.ProductReviewCreateCommand
import com.petqua.common... | Kotlin | + ์กฐํ ๋ฐ์ดํฐ์ ๋ํ ๊ฒ์ฆ์ ๋ชจ๋ ํ๋๋ฅผ ํ ํ์๋ ์๋ค๊ณ ์๊ฐํฉ๋๋ค! |
@@ -0,0 +1,27 @@
+package racingcar.dao;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
+import racingcar.dao.entity.GameEntity;
+
+public class InsertGameDao {
+
+ private final SimpleJdbcInsert i... | Java | ์ด๊ฑฐ ์ธ ์ ๋ ? |
@@ -0,0 +1,24 @@
+package com.requestrealpiano.songrequest.controller;
+
+import com.requestrealpiano.songrequest.service.AccountService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+i... | Java | ๋ค๋ฅธ ์ปจํธ๋กค๋ฌ์์๋ ResponseStatus๋ก ์ง์ ํ๋๋ฐ ์ฌ๊ธด ResponseEntity๋ก ์ง์ ํ๊ตฐ์ ์ด๋ค ์ด์ ๋ก ์ง์ ํ๋์ง ๊ถ๊ธํฉ๋๋ค. |
@@ -2,18 +2,18 @@
import com.requestrealpiano.songrequest.domain.song.searchapi.response.SearchApiResponse;
import com.requestrealpiano.songrequest.global.response.ApiResponse;
+import com.requestrealpiano.songrequest.global.response.StatusCode;
import com.requestrealpiano.songrequest.service.SongService;
import ... | Java | ์ด ๋ถ๋ถ์ ์ปจํธ๋กค๋ฌ์์ Validation์ ์ก๊ธฐ๋ณด๋จ Validation DTO๋ฅผ ์์ฑํด์ ํด๋น ๊ฐ์ฒด์์ ๊ด๋ฆฌํ๋ฉด ๋์ฑ ํธ๋ฆฌํ๊ณ ๋ณด๊ธฐ๊ฐ ์ข์๋ฏ ํฉ๋๋ค. |
@@ -1,5 +1,6 @@
package com.requestrealpiano.songrequest.domain.account;
+import com.requestrealpiano.songrequest.security.oauth.OAuthAttributes;
import com.requestrealpiano.songrequest.domain.base.BaseTimeEntity;
import com.requestrealpiano.songrequest.domain.letter.Letter;
import lombok.AccessLevel;
@@ -8,9 +9,... | Java | ์ใ
ใ
ใ
ใ
OAuthId๋ฅผ ํ์ธํ์๊ณ ๋ฐ๊พธ์
จ๊ตฐ์. |
@@ -1,5 +1,6 @@
package com.requestrealpiano.songrequest.domain.account;
+import com.requestrealpiano.songrequest.security.oauth.OAuthAttributes;
import com.requestrealpiano.songrequest.domain.base.BaseTimeEntity;
import com.requestrealpiano.songrequest.domain.letter.Letter;
import lombok.AccessLevel;
@@ -8,9 +9,... | Java | ์ฌ๊ธฐ ์ ํ์๋ MaginNumber 0์ ์ด๋ค์๋ฏธ์ธ๊ฐ์? |
@@ -11,6 +11,12 @@ public enum ErrorCode {
METHOD_NOT_ALLOWED(405, "์ง์ํ์ง ์๋ ์์ฒญ ๋ฉ์๋ ์
๋๋ค."),
INTERNAL_SERVER_ERROR(500, "์๋ฒ์์ ์์ฒญ์ ์ฒ๋ฆฌํ์ง ๋ชปํ์ต๋๋ค."),
+ // Auth
+ UNAUTHENTICATED_ERROR(401, "์ธ์ฆ์ด ํ์ํฉ๋๋ค. ๋ก๊ทธ์ธ ์ดํ ๋ค์ ์๋ ํด์ฃผ์ธ์."),
+ JWT_INVALID_ERROR(400, "์ฌ๋ฐ๋ฅธ ์ธ์ฆ ์ ๋ณด๊ฐ ์๋๋๋ค. ๋ค์ ๋ก๊ทธ์ธ ํด์ฃผ์ธ์."),
+ JWT_EXPIRATION_ERRO... | Java | ์ฌ๊ธฐ์ JWT ์ธ์ฆํ ๋ ๋๊ฐ์ง ์กฐ๊ฑด์ด ์๋๊ตฐ์.
1. JWT๊ฐ ์๋ Token์ ์ฌ์ฉํ ๊ฒฝ์ฐ - 400
2. JWT๋ ๋ง๋๋ฐ ์ฌ๋ฐ๋ฅธ JWT๊ฐ ์๋ ๊ฒฝ์ฐ - 401
๋๊ฐ์ง ๊ณ ๋ คํ์๋๊ฑด ์ด๋ ์ ์ง ๋๋ ์๊ฒฌ์ด ๊ถ๊ธํฉ๋๋ค. |
@@ -11,6 +11,12 @@ public enum ErrorCode {
METHOD_NOT_ALLOWED(405, "์ง์ํ์ง ์๋ ์์ฒญ ๋ฉ์๋ ์
๋๋ค."),
INTERNAL_SERVER_ERROR(500, "์๋ฒ์์ ์์ฒญ์ ์ฒ๋ฆฌํ์ง ๋ชปํ์ต๋๋ค."),
+ // Auth
+ UNAUTHENTICATED_ERROR(401, "์ธ์ฆ์ด ํ์ํฉ๋๋ค. ๋ก๊ทธ์ธ ์ดํ ๋ค์ ์๋ ํด์ฃผ์ธ์."),
+ JWT_INVALID_ERROR(400, "์ฌ๋ฐ๋ฅธ ์ธ์ฆ ์ ๋ณด๊ฐ ์๋๋๋ค. ๋ค์ ๋ก๊ทธ์ธ ํด์ฃผ์ธ์."),
+ JWT_EXPIRATION_ERRO... | Java | ์ฌ๊ธฐ์๋ ์ด์ผ๊ธฐ ํ๊ณ ์ถ์๊ฒ์ด ์์ต๋๋ค. ํด๋น API๋ฅผ ์ฌ์ฉํ ๋ ๊ถํ์ ๋ง๋ ๊ฒ์ด 403์ด์ง๋ง ๋ง์ฝ ๋น๊ณต๊ฐ๋ ์ ๋ณด๋ฅผ API๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ ธ์ฌ๋๋ 404๋ก Not Found๋ก ๋์์ผํ๋ค๊ณ ํ๋๊ตฐ์.
๊ทธ์ ๋ํ ๋๋น์ฑ
๋ ํ์ํด ๋ณด์
๋๋ค. |
@@ -0,0 +1,105 @@
+package com.requestrealpiano.songrequest.security;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.domain.account.Role;
+import com.requestrealpiano.songrequest.security.filter.JwtAuthorizationFilter;
+import com.requestrealpiano.songrequest.security.jw... | Java | ์ฌ์ฉํ์์ง ์์ ์ฝ๋๋ฉด ์ญ์ ํ๊ณ ๊ทธ๋๋ ์ฃผ์์ฒ๋ฆฌ๋ฅผ ๋จ๊ธฐ๊ณ ์ถ๋ค๋ฉด ์ ์ฃผ์์ฒ๋ฆฌํ๋์ง์ ๋ํ ์ค๋ช
์ ์ถ๊ฐํด์ฃผ์ธ์ |
@@ -0,0 +1,105 @@
+package com.requestrealpiano.songrequest.security;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.domain.account.Role;
+import com.requestrealpiano.songrequest.security.filter.JwtAuthorizationFilter;
+import com.requestrealpiano.songrequest.security.jw... | Java | Role์ ์์ฃผ ์ฌ์ฉํ์ค ๋ฏํ๋ฐ import static์ผ๋ก ์ ์ธํ๋ ๊ฒ๋ ๋์์ง ์๋ค๊ณ ์๊ฐํฉ๋๋ค. |
@@ -0,0 +1,105 @@
+package com.requestrealpiano.songrequest.security;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.domain.account.Role;
+import com.requestrealpiano.songrequest.security.filter.JwtAuthorizationFilter;
+import com.requestrealpiano.songrequest.security.jw... | Java | `WebConfig`์์๋ CORS ์๋ฌ์ ๋ํ ๋๋น์ฑ
์ ์ค์ ํ์
จ๋๋ฐ ์ฌ๊ธฐ์๋ ์ค์ ํ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,115 @@
+package com.requestrealpiano.songrequest.security.jwt;
+
+import com.requestrealpiano.songrequest.domain.account.Account;
+import com.requestrealpiano.songrequest.global.error.exception.jwt.JwtExpirationException;
+import com.requestrealpiano.songrequest.global.error.exception.jwt.JwtInvalidTokenExce... | Java | Date ํ์
์ ์ฐ์
จ๋๋ฐ LocalDate ํ์
์ด ์๋ ์ด์ ๊ฐ ๋ฌด์์ธ๊ฐ์? |
@@ -0,0 +1,21 @@
+package com.requestrealpiano.songrequest.security.jwt;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.ConstructorBinding;
+
+@RequiredArgsConstructor
+@Get... | Java | ์์ฑ์๊ฐ ํ์ํ๊ฐ์? ๋ถํ์ํ ์์ฑ์๊ฐ์์ |
@@ -0,0 +1,33 @@
+package com.requestrealpiano.songrequest.security.oauth;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.global.error.response.ErrorCode;
+import com.requestrealpiano.songrequest.global.error.response.ErrorResponse;
+import lombok.RequiredArgsConstructor... | Java | ์ด์ ๋ ๊ธธ์ด์ง๋ฉด throws๋ถํฐ ํ์นธ ๋ด๋ ค์ ๋ณด๊ธฐ ์ฝ๊ฒ ํด์ฃผ์ธ์ฉ |
@@ -0,0 +1,33 @@
+package com.requestrealpiano.songrequest.security.oauth;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.global.error.response.ErrorCode;
+import com.requestrealpiano.songrequest.global.error.response.ErrorResponse;
+import lombok.RequiredArgsConstructor... | Java | ์ฌ๊ธฐ์ ๊ถ๊ธํ๊ฒ ์ด๋๋ก ์ฌ์ฉํ์ ๋ ์๋ฌ์ฒ๋ฆฌ๋ ๋ฐ์์ด ์ ๋๊ฒ ์ผ๋ ์คํ๋ง ๋ก๊ทธ์๋ ์ฐํ๋ ์ง ๊ถ๊ธํฉ๋๋ค.
์ ๊ฐ ์ด์ ์ฝ๋์ค์ฟผ๋ ๋์๊ด ํ๋ก์ ํธ์์๋ ์ด๋ฐ์์ผ๋ก ์ฒ๋ฆฌํ์ ๋ ๋ก๊ทธ์ ์ฐํ์ง ์๋ ์ฌ์ํ ๋ฌธ์ ์ ์ด ์๊ฒผ์ต๋๋ค. |
@@ -0,0 +1,33 @@
+package com.requestrealpiano.songrequest.security.oauth;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.global.error.response.ErrorCode;
+import com.requestrealpiano.songrequest.global.error.response.ErrorResponse;
+import lombok.RequiredArgsConstructor... | Java | ๊ทธ๋์ ์๊ฐํด๋ธ ๊ฒ์ด `AccessDeniedException`์ ๋ฐ๋ ์๋ฌํด๋์ค๋ฅผ ๋ง๋ค๊ณ ํด๋น ์๋ฌ๋ฅผ ์์๋ฐ์ ์ฌ๊ธฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉด ํด๋น ํด๋์ค๋ฅผ ํธ์ถํ๋ ๋ฐฉ์์ ์ฌ์ฉํ์ฌ ๋ค๋ฅธ exceptionHandler์ฒ๋ผ ํ๋ฒ์ ๊ด๋ฆฌํ๊ธฐ๋ ํธํ๊ณ ๋ก๊ทธ๋ ์ฐํ ์ ์๋ค๊ณ ์๊ฐํ์ต๋๋ค.
```java
@Component("restAuthenticationEntryPoint")
public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Autowired
privat... |
@@ -0,0 +1,14 @@
+package com.requestrealpiano.songrequest.security.oauth;
+
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target... | Java | ์ด๊ฒ๋ง ๋ฌ์๋ GlobalAdvice ์ค์ ์ ํ ํ์๊ฐ ์์ด์ ์ข์ฃ ! |
@@ -0,0 +1,24 @@
+package com.requestrealpiano.songrequest.controller;
+
+import com.requestrealpiano.songrequest.service.AccountService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+i... | Java | ๋ถ๋ช
๋ชจ๋ ์ปจํธ๋กค๋ฌ๋ฅผ ๋์์ ์์ ์ ํ์ํ
๋ฐ ์ฌ๊ธฐ๋ ์ํ์ฝ๋๋ง ๋ฐ๊พธ๊ณ ํ์์ ์ด๋ ๊ฒ ๋จ๊ฒจ ๋์์๋ค์.
ํต์ผ์ฑ์ ์ํด ์์ ํ๊ฒ ์ต๋๋คใ
ใ
|
@@ -2,18 +2,18 @@
import com.requestrealpiano.songrequest.domain.song.searchapi.response.SearchApiResponse;
import com.requestrealpiano.songrequest.global.response.ApiResponse;
+import com.requestrealpiano.songrequest.global.response.StatusCode;
import com.requestrealpiano.songrequest.service.SongService;
import ... | Java | ์ง๋๋ฒ ๋ฆฌ๋ทฐ์ ๊ฐ์ ์๊ฒฌ์ ์ฃผ์
์ ๋ณ๊ฒฝ์ ๊ณ ๋ ค ํด๋ดค์๋๋ฐ์.
์ฌ๊ธฐ ์ด ๋ ๊ฐ์ ๋น ๊ฐ์ผ๋ก ์์ฒญ์ด ์์ ๋ `NotEmpty` ์ ๊ฐ์ ์ฒ๋ฆฌ๋ก ์๋ฌ๋ฅผ ๋ฐํํ ๊ฒ ์๋๋ผ default value๋ก ๊ฒ์์ ๊ณ์ ์งํ ์ํฌ ์๊ฐ ์
๋๋ค. ๋ง์ฝ `@ModelAttribute` DTO๋ก ๋ฐ์ ๊ฒฝ์ฐ์๋ setter๋ก ๊ฐ์ ๋ฐ์ธ๋ฉ ํด์ผ ํ๋ ๊ฒ์ผ๋ก ์๊ณ ์๋๋ฐ์.
๊ทธ๋ ๋ค๋ฉด setter์์ ๋น ๊ฐ์ผ ๊ฒฝ์ฐ ๊ธฐ๋ณธ ๊ฐ์ ์ฃผ๋ ๋ก์ง์ด ํ์ํ ๋ฏ ๋ณด์ด๋๋ฐ,
๊ฐ๋ฅํ๋ค๋ฉด `@RequestParam` ์ฒ๋ผ `@Something(defaultValue = "Default value")... |
@@ -1,5 +1,6 @@
package com.requestrealpiano.songrequest.domain.account;
+import com.requestrealpiano.songrequest.security.oauth.OAuthAttributes;
import com.requestrealpiano.songrequest.domain.base.BaseTimeEntity;
import com.requestrealpiano.songrequest.domain.letter.Letter;
import lombok.AccessLevel;
@@ -8,9 +9,... | Java | ๊ณ์ ์ ์ต์ด ์์ฑ ํ์ ๋์ ๊ธฐ๋ณธ ๊ฐ (์ ์ฒญ๊ณก ๋ฑ๋ก ์) ์
๋๋ค. ์ด์ ๋ฆฌ๋ทฐ์์ ์ด๋ ๊ฒ ์ง๊ด์ ์ผ๋ก ์ดํดํ ์ ์๋ ์ด๋ฐ ๊ฐ์ ๋ณ์๋ก ๋นผ์ง ์์๋ ๋ ๊ฑฐ ๊ฐ๋ค๋ ํผ๋๋ฐฑ์ ๋ฐ์์๋๋ฐ, ๊ทธ๊ฑธ ๋ฐ์ํด์ ์ฝ๋ ์์ฑ์ ํ๋ ๋ฏ ์ถ์ต๋๋ค.
์ฐ์ ์ด ์ฝ๋๋ ์ปฌ๋ผ์ ๊ธฐ๋ณธ ๊ฐ์ ์ถ๊ฐ ํ ์์ ์ด๊ธฐ ๋๋ฌธ์ ์์ด์ง ์ฝ๋๊ฐ ๋ ๋ฏ ํฉ๋๋ค.
๊ทธ๋ฐ๋ฐ ํน์ ์จ๋๋ ๋งค์ง๋๋ฒ๋ฅผ ์ง์ ํ๋ ๊ฒ์ ๋ํ ์ด๋ค ๊ธฐ์ค์ด ์์ผ์ค๊น์?
์์ ์ ํ ํ๋ก์ ํธ ํ ๋๋ ๋งค์ง ๋๋ฒ ์ฌ์ฉ์ ๋ฌด์กฐ๊ฑด ํผํ๋ ค๊ณ ๋ชจ๋ ๋ณ์๋ก ์ง์ ํ๋ค๊ฐ ์คํ๋ ค ์๋ฏธ ํด์์ด ์ด๋ ค์์ก๋ค๋ ํผ๋๋ฐฑ์ ๋ฆฌ๋ทฐ์ด ๋ถ๊ป ๋ฐ์์ ์ด ์์์ต๋๋ค. ์ด๋ฐ ๊ฒฝ์ฐ... |
@@ -1,5 +1,6 @@
package com.requestrealpiano.songrequest.domain.account;
+import com.requestrealpiano.songrequest.security.oauth.OAuthAttributes;
import com.requestrealpiano.songrequest.domain.base.BaseTimeEntity;
import com.requestrealpiano.songrequest.domain.letter.Letter;
import lombok.AccessLevel;
@@ -8,9 +9,... | Java | ์ ๋ ๋ถ๊ฐ์ ์ค๋ช
์ผ๋ก ์ฃผ์๋ฃ๋๊ฒ๋ ๊ด์ฐฎ๋ค๊ณ ์๊ฐํด์ ๊ทธ๋ฌ๋ ๋ง์ฝ ํ
์คํธ ์ฝ๋์์ ์ฌ๋ฌ๋ฒ ์ค๋ณต๋์๋๋ ๋ฐ๋ก ๊ด๋ฆฌํ๋๊ฒ ๋ซ๊ฒ ๋ค์ |
@@ -11,6 +11,12 @@ public enum ErrorCode {
METHOD_NOT_ALLOWED(405, "์ง์ํ์ง ์๋ ์์ฒญ ๋ฉ์๋ ์
๋๋ค."),
INTERNAL_SERVER_ERROR(500, "์๋ฒ์์ ์์ฒญ์ ์ฒ๋ฆฌํ์ง ๋ชปํ์ต๋๋ค."),
+ // Auth
+ UNAUTHENTICATED_ERROR(401, "์ธ์ฆ์ด ํ์ํฉ๋๋ค. ๋ก๊ทธ์ธ ์ดํ ๋ค์ ์๋ ํด์ฃผ์ธ์."),
+ JWT_INVALID_ERROR(400, "์ฌ๋ฐ๋ฅธ ์ธ์ฆ ์ ๋ณด๊ฐ ์๋๋๋ค. ๋ค์ ๋ก๊ทธ์ธ ํด์ฃผ์ธ์."),
+ JWT_EXPIRATION_ERRO... | Java | JWT ๊ด๋ จ ์์ธ๋ฅผ ๊ตฌ์ํ ๋ ์๋์ ๋ค๊ฐ์ง ์์ธ๊ฐ ๋งจ ์ฒ์ ๊ณ ๋ คํ๋ JWT ๊ด๋ จ ์์ธ์์ต๋๋ค.
1. ExpiredJwtException : ์ ํจ๊ธฐ๊ฐ์ด ์ง๋ Token์ผ๋ก ์์ฒญ
2. InvalidClaimException : Claim ํ์ฑ ์คํจ๋ก ์ธํ ์์ธ
3. MalformedJwtException : ๊ตฌ์กฐ์ ๋ฌธ์ ๊ฐ ์๋ JWT ํ ํฐ์ผ๋ก ์ธํ ์์ธ
4. SignatureException : ์ฌ๋ฐ๋ฅด์ง ์์ JWT ์๊ทธ๋์ฒ๋ก ์ธํ ๊ฒ์ฆ ์คํจ
์ด ๋ 1๋ฒ '์ ํจ๊ธฐ๊ฐ ๋ง๋ฃ' ์ 2, 3, 4์ ํด๋นํ๋ 'JWT ๊ฒ์ฆ ์คํจ'
๋๊ฐ์ง ์ ํ์ผ๋ก๋ง ๋๋์ด์ ์ฒ... |
@@ -0,0 +1,63 @@
+language: java
+jdk:
+ - openjdk11
+
+branches:
+ only:
+ - main
+
+cache:
+ directories:
+ - '$HOME/.m2/repository'
+ - '$HOME/.gradle'
+
+script: "./gradlew clean build"
+
+before_deploy:
+ - mkdir -p before-deploy
+ - cp scripts/*.sh before-deploy/
+ - cp appspec.yml before-deploy/
+... | Unknown | travis CI ์ด๊ตฐ์. ์ ๋ ์จ๋ดค์ง๋ง Github Actions๋ณด๋ค ๋๋ฆฌ๊ณ ๋๋ฒ๊น
ํ๋๋ฐ ๋ถํธํด์ ์ ์ฐ๋ค๊ฐ ๋ฐ๊ฟจ์ต๋๋ค.
ํ์ฌ๋ Github Actions + AWS CodeBuild๋ฅผ ๋ณํฉํด์ ์ฌ์ฉํ๊ณ ์๋๋ฐ CIํด ์ค travis ci๋ฅผ ์ฌ์ฉํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,18 @@
+version: 0.0
+os: linux
+files:
+ - source: /
+ destination: /home/ubuntu/app/songrequest/zip/
+ overwrite: yes
+
+permissions:
+ - object: /
+ pattern: "**"
+ owner: ubuntu
+ group: ubuntu
+
+hooks:
+ ApplicationStart:
+ - location: deploy.sh
+ timeout: 60
+ runas: ubun... | Unknown | ์ฌ๊ธฐ์ ์์
์ผํ ๊ฑด ๋ง์ฝ blue/green ๋ฐฐํฌ๋ฅผ ํ์ค ๊ฒฝ์ฐ overwrite๊ฐ ๋จน์ง ์์ต๋๋ค. ๊ทธ๋์ beforeInstall ์์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ์
์ ํ์ผ ์ญ์ ํ๋ ์คํฌ๋ฆฝํธ๋ฅผ ์ง์
์ผํฉ๋๋ค. ์ด ๋ด์ฉ์ ์ธ์ ๊ฐ ์ ๋ธ๋ก๊ทธ์ ์ ์ ์์ ์ด๋ ๊ถ๊ธํ์๋ฉด ๋ณด์ธ์ฉ |
@@ -0,0 +1,18 @@
+version: 0.0
+os: linux
+files:
+ - source: /
+ destination: /home/ubuntu/app/songrequest/zip/
+ overwrite: yes
+
+permissions:
+ - object: /
+ pattern: "**"
+ owner: ubuntu
+ group: ubuntu
+
+hooks:
+ ApplicationStart:
+ - location: deploy.sh
+ timeout: 60
+ runas: ubun... | Unknown | ๋ง์ฝ ๋ณธ์ธ์ด blue/green ๋ฌด์ค๋จ ๋ฐฐํฌ๋ฅผ ํ์ค๊ฒฝ์ฐ ์ฌ๊ธฐ์ BeforeInstall ์์คํฌ๋ฆฝํธ ๋ฃ์ผ์
์ ์ด์ ๋น๋๋ํ์ผ ์ญ์ ํ์๋ ์์คํฌ๋ฆฝํธ๋ฅผ ๋ฃ์ด์ผ ์ ์์ ์ผ๋ก ์๋๋๋ ๊ผญ ๊ธฐ์ตํ์ธ์ |
@@ -23,13 +23,33 @@ ext {
set('snippetsDir', file("build/generated-snippets"))
}
+bootJar {
+ dependsOn asciidoctor
+ from("${asciidoctor.outputDir}/html5") {
+ into 'static/docs'
+ }
+}
+
+test {
+ outputs.dir snippetsDir
+ useJUnitPlatform()
+}
+
+asciidoctor {
+ inputs.dir snippetsDi... | Unknown | ์ด๊ฒ๋ ์ข์ง๋ง DTO <-> Entity์ญํ ์ ํ๋ ๊ธฐ์กด์ modelmapper๋ ์ข์ง๋ง Mapstruct๋ ํจ์ฌ ์ฑ๋ฅ๋ ์ข์ต๋๋ค. ์ค๋ฌด์์๋ ์ฌ์ฉํ๋ ์ค์
๋๋ค.
https://huisam.tistory.com/entry/mapStruct |
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+REPOSITORY=/home/ubuntu/app/songrequest
+PROJECT_NAME=song-request
+
+echo "> Build ํ์ผ ๋ณต์ฌ"
+
+cp $REPOSITORY/zip/*.jar $REPOSITORY/
+
+echo "> ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid ํ์ธ"
+
+CURRENT_PID=$(pgrep -fl song-request | grep jar | awk '{print $1}')
+
+echo "ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid : $CURRENT_PID"
+
+i... | Unknown | home์ ๊ทธ๋๋ก ๋ฐฐํฌํ๋ ๊ฒ๋ณด๋ค ํด๋๋ฅผ ์์ฑํด์ ๊ด๋ฆฌํ๋ ๊ฒ ์ข์ต๋๋ค. ์ ์ ์ฉํ์
จ๋ค์ |
@@ -9,14 +9,16 @@
import javax.annotation.PostConstruct;
import java.util.TimeZone;
+import static com.requestrealpiano.songrequest.global.constant.JpaProperties.ASIA_SEOUL;
+
@EnableConfigurationProperties(value = {ManiaDbProperties.class, LastFmProperties.class})
@SpringBootApplication
public class SongRequest... | Java | ```suggestion
Timezone.setDefault(TimeZone.getTimeZone(ASIA_SEOUL));
```
์ผ๋ก ๋ฐ๊พธ๋ฉด ์ด๋ป๊ฒ ๋๋์? |
@@ -1,27 +1,33 @@
package com.requestrealpiano.songrequest.controller;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.requestrealpiano.songrequest.domain.song.searchapi.response.SearchApiResponse;
import com.requestrealpiano.songrequest.global.response.ApiResponse;
import com.requestrealpi... | Java | RequestParam๋ ์ข์ง๋ง artist, title๋ ํ๋ฒ์ ๊ด๋ฆฌํ๋ DTO๋ฅผ ๋ง๋ค๋ฉด ์ด๋ค๊ฐ์? ์์ฃผ ์ฐ์ผ์ง ๋ชจ๋ฅด๋ DTO๋ฅผ ๋ง๋ค๊ณ ๊ฑฐ๊ธฐ์ Validation์ฒ๋ฆฌํด๋ ๊ด์ฐฎ์ ๋ณด์
๋๋ค. |
@@ -0,0 +1,32 @@
+package com.requestrealpiano.songrequest.domain.letter.request.inner;
+
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.Size;
+
+import static com.requestrealpiano.songrequest.glo... | Java | validation ๊ด์ฐฎ๋ค์ |
@@ -0,0 +1,25 @@
+package com.requestrealpiano.songrequest.global.constant;
+
+public interface ValidationCondition {
+
+ // Common
+ String NOT_EMPTY_MESSAGE = "ํ์ ์
๋ ฅ ์ ๋ณด ์
๋๋ค.";
+
+ // Artist
+ String ARTIST_MESSAGE = "์ํฐ์คํธ๋ 30์ ๋ฏธ๋ง ์
๋๋ค.";
+ int ARTIST_MAX = 30;
+ int ARTIST_MIN = 1;
+
+ // Title
+ ... | Java | interface์ ๊ทธ๋๋ก value๊ฐ์ ์ง์ ํ๋ฉด ์ข์ง์์ต๋๋ค. ์ดํํฐ๋ธ ์๋ฐ์์ ๋ณธ ๊ฑฐ๊ฐ์๋ฐ ๋ด์ฉ์ด ์ ํํ๊ฒ ๊ธฐ์ต์ ์๋์ง๋ง ์ด๋ ๊ฒ ํ์ง๋ง๋ผ๊ณ ๊ฐํ๊ฒ ๊ฒฝ๊ณ ํ๋ ๊ธฐ์ต์ด ๋๋ค์.
๊ทธ๋ฆฌ๊ณ ๋ด์ฉ์ interface๋ณด๋จ enum์ ์ด์ธ๋ฆฌ๋๋ฐ enum์ ์ด๋ค๊ฐ์? |
@@ -0,0 +1,64 @@
+package com.requestrealpiano.songrequest.global.error;
+
+import com.requestrealpiano.songrequest.global.error.exception.BusinessException;
+import com.requestrealpiano.songrequest.global.error.exception.ParsingFailedException;
+import com.requestrealpiano.songrequest.global.error.response.ErrorCode;
... | Java | ์ด ์ฝ๋๊ฐ validation ์์ธ์ฒ๋ฆฌ๋ก ์๊ณ ์์ต๋๋ค. ์๋์ด ์๋๋์? ํ๋ฒ ํ
์คํธ์ฝ๋์์ ํ์ธํด๋ณด๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+REPOSITORY=/home/ubuntu/app/songrequest
+PROJECT_NAME=song-request
+
+echo "> Build ํ์ผ ๋ณต์ฌ"
+
+cp $REPOSITORY/zip/*.jar $REPOSITORY/
+
+echo "> ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid ํ์ธ"
+
+CURRENT_PID=$(pgrep -fl song-request | grep jar | awk '{print $1}')
+
+echo "ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid : $CURRENT_PID"
+
+i... | Unknown | p4 : ์๋ ๋ฐฐํฌ ์คํฌ๋ฆฝํธ ๊ตฐ์ ๐
๊ฐ๋จํ ํ์ด์ง๋ง.. ์ฌ๊ธฐ์ ์ฌ์ฉํ๊ณ ์๋ `tail`, `grep`๋ฑ๋ฑ ์ ๋ํ ๊ธฐ๋ณธ์ ์ธ ์ดํด ์ ๋๋ ์์ผ์๋ฉด ์ข์๋ฏ ํฉ๋๋ค! |
@@ -0,0 +1,25 @@
+package com.requestrealpiano.songrequest.global.constant;
+
+public interface ValidationCondition {
+
+ // Common
+ String NOT_EMPTY_MESSAGE = "ํ์ ์
๋ ฅ ์ ๋ณด ์
๋๋ค.";
+
+ // Artist
+ String ARTIST_MESSAGE = "์ํฐ์คํธ๋ 30์ ๋ฏธ๋ง ์
๋๋ค.";
+ int ARTIST_MAX = 30;
+ int ARTIST_MIN = 1;
+
+ // Title
+ ... | Java | p3: ์ ๋ enum์ด๋ ๋ค๋ฅธ class์ผ๋ก ๊ด๋ฆฌํ์๋ ๊ฒ ์ข๋ค๊ณ ์๊ฐ๋๋ค์! |
@@ -0,0 +1,63 @@
+language: java
+jdk:
+ - openjdk11
+
+branches:
+ only:
+ - main
+
+cache:
+ directories:
+ - '$HOME/.m2/repository'
+ - '$HOME/.gradle'
+
+script: "./gradlew clean build"
+
+before_deploy:
+ - mkdir -p before-deploy
+ - cp scripts/*.sh before-deploy/
+ - cp appspec.yml before-deploy/
+... | Unknown | travis CI๋ฅผ ์ฌ์ฉํ ๊ธฐ์ ์ ์ธ ์ด์ ๋ ์์์ต๋๋คใ
ใ
CI / CD๋ฅผ ๋ค์ํ ํด๋ก ๊ฒฝํ ํด๋ณด๊ณ ์ถ์ด์ ๋ฐฑ์๋๋ travis CI, ํ๋ก ํธ๋ Github Actions๋ก ๋ฐฐํฌ ํ๊ฒฝ์ ๊ตฌ์ฑ ํ์ต๋๋ค.
travis CI๋ฅผ ์จ๋ณด๊ณ ๋๋ ๊ฒ์... ๋๋ฒ๊น
๊ณผ์ ์์ ๋ถํธํจ์ ์์๊ณ , ๋ค๋ง ๋ง์ ํ์ ๊ฒ์ฒ๋ผ ์กฐ๊ธ ๋๋ฆฐ ๊ฒ์ด ์ฝ๊ฐ ๋ถํธ ํ์ต๋๋ค.
ํ๋ก ํธ์ ๋น๋ ๊ณผ์ ์ด ๋ค๋ฅด๊ธฐ ๋๋ฌธ์ ์ ๋์ ์ธ ๋น๊ต๋ ๋ถ๊ฐ ํ์ง๋ง ์ ๋ Github Actions๊ฐ ์ฝ๊ฐ ๋ ๋น ๋ฅธ ๋๋์ด์๋ค์. |
@@ -0,0 +1,18 @@
+version: 0.0
+os: linux
+files:
+ - source: /
+ destination: /home/ubuntu/app/songrequest/zip/
+ overwrite: yes
+
+permissions:
+ - object: /
+ pattern: "**"
+ owner: ubuntu
+ group: ubuntu
+
+hooks:
+ ApplicationStart:
+ - location: deploy.sh
+ timeout: 60
+ runas: ubun... | Unknown | ๋ง์ฝ ๊ฐ์ธ ํ๋ก์ ํธ๋ก blue / green ๋ฐฐํฌ๊น์ง ํ๊ฒ ๋๋ค๋ฉด ๋งค์ฐ ํฐ ์ฑ๊ณผ๊ฒ ๋ค์ใ
ใ
์จ๋ ๋ธ๋ก๊ทธ์ ์ ๋ณด๊ณ ์์ต๋๋ค. ๐ ์ข์ ํ ๊ฐ์ฌํฉ๋๋ค. |
@@ -1,27 +1,33 @@
package com.requestrealpiano.songrequest.controller;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.requestrealpiano.songrequest.domain.song.searchapi.response.SearchApiResponse;
import com.requestrealpiano.songrequest.global.response.ApiResponse;
import com.requestrealpi... | Java | ์์ง์ ์ฌ๊ธฐ์ ๋ฐ์ ์ฐ์ด์ง ์๋๋ฐ ์ฌ์ฉ ๋๋ ๊ณณ์ด ๋ ๋ง์์ง๋ฉด `@ModelAttribute` ๊ฐ์ฒด๋ก ํ๋ฒ ๊ด๋ฆฌ ํด๋ณผ๊ฒ์! |
@@ -0,0 +1,25 @@
+package com.requestrealpiano.songrequest.global.constant;
+
+public interface ValidationCondition {
+
+ // Common
+ String NOT_EMPTY_MESSAGE = "ํ์ ์
๋ ฅ ์ ๋ณด ์
๋๋ค.";
+
+ // Artist
+ String ARTIST_MESSAGE = "์ํฐ์คํธ๋ 30์ ๋ฏธ๋ง ์
๋๋ค.";
+ int ARTIST_MAX = 30;
+ int ARTIST_MIN = 1;
+
+ // Title
+ ... | Java | ์ธํฐํ์ด์ค๊ฐ static ์์์ ์ถ์ ๋ฉ์๋๋ง ์ ๊ทผ ๊ฐ๋ฅํด์ ์ด๋ ๊ฒ ์ ์ฉ ํด๋ดค์๋๋ฐ, ๋ค์ ๋ณด๋ Enum์ผ๋ก ๊ด๋ฆฌ ํ๋๊ฒ ๋ ์ ํฉ ํ ๊ฑฐ ๊ฐ์ต๋๋ค.
(+) ์ธ๊ธํ์ ์ดํํฐ๋ธ ์๋ฐ์ ๋ด์ฉ์ (3rd edition ๊ธฐ์ค) `Item 22` ์ ์๋ค์! |
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+REPOSITORY=/home/ubuntu/app/songrequest
+PROJECT_NAME=song-request
+
+echo "> Build ํ์ผ ๋ณต์ฌ"
+
+cp $REPOSITORY/zip/*.jar $REPOSITORY/
+
+echo "> ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid ํ์ธ"
+
+CURRENT_PID=$(pgrep -fl song-request | grep jar | awk '{print $1}')
+
+echo "ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid : $CURRENT_PID"
+
+i... | Unknown | ๋ง์ ํ์ ๊ฒ์ฒ๋ผ EC2์ Nginx๋ฅผ ์ค์ ํ๊ณ ๋ฐฐํฌ ํ๊ฒฝ์ ๊ตฌ์ฑํ๋ ๊ณผ์ ์์ ๋ฆฌ๋
์ค ๋ช
๋ น์ด๊ฐ ๋ง์ด ๋ถ์กฑํ๋ค๋ ๊ฒ์ ๋๊ผ์ต๋๋ค.
๊ทธ๋์ ๋ณ๋๋ก ์กฐ๊ธ์ฉ ๊ณต๋ถ๋ฅผ ํ๊ณ ์์ด์ใ
ใ
์กฐ์ธ ํด์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค! ๐ |
@@ -0,0 +1,18 @@
+package com.codesquad.baseball09.controller;
+
+import java.text.SimpleDateFormat;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMap... | Java | Spring Boot Actuator ์ฌ์ฉ ๊ฒํ ํด๋ด
๋๋ค.
https://supawer0728.github.io/2018/05/12/spring-actuator/ |
@@ -0,0 +1,99 @@
+package com.codesquad.baseball09.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+public class BattingLog {
+
+ private Long id;
+ private Long gameId;
+ private Long playerId;
+ private int inning;
+ private Status status;... | Java | ์ ์ ํ builder ์ฌ์ฉ ์ข๋ค์. ๐ |
@@ -0,0 +1,282 @@
+package com.codesquad.baseball09.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import java.util.List;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public class Board {
+
+ private Long gameId;
+ private int inn... | Java | ์ธ์๊ฐ ๋ง์ด ํ์ํ ์์ฑ์๋ฅผ `private` ํ๊ฒ ๊ฐ๋ฆฌ๋ ๊ตฌํ ์์ฃผ ์ข์ต๋๋ค! ๐ฏ ๐ฅ |
@@ -0,0 +1,282 @@
+package com.codesquad.baseball09.model;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import java.util.List;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public class Board {
+
+ private Long gameId;
+ private int inn... | Java | `else` ์์ด ๊ตฌํํด๋ณผ ์ ์์ง ์์์๊น์? |
@@ -0,0 +1,196 @@
+package com.codesquad.baseball09.model;
+
+import static com.codesquad.baseball09.model.Status.BALL;
+import static com.codesquad.baseball09.model.Status.HIT;
+import static com.codesquad.baseball09.model.Status.OUT;
+import static com.codesquad.baseball09.model.Status.STRIKE;
+
+import com.fasterxml... | Java | ๋ค ๊ฐ์ ํ์์ ๋ํด ๊ฒฐ๊ณผ๋ฅผ ๋ฐ์ํด์ผ ํ๋ค ๋ณด๋, ๋ค ๊ฐ์ `case` ๋ฅผ ๊ฐ๋ `switch` ๋ฌธ๊ณผ ๊ฐ์ ๊ตฌํ์ด ๋์ค๊ฒ ๋์์ต๋๋ค.
์ด๋ฅผ ์ด๋ป๊ฒ ๊ฐ์ฒด์งํฅ์ ์ผ๋ก, ๊น๋ํ๊ฒ ํ ์ ์์๊น์.
๋จ์ํ ์๊ฐํด๋ณด๊ธฐ๋ก๋ `InningCount` ๋ผ๋ ๊ฐ์ฒด๊ฐ `BallCount` ๊ฐ์ฒด๋ฅผ ๋ค์ ๊ฐ๊ณ ์์ผ๋ฉด์, ์์ ์นด์ดํธ์ ๋ณผ ์นด์ดํธ๋ฅผ ๊ด๋ฆฌํ๋ ๋ฐฉ์์ด ๋ ์ค๋ฆ
๋๋ค.
๊ฐ ํ์์ ํด๋นํ๋ `enum` ์ ๊ฐ์ฒด์ ๋๊ธฐ๋ฉด ๊ทธ ๊ฐ์ฒด๊ฐ ๋๋จธ์ง ์ผ์ ์ฒ๋ฆฌํ๊ฒ ๋๋ ๊ฑฐ์ฃ .
ํ ๋ฒ ์๊ฐํด๋ณด์๊ณ ๋๋๊ธ๋ก ๊ณ์ ๊ตฌํ์ ๋ํด ์๊ฒฌ ๋๋ ๋ณด๋ฉด ์ฌ๋ฐ๊ฒ ๋ค์. |
@@ -0,0 +1,18 @@
+package com.codesquad.baseball09.controller;
+
+import java.text.SimpleDateFormat;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMap... | Java | ๋ค์ ํ๋ก์ ํธ์ ํ๋ฒ ์ ์ฉํด๋ณด๊ฒ ์ต๋๋ค |
@@ -0,0 +1,196 @@
+package com.codesquad.baseball09.model;
+
+import static com.codesquad.baseball09.model.Status.BALL;
+import static com.codesquad.baseball09.model.Status.HIT;
+import static com.codesquad.baseball09.model.Status.OUT;
+import static com.codesquad.baseball09.model.Status.STRIKE;
+
+import com.fasterxml... | Java | @wheejuni ๋ฆ๊ฒ ๋ตํด๋๋ ค ์ฃ์กํฉ๋๋ค..
ํ์ฌ `InningStatus` ๊ฐ์ฒด๋ inning, strike, ball, out, hit๋ฅผ primitive ํ ๊ฐ์ผ๋ก ๋ณด๊ดํ๊ณ ์์ต๋๋ค.
๋ง์ํ์ ๋ฐฉ๋ฒ์ ball, out์ ๊ด๋ฆฌํ๋ `BallCount`๋ผ๋ ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด์ ํด๋น ํ์์ ๋ํด ์ด ๊ฐ์ฒด์์ ์ฒ๋ฆฌํ๋๋ก ๋ง๋๋ ๋ฐฉ๋ฒ์ด๋ผ ์ดํด๋ฉ๋๋ค.
๊ทธ๋ฆฌ๊ณ ๋๋จธ์ง ์ผ์ ์ฒ๋ฆฌํ๋ ๋ถ๋ถ์, `4ball`์ผ ๊ฒฝ์ฐ, `1 out`์ด ์ฌ๋ผ๊ฐ๋๋ก ํน์ `3 out` ์ ๊ณต์๊ต๋๋ฅผ ํ ์ ์๋๋ก ์๋ ค์ฃผ๋ ์ญํ ์ด๋ผ ์๊ฐ๋ฉ๋๋ค. ์ ๊ฐ ์ ๋๋ก ์ดํดํ ๊ฒ์ด ๋ง์๊น์? |
@@ -0,0 +1,196 @@
+package com.codesquad.baseball09.model;
+
+import static com.codesquad.baseball09.model.Status.BALL;
+import static com.codesquad.baseball09.model.Status.HIT;
+import static com.codesquad.baseball09.model.Status.OUT;
+import static com.codesquad.baseball09.model.Status.STRIKE;
+
+import com.fasterxml... | Java | strike, ball, out, hit ๊ฐ๊ฐ ์ญํ ์ด ์๋ ๋งํผ , ๋ชจ๋ ๊ฐ์ฒด๋ก ๋ง๋๋ ๊ฒ์ด ์ข ๋ ๊น๋ํ ๋ฐฉ๋ฒ์ผ๊น์?
์ด๋ ๊ฒ ์ด๋ค ๋ณํ์ ๋ฐ๋ผ ์ํฅ ๋ฐ๋ ๊ฒ๋ค์ด ๋ง์ ๋, ์ด๋ป๊ฒ ๊ทธ๋ฌํ ์ํธ์์ฉ์ ๊ตฌํํ ์ ์์์ง, ๋๊ฐํฉ๋๋คใ
ใ
|
@@ -1,3 +1,5 @@
+import {ReviewLikeButtonProps} from "@review-canvas/theme";
+
export type Shadow = 'NONE' | 'SMALL' | 'MEDIUM' | 'LARGE';
export type FocusAreaLayout = 'BEST_REVIEW_TOP' | 'BEST_REVIEW_BOTTOM' | 'BEST_REVIEW_LEFT' | 'BEST_REVIEW_RIGHT';
export type ReviewAreaLayout = 'REVIEW_TOP' | 'REVIEW_BOTTOM' |... | TypeScript | ์ ์ฒด์ ์ผ๋ก Prettier๊ฐ ์ ์ฉ์ด ์ ๋์ด ์๋ ๊ฒ ๊ฐ์๋ฐ Prettier ์ ์ฒด์ ์ผ๋ก ์ ์ฉํด ์ฃผ์ธ์! |
@@ -9,50 +9,55 @@ import {
generateShadowCSS,
} from '@review-canvas/theme';
+// import ThumbUpIcon from '@/assets/icon/icon-thumb-up.svg';
import { Star } from '@/components/review/star.tsx';
import { useReviewItemStyle } from '@/contexts/style/review-item.ts';
import useMessageToShop from '@/hooks/use-messag... | Unknown | svg๋ component๋ก ๋ถ๋ฆฌํด์ Importํด์ ์ฐ๋ ๊ฒ ์ด๋จ๊ฐ์?? ๋ค๋ฅธ ๊ณณ์์๋ ์ธ ์ ์๊ณ , ์ปดํฌ๋ํธ ์ฝ๋ ๋ด์์ ๊ฐ๋
์ฑ์ด ์ข์ง ์์ ๊ฒ ๊ฐ์์์! |
@@ -9,50 +9,55 @@ import {
generateShadowCSS,
} from '@review-canvas/theme';
+// import ThumbUpIcon from '@/assets/icon/icon-thumb-up.svg';
import { Star } from '@/components/review/star.tsx';
import { useReviewItemStyle } from '@/contexts/style/review-item.ts';
import useMessageToShop from '@/hooks/use-messag... | Unknown | ๋ถํ์ํ console์ ์ ์ธํด์ฃผ์ธ์! ์์ ์ ๋ฆฌ๋ทฐ์๋ ๋์๋ผ์ ๊ฐ์ ๊ฒฝ์ฐ๋ ์คํ๋ ค alert์ผ๋ก ๋ณด์ฌ์ฃผ๋ ๊ฒ ๋ซ์ง ์์๊น ์ถ๋ค์ |
@@ -9,50 +9,55 @@ import {
generateShadowCSS,
} from '@review-canvas/theme';
+// import ThumbUpIcon from '@/assets/icon/icon-thumb-up.svg';
import { Star } from '@/components/review/star.tsx';
import { useReviewItemStyle } from '@/contexts/style/review-item.ts';
import useMessageToShop from '@/hooks/use-messag... | Unknown | ts ignore๋ ํน์ ์ ์ค์ ํด ๋์ผ์ ๊ฑธ๊น์?? |
@@ -9,50 +9,55 @@ import {
generateShadowCSS,
} from '@review-canvas/theme';
+// import ThumbUpIcon from '@/assets/icon/icon-thumb-up.svg';
import { Star } from '@/components/review/star.tsx';
import { useReviewItemStyle } from '@/contexts/style/review-item.ts';
import useMessageToShop from '@/hooks/use-messag... | Unknown | P3: interface ๊ฐ์ ๊ฒฝ์ฐ ๋ค๋ฅธ ๊ณณ์์๋ ์ฌ๋ฌ ๊ณณ์์ ์ฐ์ผ ์ ์๋๋ฐ, type ๋๋ ํ ๋ฆฌ ๋ฑ์ ๊ณตํต์ ์ธ model์ ์ ์ํด๋๊ณ extends ๋ฑ์ผ๋ก ๊ฐ์ ธ์์ ์ฐ๋ ๋ฐฉ์๋ ๊ณ ๋ คํด ๋ณผ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค. ReviewItem์ ์๋นํ ๋ง์ ๊ณณ์์ ์ฐ์ด๋ ์์๋ก ์๊ฐ๋์ ์ฐธ๊ณ ํ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ ๋จ๊น๋๋ค! |
@@ -1,3 +1,5 @@
+import {ReviewLikeButtonProps} from "@review-canvas/theme";
+
export type Shadow = 'NONE' | 'SMALL' | 'MEDIUM' | 'LARGE';
export type FocusAreaLayout = 'BEST_REVIEW_TOP' | 'BEST_REVIEW_BOTTOM' | 'BEST_REVIEW_LEFT' | 'BEST_REVIEW_RIGHT';
export type ReviewAreaLayout = 'REVIEW_TOP' | 'REVIEW_BOTTOM' |... | TypeScript | Plugin ์ค์น๋ฅผ ํ๋ฉด ์๋ฃ์ธ ์ค ์์๋๋ฐ ์ค์ ์์ Manually๋ก ๋ฐ๊พธ์ด์ค์ผ ํ๊ตฐ์... ํ์ฌ Prettier๋ฅผ ํ์ฑํ ์ํ๋ก ๋ณ๊ฒฝํ์์ต๋๋ค. ์ ์ฒด ํ์ผ์ ์ ์ฉํ์ฌ ๋ค์ ์ปค๋ฐํ๊ฒ ์ต๋๋ค! |
@@ -9,50 +9,55 @@ import {
generateShadowCSS,
} from '@review-canvas/theme';
+// import ThumbUpIcon from '@/assets/icon/icon-thumb-up.svg';
import { Star } from '@/components/review/star.tsx';
import { useReviewItemStyle } from '@/contexts/style/review-item.ts';
import useMessageToShop from '@/hooks/use-messag... | Unknown | ํ์ธํ์์ต๋๋ค, Alert๋ก ๋ณ๊ฒฝํ๊ฒ ์ต๋๋ค, ๋์๋ผ์!์ ๊ฒฝ์ฐ์๋ ๋ฒํผ์ด ์ ๋๋ก ๋์ํ๋ ๊ฒ์ ํ์ธํ๊ธฐ ์ํด ์์๋ก ๋ฃ์ด๋๊ณ ๋์ค์ ๋์๋ผ์ API๊ฐ ๋ฐฑ์๋์์ ๊ตฌํ๋๋ฉด ๋ก์ง์ผ๋ก ๋์ฒดํ๊ฒ ์ต๋๋ค! |
@@ -9,50 +9,55 @@ import {
generateShadowCSS,
} from '@review-canvas/theme';
+// import ThumbUpIcon from '@/assets/icon/icon-thumb-up.svg';
import { Star } from '@/components/review/star.tsx';
import { useReviewItemStyle } from '@/contexts/style/review-item.ts';
import useMessageToShop from '@/hooks/use-messag... | Unknown | ํ์ธํ์์ต๋๋ค, Import๋ก ๋์ฒดํ๊ฒ ์ต๋๋ค! |
@@ -9,50 +9,55 @@ import {
generateShadowCSS,
} from '@review-canvas/theme';
+// import ThumbUpIcon from '@/assets/icon/icon-thumb-up.svg';
import { Star } from '@/components/review/star.tsx';
import { useReviewItemStyle } from '@/contexts/style/review-item.ts';
import useMessageToShop from '@/hooks/use-messag... | Unknown | ํ
์คํธ๋ฅผ ํ ๋ ReviewLikeButton์ด 'None'์ผ๋ก ๊ณ ์ ์ด๋ผ ํ๋์ฝ๋ฉ์ผ๋ก ReviewLikeButton์ ๋ฐ๊พธ๊ณ ์์์ต๋๋ค. ๊ทธ ๊ณผ์ ์์ ์กฐ๊ฑด๋ฌธ ๊ฒฝ๊ณ ๊ฐ ๋ฐ์ํ์ฌ ์ค์ ํด๋์๋๋ฐ ํ๋์ฝ๋ฉ๋ง ์ง์ฐ๊ณ ์ด๊ทธ๋
ธ์ด๋ฅผ ๋ชป ์ง์ ๋ค์... ์ง์์ ๋ฐ์ํ๊ฒ ์ต๋๋ค! |
@@ -9,50 +9,55 @@ import {
generateShadowCSS,
} from '@review-canvas/theme';
+// import ThumbUpIcon from '@/assets/icon/icon-thumb-up.svg';
import { Star } from '@/components/review/star.tsx';
import { useReviewItemStyle } from '@/contexts/style/review-item.ts';
import useMessageToShop from '@/hooks/use-messag... | Unknown | service/api-types/review.tsx์ ๊ณตํต ๋ชจ๋ธ๋ก ์ ์ธํ์ฌ export ๋ฐ import ํ์์ต๋๋ค! |
@@ -0,0 +1,97 @@
+package christmas.config;
+
+import christmas.controller.EventController;
+import christmas.exception.RetryHandler;
+import christmas.service.EventService;
+import christmas.service.MenuService;
+import christmas.validator.InputValidator;
+import christmas.view.input.ConsoleReader;
+import christmas.v... | Java | ์ ์ฒด์ ์ผ๋ก null ์ฒดํฌ๋ฅผ ํด์ฃผ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,30 @@
+package christmas.constants.event;
+
+public enum BadgeType {
+ NONE("์์", 0),
+ STAR("๋ณ", 5_000),
+ TREE("ํธ๋ฆฌ", 10_000),
+ SANTA("์ฐํ", 20_000);
+
+ private final String name;
+ private final int threshold;
+
+ BadgeType(String name, int threshold) {
+ this.name = name;
+ ... | Java | ๋ฐฐ์ง ์์์ NONE์ผ๋ก ๊ด๋ฆฌํ์ ๋ถ๋ถ๋ ์ข์ ์ ๋ต์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค :)
Optional์ ๊ณ ๋ คํด๋ณด์๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์์! ์ด๋ฒ์ Optional์ ์ฒ์ ํ์ฉํด๋ดค๋๋ฐ์, **์์ ์๋ ์๋ค ๋ผ๋ ๋น์ฆ๋์ค ์๊ตฌ์ฌํญ**์ **์ฝ๋๋ก ๋ช
์**ํ ์ ์๋ ์ ์ด ์ ๋ง ํฐ ์ฅ์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค :)
๋ง์ฝ Optional์ ๋์
ํ๋ค๋ฉด `from` ๋ฉ์๋๋ฅผ ์ด๋ ๊ฒ ๋ฆฌํฉํฐ๋งํด๋ณผ ์ ์์ ๊ฒ ๊ฐ์์!
```java
public static Optional<BadgeType> from(int benefitPrice) {
Optional<Badge> bad... |
@@ -0,0 +1,54 @@
+package christmas.constants.menu;
+
+import static christmas.constants.menu.MenuType.APPETIZER;
+import static christmas.constants.menu.MenuType.DESSERT;
+import static christmas.constants.menu.MenuType.DRINKS;
+import static christmas.constants.menu.MenuType.MAIN;
+import static christmas.exception.E... | Java | `์ด๋ฆ`์ ๋ํ `๋ฉ๋ด`๋ฅผ HashMap์ผ๋ก ์บ์ฑํด๋๋ ์ ๋ต๋ ์ถ์ฒ๋๋ฆฝ๋๋ค.
Enum์์ static ๋ธ๋ก์ ์ถ๊ฐํ ์ ์๋๋ฐ์, ์๋ฐ์์ผ๋ก ๊ตฌํํ ์ ์์ต๋๋ค!
```java
public enum Menu {
// ์ด๊ฑฐํ ์์๋ค ...
private static final Map<String, Menu> cachedMenu = new HashMap<>();
static {
for (Menu menu : values()) {
cachedMenu.put(menu.getName(), m... |
@@ -0,0 +1,98 @@
+package christmas.service;
+
+import static christmas.constants.event.EventRule.MAX_MENU_AMOUNT;
+import static christmas.constants.menu.MenuType.DRINKS;
+import static christmas.exception.ErrorCode.INVALID_MENU_ORDER;
+
+import christmas.constants.menu.Menu;
+import christmas.constants.menu.MenuType;... | Java | `MenuService` ์์ ์ฃผ๋ฌธ ์ ๋ณด๋ค์ ๋ด๊ณ ์๋๊ฒ ์ธ์๊น์ต๋๋ค!
์ด๊ฒ๋ ์ข์ ์ ๊ทผ ๋ฐฉ์์ธ ๊ฒ ๊ฐ์ง๋ง, `Map<Menu, Integer>`๊ฐ `์ฃผ๋ฌธ ์ ๋ณด` ๋ผ๋ ์ฌ์ค์ ์ถ์ ํ๊ธฐ ์ด๋ ค์ธ ์๋ ์์ ๊ฒ ๊ฐ์์!
`Order` Domain ํด๋์ค๋ฅผ ์์ฑํ๊ณ , validate ๊ฒ์ฆ ์ญํ ๋ ์์ํด์ฃผ๋ฉด MenuService ํด๋์ค๊ฐ ํ์ธต ์์์ง ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
์ฌ๊ธฐ์ Service Layer์ ํด๋์ค๊ฐ ์์์ง๋ค๋ ๊ฒ์ **Domain ๊ฐ์ฒด์๊ฒ ์์ฒญํ์ฌ ๊ฒฐ๊ณผ ๊ฐ์ ๋ฐํํ๋ ์ญํ **, **๋น์ฆ๋์ค ๋ก์ง ํ๋ฆ์ ๋ด๋นํ๋ ์ญํ **๋ก ์ถ์ ๋๋ค๋ ์๋ฏธ๋ผ๊ณ ์๊ฐํด์.... |
@@ -0,0 +1,32 @@
+package christmas.util;
+
+import static christmas.exception.ErrorCode.INVALID_DATE;
+import static christmas.exception.ErrorCode.INVALID_MENU_ORDER;
+
+import java.util.List;
+
+public class Parser {
+ public static int parseToDate(String input) {
+ try {
+ return Integer.parseIn... | Java | catch ํ ์ด๋ ํ Exception์ ๋ค๋ฅธ Exception์ผ๋ก ๋ํํ์ฌ ๋ค์ ๋์ ธ์ค ๋, catch ํ๋ Exception๋ ๋ฃ์ด์ ๋๊ฒจ์ฃผ๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค.
```java
public static int parseToDate(String input) {
try {
return Integer.parseInt(input);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(INVALID_DATE.get... |
@@ -0,0 +1,25 @@
+package christmas.constants.event;
+
+public enum EventRule {
+ EVENT_THRESHOLD(10_000),
+ PRESENT_THRESHOLD(120_000),
+ EVENT_START(1),
+ EVENT_END(31),
+ MAX_MENU_AMOUNT(20),
+ CHRISTMAS_EVENT_END(25),
+ CHRISTMAS_INIT_PRICE(1_000),
+ CHRISTMAS_EXTRA_DISCOUNT(100),
+ MENU_... | Java | ์ด๋ฒคํธ ๋ฃฐ์ ํ ๊ณณ์ ๋ชจ์๋์ผ๋ ์ฝ๋๊ฐ ์ฝ๊ฒ ์ฝํ์ง ์๋๊ฑฐ ๊ฐ์์! ์ด๋ฒคํธ ์ข
๋ฅ์ ๋ฐ๋ผ ๋ถ๋ฆฌํ๊ฑฐ๋, EventType์ ๋ฉค๋ฒ๋ณ์๋ก ๋ฃฐ์ ์ ์ํ์๋ ๊ฒ์ ์ด๋ค๊ฐ์? |
@@ -0,0 +1,38 @@
+package christmas.exception;
+
+import christmas.view.output.OutputView;
+import java.util.Arrays;
+import java.util.function.Supplier;
+
+public class RetryHandler implements ExceptionHandler {
+ private final OutputView outputView;
+
+ public RetryHandler(OutputView outputView) {
+ this... | Java | ์ค์ exception๊ณผ ์ธ์๋ก ๋ฐ์ exception์ ๋น๊ตํ๋ ๋ก์ง์ด ํ์ํ ์ด์ ๊ฐ ๊ถ๊ธํด์! |
@@ -0,0 +1,19 @@
+package christmas.constants.event;
+
+public enum EventType {
+ CHRISTMAS("ํฌ๋ฆฌ์ค๋ง์ค ๋๋ฐ์ด ํ ์ธ"),
+ WEEKDAY("ํ์ผ ํ ์ธ"),
+ WEEKEND("์ฃผ๋ง ํ ์ธ"),
+ SPECIAL("ํน๋ณ ํ ์ธ"),
+ PRESENT("์ฆ์ ์ด๋ฒคํธ");
+
+ private final String description;
+
+ EventType(String description) {
+ this.description = descrip... | Java | `Eventable` ์ธํฐํ์ด์ค์ `๊ฐ๊ฐ์ ์ด๋ฒคํธ ๊ตฌํ์ฒด ํด๋์ค`์์ ํ ์ธ / ์ฆ์ ์ํ ๊ณ์ฐ ์ฒ๋ฆฌํ์ ๋ฐฉ๋ฒ๋ ๊ต์ฅํ ์ง๊ด์ ์ผ๋ก ์ฝํ๊ณ ์ ๋ง ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! ๐
์ ๋ `ํฌ๋ฆฌ์ค๋ง์ค ๋๋ฐ์ด/ ํ์ผ/ ์ฃผ๋ง /ํน๋ณ ํ ์ธ ์ด๋ฒคํธ ์ ํ`๊ณผ `ํ ์ธ ์ด๋ฒคํธ ์ ํ์ ํด๋นํ๋ ๊ณ์ฐ ์ฒ๋ฆฌ`๋ **์๋ก ๋ฐ์ ํ ์ฐ๊ด์ด ์๋ ์์**๋ผ๋ ์๊ฐ์ด ๋ค์์ต๋๋ค! ๊ทธ๋์ `EventType Enum`์์ ํ ์ธ ๊ณ์ฐ ์ฒ๋ฆฌ๋ ํจ๊ป ๊ด๋ฆฌํ๋๋ก ํ์ต๋๋ค.
์ด๋ ๊ฒ ์ฒ๋ฆฌ๋ฅผ ํ๋ **ํ ์ธ ์ด๋ฒคํธ ์ ํ์ด๋ผ๋ ์ํ**์ **์ด๋ฒคํธ ์ ํ์ ๋ํ ๊ณ์ฐ์ฒ๋ฆฌ๋ผ๋ ํ์**๊ฐ ํ ๊ณณ์ ๋ฐ์ง๋์ด ์์ด ์ ์ง๋ณด์ํ... |
@@ -0,0 +1,7 @@
+package christmas.model;
+
+public interface Eventable<T> {
+ boolean canJoinEvent(T condition);
+
+ int getDiscountPrice();
+} | Java | Eventable์ด๋ผ๋ ๊ฐ์ฒด๋ช
์ด ์กฐ๊ธ ํท๊ฐ๋ฆฌ๋๊ฑฐ ๊ฐ์์. ํ์ฌ Eventable์ ์ด๋ฒคํธ ์ฌ๋ถ๋ฅผ ํ๋จํ๋ ๋ฉ์๋์ ํ ์ธ ๊ธ์ก์ ๊ณ์ฐํ๋ ๋ฉ์๋๊ฐ ์กด์ฌํด์. ํ์ง๋ง Eventable ๋ค์ด๋ฐ์ ํ ์ธ ์ฌ๋ถ๋ง ํ๋จํ๋ ์ญํ ์ด๋ผ๊ณ ์คํดํ ์ ์์๊ฑฐ ๊ฐ์ต๋๋ค ๐ฅ |
@@ -0,0 +1,33 @@
+package christmas.model;
+
+import static christmas.constants.event.EventRule.PRESENT_THRESHOLD;
+import static christmas.constants.menu.Menu.CHAMPAGNE;
+
+public class PresentEvent implements Eventable<Integer> {
+ private final int amount;
+
+ private PresentEvent(int orderPrice) {
+ if... | Java | 1 ์ด๋ผ๋ ์ซ์๋ฅผ ์์๋ก ์ ์ธํ๋ ๊ฒ์ ์ด๋ค๊ฐ์? ์๊ตฌ์ฌํญ์ ์ดํดํ์ง ๋ชปํ ์ฌ๋์ด ์ฝ๋๋ฅผ ๋ณด๋ ๊ฒฝ์ฐ 1์ด๋ผ๋ ์ซ์์ ์๋ฏธ๋ฅผ ํ์
ํ๊ธฐ ์ด๋ ค์ธ๊ฑฐ ๊ฐ์์ :) |
@@ -0,0 +1,80 @@
+package christmas.service;
+
+import static christmas.constants.event.EventRule.EVENT_THRESHOLD;
+import static christmas.constants.event.EventType.CHRISTMAS;
+import static christmas.constants.event.EventType.PRESENT;
+import static christmas.constants.event.EventType.SPECIAL;
+import static christma... | Java | EventService๋ ์ถฉ๋ถํ ์ข์ ์ฝ๋๋ผ๊ณ ์๊ฐ๋ฉ๋๋ค!
์ด๋ฒคํธ๋ `ํ ์ธ`์ ๋ํ ์ด๋ฒคํธ, `์ฆ์ ์ํ`์ ๋ํ ์ด๋ฒคํธ๋ก ๋๋๊ธฐ ๋๋ฌธ์ `DiscountEventService`, `GiftEventService`๋ก ๋๋๋ค๋ฉด, ๊ฐ ์๋น์ค ํด๋์ค๊ฐ ์ด๋ค ์ด๋ฒคํธ์ ๋ํด ์ฒ๋ฆฌํ๋์ง ๋ณด๋ค ๋ช
ํํด์ง๊ณ ์ ์ง๋ณด์ํ๊ธฐ๋ ์ข์์ง ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,31 @@
+package christmas.model;
+
+import static christmas.constants.event.EventRule.SPECIAL_DISCOUNT;
+
+import christmas.util.DayAnalyzer;
+
+public class SpecialEvent implements Eventable<Integer> {
+ private final int discountPrice;
+
+ private SpecialEvent(Integer date) {
+ if (canJoinEvent... | Java | ํด๋น ๋ก์ง์ ์ ์ ๋ฉ์๋์ ๋ค์ด๊ฐ๋ ๊ฒ์ด ์ ํฉํ ๊ฑฐ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์? ์์ฑ์๋ ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ ์ฑ
์๋ง ๊ฐ๊ณ , ์ ์ ๋ฉ์๋์์ ์กฐ๊ฑด์ ๋ฐ๋ฅธ discountPrice๊ฐ์ ์์ฑ์๋ก ๋๊ฒจ์ค ์ ์์๊ฑฐ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,80 @@
+package christmas.service;
+
+import static christmas.constants.event.EventRule.EVENT_THRESHOLD;
+import static christmas.constants.event.EventType.CHRISTMAS;
+import static christmas.constants.event.EventType.PRESENT;
+import static christmas.constants.event.EventType.SPECIAL;
+import static christma... | Java | ํด๋น ๋ก์ง์ EnumMap์ ์ด๊ธฐํํ๋ ๋ก์ง์ธ๊ฑฐ ๊ฐ์์. ๊ทธ๋ผ ์์ฑ์๊ฐ ์๋ init ์ด๋ผ๋ ์ด๋ฆ์ ์ ์ ๋ฉ์๋๋ฅผ ํตํด ๋ด๋ถ ๋ก์ง์ ์ข ๋ ๋ช
ํํ ํ์
ํ ์ ์๋๋ก ํ๋ ๊ฒ์ ์ด๋ค๊ฐ์? |
@@ -0,0 +1,80 @@
+package christmas.service;
+
+import static christmas.constants.event.EventRule.EVENT_THRESHOLD;
+import static christmas.constants.event.EventType.CHRISTMAS;
+import static christmas.constants.event.EventType.PRESENT;
+import static christmas.constants.event.EventType.SPECIAL;
+import static christma... | Java | ์ด๋ฒคํธ์ ๋ํ ์ ์ฑ
๋ค์ ์ธ๋ถ์์ ์ฃผ์
๋ฐ๋๋ก ํ๋ ๊ฒ์ ์ด๋ค๊ฐ์? ํ์ฌ ์ฝ๋๋ ์์กด ์ญ์ ์์น(DIP)์ ์ค์ํ์ง ์์ ์ฝ๋๋ผ๊ณ ์๊ฐํฉ๋๋ค. ํ ์ธ ์ข
๋ฅ์ ๋ํ ์ ์ฑ
์ด ๋ณํ๋ ๊ฒฝ์ฐ ์ ํ๋ฆฌ์ผ์ด์
์ฝ๋๋ฅผ ์์ ํด์ผํ๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. ๋ฐ๋ผ์, ์ ํ๋ฆฌ์ผ์ด์
๋ด๋ถ์์๋ ์ถ์ ๊ฐ์ฒด์ ์์กดํ๊ณ , service ์์ฑ์์ EnumMap์ ๋๊ฒจ์ฃผ๋ ๊ฒ์ ์ด๋ค๊ฐ์? |
@@ -0,0 +1,98 @@
+package christmas.service;
+
+import static christmas.constants.event.EventRule.MAX_MENU_AMOUNT;
+import static christmas.constants.menu.MenuType.DRINKS;
+import static christmas.exception.ErrorCode.INVALID_MENU_ORDER;
+
+import christmas.constants.menu.Menu;
+import christmas.constants.menu.MenuType;... | Java | ์ผ๋ฐ์ ์ผ๋ก validate ๊ฒ์ฆ ํ
์คํธ๋ public ๋ฉ์๋๋ฅผ ํ
์คํธํ์ฌ ์งํํ๋๋ฐ, ๋ชจ๋ private ๋ฉ์๋๊ฐ ๋์ผํ ์์ธ๋ฅผ ๋์ง๊ณ ์๊ธฐ ๋๋ฌธ์ ๋ฉ์์ง ๋ด์ฉ์ ํ์ธํ๋ ๋ฑ ์ธ๋ถ์ ์ธ ๊ฒ์ฆ ์ ์ฐจ๊ฐ ํ์ํ๋ค ์๊ฐํฉ๋๋ค. `IllegalArgumentException`์ด ์ ํํ ์ด๋ ์ง์ ์์ ๋ฐ์ํ๋์ง ์๊ธฐ ์ด๋ ค์ฐ๋๊น์!
ํ์ง๋ง ์ด๋ฒ ๋ฏธ์
์ `์๋ฌ๋ฌธ ๋ด์ฉ์ด 2๊ฐ์ง`๋ก ์ ํด์ ธ ์๊ธฐ ๋๋ฌธ์, ์ด์ ๋ฏธ์
๊ฐ์ด `์๋ฌ๋ฌธ ๋ด์ฉ์ผ๋ก ์ธ๋ถ์ ์ธ ํ
์คํธ`๋ฅผ ํ๊ธฐ๊ฐ ์ด๋ ค์ ์ต๋๋ค. ๊ทธ๋์ ์ ๋ ์ธ๋ถ ๊ฒ์ฆ์ ์ํด **์ปค์คํ
์์ธ**๋ฅผ ๋์
ํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์๋๋ฐ, ์ฐธ๊ณ ํ์๋ฉด ์ข์ ๊ฒ ... |
@@ -0,0 +1,45 @@
+package christmas.util;
+
+import static christmas.constants.Day.FRIDAY;
+import static christmas.constants.Day.SATURDAY;
+import static christmas.constants.Day.SUNDAY;
+import static christmas.constants.Day.THURSDAY;
+
+import christmas.constants.Day;
+import java.util.Arrays;
+
+public class DayAnal... | Java | ์ ๋ ๋ ์ง๋ฅผ ํ๋์ฝ๋ฉํด๋ฒ๋ ธ๋๋ฐ,,, DayAnalyzer ํด๋์ค ์ ๋ง ์ง๊ด์ ์ด๊ณ ์ข์ ์ ๊ทผ ๋ฐฉ์์ธ ๊ฒ ๊ฐ์ต๋๋ค ๐๐ |
@@ -0,0 +1,7 @@
+package christmas.exception;
+
+import java.util.function.Supplier;
+
+public interface ExceptionHandler {
+ <T> T execute(Supplier<T> action, Class<? extends Exception>... exceptions);
+} | Java | `Class<? extends Exception>... exceptions`๋ ์ด๋ค ์ญํ ์ ํ๋ผ๋ฏธํฐ์ธ์ง, ์ด๋ป๊ฒ ํ์ฉ๋๋์ง ์ฌ์ญค๋ณด๊ณ ์ถ์ต๋๋ค! |
@@ -0,0 +1,30 @@
+package christmas.constants.event;
+
+public enum BadgeType {
+ NONE("์์", 0),
+ STAR("๋ณ", 5_000),
+ TREE("ํธ๋ฆฌ", 10_000),
+ SANTA("์ฐํ", 20_000);
+
+ private final String name;
+ private final int threshold;
+
+ BadgeType(String name, int threshold) {
+ this.name = name;
+ ... | Java | stream์ผ๋ก ์ต์ ํ ํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,13 @@
+package christmas.dto;
+
+import christmas.util.Parser;
+import java.util.List;
+
+public record SingleMenu(String menu, int amount) {
+ private static final String DELIMITER = "-";
+
+ public static SingleMenu create(String singleOrder) {
+ List<String> parsed = Parser.parseToMenu(single... | Java | SingleMenu๋ฅผ record๋ก ํ์ ์ด์ ๊ฐ ๋ฌด์์ธ๊ฐ์? |
@@ -0,0 +1,38 @@
+package christmas.exception;
+
+import christmas.view.output.OutputView;
+import java.util.Arrays;
+import java.util.function.Supplier;
+
+public class RetryHandler implements ExceptionHandler {
+ private final OutputView outputView;
+
+ public RetryHandler(OutputView outputView) {
+ this... | Java | @safevarargs๋ ์ ์ฌ์ฉํ์ ๊ฑด๊ฐ์? |
@@ -0,0 +1,80 @@
+package christmas.service;
+
+import static christmas.constants.event.EventRule.EVENT_THRESHOLD;
+import static christmas.constants.event.EventType.CHRISTMAS;
+import static christmas.constants.event.EventType.PRESENT;
+import static christmas.constants.event.EventType.SPECIAL;
+import static christma... | Java | ์ด๋ฒคํธ๊ฐ ์ถ๊ฐ๋ ๋๋ง๋ค put์ ํด์ผํ๋ ๋ถํธํจ์ด ์์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,98 @@
+package christmas.service;
+
+import static christmas.constants.event.EventRule.MAX_MENU_AMOUNT;
+import static christmas.constants.menu.MenuType.DRINKS;
+import static christmas.exception.ErrorCode.INVALID_MENU_ORDER;
+
+import christmas.constants.menu.Menu;
+import christmas.constants.menu.MenuType;... | Java | stream์ int๋ก ์บ์คํ
ํ๋ ๊ฒ์ด ์ดํด๊ฐ ๋์ง ์์ต๋๋ค. |
@@ -0,0 +1,167 @@
+## ํ ์ค๋ก ํํํ๋ ํต์ฌ ๊ธฐ๋ฅ!
+
+> ๐๋ ์ง์ ์ฃผ๋ฌธ ๋ด์ญ์ ์กฐ๊ฑด์ ๋ง์ถฐ 12์ ํ ์ธ ์ด๋ฒคํธ๋ฅผ ์ ์ฉํ๊ธฐ
+
+---
+
+### ๊ธฐ๋ฅ ์๊ตฌ ์ฌํญ
+
+1๏ธโฃ 12์ ์ด๋ฒคํธ์ ๊ด๋ จ๋ ์ ๋ณด ์
๋ ฅ๋ฐ๊ธฐ
+
+-[x] ์ธ์ฟ๋ง ์ถ๋ ฅ
+-[x] ์์ ๋ฐฉ๋ฌธ ๋ ์ง ์
๋ ฅ๋ฐ๊ธฐ
+ -[x] โ ๏ธ ์ ํจํ์ง ์์ ๊ฐ์ ๋ฐ์์ ๋ ์์ธ์ฒ๋ฆฌ
+ -[x] ์ซ์๋ฅผ ์
๋ ฅํ์ง ์์์ ๋
+ -[x] 1์ผ์์ 31์ผ ์ฌ์ด์ ์๊ฐ ์๋ ๋: *[ERROR] ์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.*
+ -[x] ์ ํจํ์ง ์... | Unknown | ์ ๋ค๋ฆญ์ ์ฌ์ฉํด Discountable๋ก ํํํ ๊ฒ์ด ๋งค์ฐ ์ธ์๊น๋ค์! ์ฝ๋ ๋ฆฌ๋ทฐํ ๋๋ ๋ณด๋ฉด์ ๊ณต๋ถํ๋๋ก ํ๊ฒ ์ต๋๋ค ๐ซก |
@@ -0,0 +1,97 @@
+package christmas.config;
+
+import christmas.controller.EventController;
+import christmas.exception.RetryHandler;
+import christmas.service.EventService;
+import christmas.service.MenuService;
+import christmas.validator.InputValidator;
+import christmas.view.input.ConsoleReader;
+import christmas.v... | Java | outview์ ๊ฒฝ์ฐ static๋ฉ์๋๋ฅผ ํ์ฉํด ๊ฐ์ฒด๋ฅผ ์์ฑํ์ง ์๋ ๋ฐฉ๋ฒ๋ ์๋๋ฐ, ๊ทธ๋ผ์๋ ์ฑ๊ธํค ํจํด์ ์ ์งํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,94 @@
+package christmas.controller;
+
+import static christmas.constants.event.EventType.PRESENT;
+import static christmas.constants.menu.MenuType.DESSERT;
+import static christmas.constants.menu.MenuType.MAIN;
+
+import christmas.constants.event.BadgeType;
+import christmas.dto.SingleMenu;
+import christma... | Java | print๋ผ๋ ๋ค์ด๋ฐ์ ์ปจํธ๋กค๋ฌ๊ฐ ์ถ๋ ฅ์ ๋ด๋นํ๋ค ๋ผ๋ ๋ป์ผ๋ก ๋ณด์
๋๋ค! ๋ค๋ฅธ ๋ง๋ก ๋์ฒด ํ๋๊ฑด ์ด๋ป๊ฒ ์๊ฐํ์ธ์? |
@@ -0,0 +1,25 @@
+package christmas.constants.event;
+
+public enum EventRule {
+ EVENT_THRESHOLD(10_000),
+ PRESENT_THRESHOLD(120_000),
+ EVENT_START(1),
+ EVENT_END(31),
+ MAX_MENU_AMOUNT(20),
+ CHRISTMAS_EVENT_END(25),
+ CHRISTMAS_INIT_PRICE(1_000),
+ CHRISTMAS_EXTRA_DISCOUNT(100),
+ MENU_... | Java | ๊ฐ์ธ์ ์ผ๋ก enum์ ์ฐ๊ด๋ ์์๋ฅผ ๋ชจ์๋๋ ๊ณณ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค!
CHRISTMAS_EXTRA_DISCOUNT(100),
MENU_DISCOUNT(2_023),
๋ฑ์ ์๋ก ๋ค๋ฅธ ๊ฐ์ฒด๋จ์๋ก ๋ถ๋ฆฌ๊ฐ ๊ฐ๋ฅํด๋ณด์ฌ์!
์ฐจ๋ผ๋ฆฌ ๊ฐ์ฒด ๋ด๋ถ์ ์์ ํ๋๋ก ๊ด๋ฆฌํ๋ ๊ฒ์ ์ด๋ ์ธ์? |
@@ -0,0 +1,167 @@
+## ํ ์ค๋ก ํํํ๋ ํต์ฌ ๊ธฐ๋ฅ!
+
+> ๐๋ ์ง์ ์ฃผ๋ฌธ ๋ด์ญ์ ์กฐ๊ฑด์ ๋ง์ถฐ 12์ ํ ์ธ ์ด๋ฒคํธ๋ฅผ ์ ์ฉํ๊ธฐ
+
+---
+
+### ๊ธฐ๋ฅ ์๊ตฌ ์ฌํญ
+
+1๏ธโฃ 12์ ์ด๋ฒคํธ์ ๊ด๋ จ๋ ์ ๋ณด ์
๋ ฅ๋ฐ๊ธฐ
+
+-[x] ์ธ์ฟ๋ง ์ถ๋ ฅ
+-[x] ์์ ๋ฐฉ๋ฌธ ๋ ์ง ์
๋ ฅ๋ฐ๊ธฐ
+ -[x] โ ๏ธ ์ ํจํ์ง ์์ ๊ฐ์ ๋ฐ์์ ๋ ์์ธ์ฒ๋ฆฌ
+ -[x] ์ซ์๋ฅผ ์
๋ ฅํ์ง ์์์ ๋
+ -[x] 1์ผ์์ 31์ผ ์ฌ์ด์ ์๊ฐ ์๋ ๋: *[ERROR] ์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.*
+ -[x] ์ ํจํ์ง ์... | Unknown | ๊ณ ๋ฏผ ๋ด์ฉ์ ์ ์ผ์ ๊ฒ... ์ฐธ์ ํ๋ค์ !! ์ ๋ ๋ฆฌ๋๋ฏธ ์์ฑ์ด ํ๋ค์ด์ ใ
.ใ
๋ฐฐ์๊ฐ๋๋ค ๐ |
@@ -0,0 +1,271 @@
+var Domclass = require('../util/Domclass');
+var Eventutil = require('../util/Eventutil');
+var snippet = require('tui-code-snippet');
+
+var KEY_ENTER = 13;
+
+var todoObjects = []; // ๋ชจ๋ todoData
+var completeTodoObjects = []; // isChecked๊ฐ true์ธ ๊ฐ
+var incompleteTodoObjects = []; // isChecked๊ฐ fal... | JavaScript | ํ์ผ์ด ํ๋ ๋์ด๋๋.. ์ด๋ฐ ๋ฐฐ์ด ์ฐ์ฐ์ ๋ํ ๋ก์ง๋ค์ ์ ํธ๋ก ๋นผ๋๊ฒ ์ข์ต๋๋ค~ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.