code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -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 | ์ ๋ ์ฌ์ค ๋ชจ๋ ๋ฐ์ดํฐ๋ฅผ ๋ค ๋ณด์ง ์์์ง๋ง, ๋ช๋ช ๋ฐ์ดํฐ๋ ์ ํ์ ์ผ๋ก ๋ค์ด์ค๋ ๊ฒ ๊ฐ๋๋ผ๊ตฌ์..!! ๊ทธ๋์ ๋ชจ๋ ๋ฐ์ดํฐ์ ๋ค ๋ค์ด์ค๋ ๊ฒ์ด ์๋๋ผ๋ฉด ์ต์
๋์ ๋ถ์ฌ์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค..!! |
@@ -0,0 +1,185 @@
+package pairmatching.controller;
+
+import java.util.function.Function;
+import org.mockito.internal.util.Supplier;
+import pairmatching.enums.Course;
+import pairmatching.enums.Crew;
+import pairmatching.enums.Functions;
+import pairmatching.enums.Level;
+import pairmatching.enums.Missions;
+import ... | Java | ```suggestion
if (Functions.isEquals(input, Functions.QUIT)) {
performFunctions(input, inputView);
return
}
```
์ฌ์ํ๊ฑฐ์ง๋ง return์ ์ฌ์ฉํ๋ค๋ฉด ์๋์ if๋ฌธ์ ์๋ง๋ค๊ณ ์ฒ๋ฆฌํ ์ ์์์ ๊ฑฐ ๊ฐ์์ |
@@ -0,0 +1,34 @@
+package pairmatching.model;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class Pairs {
+
+ private Map<String, List<String>> pairs;
+
+ public Pairs(Map<String, List<String>> pair){
+ this.pairs = pair;
+ }
+
+ public Set<Map.Entry<String, List<S... | Java | for-each์ string Joiner๋ฅผ ์จ์ ํด๊ฒฐํ์ด๋ ๋์๊ฑฐ ๊ฐ์์! |
@@ -54,11 +54,20 @@ export const REVIEW_GROUP_API_PARAMS = {
},
};
+export const WRITTEN_REVIEW_PARAMS = {
+ resource: 'reviews/authored',
+ queryString: {
+ lastReviewId: 'lastReviewId',
+ size: 'size',
+ },
+};
+
export const REVIEW_WRITING_API_URL = `${serverUrl}/${VERSION2}/${REVIEW_WRITING_API_PARA... | TypeScript | ```suggestion
if (!lastReviewId) return defaultEndpoint;
return defaultEndpoint + '&' + `${WRITTEN_REVIEW_PARAMS.queryString.lastReviewId}=${lastReviewId}`;
},
```
์ด๋ฐ ๊ตฌ์กฐ๋ก ๋ฐ๊พธ๋ฉด lastReviewId๊ฐ ์์ ๋ endpoint ๊ฐ์ ํ์
ํ๋๋ฐ ๋ ์ฌ์ธ ๊ฒ ๊ฐ๋ค์ |
@@ -6,11 +6,17 @@ import {
GroupedSection,
GroupedReviews,
ReviewInfoData,
+ WrittenReviewList,
} from '@/types';
import createApiErrorMessage from './apiErrorMessageCreator';
import endPoint from './endpoints';
+export interface GetInfiniteReviewListApiParams {
+ lastReviewId: number | null;
+ size:... | TypeScript | ํจ์์ ํ๋ผ๋ฏธํฐ ํ์
์ด๋ผ์, ์ ๋ ์ด๋ด ๋ ํ์
๋ช
๋ค์ params๋ฅผ ์ถ๊ฐํ๋ ํธ์ด์์. |
@@ -0,0 +1,57 @@
+import { useGetDetailedReview, useReviewId } from '@/hooks';
+import { substituteString } from '@/utils';
+
+import QuestionAnswerSection from './QuestionAnswerSection';
+import ReviewDescription from './ReviewDescription';
+import * as S from './styles';
+
+interface DetailedReviewProps {
+ $layoutS... | Unknown | sections ๊ด๋ จ๋ ๋ถ๋ถ ์ฝ๋๊ฐ ๊ธธ์ด์, header์ questions๋ฅผ ๋ถ๋ฆฌํ๊ณ ๊ฐ๊ฐ useMemo๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ์ด๋จ๊น์'? |
@@ -6,11 +6,17 @@ import {
GroupedSection,
GroupedReviews,
ReviewInfoData,
+ WrittenReviewList,
} from '@/types';
import createApiErrorMessage from './apiErrorMessageCreator';
import endPoint from './endpoints';
+export interface GetInfiniteReviewListApiParams {
+ lastReviewId: number | null;
+ size:... | TypeScript | ์์ด๊ณ ๋์ณค๋ค์ ๐
์ถ๊ฐํ ๊ฒ์! |
@@ -0,0 +1,57 @@
+import { useGetDetailedReview, useReviewId } from '@/hooks';
+import { substituteString } from '@/utils';
+
+import QuestionAnswerSection from './QuestionAnswerSection';
+import ReviewDescription from './ReviewDescription';
+import * as S from './styles';
+
+interface DetailedReviewProps {
+ $layoutS... | Unknown | ๋ง์ฝ ์ด ์ปดํฌ๋ํธ๋ฅผ ๋ฆฌํฉํ ๋งํ๋ค๋ฉด ์ ๋ useMemo๋ฅผ ์์ ๋บ ๊ฒ ๊ฐ์์. ์ด์ ์ ๋นํด ์ฝ๋๊ฐ ๋ณต์กํด์ง๋ ๋จ์ ์ด ํฐ ๊ฒ ๊ฐ์์์. ์ ๊ฑฐํ๋ ๋ฐฉํฅ์ ๋ํด์๋ ์ด๋ป๊ฒ ์๊ฐํ์๋์?
1. ๋ฆฌ๋ทฐ๋ ์์ ๋ถ๊ฐ๋ฅํ๋ฏ๋ก ๋ฆฌ๋ทฐ์ด ์ด๋ฆ ๋ฌธ์์ด ์นํ๋ 1๋ฒ๋ง ์ผ์ด๋จ
2. `substituteString`์ useMemo๋ฅผ ์ฌ์ฉํ ๋งํผ ๋น์ผ ๋์์ด ์๋
3. 1๊ณผ ๊ฐ์ ๋งฅ๋ฝ์์, ์ด์ฐจํผ ๋ฆฌ๋ทฐ๋ ๊ฐฑ์ ๋์ง ์๊ธฐ ๋๋ฌธ์ ์ ์ ๋ ๋ฆฌ๋ทฐ ์์ธ ํ์ด์ง๋ฅผ ๊ณ์ ์๋ก๊ณ ์นจํด์ ๋ฆฌ๋ ๋๋ง์ ์ถ๊ฐ๋ก ํธ๋ฆฌ๊ฑฐํ ๊ฒ ๊ฐ์ง ์์ |
@@ -6,11 +6,17 @@ import {
GroupedSection,
GroupedReviews,
ReviewInfoData,
+ WrittenReviewList,
} from '@/types';
import createApiErrorMessage from './apiErrorMessageCreator';
import endPoint from './endpoints';
+export interface GetInfiniteReviewListApiParams {
+ lastReviewId: number | null;
+ size:... | TypeScript | ์ฐ๋ฆฌ์ ์ฝ๋ ์ปจ๋ฒค์
~ ์์ง ๋ง์์~

๊ทผ๋ฐ ํ์ธํด๋ณด๋ ์ ๋ถ์ธ ํจ์๋ค์ด ๊ฝค๋ ์๋ค์๐ |
@@ -0,0 +1,57 @@
+import { useGetDetailedReview, useReviewId } from '@/hooks';
+import { substituteString } from '@/utils';
+
+import QuestionAnswerSection from './QuestionAnswerSection';
+import ReviewDescription from './ReviewDescription';
+import * as S from './styles';
+
+interface DetailedReviewProps {
+ $layoutS... | Unknown | useMemo๋ ๊ธฐ์กด ์ฝ๋์ ์ ์ฉ๋์ด์์๊ธฐ ๋๋ฌธ์ด๋ผ, ํ์๊ฐ ์๋ค๊ณ ๋๋๋ค๋ฉด ์ฌ์ฉํ์ง ์์๋ ๋ผ์. ์ ์ ์ฝ๋ฉํธ๋ '๊ธด ์ฝ๋๋ฅผ ๋ถ๋ฆฌํด ๊ฐ๋
์ฑ์ ๋์ฌ๋ณด์'์ ์ด์ ์ด ์๋๊ฑฐ๋ผ์์. |
@@ -54,11 +54,20 @@ export const REVIEW_GROUP_API_PARAMS = {
},
};
+export const WRITTEN_REVIEW_PARAMS = {
+ resource: 'reviews/authored',
+ queryString: {
+ lastReviewId: 'lastReviewId',
+ size: 'size',
+ },
+};
+
export const REVIEW_WRITING_API_URL = `${serverUrl}/${VERSION2}/${REVIEW_WRITING_API_PARA... | TypeScript | `if (!lastReviewId) defaultEndpoint;`
์ early return์ด ๋น ์ก๋ค์ |
@@ -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,89 @@
+package store.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.model.Order;
+import store.model.Promotion;
+import store.model.Receipt;
+import store.model.Store;
+import store.service.StoreService;
+import store.view.InputView;
+import store.view.OutputView;
+
+public ... | Java | order๋ฅผ do ๋ด๋ถ์์ ์ ์ธํ๋ ๊ฒ์ด ๋ ๊น๋ํ์ง ์์๊น ์๊ฐ์ด ๋๋ค์..!
checkEnd() ๋ด๋ถ์ updateStore() ๋ฅผ do ๊ตฌ๋ฌธ ๋ด๋ถ๋ก ์ด๋์ํจ๋ค๋ฉด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ต๋๋ค..! |
@@ -0,0 +1,59 @@
+package store.model;
+
+import static store.utils.ErrorMessage.INVALID_FORMAT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Order {
+ private List<Product> order;
+
+ public Order(String inputOrder) {
+ validateProductFormat(inputOrder);
+ this.order = gen... | Java | replaceAll() ์ด๋ผ๋ ๋ฉ์๋๋ก๋ ๊ฐ์ ๊ธฐ๋ฅ์ ๊ตฌํํ ์ ์์ต๋๋ค!
์ด๋ฏธ ์์ค์๋ ์์ง๋ง ํน์๋ ํด์ ๋ง์๋๋ฆฝ๋๋ค..! |
@@ -0,0 +1,73 @@
+package store.model;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+public class Promotion {
+ private String name;
+ private int buy;
+ priv... | Java | `now.after(startDate) && now.before(endDate)` ๋ ๊ฐ์ ์๋ฏธ์ธ๋ฐ
ํ์ฌ ์ฝ๋์ฒ๋ผ ์์ฑํ์ ์ด์ ๊ฐ ์์ผ์ค๊น์?
๊ถ๊ธํด์ ์ง๋ฌธ๋๋ฆฝ๋๋ค..! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ํ์ผ๋ช
์ ์์๋ก ์ฌ์ฉํ๋ค๋ฉด ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ๋ฆฌํฉํ ๋งํ๋ค๋ฉด ์ฌ๊ธฐ ์ํ์ ์๋์ ๊ตฌํ๋ ๋ถ๋ถ์
ํ๋์ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ์๋ ๊ฒ๋ ์ข๊ฒ ๋ค์ |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ์๋ฐ ํ์ผ ์
์ถ๋ ฅ์ ์ฌ๋ฌ ๋ฐฉ๋ฒ์ด ์๋๋ฐ ๋ฒํผ๋ฆฌ๋ ํ์์ ์ฌ์ฉํ์ ์ด์ ๊ฐ ์์ผ์ค๊น์?? |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ํด๋น ๋ฉ์๋๋ ์๋น์ค๊ฐ ํ๋ ๊ธฐ๋ฅ ๋ณด๋ค๋ ๋ค๋ฅธ ํด๋์ค๋ก ์ฎ๊ธฐ๋๊ฒ ๋ ์ ํฉํด๋ณด์
๋๋ค..! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ์ด ๋ถ๋ถ๋ ๋์ค์ receiptservice๋ก ๋ถ๋ฅํ๋ฉด ์ด๋จ๊น์..? |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | Math.min์ ์ฌ์ฉํ์๋ฉด ํ์ค๋ก ๋ง๋ค์์์๊ฑฐ๊ฐ์์ |
@@ -0,0 +1,14 @@
+package store.utils;
+
+public class ErrorMessage {
+ public static final String ERROR = "[ERROR] ";
+ public static final String RETRY = " ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ public static final String INVALID_FORMAT = " ์ฌ๋ฐ๋ฅด์ง ์์ ํ์์ผ๋ก ์
๋ ฅํ์ต๋๋ค. ";
+ public static final String INVALID_NAME = " ์กด์ฌํ์ง ์๋ ์ํ์
๋๋ค.";
+... | Java | enum์ ์ฌ์ฉํ์ง ์๊ณ class๋ก ๋ถ๋ฆฌํ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค |
@@ -0,0 +1,89 @@
+package store.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.model.Order;
+import store.model.Promotion;
+import store.model.Receipt;
+import store.model.Store;
+import store.service.StoreService;
+import store.view.InputView;
+import store.view.OutputView;
+
+public ... | Java | ํจ์๋ช
์ ๋์ฌ๋ก ํ๋ ๊ฑด ์ด๋จ๊น์?? ์๋ฅผ ๋ค์ด `calculatePrice` ์ฒ๋ผ ๋ง์ด์ฃ !! |
@@ -0,0 +1,91 @@
+package store.model;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class Store {
+ private final String name;
+ private int price;
+ private int quantity;
+ private String promotion;
+
+ public Store(String name, int price, int quantity, String promotion) {
+ this... | Java | ๊ฐ๊ฐ์ ์ธ๋ฑ์ค๊ฐ ์ด๋ค ๊ฒ์ ์๋ฏธํ๋์ง ์์ํ ํ์ผ๋ฉด ๋ ์ข์์ ๊ฒ ๊ฐ์ต๋๋ค!!! |
@@ -0,0 +1,73 @@
+package store.model;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+public class Promotion {
+ private String name;
+ private int buy;
+ priv... | Java | ๋ฌธ์์ด์ ํ๋ก๋ชจ์
์ผ๋ก ํ์ฑํ๋ ์ญํ ์ ํ์ฑํ๋ ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด์ ๊ฑฐ๊ธฐ๋ก ๋๊ธฐ๋๊ฑด ์ด๋จ๊น์!! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | answer์ enum ์์๋ก ๋ง๋๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,59 @@
+package store.model;
+
+import static store.utils.ErrorMessage.INVALID_FORMAT;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Order {
+ private List<Product> order;
+
+ public Order(String inputOrder) {
+ validateProductFormat(inputOrder);
+ this.order = gen... | Java | ๊ฐ์ธ์ ์ผ๋ก ์์ ์ ๋ค [ ] ํ์ธํ๋ ๋ถ๋ถ๊ณผ ๋น๋ฌธ์์ด์ธ์ง ํ์ธํ๋ ๋ก์ง์ ๋ถ๋ฆฌํด๋ ๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,50 @@
+package store.model;
+
+public class Receipt {
+ private String name;
+ private int individualPrice;
+ private int quantity;
+ private int promotionQuantity;
+ private int promotionBuy;
+
+ public Receipt(String name, int individualPrice, int quantity, int promotionBuy) {
+ th... | Java | ์ด๋ฒ ๊ณผ์ ์์ ๊ฒํฐ ์ฌ์ฉ์ ์ค์ด๊ธฐ๊ฐ ์ฝ์ง ์์, ์ ๋ ๊ฒฐ๊ตญ ์ฌ์ฉํ ์๋ฐ์ ์์์ต๋๋คใ
ใ
๊ฒํฐ๋ฅผ ์ฌ์ฉํ๋ฉด ๊ฐ์ฒด์ ์บก์ํ๋ฅผ ์๋ฐํ ์ํ์ด ์๊ณ , ๊ฐ์ฒด์ ์ํ๋ฅผ ์ธ๋ถ์์ ์ฝ๊ฒ ๋ณ๊ฒฝํ ์ ์๊ฒ ๋์ด ๊ฐ์ฒด์ ์ฑ
์์ด ์ธ๋ถ๋ก ๋ฐ๋ ค๋ ์ ์๊ธฐ ๋๋ฌธ์ ์ง์ํด์ผ ํ๋ค๊ณ ์๊ณ ์์ต๋๋ค.
๊ทธ๋์ ์์ผ๋ก ๊ฒํฐ ์ฌ์ฉ์ ์ค์ด๊ธฐ ์ํด DTO๋ฅผ ํ์ฉํด๋ณด๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ด ๋ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | ์๋น์ค์์ View๋ฅผ ํธ์ถํ๋๊ฑด ๊ฐ์ธ์ ์ผ๋ก layered architecture๊ตฌ์กฐ์ ์ ํฉํ์ง ์๋ค๊ณ ์๊ฐ๋ฉ๋๋ค!
Layered architecture๋ ๊ด์ฌ์ฌ๋ณ๋ก ๊ณ์ธต์ ๋๋ ๊ตฌ์กฐ๋ก ์๊ณ ์์ต๋๋ค. Presentation Layer ๋ ์ฌ์ฉ์์์ ์ํธ์์ฉ์ ๋ด๋นํ๋ ์ญํ , business Layer ๋ ๋น์ง๋์ค ๋ก์ง๋ง ๋ด๋นํ๋ ์ญํ ์
๋๋ค. ๋ฐ๋ผ์ View ๊ฐ์ฒด๋ค์ presentation layer ์ ์ํ๋ค๊ณ ๋ณผ ์ ์์ต๋๋ค.
ํ์ง๋ง ํ์ฌ ์ฝ๋๋ฅผ ๋ณด๋ฉด business layer ๊ฐ presentation layer ๋ฅผ ์์กดํ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋๋ฐ, ์ด๋ ๊ฒ... |
@@ -0,0 +1,86 @@
+package store.view;
+
+import static store.utils.ErrorMessage.ERROR;
+import static store.utils.ErrorMessage.RETRY;
+
+import java.util.List;
+import store.model.Receipt;
+import store.model.Store;
+
+public class OutputView {
+ private static final String ERROR_ANSWER = "[ERROR] ์๋ชป๋ ์
๋ ฅ์
๋๋ค. ๋ค์ ์
๋ ฅํด ... | Java | ์ด ๋ถ๋ถ์ ์์๋ก ์ฒ๋ฆฌํ์ง ์์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,89 @@
+package store.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.model.Order;
+import store.model.Promotion;
+import store.model.Receipt;
+import store.model.Store;
+import store.service.StoreService;
+import store.view.InputView;
+import store.view.OutputView;
+
+public ... | Java | do while๋ฌธ์ ์ฒ์ ์ฌ์ฉํด์ ์ ๋ชฐ๋๋๋ฐ ์์์ ์ ์ธํ๋ ๋ฐฉ๋ฒ์ ์๊ฐ๋ ๋ชปํ๋ค์ ๋ฐฐ์๊ฐ๋๋ค! |
@@ -0,0 +1,73 @@
+package store.model;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+public class Promotion {
+ private String name;
+ private int buy;
+ priv... | Java | ๊ฐ๋
์ฑ์ด ๋ ์ข๋ค๊ณ ์๊ฐ๋๋ ๋ฐฉํฅ์ผ๋ก ์์ฑํ์ต๋๋ค |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | readLine() ์ ์ฌ์ฉํ์ฌ ํ ์ค์ฉ ์ฝ๊ธฐ ์ข๋ค๊ณ ์๊ฐํ์ฌ ์ฌ์ฉํ์ต๋๋ค |
@@ -0,0 +1,14 @@
+package store.utils;
+
+public class ErrorMessage {
+ public static final String ERROR = "[ERROR] ";
+ public static final String RETRY = " ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ public static final String INVALID_FORMAT = " ์ฌ๋ฐ๋ฅด์ง ์์ ํ์์ผ๋ก ์
๋ ฅํ์ต๋๋ค. ";
+ public static final String INVALID_NAME = " ์กด์ฌํ์ง ์๋ ์ํ์
๋๋ค.";
+... | Java | ๊ฐ๋ค์ ๊ทธ๋ฃนํ ํ์ฌ ์ฌ์ฉํ์ง ์๊ณ ๋จ์ ๋ฉ์ธ์ง ์ถ๋ ฅ์ด๊ธฐ์ ์์ ํด๋์ค๋ก ํด๋ ์ข์ ๊ฒ ๊ฐ๋ค๊ณ ์๊ฐํ์ต๋๋ค |
@@ -0,0 +1,73 @@
+package store.model;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+public class Promotion {
+ private String name;
+ private int buy;
+ priv... | Java | ์ญํ ๋ถ๋ฆฌ๋ฅผ ์ข ๋ ์์ธํ ํด์ผ ๋ ๊ฒ ๊ฐ๋ค์.. ์ฐธ๊ณ ํ๊ฒ ์ต๋๋ค! |
@@ -0,0 +1,50 @@
+package store.model;
+
+public class Receipt {
+ private String name;
+ private int individualPrice;
+ private int quantity;
+ private int promotionQuantity;
+ private int promotionBuy;
+
+ public Receipt(String name, int individualPrice, int quantity, int promotionBuy) {
+ th... | Java | ๋ง์ํ์ ๋ด์ฉ ๋ฃ๊ณ ์ ์ฝ๋๋ฅผ ๋ค์ ์ดํด๋ณด๋, ๊ฐ์ฒด๋ด์์๋ ๋จ์ํ ๋ฐ์ดํฐ๋ง ๋ด์๋๊ณ ๊ฒํฐ ์ฌ์ฉ์ผ๋ก ๋๋ถ๋ถ ์ธ๋ถ์์ ๋ก์ง์ ์ฒ๋ฆฌํ์ฌ ๊ฐ์ฒด์งํฅ์ ์๋ฏธ๋ฅผ ์์ ์ฝ๋๋ฅผ ์์ฑํ ๊ฒ ๊ฐ์ต๋๋ค...
๊ตฌํํ๋๋ฐ ๋๋ฌด ๊ธ๊ธํ๋๊ฑฐ๊ฐ๋ค์ใ
ใ
ํผ๋๋ฐฑ ๊ฐ์ฌํฉ๋๋ค |
@@ -0,0 +1,294 @@
+package store.service;
+
+import static store.model.Promotion.parsePromotions;
+import static store.model.Store.*;
+import static store.utils.ErrorMessage.INVALID_INPUT;
+import static store.utils.ErrorMessage.INVALID_NAME;
+import static store.utils.ErrorMessage.INVALID_QUANTITY;
+
+import java.io.B... | Java | OutputView ํด๋์ค์์ ์ ์ผํ๊ฒ ์์ฑํ ์คํํฑ ๋ฉ์๋ ์
๋๋ค.
์ ๋ ๊ตฌํํ๋ ๊ณผ์ ์์ ์ณ์ง ์๋ค๊ณ ์๊ฐํ์ง๋ง,
๋น์ฆ๋์ค ๋ก์ง์ ์ฒ๋ฆฌํ๋ ๊ณผ์ ์์ ์ณ์ง ์์ ์
๋ ฅ์ด ์์ ๋ outputView ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐ ํ ๋ฐฉ๋ฒ์ด ๋ ์ค๋ฅด์ง ์์ ์ด๋ ๊ฒ ์์ฑํ๊ฒ ๋์ต๋๋ค..
์ ํฉํ์ง ์์ ์ด์ ๋ฅผ ์์ธํ๊ฒ ๋ง์ํด ์ฃผ์
์ ์๋กญ๊ฒ ํ๋ ๋ ๋ฐฐ์๊ฐ๋๋ค ๊ฐ์ฌํฉ๋๋ค..! |
@@ -26,11 +26,32 @@ repositories {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
- compileOnly 'org.projectlombok:lombok'
+ implementation 'org.springframework.boot:spring-boot-starter-security'
+ ... | Unknown | Gradle ํ์์ด ์ผ์นํ์ง ์์ต๋๋ค.
๋ค๋ฅธ ๊ณณ๊ณผ ๋์ผํ๊ฒ ์กฐ์ ํด์ฃผ์ธ์.
```groovy
implementaion 'io.jsonwebtoken:jjwt-api:0.11.5'
``` |
@@ -0,0 +1,83 @@
+package io.study.springbootlayered.api.member.application;
+
+import java.security.SecureRandom;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.stream.Collectors;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transacti... | Java | `@Transactional` ์ด๋
ธํ
์ด์
์ ํด๋์ค ๋ ๋ฒจ๋ก ์ฌ๋ฆฌ๋๊ฒ ๋ง๋์ง์ ๋ํด์๋ ์๋ฌธ์ด ๋ญ๋๋ค.
- DB์ ์ ๊ทผํ์ง ์๋ ๋ฉ์๋๋ฅผ ์ํํ ๋๋ `@Transactional` ์ ์ํด ์๋ค๋ก ์ถ๊ฐ ๋ก์ง์ด ์คํ๋๋ฉฐ.
- readonly ๊ฐ ์๋ ๊ฒฝ์ฐ์ ์๋์์ ์ด์ฐจํผ ๋ ์ฌ์ฉํ๋์ง๋ผ ๋ถํ์ํ ์ฝ๋๊ฐ ๋์ด๋๋๊ฒ ์๋๊ฐ ์ถ์ต๋๋ค. |
@@ -0,0 +1,30 @@
+package io.study.springbootlayered.api.member.domain.dto;
+
+import java.util.List;
+
+import io.study.springbootlayered.api.member.domain.entity.AuthorityType;
+import io.study.springbootlayered.api.member.domain.entity.Member;
+import io.study.springbootlayered.api.member.domain.entity.MemberAuthori... | Java | Gradle ์ค์ ์ ์ํ๋ฉด Java ๋ฒ์ ์ด 21์ธ๋ฐ, ์ถฉ๋ถํ Record๋ก ๋์ฒด ๊ฐ๋ฅํ ์ฝ๋๋ก ๋ณด์
๋๋ค. |
@@ -0,0 +1,30 @@
+package io.study.springbootlayered.api.member.domain.dto;
+
+import java.util.List;
+
+import io.study.springbootlayered.api.member.domain.entity.AuthorityType;
+import io.study.springbootlayered.api.member.domain.entity.Member;
+import io.study.springbootlayered.api.member.domain.entity.MemberAuthori... | Java | Validation ์ ์ฌ์ฉํด์ ๋น๊ฐ์ด ๋ค์ด์ค์ง ์๋๋ก ํ๋ฉด ์ข๊ฒ ๋ค์. |
@@ -0,0 +1,19 @@
+package io.study.springbootlayered.api.member.domain.dto;
+
+import lombok.AccessLevel;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.RequiredArgsConstructor;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class MemberPasswordResetDto {
+
... | Java | ํ๋๊ฐ ๋๊ฐ์ธ๋ฐ ๊ตณ์ด ๋น๋๋ฅผ ์ฌ์ฉํด์ผ ํ๋ ์ถ์๋ฐ์,
๋น์ฅ ๋ฐ๋ก ์๋์ MemberSigninDto ์์๋ `@Builder`๊ฐ ์๋ค์. |
@@ -0,0 +1,19 @@
+package io.study.springbootlayered.api.member.domain.dto;
+
+import lombok.AccessLevel;
+import lombok.Builder;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.RequiredArgsConstructor;
+
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public class MemberPasswordResetDto {
+
... | Java | ๋ชจ๋ Dto๊ฐ ๋ด๋ถ์ ์ผ๋ก ๋ Dto๋ฅผ ๊ฐ๊ณ ์๋ ์ด์ํ ๊ตฌ์กฐ๋ค์...
๊ทธ๋ฅ ์๋ก ๋ค๋ฅธ ํ์ผ๋ก ๋ถ๋ฆฌํ๋๊ฒ ๊ฐ๋
์ฑ ์ธก๋ฉด์์ ๋ ๋ซ์ง ์์๊น์?
ํนํ๋ ๋ด๋ถ์ ์ผ๋ก ๊ฐ์ ์ด๋ฆ์ ์ฐ๊ณ ์๊ธฐ ๋๋ฌธ์, ํ์ฌ๋ ์ค์๋ก Static Import๋ฅผ ํ๋ ์๊ฐ ์ด๊ฒ ์ด๋์์ ์จ๊ฑด์ง ํ์
ํ ๋ฐฉ๋ฒ์ด ์์ ์์ด์ง๋๋ค. |
@@ -0,0 +1,83 @@
+package io.study.springbootlayered.api.member.application;
+
+import java.security.SecureRandom;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.stream.Collectors;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transacti... | Java | ๊ฒฐ๊ตญ `SpecialCharactes` ์ `ValidCharacters` ์ ์กฐํฉ์ผ๋ก ๊ตฌ์ฑ๋๋ค๊ณ ๋ณผ ์ ์๊ฒ ๋ค์.
- ์ด์ฐจํผ ๋ฌธ์์ด ์๋๊ฑด ๋๊ฐ์ต๋๋ค.
```java
private String createRandomString(String baseStr, int length) {
return random.ints(length, 0, baseStr.length())
.mapToObj(baseStr::charAt)
.collect(StringBuilder::new, StringBuilde... |
@@ -0,0 +1,83 @@
+package io.study.springbootlayered.api.member.application;
+
+import java.security.SecureRandom;
+import java.util.Collections;
+import java.util.List;
+import java.util.Random;
+import java.util.stream.Collectors;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transacti... | Java | ๋งค๋ฒ Random ๊ฐ์ฒด๋ฅผ ์์ฑํ์ง ๋ง๊ณ , ๊ทธ๋ฅ ์ต์๋จ์ private final ๋ก ์ฌ๋ ค๋ฒ๋ฆฌ์ธ์.
`private final Random random = new SecureRandom();` |
@@ -0,0 +1,32 @@
+package io.study.springbootlayered.api.member.application;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import io.study.springbootlayered.api.member.domain.MemberProcessor;
+import io.study.springbootlayered.api.member.domain.dt... | Java | ์ธ๋ผ์ธ ์ฃผ์์ // ๊ฐ ์ข๊ฒ ์ฃ ? |
@@ -0,0 +1,23 @@
+package io.study.springbootlayered.api.member.domain.entity;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Embeddable;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+
+@Embeddable
+@Getter
+@EqualsAndHashCode
+public class MemberPassword {
+
+ @Column(name = "password... | Java | ์์๋ Equals์ hashCode๋ฅผ ์ง์ ์ ์ํ๋๋, ์ด๋ฒ์๋ ๋กฌ๋ณต์ ์ฌ์ฉํ๋ค์? |
@@ -0,0 +1,42 @@
+package io.study.springbootlayered.api.member.domain.event;
+
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.event.TransactionalEventListener;
+
+import io.study.springbootlayered.infra.mail.MailService... | Java | ์ผ๋ฐ์ ์ผ๋ก ๊ฐ๋ฐ ํ๊ฒฝ์์๋ log level์ debug๋ก, ์ด์ ํ๊ฒฝ์์๋ info/warn ์์ค์ผ๋ก ์ค์ ํฉ๋๋ค.
์ด์ ํ๊ฒฝ์์ ํด๋น ์์ฒญ์ด ๋ค์ด์ฌ "๋ ๋ง๋ค" ํด๋น ๋ก๊ทธ๊ฐ ์ถ๋ ฅ๋๊ฒ ๋๋ฉด, ์๋ฌ ๋๋ฒ๊น
๊ณผ์ ์์ ๋งค์ฐ ๋ฒ๊ฑฐ๋ก์์ง ํ๋ฅ ์ด ๋์ต๋๋ค.
๊ฐ๋ฐ ๊ณผ์ ์์์ ๋๋ฒ๊น
์ฉ์ธ์ง, ์ด์ ํ๊ฒฝ์์ ์ค์ ๋ก ํ์ํ ๋ก๊ทธ์ธ์ง ์ ์๊ฐํด๋ณด์๊ณ ๋ก๊ทธ ๋ ๋ฒจ์ ์ง์ ํ๋๊ฒ ์ข์ต๋๋ค. |
@@ -0,0 +1,15 @@
+package io.study.springbootlayered.api.member.domain.event;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@Getter
+@RequiredArgsConstructor
+public class SignupEvent {
+
+ private final String email;
+
+ public static SignupEvent of(String email) {
+ return new Signu... | Java | ์์ฑ์๋ ์ญํ ์ด ๋๊ฐ๋ค์. |
@@ -0,0 +1,63 @@
+package io.study.springbootlayered.api.member.domain;
+
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Component;
+
+import io.study.springbootlayered.api.member.domain.dto.MemberDetailDto;
+import io.study.springbootlayered.api.member.doma... | Java | ~~Impl ํ์์ ํด๋์ค์ ์กด์ฌ ์ฌ๋ถ๋ฅผ ์ดํดํ๊ธด ์ด๋ ต๋ค์.
- ๋ค๋ฅธ ๊ตฌํ์ฒด์ ๊ฐ๋ฅ์ฑ์ด ์กด์ฌํ๋์?
- ์์ ๋ค๋ฅธ Processor๋ ๋ง์ ํ ํด๋์ค๋ฅผ ์์ํ๋ ๊ตฌ์กฐ๋ผ Impl์ ์ ๋ฌ๊ณ ์๋ค์. |
@@ -0,0 +1,63 @@
+package io.study.springbootlayered.api.member.domain;
+
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Component;
+
+import io.study.springbootlayered.api.member.domain.dto.MemberDetailDto;
+import io.study.springbootlayered.api.member.doma... | Java | ํด๋น ์ฟผ๋ฆฌ๊ฐ ๋ค๋ฅธ ๊ณณ์์ ์ฌ์ฌ์ฉ๋์ง ์์ ๊ฒ์ด๋ผ๋ ๋ณด์ฅ์ด ์๋์?
์ด๋ฐ ๊ธฐ๋ณธ์ ์ธ Validation ์ฉ ์ฟผ๋ฆฌ๋ ๋ถ๋ฆฌํด์ ๋ค๋ฃจ๋๊ฒ ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,32 @@
+package io.study.springbootlayered.api.member.application;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import io.study.springbootlayered.api.member.domain.MemberProcessor;
+import io.study.springbootlayered.api.member.domain.dt... | Java | ๋ก๊ทธ ๋ฏธ์ฌ์ฉ์ธ๋ฐ ํด๋น ์ด๋
ธํ
์ด์
์ฌ์ฉํ๊ณ ์๋ค์. |
@@ -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 ํด์ฃผ๋ ๊ฒ๋ ๋งค์ฐ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :)
์ข์ ์ ๋ณด ๋ฐฐ์ฐ๊ณ ๊ฐ๋๋ค!! |
@@ -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์ `hover` ์์ฑ๋ ์์ผ๋ฉด ์ด๋จ๊น ์ถ๋ค์! |
@@ -0,0 +1,37 @@
+import { forwardRef } from "react";
+import * as PI from "./ProductItem.style";
+import CartControlButton from "../../Button/CartControlButton";
+import useProductInCart from "../../../hooks/useProductInCart";
+
+interface ProductProps {
+ product: Product;
+}
+
+const ProductItem = forwardRef<HTMLDi... | Unknown | ํน์ try-catch ์์ catch๋๋ error๊ฐ `Error` ํ์
์ด ์๋ ๊ฒฝ์ฐ๋ ์๋์?!
๋จ์ํ ๊ถ๊ธํด์ ์ฌ์ญค๋ด
๋๋ค...!
catch๋๋ ๊ฒ์ Error๋ง catch๋๋์ค ์์์, ์ด ๋ก์ง์ด ํ์ํ๊ฐ ํ๋ ์๊ฐ์ด ๋ค์์ด์ ใ
ใ
|
@@ -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 | ์ค... ํด๊ฒฐ๋ฒ ์ ์๊น์ง ๋๋จํ๋ค์ ๐ ๐๐๐๐๐๐ |
@@ -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 | `requestBuilder` ๋ผ๋ ์ด๋ฆ์ผ๋ก ์์ฒญ์ ๋ง๋๋ ์ฑ
์์ ๊ฐ์ง ํจ์๋ฅผ ๋ณ๋๋ก ๋ถ๋ฆฌํด์ฃผ์ ๋ถ๋ถ์ด ์ธ์๊น๋ค์!๐๐ |
@@ -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 | `useCallback`๊ณผ`toggle`์ด๋ผ๋ ์ํ๋ฅผ ํตํด `fetchCartItems`์ ์ฌ์คํ์ํจ๋ค๋ ๋ฐ์์ด ๋ชน์ ์๋กญ๊ฒ ๋๊ปด์ง๋ค์! ํ ๋ฒ๋ ์๊ฐํด๋ณด์ง ๋ชปํ๋ ๋ฐฉ์์ธ๋ฐ... ์ํ๋ ์ต์ํ๋์ด์ผ ํ๋ค๊ณ ์๊ฐํ๋ ํธ์ด์ง๋ง, ํน์ ํธ๋ฆฌ๊ฑฐ๋ฅผ ์ํด ์ํ๋ฅผ ํ์ฉํ๋ ๊ฒ์ด ์ข์์ง ์ ๋ ํ ๋ฒ ๊ณ ๋ฏผํด๋ณผ ์ ์์๋ ๊ฒ ๊ฐ์์!
ํํธ์ผ๋ก๋ ์ํ๋ฅผ ๋ง๋ค์ง์๊ณ , `fetchCartItems`๋ก์ง์ `useEffect` ๋ฐ์ผ๋ก ๋บ ๋ค refreshCartItems ์ ์ ์์ฑํด์ฃผ๋ฉด ์ํ๊ฐ ํ์ํ์ง ์์ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค๊ธฐ๋ ํฉ๋๋ค! (์ด ๋ถ๋ถ์ ๊ฐ๋ฐ์์ ์ทจํฅ์ด๋ ์ ํธ์ ๊ฐ๊น์ธ... |
@@ -0,0 +1,15 @@
+import { useContext } from "react";
+import {
+ CartItemsContext,
+ CartItemsContextType,
+} from "../context/CartItemsContext";
+
+export const useCartItemsContext = (): CartItemsContextType => {
+ const context = useContext(CartItemsContext);
+ if (!context) {
+ throw new Error(
+ "useCa... | TypeScript | ํ์ฌ `useErrorContext`์ `useCartItemsContext`๋ context๊ฐ `undefined`์ธ ๊ฒฝ์ฐ ์๋ฌ๋ฅผ ๋์ ธ ํ์
์ ์ขํ๊ธฐ ์ํ ์ปค์คํ
ํ
์ธ ๊ฒ ๊ฐ์ต๋๋ค. ์ ๊ฐ ๋๋ผ๊ธฐ์ ๋ ํ
๋ชจ๋ ๊ฐ์ ์ญํ ์ ํด์ฃผ๊ณ ์๋ ๊ฒ ๊ฐ์์ context๋ฅผ ์ธ์๋ก ๋ฐ๋๋ค๋ฉด ํ๋์ ํ
์ผ๋ก ํฉ์ณ์ ์ฌ์ฌ์ฉํด์ฃผ์ด๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!ใ
ใ
|
@@ -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 | ๋ชน์ ํฅ๋ฏธ๋ก์ด ํจ์๋ค์!๐๐ ๋ณ๊ฑฐ ์๋์ง๋ง ์ด๋ฌํ ๋ถ๋ถ์ api ๋ด๋ถ util๋ก ํ์ผ์ ๋ถ๋ฆฌํด์ฃผ์
๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -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 | ์ถ์ํ๋ `fetchWithAuth` ๋ด๋ถ์์ ์ด๋ฏธ `response.ok`๊ฐ ์๋ ๊ฒฝ์ฐ ์๋ฌ๋ฅผ ๋์ง๋๋ก ์ฒ๋ฆฌํด๋์๋๋ฐ ์ฌ๊ธฐ๋ฅผ ํฌํจํ์ฌ ๋ชจ๋ fetch ํจ์์์ ์ฌ์ ํ ์๋ฌ๋ฅผ ๋์ง์๋ ์ด์ ๊ฐ ์์ผ์ค๊น์..?? |
@@ -0,0 +1,16 @@
+package store.constant;
+
+public enum CommonMessage {
+ YES("Y"),
+ NO("N");
+ private final String commonMessage;
+
+ CommonMessage(final String commonMessage) {
+ this.commonMessage = commonMessage;
+ }
+
+ public String getCommonMessage() {
+ return commonMessage;
+... | Java | ์
๋ ฅ์ด ๋๋ฟ์ธ ๊ฒฝ์ฐ์ ๋ํด์ Enum์ผ๋ก ๊ด๋ฆฌํ๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์ธ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,22 @@
+package store.constant;
+
+public enum FileMessage {
+ PRODUCTS_FILE_NAME("products.md"),
+ PROMOTION_FILE_NAME("promotions.md"),
+ NULL("null"),
+ SOFT_DRINK("ํ์ฐ2+1"),
+ MD_RECOMMEND_PRODUCT("MD์ถ์ฒ์ํ"),
+ FLASH_DISCOUNT("๋ฐ์งํ ์ธ"),
+ FILE_START_WORD("name");
+
+ private final Stri... | Java | ํ์ผ์ ์๋ ํ๋ก๋ชจ์
๋ฐ์ดํฐ๋ฅผ Enum์ผ๋ก ๊ด๋ฆฌํ๋๊ฑด ์ข์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค
ํ๋ก๋ชจ์
์ข
๋ฅ๊ฐ 3๊ฐ ๊ณ ์ ์ด ์๋๋ผ ๊ฐ๊ธฐ ๋ค๋ฅธ ์๋ฐฑ ๊ฐ, ์์ฒ ๊ฐ๋ก ๋์ด๋ ์ ์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,71 @@
+package store.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+
+public class Receipt {
+ private final double THIRTY_PERCENT = 0.3;
+ private final List<ReceiptItem> receiptItems = new ArrayList<>();
+
+ ... | Java | model์ ์ญํ ์ ์ํํ๋ ํด๋์ค๋ก ๋ณด์ด๋๋ฐ ํจํค์ง๋ฅผ ๋ถ๋ฆฌํ์ง ์๊ณ , domain ํจํค์ง์ ๊ฐ์ด ๋์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | `userMembership()`์์ ๋ฉค๋ฒ์ญ ํ ์ธ ์ฌ๋ถ์ ๋ฐ๋ผ ์ต์ข
๊ณ์ฐ ๊ธ์ก์์ 30% ํ ์ธ์ด ๋๊ณ ์๋๋ฐ,
์๊ตฌ์ฌํญ์์๋ ํ๋ก๋ชจ์
์ํ์ ์ ์ธํ ์ผ๋ฐ ์ํ์ผ๋ก ๊ฒฐ์ ๋ ์ํ๋ค์ ๋ํด์๋ง ๋ฉค๋ฒ์ญ ํ ์ธ์ด ๋์ด์ผ ํ๋ค๊ณ ๋ช
์๋์ด ์์ต๋๋ค
์ด ๋ถ๋ถ์ด ์ฒ๋ฆฌ๋์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,19 @@
+package store.constant;
+
+public enum CommonValue {
+ ZERO(0),
+ ONE(1),
+ TWO(2),
+ EIGHT_THOUSAND(8000);
+
+ private final int value;
+
+ CommonValue(final int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
+
+} | Java | ์์๋ค์ enum์ผ๋ก ์ ๊ด๋ฆฌํด์ฃผ์
จ๋๋ฐ์!
์ ๋ ๊ฐ์ธ์ ์ผ๋ก enum์ ๊ฐ์ ๊บผ๋ด๊ธฐ ์ํด `.getValue()` ๊น์ง ๋ถ๋๊ฒ ์กฐ๊ธ ์ง์ ๋ถํด๋ณด์
๋๋ค.
static ์์์ ๊ฒฝ์ฐ `Constant.ZERO` ์ด๋ฐ์์ผ๋ก ์ฌ์ฉํ ์ ์์ง๋ง enum์ `CommonValue.ZERO.getValue()` ๋ก 1depth ๋ ๋์ด๋๋ ๋๋์ด๋๊น์..? |
@@ -0,0 +1,71 @@
+package store.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+
+public class Receipt {
+ private final double THIRTY_PERCENT = 0.3;
+ private final List<ReceiptItem> receiptItems = new ArrayList<>();
+
+ ... | Java | int๋ฅผ double๊ณผ ๊ณฑํ ๋ค int๋ก ํ๋ณํ์ ํ๊ณ ์๋๋ฐ์!
double๋ก ๊ณ์ฐ๋๋ ๊ณผ์ ์์ ๋ถ๋์์์ ์ค๋ฅ๋ฅผ ํผํ ์ ์์ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค. ์ด๋๋ `* 30 / 100` ์ผ๋ก ๊ณ์ฐํด์ ์์ ์์์ ์ด ์์๊ธฐ๋๋ก ๊ณ์ฐํ์๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,143 @@
+package store.controller;
+
+import camp.nextstep.edu.missionutils.DateTimes;
+import java.util.List;
+import java.util.function.Supplier;
+import store.constant.CommonMessage;
+import store.constant.CommonValue;
+import store.constant.SignMessage;
+import store.domain.GeneralProduct;
+import store.d... | Java | ์ ๋ MVC ํจํด์ Service ๊ณ์ธต์ ์ถ๊ฐํด์ ์ฑ
์ ๋ถ๋ฆฌ์ ์ ๋จน์์๋๋ฐ, Service๊ฐ ์์ผ๋ ์ข ๋ ์์ฐ์ค๋ฝ๊ฒ ๋ฐ์ดํฐ ์ ๋ฌ์ด ์ด๋ฃจ์ด์ง๋ค์..!! |
@@ -0,0 +1,141 @@
+package store.view.output;
+
+import java.util.List;
+import store.domain.GeneralProduct;
+import store.domain.PromotionProduct;
+import store.domain.Receipt;
+import store.domain.ReceiptItem;
+import store.domain.Storage;
+import store.exception.ConvenienceStoreException;
+
+public class OutputView ... | Java | ํ๋ก๋ชจ์
์ํ์ด ์์ง๋๊ณ ๋์ ํ๋ก๋ชจ์
์ํ๋ ์ฌ๊ณ ์์์ผ๋ก ์ถ๋ ฅ๋๋๋ฐ,
์ฌ์ฉ์๋ ํ๋ก๋ชจ์
์ํ์ ๊ตฌ๋งคํ ์ ์์ผ๋ฏ๋ก ์์ ๋
ธ์ถ์ํค์ง ์๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์์!
UX์ชฝ์ผ๋ก๋ ํ๋ฒ ๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค๐ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.