code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -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,61 @@
+import axiosInstance from "@/lib/axiosInstance";
+import { useInfiniteQuery } from "@tanstack/react-query";
+
+type Gathering = {
+ teamId: number;
+ id: number;
+ type: "OFFICE_STRETCHING" | "MINDFULNESS" | "WORKATION";
+ name: string;
+ dateTime: string;
+ location: string;
+ image: string;
+... | TypeScript | _:warning: Potential issue_
**์บ์ ํค์ userId๋ฅผ ํฌํจ์์ผ์ฃผ์ธ์.**
ํ์ฌ queryKey๊ฐ ์ฌ์ฉ์๋ณ๋ก ๊ตฌ๋ถ๋์ง ์์ ์บ์ ์ถฉ๋์ด ๋ฐ์ํ ์ ์์ต๋๋ค.
```diff
export const useGetMyReviews = (userId: number) => {
return useInfiniteQuery({
- queryKey: ["my-reviews"],
+ queryKey: ["my-reviews", userId],
queryFn: ({ pageParam }) => fetchMyReviews({ pageP... |
@@ -0,0 +1,83 @@
+import { useGetMyReviews } from "@/app/(common)/mypage/_hooks/useGetMyReviews";
+import ListItem from "@/components/ListItem";
+import Score from "@/components/Score";
+import Spinner from "@/components/Spinner";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { useUserStore } ... | Unknown | _:warning: Potential issue_
**๋น ์ํ ๋ฉ์์ง๊ฐ ๋ถ์ ํํฉ๋๋ค.**
ํ์ฌ ํ์ด์ง๋ "์์ฑํ ๋ฆฌ๋ทฐ"๋ฅผ ๋ณด์ฌ์ฃผ๋ ๊ณณ์ด๋ฏ๋ก, ๋ฉ์์ง๋ฅผ ๋งฅ๋ฝ์ ๋ง๊ฒ ์์ ํด์ฃผ์ธ์.
```diff
<div className="flex flex-1 items-center justify-center">
- <p>์์ง ์์ฑ ๊ฐ๋ฅํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์</p>
+ <p>์์ง ์์ฑํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์</p>
</div>
```
<!-- suggestion_start -->
<details>
<summary>๐ Committable suggestion</sum... |
@@ -0,0 +1,83 @@
+import { useGetMyReviews } from "@/app/(common)/mypage/_hooks/useGetMyReviews";
+import ListItem from "@/components/ListItem";
+import Score from "@/components/Score";
+import Spinner from "@/components/Spinner";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { useUserStore } ... | Unknown | _:hammer_and_wrench: Refactor suggestion_
**์ด๋ฏธ์ง์ ์ ๊ทผ์ฑ ์์ฑ์ ์ถ๊ฐํด์ฃผ์ธ์.**
์คํฌ๋ฆฐ ๋ฆฌ๋ ์ฌ์ฉ์๋ฅผ ์ํด ์ด๋ฏธ์ง์ ๋ ์์ธํ ๋์ฒด ํ
์คํธ๋ฅผ ์ ๊ณตํด์ฃผ์ธ์.
```diff
<Image
src={review.Gathering.image}
- alt="๋ชจ์ ์ด๋ฏธ์ง"
+ alt={`${GatheringType[review.Gathering.type]} - ${review.Gathering.name} ๋ชจ์ ์ด๋ฏธ์ง`}
width={280}
height={156}
className="... |
@@ -0,0 +1,83 @@
+import { useGetMyReviews } from "@/app/(common)/mypage/_hooks/useGetMyReviews";
+import ListItem from "@/components/ListItem";
+import Score from "@/components/Score";
+import Spinner from "@/components/Spinner";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { useUserStore } ... | Unknown | _:warning: Potential issue_
**๋ฉ์์ง๊ฐ ๋ถ์ ์ ํฉ๋๋ค.**
ํ์ฌ ๋ฉ์์ง๊ฐ "์์ฑ ๊ฐ๋ฅํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์"๋ก ๋์ด ์๋๋ฐ, ์ด๋ "์์ฑํ ๋ฆฌ๋ทฐ" ํญ์ ์ปจํ
์คํธ์ ๋ง์ง ์์ต๋๋ค.
```diff
<div className="flex flex-1 items-center justify-center">
- <p>์์ง ์์ฑ ๊ฐ๋ฅํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์</p>
+ <p>์์ง ์์ฑํ ๋ฆฌ๋ทฐ๊ฐ ์์ด์</p>
</div>
```
<!-- suggestion_start -->
<details>
<sum... |
@@ -0,0 +1,83 @@
+import { useGetMyReviews } from "@/app/(common)/mypage/_hooks/useGetMyReviews";
+import ListItem from "@/components/ListItem";
+import Score from "@/components/Score";
+import Spinner from "@/components/Spinner";
+import { useInfiniteScroll } from "@/hooks/useInfiniteScroll";
+import { useUserStore } ... | Unknown | _:hammer_and_wrench: Refactor suggestion_
**ํ์
๋จ์ธ ๋์ ํ์
๊ฐ๋๋ฅผ ์ฌ์ฉํ์ธ์.**
`as number` ํ์
๋จ์ธ ๋์ ํ์
๊ฐ๋๋ฅผ ์ฌ์ฉํ์ฌ ๋ ์์ ํ ํ์
์ฒดํฌ๋ฅผ ๊ตฌํํ์ธ์.
```diff
- const id = useUserStore((state) => state.user?.id) as number;
+ const user = useUserStore((state) => state.user);
+
+ if (!user?.id) {
+ return (
+ <div className="flex fl... |
@@ -27,7 +27,8 @@ import { useGetMyGatherings } from "@/app/(common)/mypage/_hooks/useGetMyGatheri
// isCompleted๊ฐ true, isReviewed๊ฐ true => ๋ฆฌ๋ทฐ ์์ฑ x
export default function MyGatherings() {
const { data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading, error } = useGetMyGatherings([
- "my-gatherings",... | Unknown | _:hammer_and_wrench: Refactor suggestion_
**์ฟผ๋ฆฌ ํค ๊ตฌ์กฐ์ ์ผ๊ด์ฑ์ด ํ์ํฉ๋๋ค.**
`useLeaveGathering` ํ
์ ์ฟผ๋ฆฌ ํค๊ฐ `["gatherings"]`๋ก ๋์ด์๋๋ฐ, ๋ค๋ฅธ ์ฟผ๋ฆฌ ํค๋ค๊ณผ ์ผ๊ด์ฑ์ ์ ์งํ๊ธฐ ์ํด `["mypage", "gatherings"]`๋ก ๋ณ๊ฒฝํ๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค.
```diff
-const mutation = useLeaveGathering(["gatherings"]);
+const mutation = useLeaveGathering(["mypage", "gatherings"]);
```
... |
@@ -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 | ์ด๊ฑฐ ์ธ ์ ๋ ? |
@@ -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 ๊ฒ์ฆ ์คํจ'
๋๊ฐ์ง ์ ํ์ผ๋ก๋ง ๋๋์ด์ ์ฒ... |
@@ -0,0 +1,63 @@
+language: java
+jdk:
+ - openjdk11
+
+branches:
+ only:
+ - main
+
+cache:
+ directories:
+ - '$HOME/.m2/repository'
+ - '$HOME/.gradle'
+
+script: "./gradlew clean build"
+
+before_deploy:
+ - mkdir -p before-deploy
+ - cp scripts/*.sh before-deploy/
+ - cp appspec.yml before-deploy/
+... | Unknown | travis CI ์ด๊ตฐ์. ์ ๋ ์จ๋ดค์ง๋ง Github Actions๋ณด๋ค ๋๋ฆฌ๊ณ ๋๋ฒ๊น
ํ๋๋ฐ ๋ถํธํด์ ์ ์ฐ๋ค๊ฐ ๋ฐ๊ฟจ์ต๋๋ค.
ํ์ฌ๋ Github Actions + AWS CodeBuild๋ฅผ ๋ณํฉํด์ ์ฌ์ฉํ๊ณ ์๋๋ฐ CIํด ์ค travis ci๋ฅผ ์ฌ์ฉํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,18 @@
+version: 0.0
+os: linux
+files:
+ - source: /
+ destination: /home/ubuntu/app/songrequest/zip/
+ overwrite: yes
+
+permissions:
+ - object: /
+ pattern: "**"
+ owner: ubuntu
+ group: ubuntu
+
+hooks:
+ ApplicationStart:
+ - location: deploy.sh
+ timeout: 60
+ runas: ubun... | Unknown | ์ฌ๊ธฐ์ ์์
์ผํ ๊ฑด ๋ง์ฝ blue/green ๋ฐฐํฌ๋ฅผ ํ์ค ๊ฒฝ์ฐ overwrite๊ฐ ๋จน์ง ์์ต๋๋ค. ๊ทธ๋์ beforeInstall ์์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ์
์ ํ์ผ ์ญ์ ํ๋ ์คํฌ๋ฆฝํธ๋ฅผ ์ง์
์ผํฉ๋๋ค. ์ด ๋ด์ฉ์ ์ธ์ ๊ฐ ์ ๋ธ๋ก๊ทธ์ ์ ์ ์์ ์ด๋ ๊ถ๊ธํ์๋ฉด ๋ณด์ธ์ฉ |
@@ -0,0 +1,18 @@
+version: 0.0
+os: linux
+files:
+ - source: /
+ destination: /home/ubuntu/app/songrequest/zip/
+ overwrite: yes
+
+permissions:
+ - object: /
+ pattern: "**"
+ owner: ubuntu
+ group: ubuntu
+
+hooks:
+ ApplicationStart:
+ - location: deploy.sh
+ timeout: 60
+ runas: ubun... | Unknown | ๋ง์ฝ ๋ณธ์ธ์ด blue/green ๋ฌด์ค๋จ ๋ฐฐํฌ๋ฅผ ํ์ค๊ฒฝ์ฐ ์ฌ๊ธฐ์ BeforeInstall ์์คํฌ๋ฆฝํธ ๋ฃ์ผ์
์ ์ด์ ๋น๋๋ํ์ผ ์ญ์ ํ์๋ ์์คํฌ๋ฆฝํธ๋ฅผ ๋ฃ์ด์ผ ์ ์์ ์ผ๋ก ์๋๋๋ ๊ผญ ๊ธฐ์ตํ์ธ์ |
@@ -23,13 +23,33 @@ ext {
set('snippetsDir', file("build/generated-snippets"))
}
+bootJar {
+ dependsOn asciidoctor
+ from("${asciidoctor.outputDir}/html5") {
+ into 'static/docs'
+ }
+}
+
+test {
+ outputs.dir snippetsDir
+ useJUnitPlatform()
+}
+
+asciidoctor {
+ inputs.dir snippetsDi... | Unknown | ์ด๊ฒ๋ ์ข์ง๋ง DTO <-> Entity์ญํ ์ ํ๋ ๊ธฐ์กด์ modelmapper๋ ์ข์ง๋ง Mapstruct๋ ํจ์ฌ ์ฑ๋ฅ๋ ์ข์ต๋๋ค. ์ค๋ฌด์์๋ ์ฌ์ฉํ๋ ์ค์
๋๋ค.
https://huisam.tistory.com/entry/mapStruct |
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+REPOSITORY=/home/ubuntu/app/songrequest
+PROJECT_NAME=song-request
+
+echo "> Build ํ์ผ ๋ณต์ฌ"
+
+cp $REPOSITORY/zip/*.jar $REPOSITORY/
+
+echo "> ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid ํ์ธ"
+
+CURRENT_PID=$(pgrep -fl song-request | grep jar | awk '{print $1}')
+
+echo "ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid : $CURRENT_PID"
+
+i... | Unknown | home์ ๊ทธ๋๋ก ๋ฐฐํฌํ๋ ๊ฒ๋ณด๋ค ํด๋๋ฅผ ์์ฑํด์ ๊ด๋ฆฌํ๋ ๊ฒ ์ข์ต๋๋ค. ์ ์ ์ฉํ์
จ๋ค์ |
@@ -9,14 +9,16 @@
import javax.annotation.PostConstruct;
import java.util.TimeZone;
+import static com.requestrealpiano.songrequest.global.constant.JpaProperties.ASIA_SEOUL;
+
@EnableConfigurationProperties(value = {ManiaDbProperties.class, LastFmProperties.class})
@SpringBootApplication
public class SongRequest... | Java | ```suggestion
Timezone.setDefault(TimeZone.getTimeZone(ASIA_SEOUL));
```
์ผ๋ก ๋ฐ๊พธ๋ฉด ์ด๋ป๊ฒ ๋๋์? |
@@ -1,27 +1,33 @@
package com.requestrealpiano.songrequest.controller;
-import com.fasterxml.jackson.core.JsonProcessingException;
import com.requestrealpiano.songrequest.domain.song.searchapi.response.SearchApiResponse;
import com.requestrealpiano.songrequest.global.response.ApiResponse;
import com.requestrealpi... | Java | RequestParam๋ ์ข์ง๋ง artist, title๋ ํ๋ฒ์ ๊ด๋ฆฌํ๋ DTO๋ฅผ ๋ง๋ค๋ฉด ์ด๋ค๊ฐ์? ์์ฃผ ์ฐ์ผ์ง ๋ชจ๋ฅด๋ DTO๋ฅผ ๋ง๋ค๊ณ ๊ฑฐ๊ธฐ์ Validation์ฒ๋ฆฌํด๋ ๊ด์ฐฎ์ ๋ณด์
๋๋ค. |
@@ -0,0 +1,32 @@
+package com.requestrealpiano.songrequest.domain.letter.request.inner;
+
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.Size;
+
+import static com.requestrealpiano.songrequest.glo... | Java | validation ๊ด์ฐฎ๋ค์ |
@@ -0,0 +1,25 @@
+package com.requestrealpiano.songrequest.global.constant;
+
+public interface ValidationCondition {
+
+ // Common
+ String NOT_EMPTY_MESSAGE = "ํ์ ์
๋ ฅ ์ ๋ณด ์
๋๋ค.";
+
+ // Artist
+ String ARTIST_MESSAGE = "์ํฐ์คํธ๋ 30์ ๋ฏธ๋ง ์
๋๋ค.";
+ int ARTIST_MAX = 30;
+ int ARTIST_MIN = 1;
+
+ // Title
+ ... | Java | interface์ ๊ทธ๋๋ก value๊ฐ์ ์ง์ ํ๋ฉด ์ข์ง์์ต๋๋ค. ์ดํํฐ๋ธ ์๋ฐ์์ ๋ณธ ๊ฑฐ๊ฐ์๋ฐ ๋ด์ฉ์ด ์ ํํ๊ฒ ๊ธฐ์ต์ ์๋์ง๋ง ์ด๋ ๊ฒ ํ์ง๋ง๋ผ๊ณ ๊ฐํ๊ฒ ๊ฒฝ๊ณ ํ๋ ๊ธฐ์ต์ด ๋๋ค์.
๊ทธ๋ฆฌ๊ณ ๋ด์ฉ์ interface๋ณด๋จ enum์ ์ด์ธ๋ฆฌ๋๋ฐ enum์ ์ด๋ค๊ฐ์? |
@@ -0,0 +1,64 @@
+package com.requestrealpiano.songrequest.global.error;
+
+import com.requestrealpiano.songrequest.global.error.exception.BusinessException;
+import com.requestrealpiano.songrequest.global.error.exception.ParsingFailedException;
+import com.requestrealpiano.songrequest.global.error.response.ErrorCode;
... | Java | ์ด ์ฝ๋๊ฐ validation ์์ธ์ฒ๋ฆฌ๋ก ์๊ณ ์์ต๋๋ค. ์๋์ด ์๋๋์? ํ๋ฒ ํ
์คํธ์ฝ๋์์ ํ์ธํด๋ณด๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+REPOSITORY=/home/ubuntu/app/songrequest
+PROJECT_NAME=song-request
+
+echo "> Build ํ์ผ ๋ณต์ฌ"
+
+cp $REPOSITORY/zip/*.jar $REPOSITORY/
+
+echo "> ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid ํ์ธ"
+
+CURRENT_PID=$(pgrep -fl song-request | grep jar | awk '{print $1}')
+
+echo "ํ์ฌ ๊ตฌ๋ ์ค์ธ ์ ํ๋ฆฌ์ผ์ด์
pid : $CURRENT_PID"
+
+i... | Unknown | p4 : ์๋ ๋ฐฐํฌ ์คํฌ๋ฆฝํธ ๊ตฐ์ ๐
๊ฐ๋จํ ํ์ด์ง๋ง.. ์ฌ๊ธฐ์ ์ฌ์ฉํ๊ณ ์๋ `tail`, `grep`๋ฑ๋ฑ ์ ๋ํ ๊ธฐ๋ณธ์ ์ธ ์ดํด ์ ๋๋ ์์ผ์๋ฉด ์ข์๋ฏ ํฉ๋๋ค! |
@@ -0,0 +1,25 @@
+package com.requestrealpiano.songrequest.global.constant;
+
+public interface ValidationCondition {
+
+ // Common
+ String NOT_EMPTY_MESSAGE = "ํ์ ์
๋ ฅ ์ ๋ณด ์
๋๋ค.";
+
+ // Artist
+ String ARTIST_MESSAGE = "์ํฐ์คํธ๋ 30์ ๋ฏธ๋ง ์
๋๋ค.";
+ int ARTIST_MAX = 30;
+ int ARTIST_MIN = 1;
+
+ // Title
+ ... | Java | p3: ์ ๋ enum์ด๋ ๋ค๋ฅธ class์ผ๋ก ๊ด๋ฆฌํ์๋ ๊ฒ ์ข๋ค๊ณ ์๊ฐ๋๋ค์! |
@@ -0,0 +1,63 @@
+language: java
+jdk:
+ - openjdk11
+
+branches:
+ only:
+ - main
+
+cache:
+ directories:
+ - '$HOME/.m2/repository'
+ - '$HOME/.gradle'
+
+script: "./gradlew clean build"
+
+before_deploy:
+ - mkdir -p before-deploy
+ - cp scripts/*.sh before-deploy/
+ - cp appspec.yml before-deploy/
+... | Unknown | travis CI๋ฅผ ์ฌ์ฉํ ๊ธฐ์ ์ ์ธ ์ด์ ๋ ์์์ต๋๋คใ
ใ
CI / CD๋ฅผ ๋ค์ํ ํด๋ก ๊ฒฝํ ํด๋ณด๊ณ ์ถ์ด์ ๋ฐฑ์๋๋ travis CI, ํ๋ก ํธ๋ Github Actions๋ก ๋ฐฐํฌ ํ๊ฒฝ์ ๊ตฌ์ฑ ํ์ต๋๋ค.
travis CI๋ฅผ ์จ๋ณด๊ณ ๋๋ ๊ฒ์... ๋๋ฒ๊น
๊ณผ์ ์์ ๋ถํธํจ์ ์์๊ณ , ๋ค๋ง ๋ง์ ํ์ ๊ฒ์ฒ๋ผ ์กฐ๊ธ ๋๋ฆฐ ๊ฒ์ด ์ฝ๊ฐ ๋ถํธ ํ์ต๋๋ค.
ํ๋ก ํธ์ ๋น๋ ๊ณผ์ ์ด ๋ค๋ฅด๊ธฐ ๋๋ฌธ์ ์ ๋์ ์ธ ๋น๊ต๋ ๋ถ๊ฐ ํ์ง๋ง ์ ๋ Github Actions๊ฐ ์ฝ๊ฐ ๋ ๋น ๋ฅธ ๋๋์ด์๋ค์. |
@@ -0,0 +1,18 @@
+version: 0.0
+os: linux
+files:
+ - source: /
+ destination: /home/ubuntu/app/songrequest/zip/
+ overwrite: yes
+
+permissions:
+ - object: /
+ pattern: "**"
+ owner: ubuntu
+ group: ubuntu
+
+hooks:
+ ApplicationStart:
+ - location: deploy.sh
+ timeout: 60
+ runas: ubun... | Unknown | ๋ง์ฝ ๊ฐ์ธ ํ๋ก์ ํธ๋ก blue / green ๋ฐฐํฌ๊น์ง ํ๊ฒ ๋๋ค๋ฉด ๋งค์ฐ ํฐ ์ฑ๊ณผ๊ฒ ๋ค์ใ
ใ
์จ๋ ๋ธ๋ก๊ทธ์ ์ ๋ณด๊ณ ์์ต๋๋ค. ๐ ์ข์ ํ ๊ฐ์ฌํฉ๋๋ค. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.