code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค ๐ |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | ์ฌ์ญค๋ณด์ ๊ฒ ์๋ฒฝํ ์ดํด๋ฅผ ๋ชปํ์ง๋ง ๋ต๋ณ ๋๋ฆฌ๋ฉด `๋ฉค๋ฒ์ญ ํ ์ธ์ ๋ฐ์ผ์๊ฒ ์ต๋๊น? (Y/N)`๋ฅผ ๋ฌผ์ด๋ณด๋ ๋ฉ์๋๋ `askMembership`์ด๋ผ๊ณ ์ง๊ด์ ์ผ๋ก ์์ฑํ์๊ณ , ๊ทธ๋ฅผ ๋ด๋ ๋ณ์๋ ๋ฉค๋ฒ์ญ ํ ์ธ ์ ๋ฌด์ด๊ธฐ ๋๋ฌธ์ has๋ผ๋ ํค์๋๋ฅผ ์ด์ฉํ์ต๋๋ค! |
@@ -0,0 +1,29 @@
+package store.exception.store;
+
+public enum StoreErrorStatus {
+
+ INSUFFICIENT_STOCK("์ฌ๊ณ ์๋์ ์ด๊ณผํ์ฌ ๊ตฌ๋งคํ ์ ์์ต๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ NON_EXIST_PRODUCT("์กด์ฌํ์ง ์๋ ์ํ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ DUPLICATE_GENERAL_PRODUCT("์ํ์ด ์ค๋ณต๋์์ต๋๋ค."),
+ DUPLICATE_PROMOTION_PRODUCT("ํ๋์ ์ํ์ ๋๊ฐ์ ํ๋ก๋ชจ์
์ด ์ ์ฉ๋ ์ ์์ต๋๋ค."),
+
... | Java | ๊ฐ์ฌํฉ๋๋ค ๐ |
@@ -0,0 +1,92 @@
+package store.model.order;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.Map;
+import java.util.stream.Collectors;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+
+public class Payment {
+ private final PurchaseOrder purchaseOrder;
+ priv... | Java | ์ ๋ `of`, `from`๋ฉ์๋ ๋ค์ด๋ฐ์ ๋ํด์ ๊ณ ๋ฏผ์ ๋ง์ดํ๋๋ฐ ์ด๋ค ๋ธ๋ก๊ทธ์๋ ํ๋ผ๋ฏธํฐ๊ฐ 2๊ฐ ์ด์์ด๋ฉด `of` ํ๋๋ฉด `from`์ผ๋ก ํ๋ค๋ ๊ธ์ ๋ดค์ต๋๋ค.
๋ค๋ฅธ ๊ธ์์๋ ์ ๋ณด๋ฅผ ์กฐํฉํด์ ๊ฐ์ฒด๋ฅผ ๋ง๋๋ ๊ฒฝ์ฐ๋ `of`๋ผ ํ๊ณ ํ๋ผ๋ฏธํฐ๋ก ๋ค์ด์ค๋ ์ ๋ณด๋ฅผ ์ด์ฉํด์ ๊ฐ์ฒด๋ฅผ ๋ง๋๋ ๊ฒฝ์ฐ๋ `from`์ด๋ผ๊ณ ๋ค์ด๋ฐํ๋ค๋ ๊ธ๋ ์์๋๋ฐ ์ ๋ ์ด ๊ธ์ ๋ ๊ณต๊ฐ์ ๋๊ปด์ ์ ๊ฒฝ์ฐ๋ `from`์ด๋ผ๋ ๋ฉ์๋ ๋ค์์ด ์ ๋ง๋ค๋ ์๊ฐ์ ํ์ต๋๋ค. |
@@ -0,0 +1,94 @@
+package store.model.store.product;
+
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_PRICE;
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_STOCK;
+
+import java.time.LocalDateTime;
+import store.exception.store.StoreException;
+import store.model.store.prom... | Java | Product๊ฐ ์ด๋ฆ๊ณผ ๊ฐ๊ฒฉ๋ง์ ๊ฐ์ง๊ณ , Stock์ด๋ผ๋ ๋ชจ๋ธ์ ๋ง๋ค์ด `Product product`, `int stock` ์ ๊ฐ์ง๊ฒ ํ ๊น ์๊ฐํ์ง๋ง, ์ผ๋จ ๋น ๋ฅด๊ฒ ๊ตฌํํ๋๊ฒ ๋ชฉํ๊ธฐ๋ ํ๊ณ ํฐ ๋ฌธ์ ๊ฐ ์์ ๊ฒ ๊ฐ์์ ์์ ๊ฐ์ด ์ค๊ณํ์ต๋๋ค.
Service ๋ ์ด์ด์ Repository ๋ ์ด์ด๋ฅผ ๋์
์์ด MVC ํจํด๋ง์ผ๋ก ์ค๊ณํด์ ๋ชจ๋ธ์ด ์ฌ๊ณ ์๋์ ๋ค๊ณ ์๋ ๊ฒ์ ๋ฌธ์ ๋ ์๋ค๊ณ ์๊ฐํฉ๋๋ค. |
@@ -0,0 +1,61 @@
+package store.model.store.promotion;
+
+import static store.exception.store.StoreErrorStatus.INVALID_PROMOTION_BUY_AMOUNT;
+import static store.exception.store.StoreErrorStatus.INVALID_PROMOTION_GIVE_AMOUNT;
+
+import java.time.LocalDateTime;
+import store.exception.store.StoreException;
+
+public cla... | Java | ์ฐํ
์ฝ์์ ์ ๊ณตํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ `DateTimes` ํด๋์ค์ `now()` ๋ฉ์๋์ ๋ฐํ๊ฐ์ด LocalDateTime์ด์ฌ์ LocalDate๋ก ๋ณํํ์ง ์๊ณ ๋ฐ๋ก ๋น๊ตํ ์ ์๊ฒ ์์ ๊ฐ์ด ์ฌ์ฉํ์ต๋๋ค. |
@@ -0,0 +1,20 @@
+package store.util.reader;
+
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+public class RepeatableReader {
+ public static <T> T handle(Supplier<String> viewMethod,
+ Function<String, T> converter,
+ ... | Java | ๊ฐ์ฌํฉ๋๋ค ๐ |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | ์กฐ๊ธ ๋ ํ์ด์ ๋ง์๋๋ฆฌ๋ฉด
`boolean ๋ฉค๋ฒ์ฝํ ์ธ์๋ฐ๊ธฐ๋กํ๋๊ฐ` ๊ฐ ์๋,
`boolean ๋ฉค๋ฒ์ฝ์๊ฐ์ก๋๊ฐ` ๋ก ๋ช
๋ช
๋์ด์ ์ฌ์ญค๋ดค์ต๋๋ค. |
@@ -0,0 +1,94 @@
+package store.model.store.product;
+
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_PRICE;
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_STOCK;
+
+import java.time.LocalDateTime;
+import store.exception.store.StoreException;
+import store.model.store.prom... | Java | ๋ง์ต๋๋ค. ์ฝ๋๋ฅผ ๋ณด๋ฉด์ ๋ถํธํจ์ด ์ ํ ์์์ต๋๋ค! |
@@ -0,0 +1,92 @@
+package store.model.order;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.Map;
+import java.util.stream.Collectors;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+
+public class Payment {
+ private final PurchaseOrder purchaseOrder;
+ priv... | Java | ๊ฐ์ฌํฉ๋๋ค! ์ฐธ๊ณ ํ๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | ์ํ ๊ทธ ๋ป์ด์๊ตฐ์.
์ ๋ ๋ฉค๋ฒ์ญ ์ ๋ฌด์๋ง ์ ๊ฒฝ์จ์ ์ ๋ ๊ฒ ๋ค์ด๋ฐ์ ํ๋๋ฐ ๋ง์์ ๋ฃ๊ณ ๋ณด๋ ์๋๊ฐ ๋ค ๋ณ์์ ๋ด๊ธฐ์ง ์์ ๋ฏ ๋ณด์ด๋ค์. |
@@ -0,0 +1,94 @@
+package store.model.store.product;
+
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_PRICE;
+import static store.exception.store.StoreErrorStatus.INVALID_PRODUCT_STOCK;
+
+import java.time.LocalDateTime;
+import store.exception.store.StoreException;
+import store.model.store.prom... | Java | ๊ทธ๋ ๊ฒ ๋ง์ํด์ฃผ์๋ ๊ฐ์ฌํฉ๋๋ค ๐ |
@@ -0,0 +1,100 @@
+package store;
+
+import java.util.Map;
+import store.model.order.Payment;
+import store.model.order.PurchaseOrder;
+import store.model.store.StoreRoom;
+import store.util.parser.ClosedQuestionsParser;
+import store.util.parser.PurchaseParser;
+import store.util.reader.RepeatableReader;
+import store... | Java | ์๋จ ์ ๊ฐ ์กฐ๊ธ ์ต์ง๋ก ์ฌ์ญค๋ณธ ๊ฒ๋ ์์ด์. ํน๋ณํ ์๋๊ฐ ์๋ค๋ฉด ๋ฐฐ์ฐ๊ณ ์ถ์์ต๋๋ค ใ
ใ
|
@@ -0,0 +1,16 @@
+package store.view;
+
+import store.model.order.Payment;
+import store.model.store.StoreRoom;
+import store.view.formatter.OutputFormatter;
+
+public class OutputView {
+
+ public void printProducts(StoreRoom storeRoom) {
+ System.out.println(OutputFormatter.buildStoreStock(storeRoom));
+ ... | Java | `MVC` ๊ด์ ์์ ๋ทฐ๊ฐ ๋ชจ๋ธ์ ์ฐธ์กฐํ๋ ๊ฒ์ด ์๋๋ ๊ฒ์ ์๋์ง๋ง `๋ทฐ๋ ๋ชจ๋ธ๊ณผ ์ปจํธ๋กค๋ฌ๋ฅผ ์ ํ์๊ฐ ์๋ค`๋ผ๋ ๋ง์ด ์๋ ๊ฑฐ์ฒ๋ผ ๋๋๋ก ๋ชจ๋ฅด๋ ๊ฒ์ด ์ข์ ๊ฒ์ผ๋ก ์๊ณ ์์ต๋๋ค!
๊ทธ๋ฐ ์ธก๋ฉด์์ `StoreRoom`์ ์ธ์๋ก ๋ฐ์์ ์ฒ๋ฆฌํ๋ ๊ฒ ๋ณด๋ค ๋ฉ์ธ์ง ํฌ๋งท์ ์ํ ๋ฐ์ดํฐ๋ง ๋ฐ์์ ์ฒ๋ฆฌํ๋ ๋ฐฉ์์ ์ด๋จ๊น์? |
@@ -0,0 +1,130 @@
+package store.view.formatter;
+
+import store.model.order.Payment;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+import store.model.store.product.Products;
+
+public class OutputFormatter {
+ private static final String WELCOME_MESSAGE = "์๋
ํ์ธ์. Wํธ์์ ์
๋๋ค.\nํ์ฌ ๋ณด์ ํ๊ณ ... | Java | `getPurchaseOrder`๋ผ๋ ๋ฉ์๋๊ฐ ๋ ๋ฒ ์ฐ์๋์ด ๋ชจํธํ ๊ฐ์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค!
๋ ๋ฉ์๋์ ๋ค์ด๋ฐ์ ๋ฌ๋ฆฌ ํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์!
์ถ๊ฐ์ ์ผ๋ก ์ฒซ `getPurchaseOrder` ์์๋ `PurchaseOrder` ๊ฐ์ฒด๊ฐ ๋ฐํ๋๊ณ ๋ ๋ฒ์งธ์์๋ ์์ดํ
์ ๋ณด๋ค์ด ๋ด๊ธด `Map`์ด ๋ฐํ๋๋ ๊ฒ ๊ฐ์ต๋๋ค! ์ด๋ `๋๋ฏธํฐ์ ๋ฒ์น`์ ์๋ฐฐ๋๋ ๊ฒ์ผ๋ก ๋ณด์ด๋๋ฐ์! ์ฐํ
์ฝ์์ ์ ์ํ๋ ํด๋ฆฐ์ฝ๋ ์ฌํญ์ `๋๋ฏธํฐ ๋ฒ์น`์ด ํฌํจ๋ ๋งํผ ์ฐ์์ ์ผ๋ก ์ฌ์ฉํ๋ ๊ฒ์ ์ง์ํ๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,130 @@
+package store.view.formatter;
+
+import store.model.order.Payment;
+import store.model.store.StoreRoom;
+import store.model.store.product.Product;
+import store.model.store.product.Products;
+
+public class OutputFormatter {
+ private static final String WELCOME_MESSAGE = "์๋
ํ์ธ์. Wํธ์์ ์
๋๋ค.\nํ์ฌ ๋ณด์ ํ๊ณ ... | Java | `OutputFrmatter`๊ฐ ๋ค์ ๋ฌด๊ฑฐ์ด ๊ฐ์ฒด๋ผ๋ ๋๋์ด ๋ญ๋๋ค!
ํฌ๋งคํฐ์์ ๋ง์ ๋ก์ง์ ๋ด๋นํ๊ณ ์๋ ๊ฒ์ผ๋ก ์๊ฐ ๋๋๋ฐ์ ํนํ `payment.calculateActualPrice()` ๋ฑ ๋ชจ๋ธ ๊ฐ์ฒด๋ค์ ๋ด๋ถ ๊ธฐ๋ฅ๋ค์ ํ์ฉํด์ ๋ฐ์ดํฐ๋ค์ ๊ฐ์ ธ์ค๋ ๋ฐฉ์์ผ๋ก ๋ณด์
๋๋ค!
๋ค์ํ ๋ชจ๋ธ๋ค์ ๊ธฐ๋ฅ์ ํฌ๋งคํฐ ๋ด๋ถ์ ์ผ๋ก ๋ง์ด ์ฌ์ฉํด์ ๋ทฐ ๊ฐ์ฒด ๋ณด๋ค๋ ์๋น์ค์ ๊ฐ๊น์ง ์์๊น๋ผ๋ ์๊ฐ์ด ๋๋๋ฐ์ ์ด ๋ถ๋ถ์ ๋ํด์ ์ด๋ป๊ฒ ์๊ฐํ์๋์??
ํฌ๋งคํฐ๊ฐ ๋ชจ๋ธ ๊ฐ์ฒด๋ค์ ๋ฐ๋ ๊ฒ์ด ์๋ ์ด๋ฏธ ๊ณ์ฐ๋ ๋ฐ์ดํฐ๋ฅผ ๋ฐ๋ ๊ฒ์ผ๋ก ํ๋ฉด ๋ทฐ ๊ฐ์ฒด๋ก์ ๋ทฐ์ ํฌ๋งคํฐ ์ญํ ์ ๋ ์ง์ค๋ ์ ์์ ... |
@@ -0,0 +1,108 @@
+package store.contoller;
+
+import store.Utils;
+import store.model.*;
+import store.view.InputView;
+import store.view.OutputView;
+
+import java.time.LocalDate;
+import java.util.*;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+
+public class StoreController {
+ private static final Map<S... | Java | ์ํ๋ค์ ์ถ๋ ฅํ๋ ๋ก์ง์ OutputView ์์ ํ์ผ๋ฉด ์ด๋จ๊น ์ถ์ด์!!! |
@@ -0,0 +1,17 @@
+package store.model;
+
+import store.view.InputView;
+
+public class MembershipDiscount {
+ public int applyMembershipDiscount(int totalNonPromotionPrice) {
+ if (InputView.askMemberShip()) {
+ return calculateMembershipDiscount(totalNonPromotionPrice);
+ }
+ return ... | Java | ๋ฉค๋ฒ์ญ ํ ์ธ ๋น์จ์ ์์๋ก ๋ฝ์ผ๋ฉด ์ด๋จ๊น ์ถ์ต๋๋ค!!! |
@@ -0,0 +1,17 @@
+package store.model;
+
+import store.view.InputView;
+
+public class MembershipDiscount {
+ public int applyMembershipDiscount(int totalNonPromotionPrice) {
+ if (InputView.askMemberShip()) {
+ return calculateMembershipDiscount(totalNonPromotionPrice);
+ }
+ return ... | Java | ์ ๋ ์ด๋ ๊ฒ ํ ๊ฑธ ๊ทธ๋ฌ์ต๋๋ค!! ์ ๋ฐฐ์ฐ๊ณ ๊ฐ๋๋ค!!!! |
@@ -0,0 +1,81 @@
+package store.model;
+
+import store.message.ViewMessage;
+
+import java.text.NumberFormat;
+import java.util.Locale;
+
+public class Product {
+ private final String name;
+ private final int price;
+ private int quantity;
+ private int promotionQuantity;
+ private final Promotion prom... | Java | ์ฌ๊ณ ์๋์ ๋ณ๋์ setter ๋์ ์๋ ์ฆ๊ฐ์ `increaseQuantity()` ์ฌ๊ณ ๊ฐ์์ 'decreaseQuantiy()` ์ด๋ฐ์์ผ๋ก ์๋ฏธ๋ฅผ ๋ถ์ฌํ๋ ๋ฉ์๋๋ฅผ ๋ง๋ค๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!!! |
@@ -0,0 +1,69 @@
+package store.model;
+
+import store.message.ReceiptMessage;
+import store.view.OutputView;
+
+import java.text.NumberFormat;
+import java.util.Locale;
+import java.util.Map;
+
+public class Receipt {
+ private final Map<String, PurchaseItem> purchase;
+ private final Map<String, PurchaseItem> f... | Java | MVC ํจํด์ ๋ํ ๋ด์ฉ์ ์ดํด๋ณด๋ฉด ๋ชจ๋ธ์ ๋ทฐ๋ ์ปจํธ๋กค๋ฌ๋ฅผ ์์กดํ๋ฉด ์๋๋ค๊ณ ๋์ด ์๋ ๊ธ์ ๋ณด์์ต๋๋ค!! Recipt ์ ๋ํ ์ ๋ณด๋ฅผ DTO ๋ก ๋ง๋ ๋ค ์ปจํธ๋กค๋ฌ์ ๋๊ฒจ ์ปจํธ๋กค๋ฌ๊ฐ OutputView๋ก ์์์ฆ์ ๋ํ ๋ด์ฉ์ ๋๊ฒผ์ผ๋ฉด ์ด๋จ๊น ์ถ์ต๋๋ค!! |
@@ -0,0 +1,34 @@
+package store.model;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class MembershipTest {
+ private MembershipDiscount membershipDiscount;
+
+ @BeforeEach
+ void setUp() {
+ membershipDis... | Java | ํ
์คํธ ์ฝ๋์ ๋ํ ๋ง์ ๊ณ ๋ฏผ์ด ๋ณด์ด๋ ๊ฒ ๊ฐ์ต๋๋ค!!! ์ ๋ง ๊ณ ์ํ์
จ์ต๋๋ค!!!! |
@@ -0,0 +1,35 @@
+package calculator.controller.validation
+
+class UserInputValidator {
+ fun validateUserInput(numbers: List<String>): List<Int> {
+ val newNumbers = checkIsEmpty(numbers)
+ checkIsInteger(newNumbers)
+ val allNumbers = changeInteger(newNumbers)
+ changeNegativeNumber(al... | Kotlin | ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ํ๋ ํจ์์ธ์ง๋ผ chane๋ผ๋ ๋ค์ด๋ฐ์ ์กฐ๊ธ ์ด์ํ๊ฒ ๊ฐ์์ ! ใ
ใ
any๋ฅผ ์ฌ์ฉํ๋ฉด ํจ์๋ฅผ ์กฐ๊ธ ๋ ์ค์ผ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค !
```
private fun changeNegativeNumber(allNumbers: List<Int>) {
if (allNumbers.any { it < 0 }) {
throw IllegalArgumentException(UserInputErrorType.NEGATIVE_NUMBER.errorMessage)
}
}
``` |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | ์ฑ์ฑ๋! ์ ๋ ์ฒซ ์ฃผ์ฐจ ๋ ์ปค์คํ
๊ตฌ๋ถ์๋ฅผ ์๋ฐ์์ผ๋ก ์ถ์ถํ์๋๋ฐ์
๋ค๋ฅธ ๋ถ๋ค ๊ตฌํํ๊ฑธ ๋ณด๋๊น ๋ ๊ธ์ ์ด์์ผ ๋ ๋ ๊ตฌ๋ถ์๋ก ์ฌ์ฉํ ์ ์๋๋ก ๋ง๋์
จ๋๋ผ๊ตฌ์
๊ทธ๋์ ์ด๋ ๊ฒ ํ๋ฉด ์ปค์คํ
๊ตฌ๋ถ์๊ฐ 2๊ธ์ ์ด์์ผ ๊ฒฝ์ฐ ์์๊ณผ๋ ๋ค๋ฅธ ์ค๋ฅ๋ฅผ ๋ณด์ฌ์ฃผ๋ ๊ฒ ๊ฐ์์
๋ฌผ๋ก ! ๋ฌธ์ ์๊ตฌ ์ฌํญ์ ์์๊ธฐ ๋๋ฌธ์ ๋ฐฐ์ ํ๊ณ ๊ตฌํํด๋ ์ ํ ๋ฌธ์ ์์ง๋ง ์ ๋
์ด๋ฐ ๋ถ๋ถ์ ์ฒซ ์ฃผ์ฐจ ๋ ๋์ณ์ ์ด๋ฒ ๋ฆฌํฉํ ๋ง์์ ์ ์ฉํด๋ดค๋๋ฐ ํน์ ์ผ๋ถ๋ฌ ๊ตฌํ์ ์ํ์ ๊ฑด์ง ๊ถ๊ธํฉ๋๋ค ใ
ใ
<img width="926" alt="image" src="https://github.com/user-attach... |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | ์ 5๋ผ๋ ์์๋ ์ด๋ฆ์ ๋ถํ์ฃผ๋๊ฑด ์ด๋จ๊น์ ? |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | ํน์ ์ฌ๊ธฐ์ 3์ด ์๋ฏธํ๋๊ฒ ๋ญ์ง ๊ถ๊ธํ๋ค์..! |
@@ -0,0 +1,35 @@
+package calculator.controller.validation
+
+class UserInputValidator {
+ fun validateUserInput(numbers: List<String>): List<Int> {
+ val newNumbers = checkIsEmpty(numbers)
+ checkIsInteger(newNumbers)
+ val allNumbers = changeInteger(newNumbers)
+ changeNegativeNumber(al... | Kotlin | check๋ฅผ ํ๊ณ ์๋ก์ด ์ซ์๋ค์ ๋ฐํํด๋ณผ ์๊ฐ์ ๋ชปํ๋๋ฐ, ์ ๋ ์จ๋ด์ผ๊ฒ ์ต๋๋คใ
ใ
๊ทธ๋ฐ๋ฐ ์๋ก์ด ์ซ์๋ค์ ๋ฐํํ๋ค๋ฉด ๋ฐ ํจ์์ฒ๋ผ ์ด๋ฆ์ change๋ก ํด๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋น |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | ์ค ์๋์ง ์๋์ง ํ์ธํ๊ณ , ๊ฒฐ๊ณผ๋ number๋ก ํต์ผํ๋ ๋ฐฉ๋ฒ ๋ฐฐ์๊ฐ๋๋ค! |
@@ -0,0 +1,35 @@
+package calculator.controller.validation
+
+class UserInputValidator {
+ fun validateUserInput(numbers: List<String>): List<Int> {
+ val newNumbers = checkIsEmpty(numbers)
+ checkIsInteger(newNumbers)
+ val allNumbers = changeInteger(newNumbers)
+ changeNegativeNumber(al... | Kotlin | ์...! any!! ์ข์ ํจ์ ์๋ ค์ค์ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | ์ ๋ต์
๋๋ค. ์ผ๋ถ๋ฌ ๊ตฌํ ์ํ์ต๋๋ค! ์ ๋ ๋ฌธ์ ํด์ํ๋ฉด์ ๊ตฌ๋ถ์๋ ํ๊ธ์๋ง ์์ผํ๋ค๋ผ๊ณ ์๊ฐ์ ํด์ ์์ ๊ฐ์ด ์
๋ ฅํ๋ฉด ์๋ฌ๋ผ๊ณ ํ๋จํ์ต๋๋ค! ๋ฌธ์ ํด์์ด ์ ์ผ ์ด๋ ค์ด ๊ฑฐ ๊ฐ์์ ใ
ใ
|
@@ -0,0 +1,45 @@
+package calculator.controller.domain
+
+import calculator.constants.Delimiter.CLONE
+import calculator.constants.Delimiter.COMMA
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_PREFIX
+import calculator.constants.Delimiter.CUSTOM_DELIMITER_SUFFIX
+
+class DelimiterController(
+ private val ... | Kotlin | CUSTOM_DELIMITER_SUFFIX์ index๊ฐ 3์ด๋ฉด CUSTOM_DELIMITER_PREFIX์ CUSTOM_DELIMITER_SUFFIX ์ฌ์ด์ ์ปค์คํ
๊ตฌ๋ถ์๋ฅผ ์
๋ ฅ์ ํ๋ค๊ณ ํ๋จ์ ํ์ต๋๋ค! |
@@ -0,0 +1,35 @@
+package calculator.controller.validation
+
+class UserInputValidator {
+ fun validateUserInput(numbers: List<String>): List<Int> {
+ val newNumbers = checkIsEmpty(numbers)
+ checkIsInteger(newNumbers)
+ val allNumbers = changeInteger(newNumbers)
+ changeNegativeNumber(al... | Kotlin | ์ ๋ง๋ค์! ๊ทธ๋ผ ํจ์๋ช
์ด ๋ ํต์ผ์ฑ์ด ์์ด์ ์ข์๊ฑฐ ๊ฐ์์! ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | h2 ํ๊ทธ๋ฅผ ์ฌ์ฉํ๊ธฐ์ ๋๋ฌด ๋ง์ ์ง ๊ฒ ๊ฐ์๋ฐ, ์ ์ฒด์ ์ธ ๊ด์ ์ผ๋ก ๋ดค์๋ h2์ ๋ ๋ฒจ์ ๊ฐ์ง ํ
์คํธ๋ ์๋ ๊ฒ ๊ฐ์์์! strong ํ๊ทธ๋์ h2๋ฅผ ์ฐ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | early if pattern ์ถ์ฒ๋๋ฆฝ๋๋ค .. >_< |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | countryList ์ปดํฌ๋ํธ๋ฅผ ๋ณด๋, ๋จ์ UI๋ง ์ ๊ณตํ๋ ๊ฒ์ด ์๋ ํต์ฌ ๋ก์ง๋ค์ ์ ๋ถ ๋ค ๊ฐ์ง๊ณ ์๋ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค.
ํ์ผ๋ช
์ผ๋ก๋ง ๋ณด์์๋, UI ์ญํ ๋ง ํ๊ณ ์์ ๊ฒ์ผ๋ก ์ถ์ธก๋์๋๋ฐ ์ฌํ์ฉ ๊ฐ๋ฅํ ์ปดํฌ๋ํธ๋ ์๋ ๊ฒ ๊ฐ์์์~
๊ฐ์ธ์ ์ธ ์๊ฒฌ์ผ๋ก๋ List์๋ ๋จ์ ๋ด๋ ค์ค ๋ฐ์ดํฐ๋ฅผ ๋
ธ์ถํ๊ฒ๋ง ํ๊ณ , ๋น์ฆ๋์ค ๋ก์ง์ ์์์ ์ ๋ฌํด์ฃผ๋ ๊ฒ์ด ์ด๋ค์ง ์ฝ๋ฉํธ ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | ๋ณ๋ก ์ค์ํ ๊ฒ์ ์๋์ง๋ง ใ
ใ
throw new Error() ์๊ธฐ์ ๋ญ๊ฐ๋ฅผ ๋ฃ์ด์ฃผ์๋ฉด ์ข์์
```javascript
throw new Error(error.response?.data.message);
```
์ด๋ฐ์์ผ๋ก์ ใ
ใ
|
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ํํฐ๋ฅผ ํ๊ธฐ ์ํ ์๋๋ก setCountries ๋ฅผ ๋ง๋ค์ด ๊ฐ์ ๋ณ๊ฒฝํ๊ณ ์๋ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค!
favoriteCountries ๋ผ๋ ์ํ๋ฅผ ๋ฐ๋ก ์ง๋๊ณ ์๊ธฐ์ countries๋ฅผ ๋ณ๊ฒฝํ๋ ๊ฒ๋ณด๋ค ์๋์์ filter๋ง ํด์ฃผ๋ ๋ก์ง์ผ๋ก ๋ณ๊ฒฝํ๋ ๊ฒ์ด ์ด๋จ์ง ์ ์ ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ด๊ฒ๋ ์์ฃผ ์ฌ์ํ ๊ฑฐ์ง๋ง ใ
ใ
isDone ๋ณด๋ค isFavorite ์ด ์๊ธฐ ์ฌ์ธ๊ฒ ๊ฐ์์ฉใ
ใ
|
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ๋์ผํฉ๋๋ค! |
@@ -0,0 +1,18 @@
+import CountryList from "../components/CountryList";
+
+const Home = () => {
+ return (
+ <>
+ <h1 className="flex justify-center items-center mt-8 mb-8 text-2xl font-bold">
+ Favorite Countries
+ </h1>
+ <CountryList isDone={true} />
+ <h1 className="flex justify-center... | Unknown | h1์ด ๋๋ฌด ๋ง์ต๋๋ค! ํ์ด์ง์ ํ๋๋ง ์กด์ฌํด์ผํฉ๋๋ค.
ํ์ง๋ง ์ฝ๋์์๋ ํผ๋์ ์ผ๊ธฐํ ์ ์๋ ํค๋ฉํ๊ทธ๋ฅผ ์ง์ํ๋ ๊ฒ์ ์ ์๋๋ฆฝ๋๋ค :) |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | ์ ๊ฐ ์ด๋ฒ์ ์ค์ค๋ก ์จ๋ณธ๊ฑด ์ฒ์์ด๋ผ ์ ๋ชฐ๋๋๋ฐ ์๋ ์ฝ๋ ๋ณด๋ฉด์ ๊นจ๋ฌ์์ต๋๋ค ๊ฐ์ผ๋ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์๋ง ๊ณต๋ถ๋ฅผ ์ํด์ ํ์ ๋ฏ ํฉ๋๋ค๋ง..!
zustand ์คํ ์ด์ countries ์ favoriteCountries ๊ฐ ์๊ณ ์ค์ ๋ก
```javascript
const isDoneCountries = isDone ? favoriteCountries : countries;
```
์ด๋ฐ ๋ถ๋ถ์์๋ useQuery ์ data ๋ฅผ ๋ฐ๋ก ์ฐ์ง๋ ์์ผ๋, ์ด๋ฐ ๊ฒฝ์ฐ๋ผ๋ฉด tanstack์ ์์ฐ๋ ๋ฐฉํฅ๋ ์์ ๊ฒ ๊ฐ์ต๋๋ค~
๋ฌผ๋ก ๊ณต๋ถ์ฉ์ด๊ธฐ ๋๋ฌธ์ ๋ฌด์ํ์
๋ ๋ฉ๋๋ค ^^;; |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | ์ ๊ทธ๋ฅ..h1๋ฐ์ ํ์๋ก ์๋ค ์๊ฐํด์ ์๋ฌด ์๊ฐ์์ด h2๋ฅผ ์ด๊ฒ๋๋ค.. ๊ทธ๋ ๊ตฐ์ฌ.. html css์ ๋ํด์ ๋ฐ๋ก ๊ณต๋ถ๋ฅผ ์ํ๊ณ ํ์ํ ๋๋ง๋ค ๊ทธ๋ฅ ๊ทธ ๋ ๊ทธ๋ ์ฐ๋ค๋ณด๋ ์ด๋ฐ ๋ถ๋ถ์ด ์์ง ๋ง์ด ๋ฏธํกํ๋ฏํ๋ค์ฌ ํ... |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ค์ค ๊ฐ์ ์๊ฐ์
๋๋ค~~ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ๋ง๋ ๋ง์์
๋๋ค ํจ์ฌ ์ข๊ฒ๊ตฐ์ฌ |
@@ -0,0 +1,18 @@
+import CountryList from "../components/CountryList";
+
+const Home = () => {
+ return (
+ <>
+ <h1 className="flex justify-center items-center mt-8 mb-8 text-2xl font-bold">
+ Favorite Countries
+ </h1>
+ <CountryList isDone={true} />
+ <h1 className="flex justify-center... | Unknown | h1ํ๊ทธ๋ ํ์ด์ง๋น 1๊ฐ๋ง ์จ์ผํ๋์ง ๋ชฐ๋๋ค์ฌ... ๋ช
์ฌํ๊ฒ ์ต๋๋น |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | ์ฃผ์ :: ํ์
์คํฌ๋ฆฝํธ ์ ๋ชฐ๋ผ์ ์ด์ํ ์๋ฆฌ์ผ ์ ์์ต๋๋ค ใ
getCountires ํจ์์ ๋ฐํ๊ฐ์ด Promise<Country[]>์์ ๋ช
์ํด์ฃผ๊ณ ๊ณ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ ๋ ์ด๋ฒ API ๊ตฌ์กฐ๊ฐ ๋ณต์กํด์์ธ์ง ๋ฌด์จ ์๋ฌ์๋์ง ์์ธํ ๊ธฐ์ต์ ์ ๋์ง๋ง ์๋ฌ๋ฅผ ๊ณ์ ๊ฒช์์ต๋๋ค~!
try๋ฌธ ์์์ get ์์ฒญ ๋ถ๋ถ์ ๋ณด๋ฉด ์๋ต๊ฐ์ ํ์
์ง์ ์ด ์ ๋์ด ์๋๋ฐ, ์ ๋ ์ด ๋ถ๋ถ์์ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์๋ ๊ฒ์ผ๋ก ๊ธฐ์ตํฉ๋๋ค!
`const response = await countryApi.get<Country[]>("/all");`
์๋ฅผ ๋ค์ด์ dat... |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ํํ์ด์ง ๊ด๋ จํด์ ์ ์ด์ฃผ์ ๊ฒ์ฒ๋ผ ํ๊ทธ ์ด๋ฆ์ ๋ฐ๊พธ๋๊ฒ ์ข๋ค๋ ๋ง์์ด์ ๊ฐ์? |
@@ -0,0 +1,28 @@
+import { Country } from "../types/country";
+
+const CountryCard = ({
+ country,
+ handleToggleCountry,
+}: {
+ country: Country;
+ handleToggleCountry: (country: Country) => void;
+}) => {
+ return (
+ <div
+ className="flex flex-col border rounded gap-2 px-4"
+ onClick={() => handl... | Unknown | ์ฐธ๊ณ :
- https://techblog.woowahan.com/15541/
- https://webactually.com/2020/03/03/%3Csection%3E%EC%9D%84-%EB%B2%84%EB%A6%AC%EA%B3%A0-HTML5-%3Carticle%3E%EC%9D%84-%EC%8D%A8%EC%95%BC-%ED%95%98%EB%8A%94-%EC%9D%B4%EC%9C%A0/ |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ๊ทธ ์๊ฐ์ ๋ชปํด๋ดค๋๋ฐ ๋์ผํ ๊ฒฐ๊ณผ๊ฐ...๋์ค๋์ง ํด๋ณด๊ฒ ์ต๋๋ค ใ
ใ
... ํ๋ฒ์ ๋์์ผ๋ก ์ ์กฐ๊ฑด๋ฌธ์ ๊ฐ์ ํ๋ฉด ๋๊ฒ ๊ตฐ์ฌ! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ด๊ฑด ์ ๊ฐ ๋ญ ๋ง์ํ์๋์ง ์ ๋ชฐ๋ผ์...ํ์ตํ๊ฒ ์ต๋๋ค ใ
.. |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ด ๋ถ๋ถ์ home.tsx์์๋ ์ ์ฒด์ ์ธ UI ๋ฐ ํ์ด์ง ๊ด๋ จ๋ง ๋ํ๋ด๊ณ List์์ Card๋ฅผ ํธ๋ค๋ง ํ ์ ์๋๋ก ์๊ฐ์ ํด์ ๋ก์ง์ ๊ตฌํํ๋๋ฐ ์ด๋ฐ ํธ๋ค๋ง ๋ก์ง์ home.tsx๊ฐ ๋ ์ ์ ํ๋จ ๋ง์์ด์ค๊น์ฌ?? |
@@ -0,0 +1,15 @@
+import axios from "axios";
+import { Country } from "../types/country";
+
+export const countryApi = axios.create({
+ baseURL: "https://restcountries.com/v3.1",
+});
+
+export const getCountries = async (): Promise<Country[]> => {
+ try {
+ const response = await countryApi.get("/all");
+ retu... | TypeScript | ์ ๊ทธ๋ ๊ตฐ์ฌ! ์ ๋ ์ผ๋จ jsํ๋ฏ์ด ์์ฑ ํ ํ์ strict๋ชจ๋๊ฐ ์ค์ ๋์ด์์ผ๋ ts์์ ์๋ก ๋ฐ์ํ ์ค๋ฅ์ ๋ง์ถฐ ์์ ํ์ด๊ฐ์ง๊ณ ๋ฐํ๊ฐ๋ง ๋ช
์ํ๊ณ ์ค๋ฅ๊ฐ ์ฌ๋ผ์ก๊ธธ๋ ๊ทธ ๋ถ๋ถ์ ๋ฏธ์ฒ ์๊ฐ์ ๋ชปํ์ต๋๋ค.
์๋ฌด๋๋ ๋ชจ๋ ๊ฐ์ ์ ํํ ํ์
์ ๋ช
์ํ๋๊ฑด ์ ๋ ํด์ผ๊ฒ ๋ค ์๊ฐํ๋๋ฐ ๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | prop ํ์
์ ์ธ๋ผ์ธ์ผ๋ก ์ ์ํ ์ด์ ๊ฐ ์๋์ง ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์...์๋ data๋ก mpa์ ๋๋ ธ์๋๋ฐ...;; ์ด๊ฒ isDone๊ฐ์ ๊ผญ ์จ๋ณด๋ ค๊ณ ๋
ธ๋ ฅํ๋ค๋ณด๋ ์ด์ฉ๋ค ๊ทธ๋ ๊ฒ ๋์์ต๋๋ค ใ
ใ
... ๋ง์๋๋ก ์ง๊ธ ์ฟผ๋ฆฌ๊ฐ ์ด๊ธฐ๊ฐ ๋ฃ์ด์ฃผ๋๊ฑฐ๋ง๊ณ ๋ฑํ ์์ฐ์ด๊ธดํฉ๋๋ค.. |
@@ -0,0 +1,66 @@
+import { useQuery } from "@tanstack/react-query";
+import { getCountries } from "../api/countryAPI";
+import CountryCard from "./CountryCard";
+import { useEffect } from "react";
+import { Country } from "../types/country";
+import useCountryStore from "../zustand/countryStore";
+
+const CountryList =... | Unknown | ์ ๋ ๊ถ๊ธํฉ๋๋ค..!!! |
@@ -0,0 +1,84 @@
+export interface Country {
+ name: {
+ common: string;
+ official: string;
+ nativeName: {
+ [key: string]: {
+ official: string;
+ common: string;
+ };
+ };
+ };
+ tld: string[];
+ cca2: string;
+ ccn3: string;
+ cca3: string;
+ cioc: string;
+ independent:... | TypeScript | ์ ๋ ์ฌ์ค ๋ชจ๋ ๋ฐ์ดํฐ๋ฅผ ๋ค ๋ณด์ง ์์์ง๋ง, ๋ช๋ช ๋ฐ์ดํฐ๋ ์ ํ์ ์ผ๋ก ๋ค์ด์ค๋ ๊ฒ ๊ฐ๋๋ผ๊ตฌ์..!! ๊ทธ๋์ ๋ชจ๋ ๋ฐ์ดํฐ์ ๋ค ๋ค์ด์ค๋ ๊ฒ์ด ์๋๋ผ๋ฉด ์ต์
๋์ ๋ถ์ฌ์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค..!! |
@@ -1,7 +1,17 @@
package store;
+import store.controller.StoreController;
+import store.global.util.FileUtil;
+import store.view.InputView;
+import store.view.OutputView;
+
public class Application {
public static void main(String[] args) {
- // TODO: ํ๋ก๊ทธ๋จ ๊ตฌํ
+ FileUtil fileInputView = new FileUt... | Java | FileUtil ์ด๋ผ๋ ์๋ช
์ด ์ง๊ด์ ์ด์ด์ ์ข๋ค์! ์ ๋ StoreInitializer๋ก ํ๋๋ฐ ๋ญ๊ฐ ์ ์๋ฟ์์ ์์ฌ์ ์ด์ |
@@ -1 +1,325 @@
-# java-convenience-store-precourse
+# ํธ์์ ๐ช
+
+## ๊ธฐ๋ฅ ๊ตฌํ ๋ชฉ๋ก
+
+### โ
ํ์ผ ์ฝ๊ธฐ ๊ธฐ๋ฅ
+- [x] ํ์ผ ๋ด์ฉ์ ์
๋ ฅ ๋ฐ์ ๋ฆฌ์คํธ๋ก ๋ฐํํ๋ค
+ - `products.md`, `promotions.md` ํ์ผ ์
๋ ฅ
+ - ๋ด์ฉ `(,)` ์ผํ๋ก ๊ตฌ๋ถ
+ - ์ ์ฒด ๋ด์ฉ ๋ถ๋ฆฌ ํ ๋ฆฌ์คํธ๋ก ๋ฐํ
+- [x] `์์ธ์ฒ๋ฆฌ` ์ผ์นํ๋ ํ์ผ๋ช
์ด ์์ ๊ฒฝ์ฐ ์์ธ๊ฐ ๋ฐ์ํ๋ค
+- [x] `์์ธ์ฒ๋ฆฌ` ํ์ผ์์ ๋ด์ฉ์ด ์์ ๊ฒฝ์ฐ ์์ธ๊ฐ ๋ฐ์ํ๋ค
+- [x] `์์ธ์ฒ๋ฆฌ` ๋ถ๋ฆฌํ ๋ฐฐ์ด ์์๊ฐ ... | Unknown | ์๊ฐํ๊ธฐ ์ฝ์ง ์์ ์ ์๋ ์ฃ์ง ์ผ์ด์ค์์ํ
๋ฐ ์ ์ง์ผ์
จ๋ค์! |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | do {} while์ด ์์ฃผ ์ ์ฐ์ด๋ ๊ตฌ๋ฌธ์ด๋ผ์ ์ฌ์ฉ ํ ์๊ฐ์ ํ๋๊ฒ์ด ์ฝ์ง ์์ผ์
จ์ํ
๋ฐ ์ด๊ฒ๋ ์ ํ์
จ๋ค์! |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | ```java
private <T> T process(Supplier<T> supplier) {
while (true) {
try {
return supplier.get();
} catch (IllegalArgumentException e) {
outputView.printErrorMessage(e.getMessage());
}
}
}
process(inputView::read~~);... |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | ์ด ๋๊ฐ์ ๋ฉ์๋๋ฅผ, purchase.canApplyPromotion() ์ผ๋ก ๋ฌถ๋ ๊ฒ๋ ๊ฐ๋
์ฑ์ ๋์ด๋๋ฐ์ ์ข์ ๋ณด์
๋๋ค. |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | StoreController์ ์ญ ์ฝ์ผ๋ฉฐ ๋ ์๊ฐ์ด, ๋ฌผ๋ก ์๊ฐ์ด ์ด๋ฐํ๊ณ ์ด์ฉ ์ ์์์ง๋ง ์ปจํธ๋กค๋ฌ์ ๋๋ฌด ๋ง์ ์ฑ
์๊ณผ ๊ตฌํ์ด ์ง์ค๋์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค. ์ปจํธ๋กค๋ฌ๋ ์ ๋ง ๋จ์ํ ์ ์ด ์ญํ ์ ํ๊ณ , ๋น์ฆ๋์ค๊ฐ ํฌํจ๋ ๊ตฌํ ๋ถ๋ถ์ Service ๋ ์ด์ด๋ก ๋ฐ๋ก ๋นผ๋ ๋ฐฉ๋ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | ๋น์ฆ๋์ค ๋ก์ง์ด ์ปจํธ๋กค๋ฌ์ ํฌํจ๋์ด ์๋ ๊ฒ์ ์ด์ํ ๊ฒ ๊ฐ์ต๋๋ค! ์ปจํธ๋กค๋ฌ์ ์๋น์ค๋ฅผ ๋ถ๋ฆฌํ๋ค๋ฉด ๋ ๋์ ์ฝ๋๊ฐ ๋์์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | ์ด๋ฐ ๋ถ๋ถ๋ remainingStock์ด๋ผ๋ ๋ก์ปฌ ๋ณ์๊ฐ ์ฌ์ค purchase์ ํ๋๋๊น if๋ฌธ์ &&๋ฅผ ์์ ๊ณ purchase์ ํ๋์ ๋ฉ์์ง๋ฅผ ๋ณด๋ด๋ ์ชฝ์ผ๋ก ๊ตฌํํ๋ค๋ฉด ๊ฐ๋
์ฑ์ด ํจ์ฌ ์ข์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,39 @@
+package store.domain.product;
+
+import static store.global.constant.ErrorMessage.INVALID_PRICE_NUMERIC;
+import static store.global.constant.ErrorMessage.INVALID_PRICE_OUT_OF_RANGE;
+import static store.global.validation.CommonValidator.validateNotNumeric;
+
+import java.text.DecimalFormat;
+
+public... | Java | Price๊ฐ์ฒด์ ํ์๊ฐ ๋ฐ๋ก ์๋ ๊ฒ ๊ฐ์ ๋ณด์ด๋๋ฐ, ๋จ์ํ "๊ฐ๊ฒฉ"์ด๋ผ๋ ๋๋ฉ์ธ ์ ์ฝ ๊ฒ์ฆ๊ณผ, ๊ด๋ จ๋ ์์๋ค์ ๋ฌถ์ด๋๊ธฐ ์ํด ์ฌ์ฉํ์ ๊ฑด๊ฐ์? |
@@ -0,0 +1,77 @@
+package store.global.util;
+
+import static store.global.constant.ErrorMessage.INVALID_INPUT_PURCHASE;
+import static store.global.validation.CommonValidator.validateBlank;
+import static store.global.validation.CommonValidator.validateNotNumeric;
+
+import java.util.LinkedHashMap;
+import java.util.M... | Java | ๊ณตํต ํผ๋๋ฐฑ์์ ๋ณ์ ์ด๋ฆ์ ์๋ฃํ์ ๋ฃ์ง ๋ง๋ผ๊ณ ํ๋๋ผ๊ตฌ์! |
@@ -0,0 +1,15 @@
+package store.domain.product;
+
+public class Name {
+
+ private final String name;
+
+ public Name(final String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+} | Java | Nameํด๋์ค์ ์ฉ๋๊ฐ ๊ถ๊ธํด์! |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | ๊ฐ์ธ์ ์ผ๋ก๋ ์ปจํธ๋กค๋ฌ๊ฐ ๋ถ๋ด์ด ์กฐ๊ธ ํฐ ๊ฒ ๊ฐ์์!
๋น์ฆ๋์ค ๋ก์ง์ ์์ํ์ง์๊ณ ์ผ๋ถ๋ฅผ ๋ด๋นํ๊ณ ์๋ค๋ ๋๋์ด ๋ค์ด์. ์ด๋ป๊ฒ ์๊ฐํ์๋์?! |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | ์ต๋ ํ ์ธ ๊ธ์ก์ด ๋์ด์ฐ๋์ง ํ์ธํ๋ ๋ฉ์๋๋ก ๋ฐ๋ก ๋ถ๋ฆฌ๋ฅผ ํ์ผ๋ฉด ๋ ์ข์์ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค์์ด์! |
@@ -0,0 +1,46 @@
+package store.domain;
+
+import java.time.LocalDate;
+
+public class Promotions {
+
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDate startDate;
+ private final LocalDate endDate;
+
+ public Promotions(String name, String buy, St... | Java | ํน์, Name ํ์
์ผ๋ก ํ์ง ์์ผ์ ์ด์ ๊ฐ ์๋์ฉ?? |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | ์๋
ํ์ธ์!
๊ฐ์ฒด๋ฅผ ๊ฐ์ฒด๋ต๊ฒ ํ์ฉํ๊ธฐ ์ํด, ๋ฉ์์ง๋ฅผ ์ ๋ฌํด ๊ฐ์ฒด๊ฐ ์ค์ค๋ก ์์
์ ์ํํ๋๋ก ํ๋ ๊ฒ์ด ์ข๋ค๋ ๊ณตํต ํผ๋๋ฐฑ์ ํ์ธํ์ต๋๋ค.
ํ์ฌ ๋ฉ์๋๋ ์๋(quantity)์ 1์ฉ ์ฆ๊ฐ์ํค๋ ๋จ์ํ ๋ก์ง์ ๊ฐ์ง๊ณ ์๋๋ฐ์,
์ด ๊ฒฝ์ฐ ๋งค๋ฒ ํธ์ถํ ๋๋ง๋ค ์๋์ 1์ฉ ์ฆ๊ฐ์ํค๋ ๋์ , ํ๋ผ๋ฏธํฐ๋ก ์ฆ๊ฐํ ์๋์ ์ ๋ฌํ๊ณ ์ด๋ฅผ ๋ฐ์ํ๋ ๋ฐฉ๋ฒ๋ ๊ณ ๋ คํด๋ณผ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
```
public void increaseQuantity(int number) {
this.quantity += number;
}
```
ํ์ง๋ง ์ด์ ๋์์ ๋๋ฌด ๋จ์... |
@@ -0,0 +1,39 @@
+package store.domain.product;
+
+import static store.global.constant.ErrorMessage.INVALID_PRICE_NUMERIC;
+import static store.global.constant.ErrorMessage.INVALID_PRICE_OUT_OF_RANGE;
+import static store.global.validation.CommonValidator.validateNotNumeric;
+
+import java.text.DecimalFormat;
+
+public... | Java | ๋์ผํ ํ์์ ์์๋ฅผ Quantity์์๋ ๋ณด์์ด์!
ํน์, ๊ณตํต์ ์ผ๋ก ์ฌ์ฉํ๋ ์์๋ ๋ฐ๋ก ๋ถ๋ฆฌ๋ฅผ ํ์๋ ๊ฒ์ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,58 @@
+package store.view;
+
+import static store.global.constant.MessageConstant.FORMAT;
+import static store.global.constant.MessageConstant.NEW_LINE;
+import static store.global.constant.MessageConstant.OUTPUT_HEADER_PROMOTION;
+import static store.global.constant.MessageConstant.OUTPUT_HEADER_SEPARATOR;
... | Java | ์๋
ํ์ธ์!
ํน์ ์๋์ ๊ฐ์ด ํฌ๋งท์ ์ค์ ํ์
จ์ ๋, ๋์ด์ฐ๊ธฐ ๋๋ฌธ์ ์ถ๋ ฅ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ ฌ์ด ๊ฐ๋ฅํ์
จ๋์?
4์ฃผ ์ฐจ ์งํํ๋ฉด์ ์์์ฆ ์ถ๋ ฅ ๋ถ๋ถ์ ๋ณด๊ธฐ ์ข๊ฒ ์ ๋ฆฌํ๋ ๊ฒ์ด ์๊ตฌ์ฌํญ์ด์์ด์ ๋ง์ด ์ฐพ์๋ดค์ต๋๋ค!
๊ทธ ๊ณผ์ ์์ ์๊ฒ ๋ ์ ์, ํ๊ตญ์ด๋ 2๊ธ์๋ก ์ทจ๊ธ๋์ง๋ง, ๋์ด์ฐ๊ธฐ์ ์์ด๋ 1๊ธ์๋ก ์ทจ๊ธ๋๋ค๋ ๊ฒ์
๋๋ค. ๊ทธ๋์ ๋์ด์ฐ๊ธฐ๋ฅผ ํ๊ธ์ฒ๋ผ 2๊ธ์ ์ญํ ์ ํ ์ ์๋ ๋ฐฉ๋ฒ์ด ์์๊น ๊ณ ๋ฏผํ๋ค๊ฐ, \u3000 (์ ๋์ฝ๋ ๊ณต๋ฐฑ)์ ์๊ฒ ๋์์ต๋๋ค!
์๋ฅผ ๋ค์ด, ์๋์ ๊ฐ์ด ์ฌ์ฉํ ์ ์์ต๋๋ค:
`String name = String.format("%-14... |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | ์๋
ํ์ธ์!
์ ๋ ๊ณตํต ํผ๋๋ฐฑ์์ ๋๋ฉ์ธ ๊ฐ์ฒด๋ ์ถ๋ ฅ๊ณผ ๊ด๋ จ๋ ๋ก์ง์ ์ต๋ํ ๋ฐฐ์ ํ๊ณ ,
ํ์ํ ๊ฒฝ์ฐ toString์ ์ค๋ฒ๋ผ์ด๋ํ๋ ์ ๋๋ก ์ ํํ๋ ๊ฒ์ด ์ข๋ค๊ณ ๋ณธ ๊ฒ ๊ฐ์ต๋๋ค.
ํ์ฌ ํด๋น ๋ถ๋ถ์ ๋๋ฉ์ธ์์ ์ถ๋ ฅ ๋ก์ง์ ์ฒ๋ฆฌํ๊ณ ์๋ ๊ฒ์ผ๋ก ๋ณด์ฌ์!
view์์ ์ฒ๋ฆฌํ๋ ๋ฐฉ์์ด ๋ ์ข์ ๊ฒ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,223 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import store.domain.PaymentProductList;
+import store.domain.Product;
+import store.domain.Products;
+import stor... | Java | ์ ๋ ์๊ฐ์ด ์กฐ๊ธ ๋ค๋ฅธ ๊ฒ, ์ ๋ ๊ฒ ์ซ์๋ฅผ ํตํด ๊ฐ์ ์กฐ์ํ ์ ์๊ฒ ํ๋ฉด ๋จ์ํ +1 ํ๋ ๊ฒ๋ณด๋ค ์กฐ๊ธ ๋ ์ฑ
์์ ์ ๊ฐํ๋ ๊ฒ์ด๋ผ๊ณ ํด์ํ ์๋ ์์ง ์๋์? |
@@ -0,0 +1,58 @@
+package store.view;
+
+import static store.global.constant.MessageConstant.FORMAT;
+import static store.global.constant.MessageConstant.NEW_LINE;
+import static store.global.constant.MessageConstant.OUTPUT_HEADER_PROMOTION;
+import static store.global.constant.MessageConstant.OUTPUT_HEADER_SEPARATOR;
... | Java | ํ .. ! ๋๋ฌด๋๋ ์ข์ ๊ฟํ ๊ฐ์ฌ๋๋ฆฝ๋๋ค. |
@@ -0,0 +1,48 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+
+public class PaymentProduct {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ private final String name;
+ private final int quant... | Java | DecimalFormat์ด๋ผ๋ ํด๋์ค๋ ์ฒ์ ๋ณด๋ค์ ! ๋ฐฐ์๊ฐ๋๋ค |
@@ -0,0 +1,48 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+
+public class PaymentProduct {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ private final String name;
+ private final int quant... | Java | promotion ๋ณ์์ ์ ํํ ๋ป์ด ๋ฌด์์ธ๊ฐ์?
ํ๋ก๋ชจ์
์ฌ๋ถ์ธ๊ฐ์? ํ๋ก๋ชจ์
๊ฐ๊ฒฉ์ธ๊ฐ์? ๊ตณ์ด int ํ์
์ผ๋ก ์์ฑํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | ์ฐ์ํํ
ํฌ์ฝ์ค์ ๊ณตํต ํผ๋๋ฐฑ์์ ๋ณ์๋ช
์ ์๋ฃํ(List) ๊ฐ์ ๊ฑธ ๋ฃ์ง ๋ง๋ผ๊ณ ํ๋๋ฐ, ์ด์ ๋ํด ๋ณ์๋ ์๋์ง๋ง PaymentProductList ๋ผ๋ ํด๋์ค ๋ช
์ ๋ํด ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | ์ฌ๊ธฐ์ - ๊ฐ์ ๊ฒ์ ์์๋ก ์ฒ๋ฆฌํ๋ ๊ฒ์ด ๋์ ๊ฒ ๊ฐ์๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,89 @@
+package store.domain;
+
+import static store.global.constant.MessageConstant.FORMAT;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+public class PaymentProductList {
+
+ private static final DecimalFormat PRICE_FORMAT = new DecimalFormat("###,###");
+
+ ... | Java | ์ ์ฒด์ ์ผ๋ก ์ฌ๊ธฐ 8000 ์ด๋ผ๋ ์ซ์๋ ๊ทธ๋ ๊ณ , ์์ํ๋ฅผ ํ์ผ๋ฉด ๋ ๊ฐ๋
์ฑ์ด ์ข์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,83 @@
+package store.domain;
+
+import java.time.LocalDate;
+import store.domain.product.Name;
+import store.domain.product.Price;
+import store.domain.product.Quantity;
+
+public class Product {
+
+ private static final String INFO_DELIMITER = " ";
+
+ private final Name name;
+ private final Price... | Java | ๋ชจ๋ ํ๋๊ฐ ๋ํ๋์ด ์๋ ๊ฒ์ด ๊ฐ๋
์ฑ๊ณผ ๋ก์ง ๋ถ๋ฆฌ์ ์ข์ ์ํฅ์ ๋ผ์น๋ ๊ฒ ๊ฐ์์! ๐ |
@@ -0,0 +1,46 @@
+package store.domain;
+
+import java.time.LocalDate;
+
+public class Promotions {
+
+ private final String name;
+ private final int buy;
+ private final int get;
+ private final LocalDate startDate;
+ private final LocalDate endDate;
+
+ public Promotions(String name, String buy, St... | Java | ์ ๋ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,32 @@
+package store.global.constant;
+
+public enum ErrorMessage {
+ INVALID_INPUT_PURCHASE("์ฌ๋ฐ๋ฅด์ง ์์ ํ์์ผ๋ก ์
๋ ฅํ์ต๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_INPUT("์๋ชป๋ ์
๋ ฅ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+
+ INVALID_PRICE_NUMERIC("๋ฌผํ ๊ฐ๊ฒฉ์ ์ซ์๋ง ๊ฐ๋ฅํฉ๋๋ค. ๋ค์ ํ์ธํด ์ฃผ์ธ์."),
+ INVALID_PRICE_OUT_OF_RANGE("๋ฌผํ ๊ฐ๊ฒฉ์ ๋ฒ์๋ด๋ง ๋ฑ๋กํ ์ ์์ต๋๋ค. ๋ค์ ํ์ธํด ์ฃผ์ธ์... | Java | ์ด๋ ๊ฒ [ERROR]์ ํ๋ฒ์ ์ฒ๋ฆฌํ๋ ๋ฐฉ์ ์ข๋ค์. |
@@ -0,0 +1,13 @@
+package store.global.exception;
+
+import store.global.constant.ErrorMessage;
+
+public class FileException extends RuntimeException {
+ public FileException(ErrorMessage error, String fileName) {
+ super(String.format(error.getMessage(), fileName));
+ }
+
+ public FileException(ErrorM... | Java | FileExceiption์ ๋ฐ๋ก ์ ์ํ์ ์ด์ ๊ฐ ์์๊น์? ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,61 @@
+package store.global.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.domain.Product;
+import store.domain.PromotionsList;
+import store.domain.product.Name;
+import store.domain.product.Price;
+import store.domain.product.Quantity;
+
+public class ProductParser {
+ privat... | Java | ์ ๋ FileUtil์์ ์ฌ์ค ๋ชจ๋ ํ์ฑ๋ ์ฒ๋ฆฌํ๋๋ก ์์ฑํ๋๋ฐ, ์ด๋ ๊ฒ Parser์ ๋ฐ๋ก ๊ตฌ๋ถํ๋ ๊ฒ์ด ๋ ์ข์ ์ค๊ณ์ธ ๊ฒ ๊ฐ์ต๋๋ค! ์นญ์ฐฌํด์ :) |
@@ -6,6 +6,7 @@
import java.time.LocalDateTime;
import java.util.List;
+import java.util.Set;
import java.util.UUID;
import org.springframework.data.domain.Page;
@@ -14,12 +15,14 @@
import org.springframework.data.support.PageableExecutionUtils;
import com.ioteam.order_management_platform.global.exception.C... | Java | ์๊ตฌ์ฌํญ์ ๋ง๊ฒ ๊น๋ํ๊ฒ ์ฝ๋ ๊ตฌํํ์๋ ๋ชจ์ต ๋จธ์ฏ์ต๋๋ค!!! |
@@ -6,6 +6,7 @@
import java.time.LocalDateTime;
import java.util.List;
+import java.util.Set;
import java.util.UUID;
import org.springframework.data.domain.Page;
@@ -14,12 +15,14 @@
import org.springframework.data.support.PageableExecutionUtils;
import com.ioteam.order_management_platform.global.exception.C... | Java | QueryProjection์ ์ฌ์ฉํด DTO ๋งคํ์ ์๋์ผ๋ก ํด์ฃผ๋ ๊ตฐ์!! ์ฝ๋๊ฐ ํจ ๊ฐ๊ฒฐํด์ง๊ณ DTO ๋ง ์์ ํ๋ฉด ๋๋ ์ ์ง๋ณด์์๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,66 @@
+package christmas.domain;
+
+import static christmas.exception.ErrorMessage.DAY_NOT_IN_RANGE;
+import static christmas.exception.ErrorMessage.ENDS_WITH_DELIMITER;
+
+import christmas.domain.constant.EventConstraint;
+import christmas.exception.OrderException;
+
+public class Day {
+ private final i... | Java | EventConstraint์์ ์ ์ธํ ์์๋ฅผ ๊ฐ์ ธ๋ค ์ฐ์ง ์์ ์ด์ ๊ฐ ์๋์? |
@@ -0,0 +1,64 @@
+package christmas.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import christmas.domain.constant.EventConstraint;
+import christmas.exception.ErrorMessage;
+import christmas.exception.OrderException;
+import o... | Java | @ParamiterizedTest์ ์ด๋
ธํ
์ด์
์ ํ์ฉํด์ ์ค๋ณต์ ์ค์ผ ์ ์์๊ฑฐ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,5 @@
+const API_URL = `${import.meta.env.VITE_API_URL}`;
+
+export const PRODUCTS_ENDPOINT = `${API_URL}/products`;
+export const CART_ITEMS_ENDPOINT = `${API_URL}/cart-items`;
+export const CART_ITEMS_COUNTS_ENDPOINT = `${CART_ITEMS_ENDPOINT}/counts`; | TypeScript | ์ด๋ฐ endpoint๋ค์ ํ๋์ ๊ฐ์ฒด๋ก ๊ด๋ฆฌํด๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,49 @@
+const generateBasicToken = (userId: string, userPassword: string): string => {
+ const token = btoa(`${userId}:${userPassword}`);
+ return `Basic ${token}`;
+};
+
+const API_URL = `${import.meta.env.VITE_API_URL}`;
+const USER_ID = `${import.meta.env.VITE_USER_ID}`;
+const USER_PASSWORD = `${import.... | TypeScript | fetch์ ํ์ํ ์ค๋ณต๋ ๋ก์ง์ ๋ถ๋ฆฌํ ๋ถ๋ถ. ์ธ์์ ์
๋๋ค. |
@@ -0,0 +1,25 @@
+import { useEffect } from "react";
+import { useErrorContext } from "../../hooks/useErrorContext";
+import { ErrorToastStyle } from "./ErrorToast.style";
+
+const ErrorToast = () => {
+ const { error, hideError } = useErrorContext();
+
+ useEffect(() => {
+ setTimeout(() => {
+ hideError();
... | Unknown | toast๋ฅผ ๋์ด์ค ์๊ฐ์ ๋ฐ๋ก ์์๋ก ๊ด๋ฆฌํ๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,51 @@
+import useProducts from "../../hooks/useProducts";
+import ProductListHeader from "../ProductListHeader/ProductListHeader";
+import ProductItem from "./ProductItem/ProductItem";
+import * as PL from "./ProductList.style";
+import useInfiniteScroll from "../../hooks/useInfiniteScroll";
+import usePagin... | Unknown | ํ์ฌ ์๋ก์ด fetch๋ฅผ ํตํด ์๋ก์ด ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ง๊ณ ์ค๋ฉด ์คํฌ๋กค ์์น๊ฐ ๊ฐ์ ๋ก ์ฌ๋ผ๊ฐ๋ ๋ฒ๊ทธ๊ฐ ์์ต๋๋ค. ์ ๊ฐ ์๊ฐํ๊ธฐ์๋ ProductListStyle๊ฐ ์กฐ๊ฑด๋ถ๋ก ๋ ๋๋ง๋์ด ์ปดํฌ๋ํธ๊ฐ ๋งค๋ฒ ์๋กญ๊ฒ ๋ง๋ค์ด์ง๋๋ค. ๊ทธ๋์ ๋ฆฌ์กํธ๊ฐ ๋์ผํ ์ปดํฌ๋ํธ๋ก ์ธ์งํ์ง ๋ชปํด์ ๋ฐ์ํ ๋ฌธ์ ๊ฐ์ต๋๋ค. ๋ค์๊ณผ ๊ฐ์ ์ฝ๋๋ก ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
```tsx
return (
<>
<ProductListHeader
handleCategory={handleCategory}
handleSort={handleSort}
/... |
@@ -0,0 +1,49 @@
+const generateBasicToken = (userId: string, userPassword: string): string => {
+ const token = btoa(`${userId}:${userPassword}`);
+ return `Basic ${token}`;
+};
+
+const API_URL = `${import.meta.env.VITE_API_URL}`;
+const USER_ID = `${import.meta.env.VITE_USER_ID}`;
+const USER_PASSWORD = `${import.... | TypeScript | fetch์ ๊ณตํต๋ ๋ก์ง์ ๋๋ฒ์ด๋ ๊ฐ์ธ์ ๊น๋ํ๊ฒ ์ ๋ฆฌํด ์ค ๊ฒ์ด ๋ง์์ ๋๋ค์~!
์ ๋ฏธ์
์๋ ์ ์ฉ์์ผ๋ด์ผ๊ฒ ์ด์ ใ
ใ
ใ
๐ ๐๐๐ |
@@ -0,0 +1,118 @@
+import { RULE } from "../constants/rules";
+import {
+ CART_ITEMS_COUNTS_ENDPOINT,
+ CART_ITEMS_ENDPOINT,
+ PRODUCTS_ENDPOINT,
+} from "./endpoints";
+import { fetchWithAuth } from "./fetchWithAuth";
+
+interface QueryParams {
+ [key: string]:
+ | undefined
+ | string
+ | number
+ | b... | TypeScript | ์๋ง key๋ก ์ ๊ทผํด์ ๊ฐ์ ๊ฐ์ ธ์ค๊ธฐ ์ํด์ index signature๋ฅผ ์ฌ์ฉํ๋ ค๊ณ ํ์
จ๋ ๊ฑธ๊น์?!
ํ์ง๋ง ์ด๋ ๊ฒ ๋๋ฉด, ์์์น ๋ชปํ๊ฒ `page = "page1"` ๊ณผ ๊ฐ์ prop์ด๋
์๋ํ์ง ์์ key๊ฐ์ด ๋ค์ด์ฌ ๊ฒฝ์ฐ, queryParams interface์์ ๊ฑธ๋ฌ์ง์ง ์์ ๊ฒ ๊ฐ์์.
์ฌ์ ์์ผ์ค ๋ ํ๋ฒ ์๊ฐํด ๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ :) |
@@ -0,0 +1,34 @@
+import styled from "styled-components";
+
+export const ButtonStyle = styled.button`
+ cursor: pointer;
+ border: none;
+ outline: none;
+`;
+
+export const CartControlButtonStyle = styled(ButtonStyle)`
+ display: flex;
+ position: absolute;
+ right: 8px;
+ align-items: center;
+ border-radius... | TypeScript | ์ ๋ Button์ Prop์ ๋ฐ์์ ์์์ ๋ฐ๊ฟ์ฃผ๋ ์์ผ๋ก ์์ฑํ์ด์!
```suggestion
export const ButtonStyle = styled.button<ButtonProps>`
cursor: pointer;
border: none;
outline: none;
${({ color }) => {
if (color === "primary") {
return `
background-color: black;
color: white;
`;
}
... |
@@ -0,0 +1,39 @@
+import styled from "styled-components";
+
+export const HeaderStyle = styled.header`
+ display: flex;
+ background-color: #000000;
+ width: inherit;
+ height: 64px;
+ position: fixed;
+ z-index: 1;
+ padding: 16px 24px 16px;
+ box-sizing: border-box;
+`;
+
+export const LogoImg = styled.img`
+... | TypeScript | ํ๋ก์ ํธ์ ์ปดํฌ๋ํธ ๊ท๋ชจ๊ฐ ๋ณต์กํด์ง๋ฉด, zindex ๊ด๋ฆฌ๊ฐ ํ๋ค๋๋ผ๊ตฌ์
ํค๋๋ฅผ 1๋ก ํด๋จ๋๋ฐ, ํค๋๋ณด๋ค ๋ฎ์ ์ด๋ ํ component๊ฐ ์๊ธธ์๋ ์๊ณ ...!
๊ทธ๋์ ์ ๋ ์ถ์ฒ๋ฐ์ ๋ฐฉ๋ฒ์ด zIndex๋ค์ ์์๋ก ๊ด๋ฆฌํด์ ํ๊ณณ์์ ํธํ๊ฒ ๋ณผ ์ ์๋๋ก ํ๋๊ฑฐ์์ด์
์ ๋ ์์ฃผ ์ฌ์ฉํ์ง ์์ง๋ง, ๊ฟํ ๊ณต์ ํด๋ด
๋๋ค ใ
ใ
|
@@ -0,0 +1,57 @@
+import {
+ createContext,
+ useState,
+ ReactNode,
+ useEffect,
+ useCallback,
+} from "react";
+import { getCartItems } from "../api";
+import { useErrorContext } from "../hooks/useErrorContext";
+
+export interface CartItemsContextType {
+ cartItems: CartItem[];
+ refreshCartItems: () => void... | Unknown | ์ ๋ Quantity๋ง์ context๋ก ๊ด๋ฆฌํ๋๋ฐ, ์ ์ฒด List๋ฅผ context ๋ก ๊ด๋ฆฌํ์
จ๊ตฐ์!!
Provider๋ฅผ custom ํด์ฃผ๋ ๊ฒ๋ ๋งค์ฐ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :)
์ข์ ์ ๋ณด ๋ฐฐ์ฐ๊ณ ๊ฐ๋๋ค!! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.