code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,16 @@
+package core.mvc.tobe;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class DefaultMethodArgumentResolver implements HandlerMethodArgumentResolver {
+
+ @Override
+ public Object resolveArgument(MethodParameter methodParameter, HttpServletRequest request) {
+ return request.ge... | Java | true๋ณด๋ค๋ PrimitiveOrWrapper์ธ์ง ํ์ธํ ์ ์์ผ๋ฉด ์ข๊ฒ ๋ค์. |
@@ -0,0 +1,16 @@
+package core.mvc.tobe;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class DefaultMethodArgumentResolver implements HandlerMethodArgumentResolver {
+
+ @Override
+ public Object resolveArgument(MethodParameter methodParameter, HttpServletRequest request) {
+ return request.ge... | Java | Primitive argument์ง์๊ณผ HttpServletRequest argument ์ง์์ ๋๋์ด์ง๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,24 @@
+package core.mvc.tobe;
+
+import javax.servlet.http.HttpServletRequest;
+
+import next.model.User;
+
+public class UserMethodArgumentResolver implements HandlerMethodArgumentResolver {
+
+ @Override
+ public Object resolveArgument(MethodParameter methodParameter, HttpServletRequest request) {
+ ... | Java | ์ด์ ๊ฐ์ด ๊ตฌํํ ๊ฒฝ์ฐ User ๊ฐ์ฒด๋ง ์ฌ์ฉํ ์ ์๊ณ ๋ฒ์ฉ์ ์ผ๋ก ์ฌ์ฉํ๋๋ฐ๋ ํ๊ณ๊ฐ ์์ง ์์๊น?
java bean ๊ท์ฝ์ ๋ฐ๋ฅด๋ ๋ชจ๋ ๊ฐ์ฒด์ ๋ํด ์๋ ๋งคํํ ์ ์๋๋ก ๊ตฌํํด ๋ณด๋ฉด ์ด๋จ๊น?
request๋ก ์ ๋ฌ๋๋ ๋ฐ์ดํฐ์ ํด๋นํ๋ setter ๋ฉ์๋๊ฐ ์์ผ๋ฉด ์๋์ผ๋ก ๊ฐ์ ํ ๋นํ๋ค.
์๋ฅผ ๋ค์ด request.getParameter("userId") ๊ฐ์ด ์กด์ฌํ๋ฉด setUserId()๋ฅผ ํตํด ๊ฐ์ ํ ๋นํ๋ ๋ฐฉ์์ผ๋ก ๊ตฌํํด์ผ java bean ๊ท์ฝ์ ๋ฐ๋ฅด๋ ๊ฐ์ฒด์ ๋ฒ์ฉ์ ์ผ๋ก ์ฌ์ฉํ ์ ์์ง ์์๊น? |
@@ -0,0 +1,24 @@
+package core.mvc.tobe;
+
+import javax.servlet.http.HttpServletRequest;
+
+import next.model.User;
+
+public class UserMethodArgumentResolver implements HandlerMethodArgumentResolver {
+
+ @Override
+ public Object resolveArgument(MethodParameter methodParameter, HttpServletRequest request) {
+ ... | Java | ํฌ๋น๋! ๋ง์ํ์ java bean ๊ท์ฝ์ ๋ํด์๋ PrimitiveMethodArgumentResolver, WrapperMethodArgumentResolver ์์ ๊ตฌํํ๊ณ ์๋๋ฐ์. ํน์ ์ด๊ฒ๋ง์ผ๋ก๋ ๋ถ์กฑํ ๊ฒ์ผ๊น์? |
@@ -10,11 +10,14 @@
"preview": "vite preview"
},
"dependencies": {
+ "add": "^2.0.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
+ "react-hook-form": "^7.45.4",
"react-router-dom": "^6.14.2",
"recoil": "^0.7.7",
"styled-components": "^6.0.7",
+ "yarn": "^1.22.19",
"zus... | Unknown | yarn ํจํค์ง ์ค์น๋ ์ค์์ธ๊ฐ์ฉ~? |
@@ -0,0 +1,19 @@
+import * as S from "./styled";
+
+const Button = (props: {
+ text: string;
+ type: "button" | "submit" | "reset";
+ bgColor: "black" | "grey" | "hidden";
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
+}) => {
+ const { type, text, bgColor, onClick } = props;
+ return (
+ <>
+ <... | Unknown | jsx๋ฅผ ์ ๋นํ๊ทธ๋ก ๋ํํ์
จ๋์ฌ? |
@@ -0,0 +1,19 @@
+import * as S from "./styled";
+
+const Button = (props: {
+ text: string;
+ type: "button" | "submit" | "reset";
+ bgColor: "black" | "grey" | "hidden";
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
+}) => {
+ const { type, text, bgColor, onClick } = props;
+ return (
+ <>
+ <... | Unknown | Button Props์ ์ง์ ํด์ฃผ์คEo
Native element attributes๋ฅผ ๋ฃ์ง์์ ์ด์ ๊ฐ ์์๊น์ฌ? |
@@ -0,0 +1,76 @@
+import { styled } from "styled-components";
+
+// input
+export const RegisterInput = styled.input`
+ padding: 1rem;
+ border-radius: 8px;
+`;
+
+// label text
+export const InputLabelText = styled.div`
+ padding: 1rem 0;
+ font-weight: 600;
+ font-size: 16px;
+ color: #222;
+`;
+
+// button
+ex... | TypeScript | Button Props ํ์
์ ์ง์ ํด์ฃผ์ง ์์ ์ด์ ๊ฐ ๋ฌด์์ผ๊น์? |
@@ -0,0 +1,76 @@
+import { styled } from "styled-components";
+
+// input
+export const RegisterInput = styled.input`
+ padding: 1rem;
+ border-radius: 8px;
+`;
+
+// label text
+export const InputLabelText = styled.div`
+ padding: 1rem 0;
+ font-weight: 600;
+ font-size: 16px;
+ color: #222;
+`;
+
+// button
+ex... | TypeScript | ์ด๋ ๊ฒ hex ์ฝ๋๊ฐ ๊ทธ๋๋ก ๋
ธ์ถ๋๋๊ฒ์ ๋งค์ง๋๋ฒ๊ฐ ์๋๊น ์ถ์ด๋ค
์์์ฒ๋ฆฌํด์ฃผ๋ฉด ์ด๋จ๊น์? |
@@ -4,19 +4,20 @@ import { Routes, Route } from "react-router-dom";
// Components
import Home from "./Home";
+import SignUp from "./SignUp";
const Router = () => {
- const [isInLogged, setisInLogged] = useState(true);
+ const [isInLogged, setIsInLogged] = useState(false);
return (
<>
{isInLogg... | Unknown | ์ปดํฌ๋ํธ๋ Login ์ธ๋ฐ InLogged๋ ๋ค์ด๋ฐ ๋ถ์ผ์น ์๋๊น์? |
@@ -0,0 +1,60 @@
+import {
+ UseFormRegister,
+ FieldValues,
+ UseFormWatch,
+ UseFormGetValues,
+ UseFormSetValue,
+} from "react-hook-form";
+import Button from "../atoms/Button";
+import Input from "../atoms/Input";
+import * as S from "./styled";
+
+type InputAndButtonPropsType = {
+ type: "button" | "submit"... | Unknown | ์ธํ๊ณผ ๋ฒํผ์ ํจ๊ป ์ฌ์ฉํ๋ ์ด์ ๊ฐ ์ด๋ค ์ด์ ์์ ์์์๊น์?
๋ถ๋ชจ ์ปดํฌ๋ํธ์์ input๊ณผ button์ ์ ์ ํ ์ฌ์ฉํด์ฃผ๋ฉด ๋๋๋ฐ ์ด๋ ๊ฒ ๋ถ๋ฆฌํ์ ์ด์ ๊ฐ ๊ถ๊ธํจ๋ค |
@@ -0,0 +1,190 @@
+/**
+ *
+ * ์ด๋ฆ
+ * ์ด๋ฉ์ผ (์ค๋ณต ํ์ธ ๋ฒํผ)
+ * ๋น๋ฐ๋ฒํธ
+ * ๋น๋ฐ๋ฒํธ ์ฌํ์ธ
+ * ํ์๊ฐ์
๋ฒํผ
+ *
+ */
+
+import Button from "../atoms/Button";
+import Input from "../atoms/Input";
+import LabelText from "../atoms/LabelText";
+import TitleTex from "../atoms/TitleText";
+import InputAndButton from "../molecules/InputAndButton"... | Unknown | ์ฌ๊ธฐ์๋ input button์ ๋๋ค ์ฐ๋ฉด์ InputAndButton์ ์ฐ๊ธฐ๋ํด์ ์ปดํฌ๋ํธ ์ค๊ณ์ ๋ํ ์ผ๊ด์ฑ์ด ์๋ณด์ธ๋ค?
์ ๊ฐ ์ํ ๋ฏน ๋์์ธํจํด์ ์๋ฒฝํ๊ฒ ์ดํดํ์ง๋ ๋ชปํ๊ณ ์๋ค๋์ ์์์ฃผ์ธ์
ํผ ์ปดํฌ๋ํธ๋ผ๊ณ ํ๋๋ฐ ํผ์ปดํฌ๋ํธ์์ ์ด๋ค ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ์ง ์์งํ๊ฒ ์ ๋ณด์ด์ง์์ต๋๋ค!
์ปดํฌ๋ํธ๋ฅผ ๋ณด๊ณ ์์ผ๋ฉด ์ด ์ปดํฌ๋ํธ์์๋ ์ด๋ค ์ผ์ ํ ์ง๊ฐ ๋ณด์ฌ์ผํ๋๋ฐ ์ ๋ณด์ด์ง๊ฐ ์๋๋ค? |
@@ -0,0 +1,36 @@
+import {
+ FieldValues,
+ UseFormGetValues,
+ UseFormRegister,
+ UseFormSetValue,
+ UseFormWatch,
+ useForm,
+} from "react-hook-form";
+import * as S from "./styled";
+import { useEffect } from "react";
+
+type InputPropsType = {
+ type?: string;
+ placeholder?: string;
+ name: string;
+ re... | Unknown | Native input ์ดํธ๋ฆฌ๋ทฐํธ๋ฅผ ๊ณ ๋ คํด๋ด๋ ์ข์๊ฒ๊ฐ์ต๋๋ค
๊ทธ๋ฆฌ๊ณ watch์ ๊ฐ์ ๋ฉ์๋๋ฅผ ํด๋น ์ปดํฌ๋ํธ์์ ์์์ผํ ๊น์?
์ฌ์ฉ์ฒ์์ ์๊ณ ์์ด์ผํ๋ ๋ฉ์๋์ผํ
๋ฐ ๊ณผ๋ํ ์ ๋ณด๊ฐ ์๋๊น์ถ๋ค์! |
@@ -0,0 +1,8 @@
+import * as S from "./styled";
+
+const LabelText = (props: { children: string }) => {
+ const { children } = props;
+ return <S.InputLabelText>{children}</S.InputLabelText>;
+};
+
+export default LabelText; | Unknown | Props Type ์ปจ๋ฒค์
์ง์ผ์ฃผ์ธ์ |
@@ -0,0 +1,21 @@
+import * as S from "./styled";
+
+const TextContents = () => {
+ const userName = JSON.parse(localStorage.getItem("loginData") || "").name;
+
+ return (
+ <S.TextContentsGreatingContainer>
+ <S.GreetingNameContainer>
+ <S.TextContentsGreatingName>{userName}</S.TextContentsGreatingName... | Unknown | ์ด ๊ฒฝ์ฐ์ TextContents๊ฐ ์์ํ ํํ๋ผ๊ณ ํ ์์์๊น์ฌ? ์ฌ์ฉ์ฒ์์ userName์ ํ๋์ค๋ก ์ ๋ฌํด์คฌ๋ค๋ฉด ์์ํ์๊ฒ๊ฐ์๋ฐ์! |
@@ -0,0 +1,27 @@
+import Button from "../atoms/Button";
+import TextContents from "../atoms/TextContents";
+import TitleTex from "../atoms/TitleText";
+import * as S from "./styled";
+
+type MainPropsType = {
+ setIsInLogged: React.Dispatch<React.SetStateAction<boolean>>;
+};
+
+const Main = (props: MainPropsType) => ... | Unknown | setState๋ฅผ ํ๋์ค๋ก ์ ๋ฌํ์ง์๊ณ setState๋ฅผ ๋ํํ๋ ํจ์๋ฅผ ์ ๋ฌํ์ผ๋ฉด ์๋์ ๊ฐ์ด ํธํ๊ฒ ์ ๋ฌ์ด ๊ฐ๋ฅํ์ง์์์๊น์ฌ?
```ts
setIsInLogged: (state : boolean) => void
``` |
@@ -0,0 +1,190 @@
+/**
+ *
+ * ์ด๋ฆ
+ * ์ด๋ฉ์ผ (์ค๋ณต ํ์ธ ๋ฒํผ)
+ * ๋น๋ฐ๋ฒํธ
+ * ๋น๋ฐ๋ฒํธ ์ฌํ์ธ
+ * ํ์๊ฐ์
๋ฒํผ
+ *
+ */
+
+import Button from "../atoms/Button";
+import Input from "../atoms/Input";
+import LabelText from "../atoms/LabelText";
+import TitleTex from "../atoms/TitleText";
+import InputAndButton from "../molecules/InputAndButton"... | Unknown | Submit ํจ์๋ด๋ถ์์ ์ ํจ์ฑ๊ฒ์ฌ์ ๊ฒฐ๊ณผ๋ก ์ ์ ์๊ฒ ๋
ธ์ถ์ํค๋๊ฒ์ด ์๋๋ผ
Submit ์ด๋ฒคํธ๋ฅผ ๋ง์๋ฒ๋ ธ์ผ๋ฉด ์ด๋จ๊น์ฌ? ์๋ฅผ๋ค์ด ์ ํจ์ฑ๊ฒ์ฌ๋ฅผ ์คํจํ๋ค๋ฉด ๋ฒํผ์ disabled์ฒ๋ฆฌ๋ ๊ณ ๋ คํด๋ณผ์์์๊ฒ๊ฐ์ต๋๋ค
๊ทผ๋ฐ ์ด๊ฑด ๊ธฐํ๊ณผ ๋ง๋ฌผ๋ฆฌ๋๊ฑฐ๋๊น! |
@@ -0,0 +1,190 @@
+/**
+ *
+ * ์ด๋ฆ
+ * ์ด๋ฉ์ผ (์ค๋ณต ํ์ธ ๋ฒํผ)
+ * ๋น๋ฐ๋ฒํธ
+ * ๋น๋ฐ๋ฒํธ ์ฌํ์ธ
+ * ํ์๊ฐ์
๋ฒํผ
+ *
+ */
+
+import Button from "../atoms/Button";
+import Input from "../atoms/Input";
+import LabelText from "../atoms/LabelText";
+import TitleTex from "../atoms/TitleText";
+import InputAndButton from "../molecules/InputAndButton"... | Unknown | setLocalData ํจ์๋ค์์ ๋ณด๊ณ ์ด๊ฒ ๋ญ์ญํ ์ํ๋๊ฑฐ์ง ์ถ๋ค์
setLocalStorageData๋ผ๊ณ ์๋ช
ํ๋๊ฑด ์ด๋ ์๊น์ฌ |
@@ -0,0 +1,190 @@
+/**
+ *
+ * ์ด๋ฆ
+ * ์ด๋ฉ์ผ (์ค๋ณต ํ์ธ ๋ฒํผ)
+ * ๋น๋ฐ๋ฒํธ
+ * ๋น๋ฐ๋ฒํธ ์ฌํ์ธ
+ * ํ์๊ฐ์
๋ฒํผ
+ *
+ */
+
+import Button from "../atoms/Button";
+import Input from "../atoms/Input";
+import LabelText from "../atoms/LabelText";
+import TitleTex from "../atoms/TitleText";
+import InputAndButton from "../molecules/InputAndButton"... | Unknown | ์ด๋ฐ ์ ํจ์ฑ๊ฒ์ฌ๋ก์ง์ ์ธ๋ถ์ ๋ชจ๋ํํ์ฌ ์ฌ์ฉํ๋๊ฑด ์ด๋์๊น์?
๊ทธ๋ฆฌ๊ณ ๋ฆฌ์กํธ ํ
ํผ ์ฌ์ฉํ์ ๋ค๋ฉด https://www.react-hook-form.com/advanced-usage/#CustomHookwithResolver ์ด๋ฐ๊ฒ๋ ์์ด๋ค |
@@ -4,19 +4,20 @@ import { Routes, Route } from "react-router-dom";
// Components
import Home from "./Home";
+import SignUp from "./SignUp";
const Router = () => {
- const [isInLogged, setisInLogged] = useState(true);
+ const [isInLogged, setIsInLogged] = useState(false);
return (
<>
{isInLogg... | Unknown | ์ด๋ ๊ฒ ๋ก๊ทธ์ธ ์ํ์ฌ๋ถ๋ฅผ Router์์ ํ๋๊ฒ์ด ์๋๋ผ ์ ์ญ์ผ๋ก ๊ด๋ฆฌํ๋๊ฒ ์ด๋ ์๊น์ฌ?
๋ผ์ฐํฐ ์ปดํฌ๋ํธ๋ url์ ๋งคํ๋๋ ์ปดํฌ๋ํธ๋ฅผ ๋ ๋ํด์ฃผ๋ ์ญํ ์ด๋ผ๊ณ ์๊ฐ๋์ด์์ฌ! ํด๋น ์ปดํฌ๋ํธ๊ฐ ๋ก๊ทธ์ธ ์ํ์ฌ๋ถ๊น์ง ์์์ผํ์๊น์? |
@@ -0,0 +1,11 @@
+import SignUpForm from "../components/organisms/SignUpForm";
+
+type SignUpFormPropsType = {
+ setIsInLogged: React.Dispatch<React.SetStateAction<boolean>>;
+};
+
+const SignUp = (props: SignUpFormPropsType) => {
+ return <SignUpForm setIsInLogged={props.setIsInLogged} />;
+};
+
+export default Sign... | Unknown | ์ด๋ถ๋ถ๋ ์ ์ดํด๊ฐ ๋์ง์๋๋ฐ
Form ์ปดํฌ๋ํธ๊ฐ ๋ก๊ทธ์ธ์ฌ๋ถ๋ฅผ ์์์ผํ๋ ์ด์ ๊ฐ ์๋ค๊ณ ์๊ฐ๋ฉ๋๋ค..!
์ปดํฌ๋ํธ์๊ฒ ์ ๋ฌ๋๋ prop์ ์ปดํฌ๋ํธ๊ฐ ์์์ผํ๋ ์ ๋ณด์ ๋ฒ์๋ฅผ ๋ํ๋ธ๋ค๊ณ ๋ด์ |
@@ -0,0 +1,59 @@
+import accumulator.Accumulator;
+import accumulator.PostFixAccumulator;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+public class CalculatorTest {
+
+
+ ... | Java | ์ฌ๊ธฐ๋ ์ปจ๋ฒค์
์ด ์ซ... ๊ฐ ๋ฉ์๋ ์ฌ์ด๋ ๋์ ์ฃผ์๋๊ฒ ์์น์ด๊ณ IDE๋ฌธ์ ์ธ๊ฑด์ง ์ ๊ฐ ๋ณด๋ ํ๋ฉด์ด ๋ฌธ์ ์ธ๊ฑด์ง class ๋จ์์ ๋ฉ์๋ ๋จ์์ ๋ํ ๋ธ๋ญ์ด ๊ตฌ๋ถ๋์ง ์์ต๋๋ค. ์ด ๋ํ ์ง์ผ์ฃผ์
จ์ผ๋ฉด ์ข๊ฒ ์ต๋๋ค.
๋ํ ์ง๊ธ ํ๋์ ์์์ ๋ํ ํ
์คํธ ์ฝ๋๋ง ์์ฑํ์ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค. @ParameterizedTest ๋ฅผ ๊ณต๋ถํด๋ณด์๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,117 @@
+# Created by https://www.toptal.com/developers/gitignore/api/intellij
+# Edit at https://www.toptal.com/developers/gitignore?templates=intellij
+
+### Intellij ###
+# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
+# Reference: https:/... | Unknown | ์ด์ชฝ ๋ถ๋ถ ์ต์
์ผ๋ก ์ด๋ ํ ๋ด์ญ ์ถ๊ฐํ๋์ง ์๋ ค์ฃผ์ค ์ ์์๊น์? |
@@ -0,0 +1,9 @@
+package input;
+
+public interface Input {
+
+ public String selectInput();
+
+ public String expressionInput();
+
+} | Java | ์ ๋๋ฆญ์ ์ฌ์ฉํ ์ด์ ๊ฐ ์์๊น์? Input์ ๋ฐ์ดํธ ํน์ ๋ฌธ์์ด๋ก ๋ค์ด์ฌํ
๋ฐ ์ด๋ ํ ์๊ฐ์ผ๋ก ์ ๋๋ฆญ์ ์ฌ์ฉํ๋์ง๊ฐ ๊ถ๊ธํฉ๋๋น |
@@ -0,0 +1,9 @@
+
+import calculator.Calculator;
+
+public class main {
+
+ public static void main(String[] args) {
+ new Calculator().run();
+ }
+} | Java | IOException์ด ์ ํ๋ฆฌ์ผ์ด์
์ด ์คํ๋๋ ๋ถ๋ถ๊น์ง ์ ํ๋์์ต๋๋ค. ์ด๋ฌ๋ฉด ์
์ถ๋ ฅ ์์ธ ๋ฐ์ ์ ํ๋ก๊ทธ๋จ์ด ๋น์ ์์ ์ผ๋ก ์ข
๋ฃ๋ ๊ฐ๋ฅ์ฑ์ด ์๊ฒ ๋ค์. |
@@ -0,0 +1,20 @@
+package repository;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Repository {
+
+ private List<String> list = new ArrayList<>();
+
+ public void store(String expression, String result) {
+ StringBuilder formattedExpression = new StringBuilder(expression).append(" = ").ap... | Java | ์ ์ฅ์๋ฅผ List๋ก ํํํ์ ์ด์ ๋ฅผ ์ ์ ์์๊น์? ๋์ผํ ์ฐ์ฐ์์ด์ฌ๋ ๋ฆฌ์คํธ์ ์ถ๊ฐํ๋๊ฒ ๋ง์๊น์? ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ต๋ํ ์๋ ์ ์๋ ๋ฐฉ๋ฒ์ ์๊ฐํด๋ณด๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,19 @@
+import convertor.InfixToPostfixConverter;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+public class ChangToPostfixTest {
+
+ @ParameterizedTest
+ @Displ... | Java | ํ
์คํธ ์ฝ๋ ๋ด์ฉ์ด ๋ง์ด ๋ถ์คํฉ๋๋ค. ๋จ์ ํ
์คํธ์ ๋ํด์ ์๊ฐํด๋ณด์
จ์ผ๋ฉด ์ข๊ฒ ์ต๋๋ค.
์ ์ด๋ ์์ฑํ์ ์ฝ๋์์ View ์์ญ์ ์ ์ธํ ๋๋จธ์ง ์์ญ์ ํ
์คํธ๊ฐ ๊ฐ๋ฅํฉ๋๋ค. |
@@ -0,0 +1,22 @@
+package christmas.config;
+
+public enum ErrorMessage {
+ WRONG_DATE("์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค."),
+ WRONG_ORDER("์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค."),
+ OVER_MAX_ORDER("๋ฉ๋ด๋ ํ ๋ฒ์ ์ต๋ 20๊ฐ๊น์ง๋ง ์ฃผ๋ฌธํ ์ ์์ต๋๋ค."),
+ ONLY_DRINK_ORDER("์๋ฃ๋ง ์ฃผ๋ฌธํ ์ ์์ต๋๋ค.");
+
+ private static final String PREFIX = "[ERROR]";
+ private static fin... | Java | ํด๋น ์๋ฌ๋ฉ์์ง๋ ์ enum์ ์ฌ์ฉํ์
จ๋์?
์์๋ฅผ ๋ง๋๋ ๋ฐ ์ผ๋ฐ ํด๋์ค์ enum ํด๋์ค๋ฅผ ์ฌ์ฉํ์ ๊ธฐ์ค์ด ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,57 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.dto.OrderDTO;
+import christmas.util.IntParser;
+import christmas.util.OrderParser;
+import christmas.util.RetryExecutor;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+import java.util.List;
+
+publ... | Java | ์ค.. ์ด๋ฐ ๋ฐฉ๋ฒ์ผ๋ก ์ฌ์ฉํ๋ ํจ์ํ ์ธํฐํ์ด์ค๋ ์ฒ์ ๋ณด๋ ๊ฒ ๊ฐ์์ ๋ฐฐ์ธ ๋ถ๋ถ์ด ๋ง๋ค์ ใ
๐๐ |
@@ -0,0 +1,26 @@
+package christmas.domain;
+
+import java.util.Arrays;
+
+public enum Badge {
+ SANTA("์ฐํ", 20000),
+ TREE("ํธ๋ฆฌ", 10000),
+ STAR("๋ณ", 5000),
+ NOTHING("์์", 0);
+
+ private final String badgeName;
+ private final int threshold;
+
+ Badge(String badgeName, int threshold) {
+ t... | Java | stream ์ฌ์ฉ์ ์ํ์๋ ๊ฒ ๊ฐ์์! ํน์ ์ด๋ป๊ฒ ๊ณต๋ถํ๋ฉด ์ข์์ง... ํ์ด ์์ผ์ค๊น์? |
@@ -0,0 +1,94 @@
+package christmas.domain;
+
+import christmas.config.Constant;
+import christmas.dto.OrderDTO;
+import christmas.config.ErrorMessage;
+import christmas.config.MenuType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Bill implements CheckEventDate {
+ private final List<Order... | Java | ํด๋น ๋ฆฌ์คํธ๋ฅผ ํด๋์ค๋ก ๋ง๋ค์ด ์ ์ธ ํ๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,75 @@
+package christmas.domain;
+
+import christmas.config.Menu;
+import christmas.config.MenuType;
+
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+public enum Event {
+ CHRISTMAS(
+ "ํฌ๋ฆฌ์ค๋ง์ค ๋๋ฐ์ด ํ ์ธ",
+ true,
+ Bill::isNotPassedChristmas,
+ ... | Java | ์ค.. ํ ์ธ ๋ฆฌ์คํธ๋ฅผ enum ํด๋์ค๋ฅผ ๋ง๋ค์ด ์ ์ธํ ๊ฒ ๋๊ฒ ์ข์ ์์ด๋์ด๋ค์ ๐๐ |
@@ -0,0 +1,38 @@
+package christmas.util;
+
+import christmas.config.ErrorMessage;
+
+public class IntParser {
+ private static final int MAX_STRING_LENGTH = 11;
+
+ private IntParser() {
+ // ์ธ์คํด์ค ์์ฑ ๋ฐฉ์ง
+ }
+
+ public static int parseIntOrThrow(String numeric) {
+ validateNumericStringLength(... | Java | ์ธ์คํด์ค ์์ฑ ๋ฐฉ์ง๋ผ๋ ๊ฒ์ด ๋ฌด์์ธ์ง ์ ๋ชจ๋ฅด๊ฒ ๋๋ฐ ๋น ์์ฑ์๋ฅผ ๋ง๋ค์ด ๋๋ฉด ๋ฌด์์ด ์ข๋์..?? |
@@ -0,0 +1,91 @@
+package christmas.view;
+
+import christmas.dto.BenefitDTO;
+import christmas.dto.OrderDTO;
+
+import java.util.List;
+
+public class OutputView {
+ private void printMessage(ViewMessage message) {
+ System.out.println(message.getMessage());
+ }
+
+ private void printFormat(ViewMessage... | Java | ์๋ก์ด ๋ผ์ธ์ ๋ง๋ค๋๋ System.lineSeperator()๋ฅผ ์ถ์ฒ ํด์ฃผ์๋๋ผ๊ตฌ์. ์ฐธ๊ณ ํ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,145 @@
+package christmas.domain;
+
+import christmas.dto.OrderDTO;
+import christmas.config.ErrorMessage;
+import christmas.config.MenuType;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.pro... | Java | isInstanceOf์ hasMessage๋ฅผ ์ฌ์ฉํ๋ฉด ์ข ๋ ๊ผผ๊ผผํ ํ
์คํธ๋ฅผ ํ ์ ์๊ตฐ์!
๋ฐฐ์ ๊ฐ๋๋น ๐๐ |
@@ -0,0 +1,22 @@
+package christmas.config;
+
+public enum ErrorMessage {
+ WRONG_DATE("์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค."),
+ WRONG_ORDER("์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค."),
+ OVER_MAX_ORDER("๋ฉ๋ด๋ ํ ๋ฒ์ ์ต๋ 20๊ฐ๊น์ง๋ง ์ฃผ๋ฌธํ ์ ์์ต๋๋ค."),
+ ONLY_DRINK_ORDER("์๋ฃ๋ง ์ฃผ๋ฌธํ ์ ์์ต๋๋ค.");
+
+ private static final String PREFIX = "[ERROR]";
+ private static fin... | Java | ์ฌ์ค ์ ๋ ์์๋ฅผ ์ฒ๋ฆฌํ ๋ `enum`์ ์ฌ์ฉํ ์ง `class`๋ฅผ ์ฌ์ฉํ ์ง ๊ณ ๋ฏผ์ด ๋ง์์ต๋๋ค. ์ด๋ค ๊ธฐ์ค์ ์ธ์์ผ ํ ์ง๋ ์ค์ค๋ก ํ๋ฆฝํ์ง ๋ชปํ๊ตฌ์.
๊ทธ๋์ ์ฐ์ ์ ์๋ฌด๋ฐ ๊ธฐ๋ฅ ์์ด ์์๊ฐ๋ง ์ ์ฅํ๋ ๊ฒฝ์ฐ๋ `class`๋ฅผ ์ฌ์ฉํ๊ณ , ์ฝ๊ฐ์ ๊ธฐ๋ฅ์ด๋ผ๋ ํจ๊ป ์ฌ์ฉํ๋ค๋ฉด `enum`์ ์ฌ์ฉํ๋ ค๊ณ ํด๋ดค์ต๋๋ค.
์ฌ๊ธฐ `ErrorMessage`์์๋ ๊ณตํต์ ์ผ๋ก ์ฌ์ฉ๋๋ prefix์ suffix๋ฅผ `getMessage()`๋ฉ์๋์์ ํจ๊ป ํฉ์ณ์ ๋ฐํํ๋๋ก ๊ตฌ์ํ๊ธฐ ๋๋ฌธ์ `enum`์ ์ฌ์ฉํด๋ดค์ต๋๋ค. ์ฌ์ค `class`๋ก ์ฌ์ฉํด๋ ๋ฌด๋ฐฉํ ๊ฑฐ ๊ฐ๋ค์. ๐ |
@@ -0,0 +1,57 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.dto.OrderDTO;
+import christmas.util.IntParser;
+import christmas.util.OrderParser;
+import christmas.util.RetryExecutor;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+import java.util.List;
+
+publ... | Java | ์ ๋ ํจ์ํ ์ธํฐํ์ด์ค๋ผ๋ ๊ฑธ ์ฒ์ ์จ๋ดค๋ต๋๋ค! 3์ฃผ์ฐจ ์ฝ๋๋ฆฌ๋ทฐ๋ฅผ ํ๋ฉด์ ์ด๊นจ๋๋จธ๋ก ๋ฐฐ์ด๊ฑฐ๋ผ, @HongYeseul ๋๋ ์ด๋ฒ ์ฝ๋๋ฆฌ๋ทฐ๋ฅผ ๊ธฐํ๋ก ํ๋ฒ ๊ณต๋ถํด๋ณด์๋๊ฑด ์ด๋จ๊น์? ๐ |
@@ -0,0 +1,26 @@
+package christmas.domain;
+
+import java.util.Arrays;
+
+public enum Badge {
+ SANTA("์ฐํ", 20000),
+ TREE("ํธ๋ฆฌ", 10000),
+ STAR("๋ณ", 5000),
+ NOTHING("์์", 0);
+
+ private final String badgeName;
+ private final int threshold;
+
+ Badge(String badgeName, int threshold) {
+ t... | Java | ์ ๋ง ๋๋๊ฒ๋ ์ ๋ 1์ฃผ์ฐจ์ 2์ฃผ์ฐจ ์ฝ๋ ๋ฆฌ๋ทฐ๋ฅผ ํ๋ฉด์ ๋๋ถ๋ถ์ ๋ฆฌ๋ทฐ์ `stream`์ฌ์ฉ์ ์ ํ์๋๊ฒ ๋ถ๋ฝ๋ค! ๋ผ๋์์ผ๋ก ๋ง์ด ๋ฆฌ๋ทฐ๋ฅผ ๋จ๊ธฐ๊ณ ๋ค๋
์ด์. ๊ทธ๋ ๊ฒ ๋ง์ ๋ถ๋ค์ ์ฝ๋๋ฅผ ๋ณด๋ฉด์ `stream`๊ณผ ์ ์ ์น์ํด์ง๋ค ๋ณด๋ ์ ๋ `stream`์ ํ๋ฒ ์จ๋ณผ๊น? ๋ผ๋ ์๊ฐ์ด ๋ค์๊ณ , ๊ทธ๋ ๊ฒ ์ ์ ์ต์ํด์ง ๊ฒ ๊ฐ์์! ๐
4์ฃผ์ฐจ๊ฐ ๋๋ ์ง๊ธ์ ํ๊ต ๋์๊ด์์ '์ด๊ฒ์ด ์๋ฐ๋ค'๋ผ๋ ์ฑ
์ ๋น๋ ค์ ์ฝ๊ณ ์์ด์. ์๋ฐ์ ์ต์ํด์ง๊ธด ํ์ง๋ง, ๊ทธ๋๋ ์ปฌ๋ ์
์ด๋ ์คํธ๋ฆผ๊ณผ ๊ฐ์ ๋ถ๋ถ์ ์ ๋๋ก ๊ณต๋ถํ๊ณ ์ถ์ด์์. ์ด๋ฐ ์๋ฐ ์์ ์ ํ๋ ์ ํ์
์ ๊ธฐ๋ณธ ๋ฌธ๋ฒ์ ์ ๋ฆฌํ์๋ ์๊ฐ์... |
@@ -0,0 +1,38 @@
+package christmas.util;
+
+import christmas.config.ErrorMessage;
+
+public class IntParser {
+ private static final int MAX_STRING_LENGTH = 11;
+
+ private IntParser() {
+ // ์ธ์คํด์ค ์์ฑ ๋ฐฉ์ง
+ }
+
+ public static int parseIntOrThrow(String numeric) {
+ validateNumericStringLength(... | Java | ๋ชจ๋ ๋ฉ์๋๊ฐ `static`์ธ ์ ํธ๋ฆฌํฐ์ฑ ํด๋์ค์ ๊ฒฝ์ฐ `new` ํค์๋๋ฅผ ์ฌ์ฉํด ๊ฐ์ฒด๋ฅผ ์์ฑํ ํ์๊ฐ ์ ํ ์๋ค๊ณ ์๊ฐํ์ต๋๋ค. ๊ทธ๋์ ํน์๋ผ๋ ์๋์น ์๊ฒ ๊ฐ์ฒด๊ฐ ์์ฑ๋ ๊ฒฝ์ฐ๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํด ์์ฑ์๋ฅผ `private`์ผ๋ก ์ ์ธํ๊ณ , ๋น ์์ฑ์๋ก ๊ทธ๋ฅ ๋๊ธด ์ข ๋ฐ๋ฐํด์ ์ฃผ์์ ์ด์ง ๋ฌ์๋ดค์ต๋๋ค! ๐ |
@@ -0,0 +1,91 @@
+package christmas.view;
+
+import christmas.dto.BenefitDTO;
+import christmas.dto.OrderDTO;
+
+import java.util.List;
+
+public class OutputView {
+ private void printMessage(ViewMessage message) {
+ System.out.println(message.getMessage());
+ }
+
+ private void printFormat(ViewMessage... | Java | ์ข์ ์ง์ ๊ฐ์ฌํฉ๋๋ค! `lineSeperator()`์ ๋ํด์ ๊ณต๋ถํด๋ด์ผ๊ฒ ๋ค์! ๐ |
@@ -0,0 +1,94 @@
+package christmas.domain;
+
+import christmas.config.Constant;
+import christmas.dto.OrderDTO;
+import christmas.config.ErrorMessage;
+import christmas.config.MenuType;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Bill implements CheckEventDate {
+ private final List<Order... | Java | ๊ทธ๋ ๊ฒ๋ ํ ์ ์๊ฒ ๋ค์! ์์ `Orders`๋ผ๋ ํด๋์ค๋ฅผ ๋ง๋ค์ด ๋ฆฌ์คํธ๋ฅผ ๊ด๋ฆฌํ๋ ๋ฐฉ๋ฒ๋ ์ข์๋ณด์
๋๋ค!
๋ฆฌํฉํ ๋ง ํ ๋งํ ๋ถ๋ถ๋ค์ ์ง์ด์ฃผ์
์ ์ข์ต๋๋ค!! ๐ |
@@ -0,0 +1,456 @@
+# ์ด๋ฉ์ผ ๋ต์ฅ
+
+> ์ ๋ชฉ: 12์ ์ด๋ฒคํธ ๊ฐ๋ฐ ๋ณด๊ณ
+
+> ๋ณด๋ธ ์ฌ๋: ๊ฐ๋ฐํ <`dev@woowacourse.io`>
+>
+> ๋ฐ๋ ์ฌ๋: ๋น์ฆ๋์คํ <`biz@woowacourse.io`>
+
+์๋
ํ์ธ์. ๊ฐ๋ฐํ์
๋๋ค!
+
+12์ ์ด๋ฒคํธ ํ๋๋ ๊ฐ๋ฐ ์์ฒญ ์ฌํญ์ ์ ๋ฐ์ ๋ณด์์ต๋๋ค.
+์์ฒญํ์ ๋ด์ฉ๋ค์ ๋ชจ๋ ์ ์ฉํด๋ณด์๋๋ฐ์. ํน์ ๋๋ฝ๋ ๋ถ๋ถ์ด ์๋ค๋ฉด ๋ฐ๋ก ๋ง์ํด์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
+
+#### ๋ฐฉ๋ฌธ ๋ ์ง ์
๋ ฅ
+
+- ๋ฐฉ๋ฌธ ๋ ์ง๋ 1 ์ด์ 31 ์ดํ์ ์ซ์๋ก๋ง ์
๋ ฅ๋ฐ๊ฒ ํ์ต๋๋ค.
+- ๋จ, ์ฌ์ฉ์์ ๋ถ์ฃผ์๋ก ์
๋ ฅ... | Unknown | Readme.md ๋ฅผ ๊ผผ๊ผผํ ์ ์์ฑํ์ ๊ฒ ๊ฐ์์๐ |
@@ -0,0 +1,47 @@
+package christmas.config;
+
+import java.util.Arrays;
+
+public enum Menu {
+ SOUP("์์ก์ด์ํ", 6000, MenuType.APPETIZER),
+ TAPAS("ํํ์ค", 5500, MenuType.APPETIZER),
+ SALAD("์์ ์๋ฌ๋", 8000, MenuType.APPETIZER),
+ STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55000, MenuType.MAIN),
+ BARBECUE("๋ฐ๋นํ๋ฆฝ", 54000, MenuType.MAIN),... | Java | ์ ๋ ๊ฐ์ ๋ฐฉ์์ผ๋ก ๊ตฌํํ๋๋ฐ
Menu์ ํ์ฅ์ฑ์ ์๊ฐํด์ ์ฌ๋ฌ๊ฐ์ง ์นดํ
๊ณ ๋ฆฌ์ ํฌํจ๋ ์๋ ์๋ ์ ์ ์๊ฐํ์ฌ
์นดํ
๊ณ ๋ฆฌ๋ ๋ฐ๋ก ๋นผ๋๊ฒ ์ข๋ค๋ ์๊ฒฌ์ ๋ดค์ต๋๋ค!
์ฟ ํค๋์ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,18 @@
+package christmas.util;
+
+import java.util.function.Consumer;
+
+public class RetryExecutor {
+ private RetryExecutor() {
+ // ์ธ์คํด์ค ์์ฑ ๋ฐฉ์ง
+ }
+
+ public static void execute(Runnable action, Consumer<IllegalArgumentException> onError) {
+ try {
+ action.run();
+ ... | Java | Retry๋ฅผ ์ ๋ Controller์์ while๋ฌธ์ผ๋ก ํ์ฌ ์ง์ ๋ถํ ๊ฒ์ด ๊ณ ๋ฏผ์ด์๋๋ฐ
์ด๋ฐ ๋ฐฉ๋ฒ์ด ์์๋ค์! ๋ฐฐ์ ๊ฐ๋๋ค!! |
@@ -0,0 +1,91 @@
+package christmas.view;
+
+import christmas.dto.BenefitDTO;
+import christmas.dto.OrderDTO;
+
+import java.util.List;
+
+public class OutputView {
+ private void printMessage(ViewMessage message) {
+ System.out.println(message.getMessage());
+ }
+
+ private void printFormat(ViewMessage... | Java | ์ ๋ ์์ฃผ ์ฌ์ฉ๋๋ newLine()์ static์ผ๋ก ์ ์ธํ๋ฉด ์ข์ ๊ฒ ๊ฐ๋ค๊ณ ๋ง์๋๋ฆฌ๋ ค ํ๋๋ฐ
lineSeperator() ๋ผ๋๊ฒ ์์๊ตฐ์! ์ ๋ ๋ฐฐ์๊ฐ๊ฒ ์ต๋๋ค๐ |
@@ -0,0 +1,12 @@
+package christmas.config;
+
+public class Constant {
+ public static final int INIT_VALUE = 0;
+ public static final int FILTER_CONDITION = 0;
+ public static final int MIN_ORDER = 1;
+ public static final int MAX_ORDER = 20;
+
+ private Constant() {
+ // ์ธ์คํด์ค ์์ฑ ๋ฐฉ์ง
+ }
+} | Java | ๊ฐ์ธ์ ์ผ๋ก Constant ํด๋์ค์ ์์๋ค์ ๋ชจ์๋ฃ๋ ๊ฒ ๋ณด๋ค๋
๊ฐ ํด๋์ค์ ํ์ํ Constant ํด๋์ค๋ฅผ ๊ฐ๊ฐ ๋ง๋ค์ด์ ๋ง๋๋ ๊ฒ์ด ์๋ฏธ๋ฅผ ๋ ๋ช
ํํํ๊ณ ์์๋ณด๊ธฐ ์ฌ์ด ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,145 @@
+package christmas.domain;
+
+import christmas.dto.OrderDTO;
+import christmas.config.ErrorMessage;
+import christmas.config.MenuType;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.pro... | Java | ๋์ ํ์ธ ๋ณด๋ค๋ ์๋๋ฆฌ์ค๋ฅผ ์ ์ด์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์์
ํํ์ค 2๊ฐ, ํฐ๋ณธ์คํ
์ดํฌ 1๊ฐ, ์ ๋ก์ฝ๋ผ 2๊ฐ์ ํ ํ ์ฃผ๋ฌธ ๊ธ์ก 72000์์ ๋ฐํํ๋ค . ์ฝ๊ฐ ์ด๋ฐ์์ผ๋ก? |
@@ -0,0 +1,456 @@
+# ์ด๋ฉ์ผ ๋ต์ฅ
+
+> ์ ๋ชฉ: 12์ ์ด๋ฒคํธ ๊ฐ๋ฐ ๋ณด๊ณ
+
+> ๋ณด๋ธ ์ฌ๋: ๊ฐ๋ฐํ <`dev@woowacourse.io`>
+>
+> ๋ฐ๋ ์ฌ๋: ๋น์ฆ๋์คํ <`biz@woowacourse.io`>
+
+์๋
ํ์ธ์. ๊ฐ๋ฐํ์
๋๋ค!
+
+12์ ์ด๋ฒคํธ ํ๋๋ ๊ฐ๋ฐ ์์ฒญ ์ฌํญ์ ์ ๋ฐ์ ๋ณด์์ต๋๋ค.
+์์ฒญํ์ ๋ด์ฉ๋ค์ ๋ชจ๋ ์ ์ฉํด๋ณด์๋๋ฐ์. ํน์ ๋๋ฝ๋ ๋ถ๋ถ์ด ์๋ค๋ฉด ๋ฐ๋ก ๋ง์ํด์ฃผ์๋ฉด ๊ฐ์ฌํ๊ฒ ์ต๋๋ค.
+
+#### ๋ฐฉ๋ฌธ ๋ ์ง ์
๋ ฅ
+
+- ๋ฐฉ๋ฌธ ๋ ์ง๋ 1 ์ด์ 31 ์ดํ์ ์ซ์๋ก๋ง ์
๋ ฅ๋ฐ๊ฒ ํ์ต๋๋ค.
+- ๋จ, ์ฌ์ฉ์์ ๋ถ์ฃผ์๋ก ์
๋ ฅ... | Unknown | ํด๋์ค๋ณ๋ก ์์ธ์ฌํญ ์์๋ ๊ธฐ๋ฅ์ ๊ผผ๊ผผํ ์์ฑํด์ ์ข์์ต๋๋ค! ํ๋ก๊ทธ๋จ์ ์กฐ๊ธ ์์ฝํด์ ์ ๋ฆฌํ ์ ๋ณด๋ ์์ผ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,12 @@
+package christmas.config;
+
+public class Constant {
+ public static final int INIT_VALUE = 0;
+ public static final int FILTER_CONDITION = 0;
+ public static final int MIN_ORDER = 1;
+ public static final int MAX_ORDER = 20;
+
+ private Constant() {
+ // ์ธ์คํด์ค ์์ฑ ๋ฐฉ์ง
+ }
+} | Java | ์ฃผ๋ฌธ ์๋์ ๋ํ ์์๋ค์ ์ ์ฅํ์
จ๋๋ฐ, ํด๋์ค๋ช
์ด Constant์ฌ์ init value ๋ filter condition ์์๋ช
์ ์๋ฏธ๊ฐ ์ข ๋ช
ํํ์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค. ํ์ธ์ด ์ฝ๊ธฐ์ ์ฉ๋๊ฐ ๋ช
ํํ์ง ์์๊ฒ ๊ฐ์ต๋๋ค!
ํด๋์ค๋ช
์ OrderConstatns ์ ๊ฐ์ด ํ๋ฉด ์ข์๊ฒ ๊ฐ๋ค์.
์ต๋ ์ฃผ๋ฌธ ๊ฐฏ์๋ฅผ ์ธ์ ๋ ์ ์ฑ
๋ณ๊ฒฝ์ ๋ฐ๋ผ ๋ฐ๊พธ์๋ ค๊ณ ๋นผ๋ ๊ฒ์ด๋ผ๋ฉด ํจํค์ง ์์น๋ฅผ ๊ณ ๋ คํด๋ณด๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,22 @@
+package christmas.config;
+
+public enum ErrorMessage {
+ WRONG_DATE("์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค."),
+ WRONG_ORDER("์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค."),
+ OVER_MAX_ORDER("๋ฉ๋ด๋ ํ ๋ฒ์ ์ต๋ 20๊ฐ๊น์ง๋ง ์ฃผ๋ฌธํ ์ ์์ต๋๋ค."),
+ ONLY_DRINK_ORDER("์๋ฃ๋ง ์ฃผ๋ฌธํ ์ ์์ต๋๋ค.");
+
+ private static final String PREFIX = "[ERROR]";
+ private static fin... | Java | ์ ๋ `class`๋ก ๊ตฌํํ๋๋ฐ ๋ค๋ฅธ ๋ถ๋ค ๋ณด๊ณ `enum`์ผ๋ก ๊ตฌํํด๋ณด๋ ค๊ตฌ์! ์ด๊ฑฐํ์ผ๋ก ๊ตฌํํ์ ๋๋ง์ ์ฅ์ ์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค! "์๋ฌ ๋ชจ์์ง์์ ์ด๋ฐ ์๋ฌ๋ฅผ ๊ฐ์ ธ์ค๋ ๊ตฌ๋~" ๋ผ๊ณ ์ฝ๊ธฐ ๋ ์ข์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,47 @@
+package christmas.config;
+
+import java.util.Arrays;
+
+public enum Menu {
+ SOUP("์์ก์ด์ํ", 6000, MenuType.APPETIZER),
+ TAPAS("ํํ์ค", 5500, MenuType.APPETIZER),
+ SALAD("์์ ์๋ฌ๋", 8000, MenuType.APPETIZER),
+ STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55000, MenuType.MAIN),
+ BARBECUE("๋ฐ๋นํ๋ฆฝ", 54000, MenuType.MAIN),... | Java | ```suggestion
SOUP("์์ก์ด์ํ", 6_000, MenuType.APPETIZER),
```
๋ณ๊ฑฐ ์๋์ง๋ง ๊ฐ๊ฒฉ์ 3์๋ฆฌ ์ซ์ ๋ง๋ค '-' ์ธ๋๋ฐ ๋ฃ์ด์ฃผ์๋ฉด ๊ฐ๋
์ฑ์ ์ข์๊ฒ๊ฐ์ต๋๋ค. ์ค์๋ ์ค์ฌ์ฃผ๊ณ ์ |
@@ -0,0 +1,47 @@
+package christmas.config;
+
+import java.util.Arrays;
+
+public enum Menu {
+ SOUP("์์ก์ด์ํ", 6000, MenuType.APPETIZER),
+ TAPAS("ํํ์ค", 5500, MenuType.APPETIZER),
+ SALAD("์์ ์๋ฌ๋", 8000, MenuType.APPETIZER),
+ STEAK("ํฐ๋ณธ์คํ
์ดํฌ", 55000, MenuType.MAIN),
+ BARBECUE("๋ฐ๋นํ๋ฆฝ", 54000, MenuType.MAIN),... | Java | ```suggestion
public static Menu getMenuBy(String menuName) {
```
์ ๋ง ๊ฐ์ ์คํ์ผ์ด ๋ฌ๋ผ์ ์ ๊ฐ ๊ผญ ์ ๋ต์ ์๋์ง๋ง ๋ฉ์๋๋ช
์ถ์ฒ๋๋ฆฝ๋๋ค! |
@@ -0,0 +1,5 @@
+package christmas.config;
+
+public enum MenuType {
+ APPETIZER, MAIN, DESSERT, DRINK
+} | Java | ์นดํ
๊ณ ๋ฆฌ ๋ฐ๋ก ์ด๊ฑฐํด์ ๊ตฌ๋ถํ์ ๊ฒ ๋์ค์ ๋ฌธ์๋ก ๋น๊ตํ๋ ๊ฒ๋ณด๋ค ์์ ์ฑ ์๊ฒ ๊ตฌํํ์ ๊ฒ ๊ฐ์์ |
@@ -0,0 +1,26 @@
+package christmas.domain;
+
+import java.util.Arrays;
+
+public enum Badge {
+ SANTA("์ฐํ", 20000),
+ TREE("ํธ๋ฆฌ", 10000),
+ STAR("๋ณ", 5000),
+ NOTHING("์์", 0);
+
+ private final String badgeName;
+ private final int threshold;
+
+ Badge(String badgeName, int threshold) {
+ t... | Java | ์ ๋ ์ด๋ ๊ฒ ๊ตฌํํ๋๋ฐ ๊ณ ๋ฏผํ๋ค๋ณด๋
๋ฑ์ง๊ฐ ๊ฐ์ง ๊ฐ๋
์ด `๊ฐ๊ฒฉ` ์ธ์ง `๋ฒ์`์ธ์ง ์ทจํฅ ์ฐจ์ด๋ผ๊ณ ์๊ฐํ๋๋ฐ ์ ๋ `๋ฒ์`๊ฐ ์กฐ๊ธ๋ ๋ฑ์ง๊ฐ ๊ฐ์ง ๊ฐ๋
์ด๋ผ๊ณ ์๊ฐ์ด ๋ค๋๋ผ๊ตฌ์ ๊ทธ๋์ ์์ ๊ธฐ์ค ๊ฐ๊ฒฉ๋์ ๋ฒ์๋ฅผ ๋ฃ์ด๋ณด๋ ๊ณ ๋ฏผ๋ ํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,81 @@
+package christmas.domain;
+
+import christmas.config.ErrorMessage;
+
+import java.util.Arrays;
+
+public class Date implements CheckEventDate {
+ private static final int WEEK_NUM = 7;
+ private static final int WEEK_DIFF = 4;
+ private static final int FIRST_DAY = 1;
+ private static fina... | Java | ์ด ํด๋์ค ๊ต์ฅํ ์ข์ ๊ฒ ๊ฐ์์ Date๋ผ๋ ๊ฐ๋
๋ ์ ๋ด๊ฒจ์๊ณ ํฌ๋ฆฌ์ค๋ง์ค๋ ์์ ์์ผ์ ๋ค๋ฅธ ๊ณณ์์ ๋ฐ์์ค๋ ๋ฐฉ์์ผ๋ก ๋ฐ๊พผ๋ค๋ฉด ํด๋น ์ ๋ณด๋ง ๊ฐ์๋ผ์ฐ๋ฉด ๊ณ์ ๋์๋๋ ํด๋์ค ๊ฐ์์.
java.time ์ด๋ผ๋ ์๋ฐ ํจํค์ง๋ฅผ ํ๋ ์ถ์ฒํด๋๋ฆด๊ฒ์
```
import java.time.LocalDate;
import java.time.DayOfWeek;
import java.time.format.TextStyle;
import java.util.Locale;
public class Main {
public static void main(Stri... |
@@ -0,0 +1,75 @@
+package christmas.domain;
+
+import christmas.config.Menu;
+import christmas.config.MenuType;
+
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+public enum Event {
+ CHRISTMAS(
+ "ํฌ๋ฆฌ์ค๋ง์ค ๋๋ฐ์ด ํ ์ธ",
+ true,
+ Bill::isNotPassedChristmas,
+ ... | Java | ์ค ํ ์ธ์ด ์ ์ฉ ๋์๋์ง ๋ถ๋ฆฐ๊ฐ์ ๋ฃ์ด๋์ ๊ฒ์ด ๋งค์ฐ ์ข์๋ณด์
๋๋ค! ๋ฐฐ์๊ฐ๋๋ค.
ํด๋น ๋ด์ฉ์ ๋ฑ์ง์๋ ์ ์ฉํ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,52 @@
+package christmas.util;
+
+import christmas.dto.OrderDTO;
+import christmas.config.ErrorMessage;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+public class OrderParser {
+ private static final String SEQUENCE_DELIMITER = ",";
+ private static final St... | Java | ```suggestion
private static final Pattern ORDER_PATTERN = Pattern.compile("[^-]+-[0-9]+"); // ์ปดํ์ผ๋ ํจํด
``` |
@@ -0,0 +1,110 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.utils.EventSettings;
+import christmas.parser.EventDetailsParser;
+import christmas.view.EventView;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class ChristmasEventController implements EventController ... | Java | 3์ฃผ ์ฐจ ์น ๋ฐฑ์๋ ๊ณตํต ํผ๋๋ฐฑ์ผ๋ก ํ๋(์ธ์คํด์ค ๋ณ์)์ ์๋ฅผ ์ค์ด๊ธฐ ์ํด ๋
ธ๋ ฅํ๋ค๋ผ๋ ํญ๋ชฉ์ด ์์๋๋ฐ์ ์ค๋ณต๋๋ ํญ๋ชฉ๋ค์ ํ๋์ result๋ก ๋ฌถ์ด์ ํ๋ฒ ๊ด๋ฆฌ๋ฅผ ํด๋ณด๋ ๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,110 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.utils.EventSettings;
+import christmas.parser.EventDetailsParser;
+import christmas.view.EventView;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class ChristmasEventController implements EventController ... | Java | ๊ฐ์ธ์ ์ธ ์๊ฐ์ผ๋ก๋ ์ปจํธ๋กค๋ฌ์์ ๋๋ฉ์ธ์์ ํด์ผ ํ ์ญํ ๋ค์ ๋ง์ด ๊ฐ์ง๊ณ ์๋ ๊ฒ ๊ฐ์์ ์ด๋ฐ ๊ณ์ฐ์ด๋ ํ ์ธ์ ๋ํ ๋ด์ฉ๋ค์ ๋ฐ๋ก ์ด ์ญํ ์ ๋ด๋นํ๋ ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด์ ๊ทธ๊ณณ์์ ์ค์ค๋ก ์ผ์ ํ ์ ์๋๋ก ๊ฐ์ฒด์งํฅ์ ์ผ๋ก ์ค๊ณํด ๋ณด๋ ๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,110 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.utils.EventSettings;
+import christmas.parser.EventDetailsParser;
+import christmas.view.EventView;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class ChristmasEventController implements EventController ... | Java | ํ๋์ ํจ์์์ ๋ค์ํ ์ผ์ ํ๊ณ ์๋ ๊ฒ ๊ฐ์๋ฐ ๊ธฐ๋ฅ์ ๋ถ๋ฆฌํด ๋ณด๋ ๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,26 @@
+package christmas.controller;
+
+import christmas.domain.Bill;
+import christmas.domain.Order;
+import christmas.domain.ReservationDay;
+
+import java.math.BigDecimal;
+
+public interface EventController {
+
+ void applyEvent(ReservationDay day, Order order, Bill bill);
+
+ void showEventDiscoun... | Java | EventController๋ฅผ interface๋ก ๋ง๋ค์ด์ ์ด๋ฒคํธ์ ๋ํ ๋ก์ง์ ๊ด๋ฆฌํ๋ ๊ฒ๋ณด๋ค ์ด๋ฒคํธ ๊ด๋ จ ๋๋ฉ์ธ์ interface๋ก ๋ง๋ค์ด์ ์ฌ์ฉํด ๋ณด๋ ๊ฑด ์ด๋จ๊น์? ๊ฐ์ฒด์งํฅ์ ๋ค๋ฃฌ ์ค๋ธ์ ํธ ์์ ์์ ๋น์ทํ ๋ด์ฉ์ด ์์ด์ ๋งํฌ ๋จ๊น๋๋ค. https://github.com/eternity-oop/object/tree/master/chapter13/src/main/java/org/eternity/movie/step02 |
@@ -0,0 +1,32 @@
+package christmas.domain;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigDecimal;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class BadgeTest {
+
+ @Test
+ @DisplayName("์ฐํ_๋ฑ์ง_๊ฒฝ๊ณ๊ฐ_ํ
์คํธ")
+ void getBadge_SantaBadgeAmount_Shoul... | Java | import static org.junit.jupiter.api.Assertions.*; ๋ฅผ ์ฌ์ฉํ๊ธฐ๋ณด๋ค ๋ ๊ฐํธํ๊ฒ ํ
์คํธ๋ฅผ ํ ์ ์๋ import static org.junit.jupiter.api.Assertions.*;๋ฅผ ์ฌ์ฉํด ๋ณด๋ ๊ฑด ์ด๋จ๊น์?
https://jwkim96.tistory.com/168 |
@@ -0,0 +1,36 @@
+package christmas.domain;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+import java.math.BigDecimal;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+public class BillTest {
+ Order testOrder = new Order();
+
+ @Test
+ @DisplayName("์ ์ฒด_๊ฐ๊ฒฉ_๊ณ์ฐ_ํ
์คํธ")
... | Java | given when then ํจํด์ ์ฌ์ฉํด์ ํ
์คํธ์ฝ๋๋ฅผ ๋๋ ๋ณด๋ ๊ฑด ์ด๋จ๊น์?
https://brunch.co.kr/@springboot/292 |
@@ -0,0 +1,89 @@
+package christmas.domain;
+
+import christmas.utils.ErrorMessage;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+class OrderTest {
+ String validInput = "ํฐ๋ณธ์คํ
์ด... | Java | ๋ฐ๋ณต๋๋ Order order = new Order(); ๋ @BeforeAll void setUp()์ ํ์ฉํ์ฌ์ ๋ฏธ๋ฆฌ ์์ฑํด ์ฃผ๋ ๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,110 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.utils.EventSettings;
+import christmas.parser.EventDetailsParser;
+import christmas.view.EventView;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class ChristmasEventController implements EventController ... | Java | ํน์ ๋ฉ์๋์์๋ง ์ฌ์ฉ๋๋ ํ๋๋ ๋ก์ปฌํํ๊ณ ๋๋จธ์ง ๊ฐ์ฒดํํ์ฌ ํ๋ ์๋ฅผ ์ค์ฌ๋ณด๋ ๊ฑด ์ด๋จ๊น์?
์ถ๊ฐ๋ก `final` ํค์๋๋ฅผ ์๋ตํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,69 @@
+package christmas.controller;
+
+import christmas.domain.Bill;
+import christmas.domain.Order;
+import christmas.domain.ReservationDay;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+public class PlannerController {
+ private final Order order;
+ private final Reservatio... | Java | ์์ธ ๋ฉ์์ง ์ถ๋ ฅ๋ `OutputView` ์์ ์ฒ๋ฆฌํ๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,69 @@
+package christmas.controller;
+
+import christmas.domain.Bill;
+import christmas.domain.Order;
+import christmas.domain.ReservationDay;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
+public class PlannerController {
+ private final Order order;
+ private final Reservatio... | Java | ํ๋๊ฐ ์์ฑ์๊ฐ ์๋ ๋ค๋ฅธ ๋ฉ์๋์์ ์ด๊ธฐํ๋๋๊ฒ ์ด์ํ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,35 @@
+package christmas.domain;
+
+import java.math.BigDecimal;
+
+public enum Badge {
+ SANTA_BADGE("์ฐํ", new BigDecimal(20000)),
+ TREE_BADGE("ํธ๋ฆฌ", new BigDecimal(10000)),
+ STAR_BADGE("๋ณ", new BigDecimal(5000));
+
+ private final String name;
+ private final BigDecimal standardAmount;
+
+ ... | Java | ์ด๋ฆ์ด `null`์ด ๋๋ ๊ฒฝ์ฐ๊ฐ ์์๊น์? |
@@ -0,0 +1,110 @@
+package christmas.controller;
+
+import christmas.domain.*;
+import christmas.utils.EventSettings;
+import christmas.parser.EventDetailsParser;
+import christmas.view.EventView;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class ChristmasEventController implements EventController ... | Java | `BigDecimal` ์ ๊ฒฝ์ฐ ์ผ๋ถ ๊ฐ์ ์บ์ฑํ๊ณ ์์ด ์์ฑ์ ๋์ `valueOf()` ๋ฉ์๋๋ฅผ ํตํด ๊ฐ์ฒด๋ฅผ ์ป๋๊ฒ ๋ ํจ์จ์ ์
๋๋ค! |
@@ -0,0 +1,35 @@
+package christmas.domain;
+
+import java.math.BigDecimal;
+
+public enum Badge {
+ SANTA_BADGE("์ฐํ", new BigDecimal(20000)),
+ TREE_BADGE("ํธ๋ฆฌ", new BigDecimal(10000)),
+ STAR_BADGE("๋ณ", new BigDecimal(5000));
+
+ private final String name;
+ private final BigDecimal standardAmount;
+
+ ... | Java | `null` ๋ฐํ์ด ์ํํ ๊ฒ ๊ฐ์์! `NONE` ๊ณผ ๊ฐ์ ์ธ์คํด์ค๋ฅผ ์ถ๊ฐํ์ฌ ์ด๋ฅผ ๋ฐํํ๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,32 @@
+package christmas.domain;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+public class Bill {
+ private final Map<Menu, Integer> orderDetails;
+
+ private BigDecimal totalPrice = new BigDecimal(0);
+
+ public Bill(Order order) {
+ this.orderDetails = order.getOrderDetails();
... | Java | ๋ฉ๋ด ์
๋ ฅ ์ ์ด๋ฆ, ์๋ ์ธ์ ๋ค๋ฅธ ๊ฐ์ด ์ถ๊ฐ๋๋๊ฑธ ๊ฐ์ํ์ฌ `Map<K, V>` ๋์ ๋ณ๋์ ํด๋์ค ์ฌ์ฉ์ ์ด๋จ๊น์? |
@@ -0,0 +1,29 @@
+package christmas.domain;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class DecemberCalendar {
+ private final List<Integer> weekdays = Stream.of(3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 24, 25, 26, 27, 28, 31)
+ ... | Java | `Arrays.asList()` ๋์ Stream์ ์ฌ์ฉํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -0,0 +1,62 @@
+package christmas.domain;
+
+import christmas.utils.ErrorMessage;
+import christmas.parser.Parser;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static christmas.domain.validator.OrderValidator.*;
+
+public class Order {
+ private final Map<Menu, Integer> ord... | Java | `int`์ ๊ฒฝ์ฐ ํ๋์์ ๊ฐ์ ๋์
ํ์ง ์์๋ ๊ฐ์ฒด ์์ฑ์ 0์ผ๋ก ์ด๊ธฐํ ๋ฉ๋๋ค! |
@@ -0,0 +1,62 @@
+package christmas.domain;
+
+import christmas.utils.ErrorMessage;
+import christmas.parser.Parser;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static christmas.domain.validator.OrderValidator.*;
+
+public class Order {
+ private final Map<Menu, Integer> ord... | Java | ๋๋ฉ์ธ์ด View์ ์์กดํ๋ ๊ฒ ๊ฐ์ต๋๋ค! `OutputView`์์ `Order`์ ๋ํ ๊ฐ์ ๊ฐ์ ธ์จ ํ ์ถ๋ ฅํ๋๊ฑด ์ด๋จ๊น์? |
@@ -0,0 +1,27 @@
+package racingcar.dao;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
+import racingcar.dao.entity.GameEntity;
+
+public class InsertGameDao {
+
+ private final SimpleJdbcInsert i... | Java | ์ด๊ฑฐ ์ธ ์ ๋ ? |
@@ -2,13 +2,30 @@ package com.petqua.application.product.review
import com.amazonaws.services.s3.AmazonS3
import com.ninjasquad.springmockk.SpykBean
+import com.petqua.application.product.dto.MemberProductReviewReadQuery
import com.petqua.application.product.dto.ProductReviewCreateCommand
import com.petqua.common... | Kotlin | ์ฌ๊ธฐ ์๋ memberProductReviews๊ฒ์ฆํ๋ ์ฝ๋๊ฐ ์กฐํผ ๊ธด๋ฐ
์... ๋ฉ์๋๋ก ๋ถ๋ฆฌํ๋ฉด ์ด๋จ๊น์??
valdiateMemberProductReview(memberProductReviewB, productReivewB, orderB); |
@@ -6,6 +6,10 @@ import com.linecorp.kotlinjdsl.render.jpql.JpqlRenderer
import com.petqua.common.domain.dto.CursorBasedPaging
import com.petqua.common.util.createQuery
import com.petqua.domain.member.Member
+import com.petqua.domain.order.Order
+import com.petqua.domain.order.OrderPayment
+import com.petqua.domain.... | Kotlin | createdAt ๋์ id๋ก ์ ๋ ฌํด๋ ๋ฌด๋ฐฉํ ๊ฑฐ ๋ง์๊น์??
id๊ฐ ์ธ๋ฑ์ค๋ผ ๋ ํจ์จ์ ์ผ ๊ฒ ๊ฐ์์์! |
@@ -1,12 +1,14 @@
package com.petqua.application.product.review
+import com.petqua.application.product.dto.MemberProductReviewReadQuery
+import com.petqua.application.product.dto.MemberProductReviewResponse
+import com.petqua.application.product.dto.MemberProductReviewsResponse
import com.petqua.application.product... | Kotlin | ids๋ฅผ ๋ฐ๊ฒ ๋ฐ๊พธ๊ณ ์ฌํ์ฉ ๋ ์ข๋ค์!! |
@@ -1,5 +1,6 @@
package com.petqua.presentation.product
+import com.petqua.application.product.dto.MemberProductReviewsResponse
import com.petqua.application.product.dto.ProductReviewStatisticsResponse
import com.petqua.application.product.dto.ProductReviewsResponse
import com.petqua.application.product.review.Pr... | Kotlin | URI ์ข๋ค์ฉ๐ |
@@ -2,13 +2,30 @@ package com.petqua.application.product.review
import com.amazonaws.services.s3.AmazonS3
import com.ninjasquad.springmockk.SpykBean
+import com.petqua.application.product.dto.MemberProductReviewReadQuery
import com.petqua.application.product.dto.ProductReviewCreateCommand
import com.petqua.common... | Kotlin | + ์กฐํ ๋ฐ์ดํฐ์ ๋ํ ๊ฒ์ฆ์ ๋ชจ๋ ํ๋๋ฅผ ํ ํ์๋ ์๋ค๊ณ ์๊ฐํฉ๋๋ค! |
@@ -0,0 +1,24 @@
+package com.requestrealpiano.songrequest.controller;
+
+import com.requestrealpiano.songrequest.service.AccountService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+i... | Java | ๋ค๋ฅธ ์ปจํธ๋กค๋ฌ์์๋ ResponseStatus๋ก ์ง์ ํ๋๋ฐ ์ฌ๊ธด ResponseEntity๋ก ์ง์ ํ๊ตฐ์ ์ด๋ค ์ด์ ๋ก ์ง์ ํ๋์ง ๊ถ๊ธํฉ๋๋ค. |
@@ -2,18 +2,18 @@
import com.requestrealpiano.songrequest.domain.song.searchapi.response.SearchApiResponse;
import com.requestrealpiano.songrequest.global.response.ApiResponse;
+import com.requestrealpiano.songrequest.global.response.StatusCode;
import com.requestrealpiano.songrequest.service.SongService;
import ... | Java | ์ด ๋ถ๋ถ์ ์ปจํธ๋กค๋ฌ์์ Validation์ ์ก๊ธฐ๋ณด๋จ Validation DTO๋ฅผ ์์ฑํด์ ํด๋น ๊ฐ์ฒด์์ ๊ด๋ฆฌํ๋ฉด ๋์ฑ ํธ๋ฆฌํ๊ณ ๋ณด๊ธฐ๊ฐ ์ข์๋ฏ ํฉ๋๋ค. |
@@ -1,5 +1,6 @@
package com.requestrealpiano.songrequest.domain.account;
+import com.requestrealpiano.songrequest.security.oauth.OAuthAttributes;
import com.requestrealpiano.songrequest.domain.base.BaseTimeEntity;
import com.requestrealpiano.songrequest.domain.letter.Letter;
import lombok.AccessLevel;
@@ -8,9 +9,... | Java | ์ใ
ใ
ใ
ใ
OAuthId๋ฅผ ํ์ธํ์๊ณ ๋ฐ๊พธ์
จ๊ตฐ์. |
@@ -1,5 +1,6 @@
package com.requestrealpiano.songrequest.domain.account;
+import com.requestrealpiano.songrequest.security.oauth.OAuthAttributes;
import com.requestrealpiano.songrequest.domain.base.BaseTimeEntity;
import com.requestrealpiano.songrequest.domain.letter.Letter;
import lombok.AccessLevel;
@@ -8,9 +9,... | Java | ์ฌ๊ธฐ ์ ํ์๋ MaginNumber 0์ ์ด๋ค์๋ฏธ์ธ๊ฐ์? |
@@ -11,6 +11,12 @@ public enum ErrorCode {
METHOD_NOT_ALLOWED(405, "์ง์ํ์ง ์๋ ์์ฒญ ๋ฉ์๋ ์
๋๋ค."),
INTERNAL_SERVER_ERROR(500, "์๋ฒ์์ ์์ฒญ์ ์ฒ๋ฆฌํ์ง ๋ชปํ์ต๋๋ค."),
+ // Auth
+ UNAUTHENTICATED_ERROR(401, "์ธ์ฆ์ด ํ์ํฉ๋๋ค. ๋ก๊ทธ์ธ ์ดํ ๋ค์ ์๋ ํด์ฃผ์ธ์."),
+ JWT_INVALID_ERROR(400, "์ฌ๋ฐ๋ฅธ ์ธ์ฆ ์ ๋ณด๊ฐ ์๋๋๋ค. ๋ค์ ๋ก๊ทธ์ธ ํด์ฃผ์ธ์."),
+ JWT_EXPIRATION_ERRO... | Java | ์ฌ๊ธฐ์ JWT ์ธ์ฆํ ๋ ๋๊ฐ์ง ์กฐ๊ฑด์ด ์๋๊ตฐ์.
1. JWT๊ฐ ์๋ Token์ ์ฌ์ฉํ ๊ฒฝ์ฐ - 400
2. JWT๋ ๋ง๋๋ฐ ์ฌ๋ฐ๋ฅธ JWT๊ฐ ์๋ ๊ฒฝ์ฐ - 401
๋๊ฐ์ง ๊ณ ๋ คํ์๋๊ฑด ์ด๋ ์ ์ง ๋๋ ์๊ฒฌ์ด ๊ถ๊ธํฉ๋๋ค. |
@@ -11,6 +11,12 @@ public enum ErrorCode {
METHOD_NOT_ALLOWED(405, "์ง์ํ์ง ์๋ ์์ฒญ ๋ฉ์๋ ์
๋๋ค."),
INTERNAL_SERVER_ERROR(500, "์๋ฒ์์ ์์ฒญ์ ์ฒ๋ฆฌํ์ง ๋ชปํ์ต๋๋ค."),
+ // Auth
+ UNAUTHENTICATED_ERROR(401, "์ธ์ฆ์ด ํ์ํฉ๋๋ค. ๋ก๊ทธ์ธ ์ดํ ๋ค์ ์๋ ํด์ฃผ์ธ์."),
+ JWT_INVALID_ERROR(400, "์ฌ๋ฐ๋ฅธ ์ธ์ฆ ์ ๋ณด๊ฐ ์๋๋๋ค. ๋ค์ ๋ก๊ทธ์ธ ํด์ฃผ์ธ์."),
+ JWT_EXPIRATION_ERRO... | Java | ์ฌ๊ธฐ์๋ ์ด์ผ๊ธฐ ํ๊ณ ์ถ์๊ฒ์ด ์์ต๋๋ค. ํด๋น API๋ฅผ ์ฌ์ฉํ ๋ ๊ถํ์ ๋ง๋ ๊ฒ์ด 403์ด์ง๋ง ๋ง์ฝ ๋น๊ณต๊ฐ๋ ์ ๋ณด๋ฅผ API๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ ธ์ฌ๋๋ 404๋ก Not Found๋ก ๋์์ผํ๋ค๊ณ ํ๋๊ตฐ์.
๊ทธ์ ๋ํ ๋๋น์ฑ
๋ ํ์ํด ๋ณด์
๋๋ค. |
@@ -0,0 +1,105 @@
+package com.requestrealpiano.songrequest.security;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.domain.account.Role;
+import com.requestrealpiano.songrequest.security.filter.JwtAuthorizationFilter;
+import com.requestrealpiano.songrequest.security.jw... | Java | ์ฌ์ฉํ์์ง ์์ ์ฝ๋๋ฉด ์ญ์ ํ๊ณ ๊ทธ๋๋ ์ฃผ์์ฒ๋ฆฌ๋ฅผ ๋จ๊ธฐ๊ณ ์ถ๋ค๋ฉด ์ ์ฃผ์์ฒ๋ฆฌํ๋์ง์ ๋ํ ์ค๋ช
์ ์ถ๊ฐํด์ฃผ์ธ์ |
@@ -0,0 +1,105 @@
+package com.requestrealpiano.songrequest.security;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.domain.account.Role;
+import com.requestrealpiano.songrequest.security.filter.JwtAuthorizationFilter;
+import com.requestrealpiano.songrequest.security.jw... | Java | Role์ ์์ฃผ ์ฌ์ฉํ์ค ๋ฏํ๋ฐ import static์ผ๋ก ์ ์ธํ๋ ๊ฒ๋ ๋์์ง ์๋ค๊ณ ์๊ฐํฉ๋๋ค. |
@@ -0,0 +1,105 @@
+package com.requestrealpiano.songrequest.security;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.domain.account.Role;
+import com.requestrealpiano.songrequest.security.filter.JwtAuthorizationFilter;
+import com.requestrealpiano.songrequest.security.jw... | Java | `WebConfig`์์๋ CORS ์๋ฌ์ ๋ํ ๋๋น์ฑ
์ ์ค์ ํ์
จ๋๋ฐ ์ฌ๊ธฐ์๋ ์ค์ ํ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,115 @@
+package com.requestrealpiano.songrequest.security.jwt;
+
+import com.requestrealpiano.songrequest.domain.account.Account;
+import com.requestrealpiano.songrequest.global.error.exception.jwt.JwtExpirationException;
+import com.requestrealpiano.songrequest.global.error.exception.jwt.JwtInvalidTokenExce... | Java | Date ํ์
์ ์ฐ์
จ๋๋ฐ LocalDate ํ์
์ด ์๋ ์ด์ ๊ฐ ๋ฌด์์ธ๊ฐ์? |
@@ -0,0 +1,21 @@
+package com.requestrealpiano.songrequest.security.jwt;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.ConstructorBinding;
+
+@RequiredArgsConstructor
+@Get... | Java | ์์ฑ์๊ฐ ํ์ํ๊ฐ์? ๋ถํ์ํ ์์ฑ์๊ฐ์์ |
@@ -0,0 +1,33 @@
+package com.requestrealpiano.songrequest.security.oauth;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.global.error.response.ErrorCode;
+import com.requestrealpiano.songrequest.global.error.response.ErrorResponse;
+import lombok.RequiredArgsConstructor... | Java | ์ด์ ๋ ๊ธธ์ด์ง๋ฉด throws๋ถํฐ ํ์นธ ๋ด๋ ค์ ๋ณด๊ธฐ ์ฝ๊ฒ ํด์ฃผ์ธ์ฉ |
@@ -0,0 +1,33 @@
+package com.requestrealpiano.songrequest.security.oauth;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.global.error.response.ErrorCode;
+import com.requestrealpiano.songrequest.global.error.response.ErrorResponse;
+import lombok.RequiredArgsConstructor... | Java | ์ฌ๊ธฐ์ ๊ถ๊ธํ๊ฒ ์ด๋๋ก ์ฌ์ฉํ์ ๋ ์๋ฌ์ฒ๋ฆฌ๋ ๋ฐ์์ด ์ ๋๊ฒ ์ผ๋ ์คํ๋ง ๋ก๊ทธ์๋ ์ฐํ๋ ์ง ๊ถ๊ธํฉ๋๋ค.
์ ๊ฐ ์ด์ ์ฝ๋์ค์ฟผ๋ ๋์๊ด ํ๋ก์ ํธ์์๋ ์ด๋ฐ์์ผ๋ก ์ฒ๋ฆฌํ์ ๋ ๋ก๊ทธ์ ์ฐํ์ง ์๋ ์ฌ์ํ ๋ฌธ์ ์ ์ด ์๊ฒผ์ต๋๋ค. |
@@ -0,0 +1,33 @@
+package com.requestrealpiano.songrequest.security.oauth;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.requestrealpiano.songrequest.global.error.response.ErrorCode;
+import com.requestrealpiano.songrequest.global.error.response.ErrorResponse;
+import lombok.RequiredArgsConstructor... | Java | ๊ทธ๋์ ์๊ฐํด๋ธ ๊ฒ์ด `AccessDeniedException`์ ๋ฐ๋ ์๋ฌํด๋์ค๋ฅผ ๋ง๋ค๊ณ ํด๋น ์๋ฌ๋ฅผ ์์๋ฐ์ ์ฌ๊ธฐ์ ์๋ฌ๊ฐ ๋ฐ์ํ๋ฉด ํด๋น ํด๋์ค๋ฅผ ํธ์ถํ๋ ๋ฐฉ์์ ์ฌ์ฉํ์ฌ ๋ค๋ฅธ exceptionHandler์ฒ๋ผ ํ๋ฒ์ ๊ด๋ฆฌํ๊ธฐ๋ ํธํ๊ณ ๋ก๊ทธ๋ ์ฐํ ์ ์๋ค๊ณ ์๊ฐํ์ต๋๋ค.
```java
@Component("restAuthenticationEntryPoint")
public class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Autowired
privat... |
@@ -0,0 +1,14 @@
+package com.requestrealpiano.songrequest.security.oauth;
+
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target... | Java | ์ด๊ฒ๋ง ๋ฌ์๋ GlobalAdvice ์ค์ ์ ํ ํ์๊ฐ ์์ด์ ์ข์ฃ ! |
@@ -0,0 +1,24 @@
+package com.requestrealpiano.songrequest.controller;
+
+import com.requestrealpiano.songrequest.service.AccountService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+i... | Java | ๋ถ๋ช
๋ชจ๋ ์ปจํธ๋กค๋ฌ๋ฅผ ๋์์ ์์ ์ ํ์ํ
๋ฐ ์ฌ๊ธฐ๋ ์ํ์ฝ๋๋ง ๋ฐ๊พธ๊ณ ํ์์ ์ด๋ ๊ฒ ๋จ๊ฒจ ๋์์๋ค์.
ํต์ผ์ฑ์ ์ํด ์์ ํ๊ฒ ์ต๋๋คใ
ใ
|
@@ -2,18 +2,18 @@
import com.requestrealpiano.songrequest.domain.song.searchapi.response.SearchApiResponse;
import com.requestrealpiano.songrequest.global.response.ApiResponse;
+import com.requestrealpiano.songrequest.global.response.StatusCode;
import com.requestrealpiano.songrequest.service.SongService;
import ... | Java | ์ง๋๋ฒ ๋ฆฌ๋ทฐ์ ๊ฐ์ ์๊ฒฌ์ ์ฃผ์
์ ๋ณ๊ฒฝ์ ๊ณ ๋ ค ํด๋ดค์๋๋ฐ์.
์ฌ๊ธฐ ์ด ๋ ๊ฐ์ ๋น ๊ฐ์ผ๋ก ์์ฒญ์ด ์์ ๋ `NotEmpty` ์ ๊ฐ์ ์ฒ๋ฆฌ๋ก ์๋ฌ๋ฅผ ๋ฐํํ ๊ฒ ์๋๋ผ default value๋ก ๊ฒ์์ ๊ณ์ ์งํ ์ํฌ ์๊ฐ ์
๋๋ค. ๋ง์ฝ `@ModelAttribute` DTO๋ก ๋ฐ์ ๊ฒฝ์ฐ์๋ setter๋ก ๊ฐ์ ๋ฐ์ธ๋ฉ ํด์ผ ํ๋ ๊ฒ์ผ๋ก ์๊ณ ์๋๋ฐ์.
๊ทธ๋ ๋ค๋ฉด setter์์ ๋น ๊ฐ์ผ ๊ฒฝ์ฐ ๊ธฐ๋ณธ ๊ฐ์ ์ฃผ๋ ๋ก์ง์ด ํ์ํ ๋ฏ ๋ณด์ด๋๋ฐ,
๊ฐ๋ฅํ๋ค๋ฉด `@RequestParam` ์ฒ๋ผ `@Something(defaultValue = "Default value")... |
@@ -1,5 +1,6 @@
package com.requestrealpiano.songrequest.domain.account;
+import com.requestrealpiano.songrequest.security.oauth.OAuthAttributes;
import com.requestrealpiano.songrequest.domain.base.BaseTimeEntity;
import com.requestrealpiano.songrequest.domain.letter.Letter;
import lombok.AccessLevel;
@@ -8,9 +9,... | Java | ๊ณ์ ์ ์ต์ด ์์ฑ ํ์ ๋์ ๊ธฐ๋ณธ ๊ฐ (์ ์ฒญ๊ณก ๋ฑ๋ก ์) ์
๋๋ค. ์ด์ ๋ฆฌ๋ทฐ์์ ์ด๋ ๊ฒ ์ง๊ด์ ์ผ๋ก ์ดํดํ ์ ์๋ ์ด๋ฐ ๊ฐ์ ๋ณ์๋ก ๋นผ์ง ์์๋ ๋ ๊ฑฐ ๊ฐ๋ค๋ ํผ๋๋ฐฑ์ ๋ฐ์์๋๋ฐ, ๊ทธ๊ฑธ ๋ฐ์ํด์ ์ฝ๋ ์์ฑ์ ํ๋ ๋ฏ ์ถ์ต๋๋ค.
์ฐ์ ์ด ์ฝ๋๋ ์ปฌ๋ผ์ ๊ธฐ๋ณธ ๊ฐ์ ์ถ๊ฐ ํ ์์ ์ด๊ธฐ ๋๋ฌธ์ ์์ด์ง ์ฝ๋๊ฐ ๋ ๋ฏ ํฉ๋๋ค.
๊ทธ๋ฐ๋ฐ ํน์ ์จ๋๋ ๋งค์ง๋๋ฒ๋ฅผ ์ง์ ํ๋ ๊ฒ์ ๋ํ ์ด๋ค ๊ธฐ์ค์ด ์์ผ์ค๊น์?
์์ ์ ํ ํ๋ก์ ํธ ํ ๋๋ ๋งค์ง ๋๋ฒ ์ฌ์ฉ์ ๋ฌด์กฐ๊ฑด ํผํ๋ ค๊ณ ๋ชจ๋ ๋ณ์๋ก ์ง์ ํ๋ค๊ฐ ์คํ๋ ค ์๋ฏธ ํด์์ด ์ด๋ ค์์ก๋ค๋ ํผ๋๋ฐฑ์ ๋ฆฌ๋ทฐ์ด ๋ถ๊ป ๋ฐ์์ ์ด ์์์ต๋๋ค. ์ด๋ฐ ๊ฒฝ์ฐ... |
@@ -1,5 +1,6 @@
package com.requestrealpiano.songrequest.domain.account;
+import com.requestrealpiano.songrequest.security.oauth.OAuthAttributes;
import com.requestrealpiano.songrequest.domain.base.BaseTimeEntity;
import com.requestrealpiano.songrequest.domain.letter.Letter;
import lombok.AccessLevel;
@@ -8,9 +9,... | Java | ์ ๋ ๋ถ๊ฐ์ ์ค๋ช
์ผ๋ก ์ฃผ์๋ฃ๋๊ฒ๋ ๊ด์ฐฎ๋ค๊ณ ์๊ฐํด์ ๊ทธ๋ฌ๋ ๋ง์ฝ ํ
์คํธ ์ฝ๋์์ ์ฌ๋ฌ๋ฒ ์ค๋ณต๋์๋๋ ๋ฐ๋ก ๊ด๋ฆฌํ๋๊ฒ ๋ซ๊ฒ ๋ค์ |
@@ -11,6 +11,12 @@ public enum ErrorCode {
METHOD_NOT_ALLOWED(405, "์ง์ํ์ง ์๋ ์์ฒญ ๋ฉ์๋ ์
๋๋ค."),
INTERNAL_SERVER_ERROR(500, "์๋ฒ์์ ์์ฒญ์ ์ฒ๋ฆฌํ์ง ๋ชปํ์ต๋๋ค."),
+ // Auth
+ UNAUTHENTICATED_ERROR(401, "์ธ์ฆ์ด ํ์ํฉ๋๋ค. ๋ก๊ทธ์ธ ์ดํ ๋ค์ ์๋ ํด์ฃผ์ธ์."),
+ JWT_INVALID_ERROR(400, "์ฌ๋ฐ๋ฅธ ์ธ์ฆ ์ ๋ณด๊ฐ ์๋๋๋ค. ๋ค์ ๋ก๊ทธ์ธ ํด์ฃผ์ธ์."),
+ JWT_EXPIRATION_ERRO... | Java | JWT ๊ด๋ จ ์์ธ๋ฅผ ๊ตฌ์ํ ๋ ์๋์ ๋ค๊ฐ์ง ์์ธ๊ฐ ๋งจ ์ฒ์ ๊ณ ๋ คํ๋ JWT ๊ด๋ จ ์์ธ์์ต๋๋ค.
1. ExpiredJwtException : ์ ํจ๊ธฐ๊ฐ์ด ์ง๋ Token์ผ๋ก ์์ฒญ
2. InvalidClaimException : Claim ํ์ฑ ์คํจ๋ก ์ธํ ์์ธ
3. MalformedJwtException : ๊ตฌ์กฐ์ ๋ฌธ์ ๊ฐ ์๋ JWT ํ ํฐ์ผ๋ก ์ธํ ์์ธ
4. SignatureException : ์ฌ๋ฐ๋ฅด์ง ์์ JWT ์๊ทธ๋์ฒ๋ก ์ธํ ๊ฒ์ฆ ์คํจ
์ด ๋ 1๋ฒ '์ ํจ๊ธฐ๊ฐ ๋ง๋ฃ' ์ 2, 3, 4์ ํด๋นํ๋ 'JWT ๊ฒ์ฆ ์คํจ'
๋๊ฐ์ง ์ ํ์ผ๋ก๋ง ๋๋์ด์ ์ฒ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.