code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,23 @@
+package christmas.domain;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+class MenuTest {
+ @DisplayName("์ฃผ์ด์ง ์ด๋ฆ์ ํ ๋๋ก ๋ฉ๋ด๋ฅผ ํ๋จํ ์ ์๋ค.")
+ @Test
+ void decideMenu() {
+ String inputTapas = "ํ... | Java | ๋ง์์ ๊ฐ์ธ์ ์ผ๋ก ๊ฐ์ฅ ์์ฌ์ด ๋ถ๋ถ์ธ๋ฐ์,, ๊ตฌํํ๊ณ ๋ฆฌํฉํฐ๋ง์ ํ๋ ๋ง์ด ํด์ ์๊ฐ์ด ๋งค์ฐ ์ด๋ฐํ๋ค๋,, ใ
ใ
|
@@ -0,0 +1,39 @@
+package christmas.domain;
+
+import java.util.Arrays;
+import java.util.List;
+
+public enum MenuType {
+ APPETIZER("์ ํผํ์ด์ ", Arrays.asList(Menu.MUSHROOM_SOUP, Menu.TAPAS, Menu.CAESAR_SALAD)),
+ MAIN("๋ฉ์ธ", Arrays.asList(Menu.T_BONE_STAKE, Menu.BARBECUE_LIP, Menu.SEAFOOD_PASTA, Menu.CHRISTMAS_PAST... | Java | ์ ํํ
๋จ๊ฒจ์ฃผ์
จ๋ ์ฝ๋ ๋ฆฌ๋ทฐ์์ ์ธ๊ธํ์ ํจํด์ด๋ค์! ์ข์ ๊ณต๋ถ๊ฐ ๋ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,21 @@
+package christmas.domain;
+
+public enum OrderResultType {
+ ORDER_MENU("<์ฃผ๋ฌธ ๋ฉ๋ด>"),
+ TOTAL_ORDER_PRICE("<ํ ์ธ ์ ์ด์ฃผ๋ฌธ ๊ธ์ก>"),
+ GIFT_MENU("<์ฆ์ ๋ฉ๋ด>"),
+ BENEFIT_STATISTICS("<ํํ ๋ด์ญ>"),
+ TOTAL_BENEFIT_AMOUNT("<์ดํํ ๊ธ์ก>"),
+ ESTIMATED_PAYMENT("<ํ ์ธ ํ ์์ ๊ฒฐ์ ๊ธ์ก>"),
+ EVENT_BADGE("<12์ ์ด๋ฒคํธ ๋ฐฐ์ง... | Java | ๐ค `OrderResultType`์ ์ ๋ชฉ์ ๊ทธ๋ ๋ค ์ณ๋, < > ๊ฐ์ character ๋ค์ View์ ์ฑ
์์ ๊ฐ๊น์ ๋ณด์ฌ์.
View์์`"<%s>"` ์ ๊ฐ์ ๋ฐฉ๋ฒ์ผ๋ก ์ฑ
์์ ๋ถ๋ฆฌํ๊ณ formatting์ ์ด์ฉํด ์ถ๋ ฅํ๋ ๋ฐฉ๋ฒ์ด ๋ ๋ณ๊ฒฝ์ ๊ฐํ ์ค๊ณ ์๋๊น์? |
@@ -0,0 +1,45 @@
+package christmas.domain;
+
+public class OrderedMenu {
+ public static final String ORDER_RE_READ_REQUEST_MESSAGE = "์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ private static final int AMOUNT_MINIMUM_QUANTITY = 1;
+
+ private final String menuName;
+ private final int quantity;
+
+ public OrderedM... | Java | `Menu` ์ ์ํ๋ ๊ฒ์ผ๋ก ๊ฒ์ฆ์ด ๋์๋ค๋ฉด, field๋ฅผ `String`์ด ์๋ `Menu`๋ก ์ ์ฅํ๋๊ฒ ๋ ์ข์์ ๊ฒ ๊ฐ์์.
enum ์ฌ์ฉ์ ์๋ฏธ๊ฐ ์ฝ๊ฐ ํด์๋์ง ์์๋ ์ถ๋ค์! |
@@ -0,0 +1,52 @@
+package christmas.ui;
+
+import static christmas.domain.Date.DATE_RE_READ_REQUEST_MESSAGE;
+import static christmas.domain.OrderedMenu.ORDER_RE_READ_REQUEST_MESSAGE;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Converter {
+ private static final String ORDER_DELIMITER = ",... | Java | String์ ์ค๋ธ์ ํธ๋ก ๋ฐ๊พธ๋ ํด๋์ค๋ `Parser`๋ผ๊ณ ์ด๋ฆ ์ง๋ ๊ฒ์ด ๋ convention์ ๊ฐ๊น์ธ ๊ฒ ๊ฐ์๋ฐ, ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,63 @@
+package christmas.ui;
+
+import camp.nextstep.edu.missionutils.Console;
+import christmas.domain.Date;
+import christmas.domain.Order;
+import christmas.domain.OrderedMenu;
+import java.util.ArrayList;
+import java.util.List;
+
+public class InputView {
+ private static final String OPENING_MESSAGE... | Java | Supplier์ ํํ๋ก handling ํ๋ ๋ฐฉ๋ฒ๋ ์์ด์. inputDate์ inputOrder์ ํํ๊ฐ ๊ต์ฅํ ๋ฎ์์์ด์, ์ฌ์ฌ์ฉ์ฑ์ ๋์ด๋ ๋ฐฉ๋ฒ์ผ๋ก ์ ์ฉ ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ผ๋ ์ด ์๋ฃ ํ๋ฒ ์ฝ์ด๋ณด์๊ธธ ์ถ์ฒํฉ๋๋ค.
https://hwan33.tistory.com/17 |
@@ -0,0 +1,85 @@
+package christmas.domain;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class EventResult {
+ private static final String NON_BADGE = "์์";
+ private static final String STAR_BADGE = "๋ณ";
+ private static final String TR... | Java | Early return์ ์ฌ์ฉํ์
จ๋๋ฐ, ๊ตณ์ด ๋ฒ์๋ฅผ max, min์ ์ด์ฉํด ์ผ์ผ์ด ์ค๋ช
ํ์ง ์์๋ ๋ ๊ฒ ๊ฐ์์.
๊ผญ maximum_amount๊ฐ ํ์ํ์๊น์?
(๊ทธ๋ฆฌ๊ณ ๋ณ์๋ช
์ maximum์ด๋ผ๊ณ ๋ณด๊ธฐ์ ํด๋น ๋ถ๋ถ์ ํฌํจํ์ง ์์์ ํผ๋์ด ์์ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.
์ฐจ๋ผ๋ฆฌ `STAR_BADGE_MAXIMUM_AMOUNT = 9999`์ ๊ฐ์ ๋ฐฉ์์ด์๋ค๋ฉด...)
```suggestion
if (totalBenefitAmount >= STAR_BADGE_MINIMUM_AMOUNT) {
return STAR_BADGE;
... |
@@ -0,0 +1,85 @@
+package christmas.domain;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class EventResult {
+ private static final String NON_BADGE = "์์";
+ private static final String STAR_BADGE = "๋ณ";
+ private static final String TR... | Java | ์ถ๊ฐ) NON_BADGE๋ ๋ณ์๋ช
ํต์ผ์ฑ์ ์ํด NONE_BADGE๋ก ์์ฑํ์
จ๋ค๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,39 @@
+package christmas.domain;
+
+import java.util.Arrays;
+import java.util.List;
+
+public enum MenuType {
+ APPETIZER("์ ํผํ์ด์ ", Arrays.asList(Menu.MUSHROOM_SOUP, Menu.TAPAS, Menu.CAESAR_SALAD)),
+ MAIN("๋ฉ์ธ", Arrays.asList(Menu.T_BONE_STAKE, Menu.BARBECUE_LIP, Menu.SEAFOOD_PASTA, Menu.CHRISTMAS_PAST... | Java | ๋ง์์ ๋ค์ ๋ฌผ์ด๋ณด์
จ์ด์ ๋๊ธ์ ์ ๋ณด๋ฅผ ์ป์ ๋งํฌ ๋จ๊ฒจ๋๋ ธ์๋๋ฐ์ ๋ชป ๋ณด์ ๊ฒ ๊ฐ์ ๋ค์ ๋จ๊ฒจ๋๋ ค์..!!
https://techblog.woowahan.com/2527/
@Uniaut |
@@ -0,0 +1,21 @@
+package christmas.domain;
+
+public enum OrderResultType {
+ ORDER_MENU("<์ฃผ๋ฌธ ๋ฉ๋ด>"),
+ TOTAL_ORDER_PRICE("<ํ ์ธ ์ ์ด์ฃผ๋ฌธ ๊ธ์ก>"),
+ GIFT_MENU("<์ฆ์ ๋ฉ๋ด>"),
+ BENEFIT_STATISTICS("<ํํ ๋ด์ญ>"),
+ TOTAL_BENEFIT_AMOUNT("<์ดํํ ๊ธ์ก>"),
+ ESTIMATED_PAYMENT("<ํ ์ธ ํ ์์ ๊ฒฐ์ ๊ธ์ก>"),
+ EVENT_BADGE("<12์ ์ด๋ฒคํธ ๋ฐฐ์ง... | Java | ๋ ์ข์ ๋ฐฉ๋ฒ์ธ๊ฒ ๊ฐ๋ค์!! ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค |
@@ -0,0 +1,45 @@
+package christmas.domain;
+
+public class OrderedMenu {
+ public static final String ORDER_RE_READ_REQUEST_MESSAGE = "์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ private static final int AMOUNT_MINIMUM_QUANTITY = 1;
+
+ private final String menuName;
+ private final int quantity;
+
+ public OrderedM... | Java | ๋ง๋ค์..! ์ข์ ์๊ฒฌ ๊ฐ์ฌํฉ๋๋ค!! Menu์ด๊ฑฐ์์ ๋ฉ๋ด์ ์ํ์ง ์๋ ์
๋ ฅ์ ์ฒ๋ฆฌํ๊ธฐ ์ํด "์์"์ ๋ง๋ค์์๋๋ฐ, ๋ง์ฝ null๋ก ์ฒ๋ฆฌํ์๋ค๋ฉด Menu์ ์ํ๋ ๊ฒ์ผ๋ก ์์ง ๊ฒ์ฆ์ด ์๋์๋ ๊ฑฐ๋๊น ์ง๊ธ์ฒ๋ผ String์ผ๋ก ํ๋ ๊ฒ์ด ๋ง์๊น์? ์ ๊ฐ ์ดํดํ ๊ฒ์ด ๋ง๋์ง ๊ถ๊ธํด์ @Uniaut |
@@ -0,0 +1,58 @@
+package christmas.domain;
+
+import java.time.DayOfWeek;
+import java.time.LocalDate;
+
+public class Date {
+ public static final String DATE_RE_READ_REQUEST_MESSAGE = "์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ private static final LocalDate CHRISTMAS_DAY = LocalDate.of(2023, 12, 25);
+ private static ... | Java | @JaeHongDev
์ ๋ ์๋กญ๊ฒ ๋ฐฐ์๊ฐ๋๋ค..! |
@@ -0,0 +1,85 @@
+package christmas.domain;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class EventResult {
+ private static final String NON_BADGE = "์์";
+ private static final String STAR_BADGE = "๋ณ";
+ private static final String TR... | Java | ๋ง์์!! ์ ๋ ๊ฐ์ธ์ ์ผ๋ก ์ด ๋ฉ์๋์ ๋ก์ง์ ๋ง๋ค์๋ ๋ฐฉ์์ด ์์ฌ์ ๋๋ฐ์ ,, ๋ง์ํด ์ฃผ์ ๋ฐฉ๋ฒ์ด ํจ์ฌ ๊น๋ํ ๊ฒ ๊ฐ์์ ๋์
if ((totalBenefitAmount >= SANTA_BADGE_MINIMUM_AMOUNT)) {
return SANTA_BADGE;
}
if (totalBenefitAmount >= TREE_BADGE_MINIMUM_AMOUNT) {
return TREE_BADGE;
}
if (totalBenefitAmount >= STAR_BADGE_MINIMUM_AMOUNT) {
return STAR_B... |
@@ -0,0 +1,85 @@
+package christmas.domain;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class EventResult {
+ private static final String NON_BADGE = "์์";
+ private static final String STAR_BADGE = "๋ณ";
+ private static final String TR... | Java | if๋ฌธ ์ ๊น์ง๊ฐ calculateTotalBenefitAmount๋ ๊ฐ์์ ๊ฐ์ ์ฝ๋๋ฅผ ์ ์ ํ์์์ด ๋ฉ์๋๋ฅผ ์ฌ์ฉํด๋ ๋ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,85 @@
+package christmas.domain;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+public class EventResult {
+ private static final String NON_BADGE = "์์";
+ private static final String STAR_BADGE = "๋ณ";
+ private static final String TR... | Java | ์ด if๋ฌธ์ ์กฐ๊ฑด๋ isReceivedGiftBenefit ๋ฉ์๋๋ฅผ ์ฌ์ฉํด๋ ๋๊ฒ ๋ค์! |
@@ -0,0 +1,76 @@
+package christmas.domain;
+
+import static christmas.domain.OrderedMenu.ORDER_RE_READ_REQUEST_MESSAGE;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class Order {
+ private static final int MAXIMUM_M... | Java | ๋ฉ์๋๋ช
์ด ๊ธธ์ด๋ ํ์คํ ์ด๋ฆ๋ง ๋ณด๊ณ ๋ ์ด๋ค ์ญํ ์ ํ๋์ง ๋ฐ๋ก ์ ์ ์์ด์ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,21 @@
+package nextstep.subway;
+
+import org.springframework.dao.DataIntegrityViolationException;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+@RestControllerAdvice
... | Java | @RestControllerAdvice ๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ ์๋ฌ๋ฅผ ํ๊ตฐ๋ฐ์ ์ฒ๋ฆฌํด์ค ์ ์๊ฒํด์ค ๋ถ๋ถ ์ข์ต๋๋ค ๐ |
@@ -0,0 +1,21 @@
+package nextstep.subway;
+
+import org.springframework.dao.DataIntegrityViolationException;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+@RestControllerAdvice
... | Java | ์ด ๋ถ๋ถ์ ์กฐ๊ธ ๊ถ๊ธํ์ฌ ์ฌ์ญค๋ด
๋๋ค! DataIntegrityViolationException ๋ ํ์ฌ ์ดํ๋ฆฌ์ผ์ด์
๋ด์์ ์ธ์ , ์ด๋ค ์ผ์ด์ค์์ ๋ฐ์ํ๊ฒ ๋๋์...? |
@@ -0,0 +1,38 @@
+package nextstep.subway.line.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import nextstep.subway.station.domain.Station;
+import org.jgrapht.GraphPath;
+import org.jgrapht.alg.shortestpath.DijkstraShortestPath;
+import org.jgrapht.graph.DefaultWeightedEdge;
+import org.jgrapht.graph... | Java | ์ ๊ทผ์ ํ์๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,38 @@
+package nextstep.subway.line.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import nextstep.subway.station.domain.Station;
+import org.jgrapht.GraphPath;
+import org.jgrapht.alg.shortestpath.DijkstraShortestPath;
+import org.jgrapht.graph.DefaultWeightedEdge;
+import org.jgrapht.graph... | Java | ๋์ฌ๊ตฌ๋ก ๋ฉ์๋๋ฅผ ํํํด๋ณด๋ ๊ฒ์ ์ด๋จ๊น์...? ๊ทธ๋ฆฌ๊ณ ํน์ ์ ๋๋ฆญ์ ์์ฐ์๋ ์ด์ ๊ฐ ์์ผ์ค๊น์...? |
@@ -6,9 +6,11 @@
import javax.persistence.CascadeType;
import javax.persistence.Embeddable;
import javax.persistence.OneToMany;
-import nextstep.subway.SectionsNotAddedException;
-import nextstep.subway.SectionsNotRemovedException;
+import nextstep.subway.line.exception.SectionsNotAddedException;
+import nextstep.su... | Java | ์ด๋ถ๋ถ๋ Section์ ๋ฉ์์ง๋ฅผ ๋์ ธ์ ํ์ธํด๋ณผ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -6,9 +6,11 @@
import javax.persistence.CascadeType;
import javax.persistence.Embeddable;
import javax.persistence.OneToMany;
-import nextstep.subway.SectionsNotAddedException;
-import nextstep.subway.SectionsNotRemovedException;
+import nextstep.subway.line.exception.SectionsNotAddedException;
+import nextstep.su... | Java | ์ฌ๊ธฐ๊น์ง ํผ๋๋ฐฑ ๋ฐ์ ์ข๋ค์ ใ
ใ
๐ |
@@ -0,0 +1,38 @@
+package nextstep.subway.path.application;
+
+import nextstep.subway.station.exception.StationNotFoundException;
+import nextstep.subway.line.domain.LineRepository;
+import nextstep.subway.line.domain.Lines;
+import nextstep.subway.path.dto.PathResponse;
+import nextstep.subway.station.domain.Station;
... | Java | ์ฌ๊ธฐ์ ํน์ System ํจ์๋ฅผ ์ฐ์ ์ด์ ๊ฐ ์์๊น์...? Sysytem ํจ์๋ ๋ฆฌ์์ค๋ฅผ ๋ง์ด ๋จน์ด์ ์ต๋ํ ์ฌ์ฉํ์ง ์๋ ๊ฒ์ด ์ข์ต๋๋ค. |
@@ -0,0 +1,38 @@
+package nextstep.subway.path.application;
+
+import nextstep.subway.station.exception.StationNotFoundException;
+import nextstep.subway.line.domain.LineRepository;
+import nextstep.subway.line.domain.Lines;
+import nextstep.subway.path.dto.PathResponse;
+import nextstep.subway.station.domain.Station;
... | Java | Repository ์กฐํํ๋ ๋ถ๋ถ์ด ์๋๋ฐ readOnly ์ต์
์ ์ฃผ๋ ๊ฒ์ ์ด๋จ๊น์....? |
@@ -1,9 +1,111 @@
package nextstep.subway.path;
+import static nextstep.subway.line.acceptance.LineAcceptanceTest.์งํ์ฒ _๋
ธ์ _๋ฑ๋ก๋์ด_์์;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import io.restassured.RestAssured;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Respo... | Java | ์ธ์ํ
์คํธ ์ข์ต๋๋ค ๐ ๋ค๋ง ์ด๋ฒ์ ์๋ก๋ง๋์ Lines์ ๋ํ ๋จ์ ํ
์คํธ, PathService์ ๋ํ ๋จ์ํ
์คํธ๋ ์ถ๊ฐ๋๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!
Lines์ ๊ฒฝ์ฐ ์ค์ ์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ฏ๋ก ํด๋น ์ค์ ๊ฐ์ฒด๋ฅผ ์ด์ฉํ์ฌ ํ
์คํธ๋ฅผ ์์ฑํ๊ณ , PathService์ ๊ฒฝ์ฐ๋ ์ธ๋ถ ์์กด์ฑ์ Mocking ํ ๋จ์ ํ
์คํธ๋ฅผ ์์ฑํด๋ณด๋ ๊ฒ๋ ์ข์ ๊ณต๋ถ๊ฐ ๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -1,9 +1,111 @@
package nextstep.subway.path;
+import static nextstep.subway.line.acceptance.LineAcceptanceTest.์งํ์ฒ _๋
ธ์ _๋ฑ๋ก๋์ด_์์;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import io.restassured.RestAssured;
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Respo... | Java | ์ฐ๊ฒฐ๋์ด ์์ง ์์ ์ญ์ ๋ํ ์ต๋จ๊ฑฐ๋ฆฌ ์กฐํ์ ๊ฒฝ์ฐ์๋ ํ
์คํธ๋ฅผ ์ถ๊ฐํด๋ณด๋ ๊ฒ์ ์ด๋จ๊น์...? |
@@ -55,6 +55,7 @@ captures/
.idea/caches
# Keystore files
+keystore.properties
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks
@@ -100,3 +101,6 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk
+app/src/main/java/kr/co/connect/boostcamp/livewhere/ui/bookmark/
+app/src/main... | Unknown | #82 ์์
์ด ์ด๋ค๊ฑด์ง ํ์คํ ๋ฆฌ๊ฐ ์์ด์ ์ ์ถ๊ฐ๋์๋์ง ๋ชจ๋ฅด๊ฒ ๋๋ฐ
1) ๋ณด์๊ณผ ๊ด๋ จ๋์ด ๊ณต์ ๋์ง ์์์ผ ํ๋ ํ์ผ
2) ๊ฐ์ธ๋ณ ํ๊ฒฝ์ค์ ํ์ผ
3) ์บ์ ํ์ผ
4) ์ฐ๋ ๊ธฐ ํ์ผ
๋ฑ์ ์ฌ์ ๊ฐ ์๋๋ผ๋ฉด .gitignore์ ๋ค์ด๊ฐ๋๊ฒ ๋ถ์ ์ ํด ๋ณด์
๋๋ค.
ํด๋น ํด๋๋ฅผ git์์ ์ ๊ฑฐํ๋ ค๋ค ํธ๋ฒ์ ์ด๊ฒ ์๋๊น ์ถ์ธก์ด ๋๋๋ฐ ์ฌ๋ฐ๋ฅด์ง ๋ชปํ ๋ฐฉ๋ฒ์ธ๊ฑฐ ๊ฐ์์. |
@@ -0,0 +1,68 @@
+# ์์ธ ์ด์ด <img width="85" alt="kakaotalk_20190212_204520833" src="https://user-images.githubusercontent.com/22374750/52834626-1efe2080-3126-11e9-92c3-66ac08c1f2c9.png">
+
+
+data class RecentSearchEntity(
+ @PrimaryKey var text: String,
+ @ColumnInfo(name = "Longitude") var lon... | Kotlin | ๋ค๋ฅธ ํ
์ด๋ธ์ ์ปฌ๋ผ๋ค์ ์๋ฌธ์๋ก ์์ํ๋ snake case๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
ํต์ผ์ด ํ์ํด๋ณด์ฌ์ |
@@ -0,0 +1,13 @@
+package kr.co.connect.boostcamp.livewhere.di
+
+
+val appModules = arrayListOf(
+ apiModule
+ , loginModule
+ , sharedModule
+ , databaseModule
+ , homeModule
+ , mapModule
+ , reverseGeoApiModule
+ , detailModule
+) | Kotlin | ๋ค๋ฅธ ์ฝ๋๋ค๊ณผ ์ ํ ๋ค๋ฅธ code format์ธ๋ฐ ํต์ผ์ด ํ์ํด ๋ณด์
๋๋ค. |
@@ -0,0 +1,24 @@
+package kr.co.connect.boostcamp.livewhere.di
+
+import androidx.room.Room
+import kr.co.connect.boostcamp.livewhere.data.database.AppDataBase
+import org.koin.android.ext.koin.androidContext
+import org.koin.dsl.module.module
+
+const val DATABASE_NAME = "mdatabase.db"
+
+val databaseModule = module {... | Kotlin | ์ด ๋ชจ๋์ ์ ์๋ 3๊ฐ์ง injection๋ค์ named inject๊ฐ ํ์ํ๊ฐ์?
๋ถํ์ํด๋ณด์
๋๋ค. |
@@ -0,0 +1,22 @@
+package codesquad.dto.question;
+
+import lombok.*;
+
+@AllArgsConstructor
+@Getter
+@Setter
+@Builder
+public class QuestionRequestDto {
+ private String writer;
+ private String title;
+ private String contents;
+
+ @Override
+ public String toString() {
+ return "QuestionDto{"... | Java | ๊ธฐ๋ณธ ์์ฑ์๋ฅผ ์์ฑํด์ฃผ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -1,22 +1,36 @@
package codesquad;
-import codesquad.repository.ArrayUserRepository;
+import codesquad.repository.QuestionRepositoryImpl;
+import codesquad.repository.UserRepositoryImpl;
+import codesquad.repository.QuestionRepository;
import codesquad.repository.UserRepository;
+import codesquad.service.Question... | Java | ์ปจํธ๋กค๋ฌ๋ @Controller ์ด๋
ธํ
์ด์
์ ์ด์ฉํด ๋น์ ๋ฑ๋กํ๊ณ ๊ณ์๋๋ฐ, Service์ Repository๋ Config ํ์ผ์์ ๋น์ ๋ฐ๋ก ๋ฑ๋กํด์ฃผ๊ณ ๊ณ์๋ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -7,6 +7,8 @@
public interface UserRepository {
void register(UserEntity userEntity);
+ void update(String userId, UserEntity userEntity);
+
UserEntity findById(String userId);
List<UserEntity> findAll(); | Java | update()๋ dto๋ฅผ ๋๊ฒจ์ฃผ๊ณ ์๋๋ฐ, register()๋ ์ํฐํฐ๋ฅผ ๋๊ฒจ์ฃผ๋ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,30 @@
+package codesquad.service;
+
+import codesquad.entity.QuestionEntity;
+import codesquad.repository.QuestionRepository;
+
+import java.util.List;
+
+public class QuestionServiceImpl implements QuestionService {
+ private final QuestionRepository questionRepository;
+
+ public QuestionServiceImpl(... | Java | ์ํฐํฐ๋ฅผ ์ด์ฉํด ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ์ผ๋ฉด ์ด๋ค ๋ฌธ์ ๊ฐ ์์์ง ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,30 @@
+package codesquad.service;
+
+import codesquad.entity.QuestionEntity;
+import codesquad.repository.QuestionRepository;
+
+import java.util.List;
+
+public class QuestionServiceImpl implements QuestionService {
+ private final QuestionRepository questionRepository;
+
+ public QuestionServiceImpl(... | Java | Entity, Model, Dto, VO์ ์ฐจ์ด์ ๋ํด ์์๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,74 @@
+package codesquad.controller;
+
+import codesquad.AppConfig;
+import codesquad.dto.question.QuestionRequestDto;
+import codesquad.dto.question.QuestionResponseDto;
+import codesquad.entity.QuestionEntity;
+import codesquad.mapper.QuestionMapper;
+import codesquad.service.QuestionService;
+import org.s... | Java | applicationcontext๋ก๋ถํฐ ์ง์ ๋น์ ๊ฐ์ ธ์ค์
์ ์ฌ์ฉํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -1,18 +1,17 @@
package codesquad.controller;
import codesquad.AppConfig;
-import codesquad.dto.UserDto;
+import codesquad.dto.user.UserDto;
+import codesquad.dto.user.UserUpdateRequestDto;
import codesquad.entity.UserEntity;
+import codesquad.mapper.UserMapper;
import codesquad.service.UserService;
import org... | Java | ์
๋ฐ์ดํธ์๋ ๋ณดํต PUT๊ณผ PATCH๊ฐ ์ฌ์ฉ๋ฉ๋๋ค. ์ด ๋์ ์ฐจ์ด๋ ๋ฌด์์ผ๊น์? |
@@ -1,22 +1,36 @@
package codesquad;
-import codesquad.repository.ArrayUserRepository;
+import codesquad.repository.QuestionRepositoryImpl;
+import codesquad.repository.UserRepositoryImpl;
+import codesquad.repository.QuestionRepository;
import codesquad.repository.UserRepository;
+import codesquad.service.Question... | Java | ์ฐ์ ์์กด์ฑ์ ์ฃผ์
ํ์ฌ ์ฝ๋/๊ฐ์ฒด ๊ฐ์ ๊ฒฐํฉ๋๋ฅผ ๋ฎ์ถ๊ธฐ ์ํด Service์ Repository๋ ์๋ฐ ์ฝ๋๋ก ์ง์ ์คํ๋ง ๋น์ ๋ฑ๋กํ์์ต๋๋ค. ์ด๋ ๊ฐ๋ฐ์ ์งํํ๋ค Repository๋ฅผ ๋ณ๊ฒฝํด์ผํ๋ ์ํฉ์ผ ๋, Config์ ๋ฑ๋ก๋ Repository Bean๋ง ์์ ํ๋ฉด ๋๊ธฐ ๋๋ฌธ์
๋๋ค.
๊ทธ๋ผ Controller์ ์ญํ ์ ์๊ฐํด๋ณด๊ฒ ์ต๋๋ค.
์ปจํธ๋กค๋ฌ๋ View์ Service๋ฅผ ์ด์ด์ฃผ๋ ์ญํ ๋ง ํ๊ณ ๋น์ฆ๋์ค ๋ก์ง์ ๊ฐ์ง๊ณ ์์ง ์์ต๋๋ค. ๋ฐ๋ผ์ Repository๊ฐ ๋ณ๊ฒฝ๋๊ฑฐ๋ ๋น์ฆ๋์ค ๋ก์ง์ด ๋ณ๊ฒฝ๋์ด๋ Controller๋ ๋ณ๊ฒฝ๋์ง ์์ผ๋ฏ๋ก Config์์ ... |
@@ -0,0 +1,74 @@
+package codesquad.controller;
+
+import codesquad.AppConfig;
+import codesquad.dto.question.QuestionRequestDto;
+import codesquad.dto.question.QuestionResponseDto;
+import codesquad.entity.QuestionEntity;
+import codesquad.mapper.QuestionMapper;
+import codesquad.service.QuestionService;
+import org.s... | Java | AppConfig์์ @ComponentScan ๊ฐ์ Spring Bean์ ์๋์ผ๋ก ๊ฐ์ ธ์ค๊ธฐ ์ํ ์ด๋
ธํ
์ด์
์ ์ฌ์ฉํ์ง ์์๊ธฐ์ ์ง์ ๋น์ ๊ฐ์ ธ์์ต๋๋ค!
(์ฌ์ค ์ง๋ฌธ ์๋๋ฅผ ์ ๋๋ก ์ดํดํ์ง ๋ชปํ์ต๋๋ค. ๋ถ์ฐ ์ค๋ช
ํด์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค!) |
@@ -1,18 +1,17 @@
package codesquad.controller;
import codesquad.AppConfig;
-import codesquad.dto.UserDto;
+import codesquad.dto.user.UserDto;
+import codesquad.dto.user.UserUpdateRequestDto;
import codesquad.entity.UserEntity;
+import codesquad.mapper.UserMapper;
import codesquad.service.UserService;
import org... | Java | `PUT`์ ์์ ์ ์ฒด๋ฅผ ๊ต์ฒดํ์ฌ, ์์์ ๋ชจ๋ ํ๋๊ฐ ํ์ํ๊ณ
`PATCH`๋ ์์์ ๋ถ๋ถ๋ง ๊ต์ฒดํ์ฌ, ์์์ ์ผ๋ถ ํ๋๋ง ์์ด๋ ๋ฉ๋๋ค.
GOOD
```
PUT /userId/1
{
"userId" : "mywnajsldkf",
"age" : 24
}
GET /userId/1
{
"userId" : "mywnajsldkf",
"age" : 24
}
```
BAD
```
PUT /userId/1
{
"userId" : "mywnajsldkf",
}
GET /... |
@@ -7,6 +7,8 @@
public interface UserRepository {
void register(UserEntity userEntity);
+ void update(String userId, UserEntity userEntity);
+
UserEntity findById(String userId);
List<UserEntity> findAll(); | Java | dto <-> entity ์ฌ์ด์ ๋งตํ์ ์ด๋์ ํด์ผํ ์ง ๊ณ ๋ฏผ์ ํ๋๋ฐ์.
DTO๋ ์ปจํธ๋กค๋ฌ ๋ ์ด์ด์ ์ข
์๋์ด์ผ ํ๋ค๊ณ ์๊ฐํด ๋งตํ์ ๊ด๋ จ๋ ๊ฒ์ ๋ชจ๋ ์ปจํธ๋กค๋ฌ์์ ๋๋ ค๊ณ ํ์์ต๋๋ค.
update()์ ๋ํ ๋ถ๋ถ์ ํผ๋๋ฐฑ์ ๋ณด๊ณ ๋ค์ ๋ณด๋, ์๋ก์ด userEntity๋ฅผ ์์ฑํ๋ register์ ๋ค๋ฅด๊ฒ ๊ธฐ์กด์ ์๋ userEntity๋ฅผ ์์ ํ๋ ๊ฒ์ด๋ค๋ณด๋ ๊ฐ์ updateํ๋ ๋ฐฉํฅ์ ์ง์คํ์ต๋๋ค. ๊ทธ๋ฌ๋ค๋ณด๋ DTO -> Entity๋ ์๋กญ๊ฒ ๊ฐ์ฒด๋ฅผ ๋ง๋ ๋ค๋ ์๊ฐ์ ๊ฑฐ์น์ง ์์๋ค์.๐
๋ค์๋ณด๋ register() ์ฒ๋ผ controller์์ enti... |
@@ -0,0 +1,30 @@
+package codesquad.service;
+
+import codesquad.entity.QuestionEntity;
+import codesquad.repository.QuestionRepository;
+
+import java.util.List;
+
+public class QuestionServiceImpl implements QuestionService {
+ private final QuestionRepository questionRepository;
+
+ public QuestionServiceImpl(... | Java | > ์ํฐํฐ๋ฅผ ์ด์ฉํด ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ์ผ๋ฉด ์ด๋ค ๋ฌธ์ ๊ฐ ์์์ง ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!
๋ค! ํ๋ฒ ๊ณ ๋ฏผํด๋ณด๊ฒ ์ต๋๋ค~ ํน์ ์์ฝ๋์ด ๋ง์ํ์ ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ๋ ๋ถ๋ถ์ view(controller)์ ์ฃผ๊ณ ๋ฐ๋๋ค๋ ๋ง์์ด์ค๊น์? |
@@ -0,0 +1,30 @@
+package codesquad.service;
+
+import codesquad.entity.QuestionEntity;
+import codesquad.repository.QuestionRepository;
+
+import java.util.List;
+
+public class QuestionServiceImpl implements QuestionService {
+ private final QuestionRepository questionRepository;
+
+ public QuestionServiceImpl(... | Java | > Entity, Model, Dto, VO์ ์ฐจ์ด์ ๋ํด ์์๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์
์กฐ์ธ ๊ฐ์ฌํฉ๋๋ค~
๊ณต๋ถํ๋ฉด์ ๊ถ๊ธํ ์ ์ด ์์ต๋๋ค.
์์ง VO๋ฅผ ์ฌ์ฉํ๋ ์ด์ ๊ฐ ์๋ฟ์ง ์๋๋ฐ์~
DTO์ฒ๋ผ ๋ฐ์ดํฐ๋ฅผ ์ ์กํ๋ ์ํฉ์๋ง ์ด๋ค๋ ๊ฒ์ด ์๋,
VO์ ์ ์ฝ์ฌํญ(๋ถ๋ณ์ฑ, ๋๋ฑ์ฑ, ์๊ฐ ์ ํจ์ฑ)์ด ์๊ธฐ์
๊ฐ์ฒด ์์ฑ ์ VO ๊ทธ ์์ฒด๊ฐ ์ ์ฝ์ฌํญ์ด ๋๊ฑฐ๋ ์ธ์คํด์ค๊ฐ ์ ํด์ ธ ์๋ ๊ฒฝ์ฐ ๋ฏธ๋ฆฌ ์ธ์คํด์ค๋ฅผ ์์ฑํ๋ ๋ฑ
VO์ ํน์ง์ผ๋ก ์ป์ ์ ์๋ ์ด์ ์ด ์๊ธฐ์ ์ฌ์ฉํ๋ค๊ณ ์ดํดํด๋ ๋ ๊น์?
์๋๋ถํฐ๋ ์ ๋ฆฌํ ๋ด์ฉ์
๋๋ค.
# Entity
- D... |
@@ -1,22 +1,36 @@
package codesquad;
-import codesquad.repository.ArrayUserRepository;
+import codesquad.repository.QuestionRepositoryImpl;
+import codesquad.repository.UserRepositoryImpl;
+import codesquad.repository.QuestionRepository;
import codesquad.repository.UserRepository;
+import codesquad.service.Question... | Java | ์์กด์ฑ ์ฃผ์
์ ์คํ๋ง์ด ์์์ ํด์ฃผ๋ ๋ถ๋ถ์
๋๋ค ~
์คํ๋ง ๋ถํธ์ DI ๋ฐฉ์์ ๋ํด ์์๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,74 @@
+package codesquad.controller;
+
+import codesquad.AppConfig;
+import codesquad.dto.question.QuestionRequestDto;
+import codesquad.dto.question.QuestionResponseDto;
+import codesquad.entity.QuestionEntity;
+import codesquad.mapper.QuestionMapper;
+import codesquad.service.QuestionService;
+import org.s... | Java | ์คํ๋ง๋ถํธ์์ ์์ฑ์ ์ฃผ์
์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํด ๊ฒ์ํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,45 @@
+package codesquad.mapper;
+
+import codesquad.dto.question.QuestionRequestDto;
+import codesquad.dto.question.QuestionResponseDto;
+import codesquad.entity.QuestionEntity;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+public class QuestionMapper {
+
+ public stat... | Java | ๋ณ์๋ private ์ผ๋ก ์ ์ธํ๊ณ setter ๋ฅผ ์ฌ์ฉํด์ ์ ๊ทผํ๋๊ฒ ์๋ฐ์ ์ผ๋ฐ์ ์ธ ์์น์
๋๋ค ~ |
@@ -0,0 +1,24 @@
+package codesquad.entity;
+
+import lombok.*;
+
+@Setter
+@Getter
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class QuestionEntity extends BaseTimeEntity {
+
+ private String writer;
+ private String title;
+ private String contents;
+
+ @Override
+ public String toString... | Java | Entity ๋ผ๋ postfix ๋ฅผ ๋ถ์ด์ง ์์๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค ~ |
@@ -1,22 +1,36 @@
package codesquad;
-import codesquad.repository.ArrayUserRepository;
+import codesquad.repository.QuestionRepositoryImpl;
+import codesquad.repository.UserRepositoryImpl;
+import codesquad.repository.QuestionRepository;
import codesquad.repository.UserRepository;
+import codesquad.service.Question... | Java | ์ ์ด์ ์ญ์ (IoC)๊ฐ ๋ฌด์์ธ์ง๋ ํ ๋ฒ ์์๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,30 @@
+package codesquad.service;
+
+import codesquad.entity.QuestionEntity;
+import codesquad.repository.QuestionRepository;
+
+import java.util.List;
+
+public class QuestionServiceImpl implements QuestionService {
+ private final QuestionRepository questionRepository;
+
+ public QuestionServiceImpl(... | Java | > > ์ํฐํฐ๋ฅผ ์ด์ฉํด ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ์ผ๋ฉด ์ด๋ค ๋ฌธ์ ๊ฐ ์์์ง ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!
>
> ๋ค! ํ๋ฒ ๊ณ ๋ฏผํด๋ณด๊ฒ ์ต๋๋ค~ ํน์ ์์ฝ๋์ด ๋ง์ํ์ ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ๋ ๋ถ๋ถ์ view(controller)์ ์ฃผ๊ณ ๋ฐ๋๋ค๋ ๋ง์์ด์ค๊น์?
์ปจํธ๋กค๋ฌ ๋ฟ ์๋๋ผ ๋ ์ด์ด๋ ์ํคํ
์ณ์์ ๊ฐ ๊ณ์ธต๊ฐ์ ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค! |
@@ -7,6 +7,8 @@
public interface UserRepository {
void register(UserEntity userEntity);
+ void update(String userId, UserEntity userEntity);
+
UserEntity findById(String userId);
List<UserEntity> findAll(); | Java | > dto <-> entity ์ฌ์ด์ ๋งตํ์ ์ด๋์ ํด์ผํ ์ง ๊ณ ๋ฏผ์ ํ๋๋ฐ์. DTO๋ ์ปจํธ๋กค๋ฌ ๋ ์ด์ด์ ์ข
์๋์ด์ผ ํ๋ค๊ณ ์๊ฐํด ๋งตํ์ ๊ด๋ จ๋ ๊ฒ์ ๋ชจ๋ ์ปจํธ๋กค๋ฌ์์ ๋๋ ค๊ณ ํ์์ต๋๋ค.
>
> update()์ ๋ํ ๋ถ๋ถ์ ํผ๋๋ฐฑ์ ๋ณด๊ณ ๋ค์ ๋ณด๋, ์๋ก์ด userEntity๋ฅผ ์์ฑํ๋ register์ ๋ค๋ฅด๊ฒ ๊ธฐ์กด์ ์๋ userEntity๋ฅผ ์์ ํ๋ ๊ฒ์ด๋ค๋ณด๋ ๊ฐ์ updateํ๋ ๋ฐฉํฅ์ ์ง์คํ์ต๋๋ค. ๊ทธ๋ฌ๋ค๋ณด๋ DTO -> Entity๋ ์๋กญ๊ฒ ๊ฐ์ฒด๋ฅผ ๋ง๋ ๋ค๋ ์๊ฐ์ ๊ฑฐ์น์ง ์์๋ค์.๐
>
> ๋ค์๋ณด๋ register() ์ฒ๋ผ controller์... |
@@ -7,6 +7,8 @@
public interface UserRepository {
void register(UserEntity userEntity);
+ void update(String userId, UserEntity userEntity);
+
UserEntity findById(String userId);
List<UserEntity> findAll(); | Java | @saint6839
์ ๋ service(application or usecase), domain ์ ์ธ๋ถ์ ๊ฒ์ผ๋ก๋ถํฐ ๋
๋ฆฝ์ ์ด๊ณ ์ต๋ํ ์์ํ ์๋ต์ ๋ณด๋ด์ผ ์ฌ์ฉ์ฑ์ด ์ข์์ง๋ค๊ณ ์๊ฐํฉ๋๋ค.
๋ฐ๋ผ์ service ๋ ์ด์ด์์๋ ์ธ๋ถ ์๊ตฌ์ฌํญ์ ํด๋นํ๋ ๋ฐ์ดํฐ ๊ตฌ์กฐ์ธ dto ๋ณํ์ ์ง์ํ๋๋ก ๊ฐ๋ฐํ๋ ํธ์
๋๋ค. ์ค์ ์๋น์ค์์ ๊ฐ๋ฐํ๋ค๋ณด๋ฉด 1controller - 1service ๊ฐ ์๋๋ผ n๊ฐ์ controller ์ผ์ด์ค์์ ์๋ก ๋ค๋ฅธ ๋ชฉ์ ์ผ๋ก 1service ๋ฅผ ํธ์ถํ๋ ์ผ์ด์ค๋ ์์ผ๋ ๊ฐ์๊ฐ ํ์ํ ๋ฐ์ดํฐ๊ฐ ๋ค๋ฅผ ๊ฒฝ์ฐ, dto ๊ฐ ๊ณตํต์ผ๋ก ์ฌ์ฉ๋์ด์ ๋ฑ๋ฑํด์ง๊ณ ... |
@@ -0,0 +1,30 @@
+package codesquad.service;
+
+import codesquad.entity.QuestionEntity;
+import codesquad.repository.QuestionRepository;
+
+import java.util.List;
+
+public class QuestionServiceImpl implements QuestionService {
+ private final QuestionRepository questionRepository;
+
+ public QuestionServiceImpl(... | Java | ์์ง 1๋จ๊ณ๋ผ์ ์ด๋ฐ ๋ถ๋ถ์ ๋ํ ์ฝ๋ฉํธ๋ ์ข ๋ ์น์ ํ ์ค๋ช
ํด์ฃผ์ด๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,24 @@
+package codesquad.entity;
+
+import lombok.*;
+
+@Setter
+@Getter
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class QuestionEntity extends BaseTimeEntity {
+
+ private String writer;
+ private String title;
+ private String contents;
+
+ @Override
+ public String toString... | Java | @hyukjin-lee class๋ช
๋ง์ํ์ค๊น์?? |
@@ -0,0 +1,74 @@
+package codesquad.controller;
+
+import codesquad.AppConfig;
+import codesquad.dto.question.QuestionRequestDto;
+import codesquad.dto.question.QuestionResponseDto;
+import codesquad.entity.QuestionEntity;
+import codesquad.mapper.QuestionMapper;
+import codesquad.service.QuestionService;
+import org.s... | Java | > applicationcontext๋ก๋ถํฐ ์ง์ ๋น์ ๊ฐ์ ธ์ค์
์ ์ฌ์ฉํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค!
questionService๋ ๋ค์๊ณผ ๊ฐ์ด ์์ฑ์๋ฅผ ํตํด ์ฃผ์
๋์์ต๋๋ค.
**AppConfig**
```java
@Bean
public QuestionService questionService() {
return new QuestionServiceImpl(questionRepository());
}
@Bean
public QuestionRepository questionRepository() {
return new Questio... |
@@ -0,0 +1,45 @@
+package codesquad.mapper;
+
+import codesquad.dto.question.QuestionRequestDto;
+import codesquad.dto.question.QuestionResponseDto;
+import codesquad.entity.QuestionEntity;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+public class QuestionMapper {
+
+ public stat... | Java | @hyukjin-lee ๋ต!!! ๊ธฐ์ตํ๊ฒ ์ต๋๋ค. ์ด๋ฒ์๋ ๋ณ๊ฒฝ ๊ฐ๋ฅ์ฑ์ ์ด์ด๋๋ setter ์ฌ์ฉ์ ์ง์ํ๊ณ , ํ์ํ ๋ฐ์ดํฐ๋ง ์ค์ ํ๊ณ ์ถ์ด Builder ํจํด์ ์ฌ์ฉํด๋ณด์์ต๋๋ค~ |
@@ -1,158 +1,89 @@
package codesquad.qua;
-import codesquad.answer.Answer;
-import codesquad.answer.AnswerRepository;
-import codesquad.user.User;
-import codesquad.utils.SessionUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
+import co... | Java | Question์ ๋ํ Exception์ customizing ํ ์ด์ ์
๋๋ค
QuestionEditException์ ํด๋น ์ง๋ฌธ์๊ฐ ์๋๊ธฐ ๋๋ฌธ์ ์ญ์ ํ ์ ์๋ ๊ฒฝ์ฐ,
QuestionDeleteException์ ๋ค๋ฅธ User์ ๋ต๊ธ์ด ์กด์ฌํ์ฌ ์ญ์ ํ ์ ์๋ ๊ฒฝ์ฐ์
๋๋ค
์ฒ์์๋ boolean์ผ๋ก ์ฒ๋ฆฌํ๋ ค๋ค๊ฐ ๋ ๊ฐ์ง ๊ฒฝ์ฐ๊ฐ ์๊ฒ ๋์ด(=๋ ๊ฐ์ง view)
exception์ ๋ง๋ค์์ต๋๋ค |
@@ -1,10 +1,15 @@
package codesquad.user;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
import javax.persistence.*;
import java.util.Objects;
@Entity
+@NoArgsConstructor
+@Getter
public class User {
@Id
@@ -20,43 +25,14 @@ public class User {
private String email;
- public Str... | Java | ์ ๋ฒ์ ๋ง์ํด์ฃผ์ equals์ ๋ํ ๋ฆฌ๋ทฐ ์๊ฐํด๋ดค์ต๋๋ค
๋ง์๋๋ก ๊ด๊ณํ DB์์๋ "์๋ณ์(id)" ๊ฐ ๊ณ ์ ํ ๊ฐ์ผ๋ก, ํด๋น ์๋ณ์๊ฐ ๋์ผํ๋ค๋ฉด ๊ฐ์ ๋ฐ์ดํฐ๋ผ๊ณ ์ธ์ํ๋๋ฐ equals๋ฅผ overridingํ๋ค๋ฉด ๋ชจ๋ ํ๋์ ๊ฐ์ด ๋์ผํด์ผ ๊ฐ์ ๊ฐ์ฒด๋ผ๊ณ ํ๋จํฉ๋๋ค
equals๋ฅผ ๊ตณ์ด overridingํ ํ์์๋ ์ํฉ์์ overriding์ ํ๋ค๋ฉด HashSet์ด๋ HashMap์ ์ํฅ์ ์ฃผ์ด ์์์น ๋ชปํ ์ํฉ์ด ๋ฐ์ํ ์๋ ์์ต๋๋ค
๋ฐ๋ผ์ User๋ฅผ ์๋ณํ๊ธฐ ์ํด์๋ "id"๋ก ์ถฉ๋ถํ๊ธฐ ๋๋ฌธ์ equals๋ฅผ overridingํ์ง ์์๋๋๋ค ๋ผ๋ ... |
@@ -0,0 +1,126 @@
+package codesquad.qua;
+
+import codesquad.answer.Answer;
+import codesquad.exception.QuestionDeleteException;
+import codesquad.exception.QuestionEditException;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j... | Java | canDeleteQuestion์ ์ง๋ฌธ์ ์ญ์ ํ ์ ์๋์ง ํ๋จํ๋ ๋ฉ์๋์
๋๋ค
- ๋ต๊ธ์ด ์์ ๊ฒฝ์ฐ ์ญ์ ๊ฐ๋ฅ
- ๋ต๊ธ์ด ์์ผ๋ ์์ฑ์ ๋ชจ๋ ์ง๋ฌธ ์์ฑ์์ ๊ฐ์ ๊ฒฝ์ฐ ์ญ์ ๊ฐ๋ฅ
ํด๋น ๋ฉ์๋๋ Question์ด ์ญ์ ๋ ์ ์์ด?๋ผ๊ณ ๋ฌป๊ณ , Question์ด ์ญ์ ๋ ์ ์์ด/์์ด๋ฅผ ํ๋จํฉ๋๋ค
๊ทธ๋์ ์ ๋ ์ด ๋ถ๋ถ์ด Question์๊ฒ ๋ฌผ์ด๋ณด๊ณ Question์ด ๊ฒฐ์ ํ๋ ๊ฒ์ด๋ผ๋ ์๊ฐ์ด ๋ค์ด Question ํด๋์ค์ ์์ด์ผํ ๊น๋ผ๋ ์๊ฐ์ ํ์ต๋๋ค.
ํ์ง๋ง ์ด ๋
ผ๋ฆฌ๋ผ๋ฉด ์๋ isQuestionMatchUser(์ง๋ฌธ ์์ฑ์์ ๋ก๊ทธ์ธ ๋ User๊ฐ ๊ฐ์์ง ํ๋จ... |
@@ -0,0 +1,62 @@
+package codesquad.answer;
+
+import codesquad.qua.Question;
+import codesquad.qua.QuestionRepository;
+import codesquad.response.Result;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframew... | Java | Answer์ ๋น์ฆ๋์ค ๋ก์ง์ ๋ด๋นํ๋ AnswerService์์ Question๊ด๋ จ ๋ฐ์ดํฐ๊ฐ ํ์ํ ๋ QuestionRepository๋ฅผ ์ง์ ์ฐธ์กฐํ๋ ๋ฐฉ๋ฒ๋ ์์ง๋ง, QuestionService๋ฅผ ํตํด ์ฐธ์กฐํ๋๋ก ํ ์๋ ์์ ๊ฑฐ ๊ฐ์๋ฐ ์ด๋ค ์ฐจ์ด๊ฐ ์์๊น์? |
@@ -0,0 +1,62 @@
+package codesquad.answer;
+
+import codesquad.qua.Question;
+import codesquad.qua.QuestionRepository;
+import codesquad.response.Result;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframew... | Java | Answer๋ฅผ db์์ ์กฐํํ๋ ๋ก์ง ๋ค์ ์ธ์
์ ์ ์ฒดํฌ๊ฐ ์ด๋ค์ง๊ณ ์์ต๋๋ค. ๊ฐ์ ํ ์ ์ด ์์ด๋ณด์ด๋๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,27 @@
+package codesquad.answer;
+
+import codesquad.response.Result;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpSession;
+
+@RestController
+@RequiredArgsConstructor
+@Slf4j
+public class ApiA... | Java | ์ด ์์ฒญ์ ์๋ต ์ํ์ฝ๋๋ ์ด๋ป๊ฒ ๋๊ฐ๊น์? |
@@ -0,0 +1,126 @@
+package codesquad.qua;
+
+import codesquad.answer.Answer;
+import codesquad.exception.QuestionDeleteException;
+import codesquad.exception.QuestionEditException;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j... | Java | 1. Service๊ฐ์ฒด๊ฐ HttpSession๋ฅผ ์์์ผํ ํ์๊ฐ ์์๊น์?
2. ํ์ฌ ์์ฒญ์ ๋ํ ์ธ์
์ ๋ณด๊ฐ ์กด์ฌํ๋์ง ํ๋จํ๋ ๋ฉ์๋๋ก ๋ณด์ด๋๋ฐ, ํ์ฌ ๋ฉ์๋๋ช
์ด ์ค์ ์ญํ ์ ์ถฉ๋ถํ ์ค๋ช
ํ์ง ๋ชปํ๋ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,126 @@
+package codesquad.qua;
+
+import codesquad.answer.Answer;
+import codesquad.exception.QuestionDeleteException;
+import codesquad.exception.QuestionEditException;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j... | Java | ์ธ์
์ ์ ์ ์ ๋ณด๊ฐ ํฌํจ๋์ผ๋งํ๋ ๋ชจ๋ ๋ฉ์๋์์ ํด๋น ๋ก์ง์ด ์์ฑ๋๊ณ ์๋๋ฐ ์ด๋ป๊ฒ ํ๋ฉด ์ค๋ณต์ ์ค์ผ ์ ์์๊น์? |
@@ -0,0 +1,126 @@
+package codesquad.qua;
+
+import codesquad.answer.Answer;
+import codesquad.exception.QuestionDeleteException;
+import codesquad.exception.QuestionEditException;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j... | Java | ๋ฉ์๋๋ช
์ ๋ณด๊ณ Question์ ๋ํ ๋น์ฆ๋์ค๋ก์ง์ ์ํํ๋ ๊ฐ์ฒด์์ Form๊น์ง ๊ด์ฌํ๋ ๊ฑด๊ฐ๋ผ๋ ์๊ฐ์ด ๋ค์์ต๋๋ค. |
@@ -0,0 +1,126 @@
+package codesquad.qua;
+
+import codesquad.answer.Answer;
+import codesquad.exception.QuestionDeleteException;
+import codesquad.exception.QuestionEditException;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j... | Java | ์ ๋ ์ฝ๋ ์ฌ์ฌ์ฉ์ฑ ์ธก๋ฉด์์ ์๊ฐํด๋ดค์ ๋ ์ด ๋ก์ง์ด ํด๋น Service์์๋ง ์ฌ์ฉ๋๋ ๊ฑฐ๋ผ๋ฉด Question์ด ๋ฌด๊ฑฐ์์ง๋ ๊ฒ์ ๊ณ ๋ คํด์ Service์์ ๋ด๋นํ๋๋ก ๊ตฌํํ ๊ฒ ๊ฐ์ต๋๋ค. ๋ฐ๋ฉด ์ด Service๋ฅผ ๋ฒ์ด๋ ์์ญ์์๋ ์ฌ์ฉ๋๋ ๋ก์ง์ด๋ผ๋ฉด Question์์ ๋ด๋นํ๋ ๊ฒ์ด ์ค๋ณต์ ์ค์ด๋ ๋ฐฉ๋ฒ์ด์ง ์์๊น ์๊ฐํฉ๋๋ค! |
@@ -0,0 +1,62 @@
+package codesquad.answer;
+
+import codesquad.qua.Question;
+import codesquad.qua.QuestionRepository;
+import codesquad.response.Result;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframew... | Java | ResponseAnswerDto๋ฅผ Result๋ก ํ๋ฒ ๋ ๊ฐ์ธ๋ ๋ฐฉ์์ผ๋ก ๊ตฌํํ์
จ๋๋ฐ ์ด๋ค ์ด์ ๊ฐ ์์๊น์? |
@@ -1,158 +1,89 @@
package codesquad.qua;
-import codesquad.answer.Answer;
-import codesquad.answer.AnswerRepository;
-import codesquad.user.User;
-import codesquad.utils.SessionUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
+import co... | Java | ์ด๋ฏธ ๋ณด์
จ์ ์๋ ์์ง๋ง ํ๋ฒ ์ฝ์ด๋ณด์๋ฉด ์ข์ ๊ฑฐ ๊ฐ์ ๊ณต์ ๋๋ฆฝ๋๋ค!
https://tecoble.techcourse.co.kr/post/2020-08-17-custom-exception/ |
@@ -1,158 +1,89 @@
package codesquad.qua;
-import codesquad.answer.Answer;
-import codesquad.answer.AnswerRepository;
-import codesquad.user.User;
-import codesquad.utils.SessionUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
+import co... | Java | ์ค ๋ง์ต๋๋ค ์ ๋ ์ฌ์ฉ์ ์ ์ ์์ธ๋ฅผ ์ฌ์ฉํ๊ธฐ ์ ์ ์ฌ๋ ค์ฃผ์ ๋งํฌ๋ฅผ ๋ดค์ต๋๋ค.
๋งํฌ์ ๋ํด์ ๋ณด๋ฉด ๊ตณ์ด ๋๋ ํ์ ์์ด, IllegalArgumentException, IllegalstateException์ ๋ฐ๋ผ ๋ค๋ฅธ ๋ทฐ๋ฅผ ๋ณด์ฌ์ค ์ ์์ง๋ง, ์ด๋๋ ๋ช
์์ ์ผ๋ก ๋ณด์ฌ์ฃผ๋๊ฒ ๋ซ์ง ์์๊น ๋ผ๋ ์๊ฐ์ ํ์ต๋๋ค |
@@ -0,0 +1,126 @@
+package codesquad.qua;
+
+import codesquad.answer.Answer;
+import codesquad.exception.QuestionDeleteException;
+import codesquad.exception.QuestionEditException;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j... | Java | updateํ๊ธฐ ์ํด์๋ ์กฐ๊ฑด์ด ํ์ํ๋ฐ ์ด ์กฐ๊ฑด์ ๊ฒ์ฆํ๋ ๊ฒ๋ Question์ ๋ํ ๋น์ฆ๋์ค๋ก์ง์ด๋ผ๊ณ ์๊ฐํด์ ์์ฑํ์ต๋๋ค.
ํน์ ๋ฉ์๋๋ช
์ ์์ ํ๋๊ฒ ์ข์๋ณด์ผ ๊ฒ ๊ฐ์ ๋ง์์ด์ค๊น์~~?? |
@@ -0,0 +1,62 @@
+package codesquad.answer;
+
+import codesquad.qua.Question;
+import codesquad.qua.QuestionRepository;
+import codesquad.response.Result;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframew... | Java | ์ค,, ์ด ๋ถ๋ถ์ DB ์ ๊ทผ์ ๋ฌด๊ฑฐ์ด ์์
์ด๊ธฐ ๋๋ฌธ์ ์ธ์
์ ์ฒดํฌํ๊ณ ๋์ DB ์ ๊ทผํ๋ ๊ฒ์ด ์ข์๋ณด์
๋๋ค
๊ฐ์ฌํฉ๋๋ค! |
@@ -0,0 +1,62 @@
+package codesquad.answer;
+
+import codesquad.qua.Question;
+import codesquad.qua.QuestionRepository;
+import codesquad.response.Result;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframew... | Java | ์ด ๋ถ๋ถ๋ง ๊ทธ๋ฐ๊ฒ ์๋๋ผ ๋ค๋ฅธ ๊ณณ๋ ๊ทธ๋ ๊ฒ ์์ฑ๋์ด์๋ค์!! |
@@ -0,0 +1,62 @@
+package codesquad.answer;
+
+import codesquad.qua.Question;
+import codesquad.qua.QuestionRepository;
+import codesquad.response.Result;
+import codesquad.user.User;
+import codesquad.utils.SessionUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframew... | Java | ๋ฏธ์
๋ช
์ธ์์ Result๋ฅผ ๋ฐํํ๋ผ๊ณ ํด์ ์ด๋ ๊ฒ ์์ฑํ์ต๋๋ค! |
@@ -0,0 +1,27 @@
+package codesquad.answer;
+
+import codesquad.response.Result;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpSession;
+
+@RestController
+@RequiredArgsConstructor
+@Slf4j
+public class ApiA... | Java | create๋ฉ์๋๋ ์ฑ๊ณต, ์คํจ ์ฌ๋ถ์์ด Result ๋ฅผ ๋ฐํํ๊ธฐ ๋๋ฌธ์ 200 OK๊ฐ ๋๊ฐ ๊ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค! |
@@ -0,0 +1,13 @@
+export class NetworkError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = "NetworkError";
+ }
+}
+
+export class HttpError extends Error {
+ constructor(message) {
+ super(message);
+ this.name = "HttpError";
+ }
+} | JavaScript | ์ฌ์ฉ๋์ง ์๋ ์ฝ๋๊ฐ ๋จ์์๋ค์, ํน์ ์ด๋ค ์๋๋ก ๋ง๋์
จ์๊น์?! |
@@ -0,0 +1,39 @@
+function formatUrl(config) {
+ const { href, query } = config;
+ const searchParams = new URLSearchParams(query);
+
+ return `${href}?${searchParams.toString()}`;
+}
+
+function formatHeaders(headersRecord) {
+ const headers = new Headers();
+
+ headers.append("content-type", "application/json");... | JavaScript | [MDN Error() ์์ฑ์](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Error/Error) ๋ฌธ์ ์ฒจ๋ถ๋๋ฆฝ๋๋ค!
error ๊ฐ์ฒด๋ ์ฒซ๋ฒ์งธ ์ธ์๋ก `message`๋ฅผ ๋ฐ์ผ๋ฉฐ, ๋๋ฒ์งธ ์ธ๋ฒ์งธ ์ธ์๊ฐ ์๊ธดํ์ง๋ง, ๋นํ์ค์
๋๋ค!
์ค์ ๋ก ์๋ฌ๋ฅผ ์ผ์ผ์ผ๋ณด๋ฉด alert์์ `Http error: ` , `Network error: `
ํด๋น ๋ฌธ์์ด๋ง ๋
ธ์ถ๋๋ ๊ฑธ ํ์ธํ์ค ์ ์์๊ฑฐ์์! |
@@ -0,0 +1,39 @@
+function formatUrl(config) {
+ const { href, query } = config;
+ const searchParams = new URLSearchParams(query);
+
+ return `${href}?${searchParams.toString()}`;
+}
+
+function formatHeaders(headersRecord) {
+ const headers = new Headers();
+
+ headers.append("content-type", "application/json");... | JavaScript | ์ด ํ์ผ์ ๋ํ ์ ๋ฐ์ ์ธ ๋๋์ `formatUrl`, `formatHeaders` ํจ์์ ํ์์ฑ์ ๋ชจ๋ฅด๊ฒ ๋ค.. ์ด๊ธด ํฉ๋๋ค!
`createAPIRequest` ์ฒ๋ผ ์ ์ฒด์ ์ธ ์์ฒญ์ ๋ํ ๊ณตํต ํจ์๋ ์์ผ๋ฉด ๋น์ฐํ ์ข๋ค!
์ด๊ธดํ๋ฐ ํํ์ ๋ํด์๋ ์กฐ๊ธ ์์ฌ์ด ๋ถ๋ถ์ด ์๋ค๊ณ ๋๊ปด์ง๋๋ค!
์ฝ๋ฉํธ๋ก ํ๋ ํ๋ ์์ฑํด๋ณผ๊ฒ์! |
@@ -0,0 +1,39 @@
+function formatUrl(config) {
+ const { href, query } = config;
+ const searchParams = new URLSearchParams(query);
+
+ return `${href}?${searchParams.toString()}`;
+}
+
+function formatHeaders(headersRecord) {
+ const headers = new Headers();
+
+ headers.append("content-type", "application/json");... | JavaScript | `headers.append("content-type", "application/json")`;
์ฌ์ค์ ์ญํ ์ ๋ชจ๋ ์์ฒญ์ ํด๋น ํค๋๋ฅผ ๋ํด์ฃผ๋ ์ญํ ๋ฐ์ ์๋๋ฐ
`createAPIRequest`์ headers์์ ํด์ฃผ๋ฉด ๋์ง ์์๊น ์ถ๋ค์!
```js
headers: {
...request.headers
'content-type': "application/json"
}
``` |
@@ -0,0 +1,39 @@
+function formatUrl(config) {
+ const { href, query } = config;
+ const searchParams = new URLSearchParams(query);
+
+ return `${href}?${searchParams.toString()}`;
+}
+
+function formatHeaders(headersRecord) {
+ const headers = new Headers();
+
+ headers.append("content-type", "application/json");... | JavaScript | ๊ฐ์ฅ ๋จผ์ searchParams์ ์ฌ๋ถ์ ๊ด๊ณ ์์ด URL์ `?`๊ฐ ๋ถ์ต๋๋ค!
๊ทธ๋ฆฌ๊ณ `createAPIRequest`๋ณด๋ค ์ค์ ์์ฒญํ๋ ๊ณณ์์ ์ฌ์ฉํ๋ ๊ฒ์ด ์ด๋จ๊น ์ถ๊ธดํฉ๋๋ค!
์ด๋ค ์๋ฏธ๋๋ฉด์!
fetch API๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๋๋ฌ๋ด๊ณ , ์ฌ์ฉ์ฒ์์ ์ด๋ฅผ ์์๋ณผ ์ ์์ผ๋ฉด ๋ ์ข๊ฒ ๋ค๋ ์๊ฐ์
๋๋ค.
`fetchPopularMovies`๋ fetch API์ ์ง์ ์ฌ์ฉํ ์ ์๋ ํํ์ `createAPIRequest`์ ์๋ง์ ์ธ์๋ฅผ ๋๊ฒจ์ค๋๋ค.
`createAPIRequest`๋ ์ด ์ธ์๋ฅผ ๊ฐ๊ณตํด์ fetch API์ ์ฌ์ฉํ ์ ์๋ ํํ๋ก ๋ณ๊ฒฝ์... |
@@ -0,0 +1,39 @@
+function formatUrl(config) {
+ const { href, query } = config;
+ const searchParams = new URLSearchParams(query);
+
+ return `${href}?${searchParams.toString()}`;
+}
+
+function formatHeaders(headersRecord) {
+ const headers = new Headers();
+
+ headers.append("content-type", "application/json");... | JavaScript | ์ฝ๋ฉํธ๊ฐ ๋ง์ด ๊ธธ์ด์ก๋ค์.. ใ
ใ
ใ
ใ
์์ฝํ์๋ฉด, ์ธํฐํ์ด์ค๋ฅผ ๋๋ฃ๊ฐ ๋ฐ๋ก ๋ฏ์ด๋ณด์ง ์์๋ ๋ฐ๋ก ์ดํดํ ์ ์๋ ํํ๋ก ์์ฑํ์..! ์
๋๋ค |
@@ -0,0 +1,39 @@
+function formatUrl(config) {
+ const { href, query } = config;
+ const searchParams = new URLSearchParams(query);
+
+ return `${href}?${searchParams.toString()}`;
+}
+
+function formatHeaders(headersRecord) {
+ const headers = new Headers();
+
+ headers.append("content-type", "application/json");... | JavaScript | `data` ๋ณ์๋ฅผ ์์ฑํ ํ์ํ ์์ด ๋ฐ๋ก ๊ฒฐ๊ณผ๊ฐ์ ๋ฐํํ๋ฉด ๋ ๊ฒ ๊ฐ๋ค์~ |
@@ -0,0 +1,37 @@
+import "./components/layout/app-header.js";
+import "./components/movie/movie-card.js";
+import "./components/movie/movie-list.js";
+import "./components/movie/movie-container.js";
+
+import { html } from "./utils/template.js";
+
+class App extends HTMLElement {
+ constructor() {
+ super();
+ t... | JavaScript | ์ ๊ฑฐ ํด๋ ๊ด์ฐฎ์ ์คํ์ผ ๊ฐ์๋ฐ ์ด๋ค ์๋ฏธ๊ฐ ์์๊น์? |
@@ -0,0 +1,2 @@
+export const html = String.raw;
+export const css = String.raw; | JavaScript | ๋ง์ฐฌ๊ฐ์ง๋ก ์ฌ์ฉ๋์ง ์๊ณ ์๋ค์! |
@@ -0,0 +1,58 @@
+import endedPopularMovies from "../fixtures/ended-popular-movies.json";
+
+describe("์ํ ๋ชฉ๋ก", () => {
+ beforeEach(() => {
+ const url = "http://localhost:8080";
+ cy.visit(url);
+
+ cy.get("movie-app")
+ .as("movieApp")
+ .shadow()
+ .find("movie-container")
+ .as("movieC... | JavaScript | ํ
์คํธ๊ฐ ๋ชจ๋ ํดํผ์ผ์ด์ค๋ฅผ ๊ฐ์ ํ๊ณ ์์ฑ๋ ๊ฒ ๊ฐ์์!
๋คํธ์ํฌ ์๋ฌ๋ HTTP ์๋ฌ์ ๊ดํ ์ํฉ์ ์ ์ ํ๊ฒ ์์ฑ๋ ์ฝ๋๋๋ก ๋์ํ๋์ง๋ ํ์ธํ๋ฉด ์ข์ ๊ฒ ๊ฐ๋ค์! |
@@ -0,0 +1,143 @@
+import StarFilled from "../../../images/star_filled.png";
+import { html } from "../../utils/template.js";
+
+const BASE_URL = "https://image.tmdb.org/t/p/w220_and_h330_face";
+
+class MovieCard extends HTMLElement {
+ static get observedAttributes() {
+ return ["posterPath", "title", "voteAverag... | JavaScript | `a` ํ๊ทธ ๋ฐ `href="#'`๋ฅผ ์ฌ์ฉํ์ ์ด์ ๊ฐ ์๋์? |
@@ -3,7 +3,10 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
- <title>React App</title>
+ <meta name="description" content="Web site created using create-react-app"/>
+ <link href="https://fonts.googleapis.com/css2?family=Lobster&display=s... | Unknown | description์ ์์ด๋ ๋์ง ์์๊น์? ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค ใ
ใ
|
@@ -0,0 +1,50 @@
+import React from 'react';
+import { withRouter } from 'react-router-dom';
+import './Login.scss';
+
+
+class LoginJaeyoung extends React.Component {
+ constructor () {
+ super();
+ this.state = {
+ id: '',
+ pw : '',
+ };
+ }
+
+ handleInput = (e) ... | JavaScript | https://www.notion.so/wecode/React-Refactoring-Check-List-aea297cf88ed4601b769e4b2c2cfd4e1#089493d6bfca438aa328226e327cff92
์ด ๋ถ๋ถ์ ์ฐธ๊ณ ํ๋ฉด ํ๋์ ๋ฉ์๋๋กค ๋ฌถ์ ์ ์์ต๋๋ค. |
@@ -0,0 +1,85 @@
+* {
+ box-sizing: border-box;
+}
+
+.loginContainer {
+ border: 2px solid #e6e6e6;
+ width: 350px;
+ height: 380px;
+ margin: 0 auto;
+ .logoName {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+ h1 {
+ font-family: "Lobster",... | Unknown | ์ด ๋ถ๋ถ์ common.css์ ์์ผ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,85 @@
+* {
+ box-sizing: border-box;
+}
+
+.loginContainer {
+ border: 2px solid #e6e6e6;
+ width: 350px;
+ height: 380px;
+ margin: 0 auto;
+ .logoName {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: 100%;
+ h1 {
+ font-family: "Lobster",... | Unknown | font-family๊ฐ์ ์์ฑ์ width๋ margin์๋์ ์์ผ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,190 @@
+import React from 'react';
+import FeedComponent from './FeedComponent/FeedComponent';
+import './Main.scss';
+import explore from '../../../images/jaeyoungLee/Main/explore.jpg';
+import heart from '../../../images/jaeyoungLee/Main/heart.jpg';
+import profile from '../../../images/jaeyoungLee/Main/pr... | JavaScript | ๋ณ์๋ช
์ด ๋ช
์์ ์ด์ฌ์ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.! |
@@ -0,0 +1,190 @@
+import React from 'react';
+import FeedComponent from './FeedComponent/FeedComponent';
+import './Main.scss';
+import explore from '../../../images/jaeyoungLee/Main/explore.jpg';
+import heart from '../../../images/jaeyoungLee/Main/heart.jpg';
+import profile from '../../../images/jaeyoungLee/Main/pr... | JavaScript | ```suggestion
inputKeyPress= (e) => {
```
๊ฐ์ ์ด๋ฆ์ ์ด๋จ๊น์? ๋ฉ์๋๊ฐ ๋ง์์ง๋ฉด ํท๊ฐ๋ฆด ์ ์์ ๊ฑฐ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,412 @@
+* {
+ margin: 0;
+ padding: 0;
+}
+nav {
+ position: fixed;
+ width: 100%;
+ top: 0px;
+ left: 0px;
+ right: 0px;
+ background-color: #fff;
+ border-bottom: 1px solid #dbdbdb;
+ .navcontents {
+ width: 935px;
+ height: 54px;
+ background-color: #fff;
+ margin: 0 auto;
+ ... | Unknown | ```suggestion
.nav_center {
```
๊ฐ์ด ๋์ด์ฐ๊ธฐ๋ฅผ '-'๋ '_'๋ก ํ์ํด์ฃผ๋ฉด ์์ฑ์ฝ๊ธฐ๊ฐ ๋ ์์ํด ์ง ๊ฑฐ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,412 @@
+* {
+ margin: 0;
+ padding: 0;
+}
+nav {
+ position: fixed;
+ width: 100%;
+ top: 0px;
+ left: 0px;
+ right: 0px;
+ background-color: #fff;
+ border-bottom: 1px solid #dbdbdb;
+ .navcontents {
+ width: 935px;
+ height: 54px;
+ background-color: #fff;
+ margin: 0 auto;
+ ... | Unknown | scss์ nesting์ ๊ต์ฅํ ์ ์ ์ฉํ์ ๊ฒ ๊ฐ์์
์ด๋ฌ๋ฉด ๋์ค์ component๋จ์๋ก ๋๋ ๋ ๋ ํธํ ๊ฒ ๊ฐ์ต๋๋ค! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.