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
์šฐ๋ฆฌ์˜ ์ฝ”๋“œ ์ปจ๋ฒค์…˜~ ์žŠ์ง€ ๋ง์•„์š”~ ![แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2025-02-13 แ„‹แ…ฉแ„’แ…ฎ 4 02 32](https://github.com/user-attachments/assets/44efa353-3161-4b52-b8c9-24922fd1736f) ๊ทผ๋ฐ ํ™•์ธํ•ด๋ณด๋‹ˆ ์•ˆ ๋ถ™์ธ ํ•จ์ˆ˜๋“ค์ด ๊ฝค๋‚˜ ์žˆ๋„ค์š”๐Ÿ˜‚
@@ -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์ชฝ์œผ๋กœ๋„ ํ•œ๋ฒˆ ๊ณ ๋ฏผํ•ด๋ณด์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค๐Ÿ™‚