code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,17 @@
+package lotto
+
+import lotto.service.LottoService
+import lotto.view.Input
+import lotto.view.Output
+
+fun main() {
+ val money = Input.money()
+ val randomNums = Input.getRandomLottoNumsPerMoney(money)
+ val winNums = Input.winNums()
+
+ val lottoService = LottoService()
+ val lottoR... | Kotlin | VO์ ๋ํด ์์๋ณด๊ณ ์์๊ฐ์ ํฌ์ฅํด๋ณด๋ฉด ์ด๋จ๊น์? [์ฐธ๊ณ ](https://tecoble.techcourse.co.kr/post/2020-05-29-wrap-primitive-type/) |
@@ -0,0 +1,36 @@
+package lotto.view
+
+import lotto.domain.LottoTicket.Companion.TICKET_PRICE
+
+object Input {
+ fun money(): Int {
+ println("๊ตฌ์
๊ธ์ก์ ์
๋ ฅํด ์ฃผ์ธ์.")
+ return readln().toInt()
+ }
+
+ fun getRandomLottoNumsPerMoney(money: Int): List<List<Int>> {
+ val ticketNumber = money.div(T... | Kotlin | ์ค์ฒฉ ์ปฌ๋ ์
๋ณด๋ค๋ ์๋ฏธ๋ฅผ ๋ด์ ์ ์๋ ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,36 @@
+package lotto.view
+
+import lotto.domain.LottoTicket.Companion.TICKET_PRICE
+
+object Input {
+ fun money(): Int {
+ println("๊ตฌ์
๊ธ์ก์ ์
๋ ฅํด ์ฃผ์ธ์.")
+ return readln().toInt()
+ }
+
+ fun getRandomLottoNumsPerMoney(money: Int): List<List<Int>> {
+ val ticketNumber = money.div(T... | Kotlin | ๊ตฌ๋งคํ ํฐ์ผ์๋์ view์์ ๊ตฌํ๋๊ฒ์ด ์ ์ ํ ์์น์ผ์ง ๊ณ ๋ฏผํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,36 @@
+package lotto.view
+
+import lotto.domain.LottoTicket.Companion.TICKET_PRICE
+
+object Input {
+ fun money(): Int {
+ println("๊ตฌ์
๊ธ์ก์ ์
๋ ฅํด ์ฃผ์ธ์.")
+ return readln().toInt()
+ }
+
+ fun getRandomLottoNumsPerMoney(money: Int): List<List<Int>> {
+ val ticketNumber = money.div(T... | Kotlin | ๋งค์ง๋๋ฒ๋ฅผ ์์ํํด๋ณด๋ฉด ์ด๋จ๊น์?! |
@@ -9,3 +9,8 @@
- [x] ๋ฌธ์์ด ๊ณ์ฐ๊ธฐ์ ์ซ์ ์ด์ธ์ ๊ฐ ๋๋ ์์๋ฅผ ์ ๋ฌํ๋ ๊ฒฝ์ฐ RuntimeException ์์ธ๋ฅผ throw ํ๋ค.
- [x] ์์๊ฐ์ ํฌ์ฅํ ๋๋ฉ์ธ๊ฐ์ฒด ๊ตฌํ
- [x] ์ฐ์ฐ์ ์ค๋ฒ๋ผ์ด๋ฉ ๊ตฌํ
+
+## ๋ก๋ (์๋) ๊ธฐ๋ฅ ์๊ตฌ์ฌํญ
+- [x] ๋ก๋ ๊ตฌ์
๊ธ์ก์ ์
๋ ฅํ๋ฉด ๊ตฌ์
๊ธ์ก์ ํด๋นํ๋ ๋ก๋๋ฅผ ๋ฐ๊ธํด์ผ ํ๋ค.
+ - [x] ๊ธ์ก์ 0 ์ด์์ด๋ค.
+- [x] ๋ก๋ 1์ฅ์ ๊ฐ๊ฒฉ์ 1000์์ด๋ค. | Unknown | ํด๋น validation์ ์ด๋์ ์ํํด์ฃผ๊ณ ์๋์?! |
@@ -0,0 +1,23 @@
+package lotto.service
+
+import lotto.domain.LottoTicketMachine
+import lotto.domain.Rank
+
+class LottoService {
+ fun getLottoRanks(nums: List<List<Int>>, winNums: List<Int>): List<Rank> {
+ return nums.map {
+ val issue = LottoTicketMachine.issue(it)
+ val winLottoTi... | Kotlin | object ์ฌ์ฉ์ ๊ณ ๋ คํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,17 @@
+package lotto.domain
+
+object LottoTicketMachine {
+ fun issue(nums: List<Int>): LottoTicket {
+ require(nums.size == 6) {
+ "๋ก๋ ๊ฐ์๋ฅผ ์๋ชป ์
๋ ฅํ์ต๋๋ค"
+ }
+
+ val lottoBox = LottoBox()
+
+ val lottoNums = nums.map {
+ lottoBox.getLottoNum(it)
+ }.t... | Kotlin | issue๋ผ๋ ๋ค์ด๋ฐ์ ๋ถ์ด์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,24 @@
+package lotto.domain
+
+class LottoBox {
+ private val lottoNums: MutableMap<Int, LottoNum>
+
+ init {
+ val intRange = 1..45
+
+ lottoNums = intRange
+ .map { LottoNum(it) }
+ .associateBy { it.num }
+ .toMutableMap()
+ }
+
+ fun getLottoNum(... | Kotlin | LottoBox๋ง ๋ดค์๋ lottoNum์ด null์ด๋ผ๊ณ ํด์ ์ค๋ณต๋ ์ซ์๋ฅผ ์
๋ ฅํ๋ค๊ณ ๋ณด์ฅํ ์ ์์๊น์? |
@@ -0,0 +1,28 @@
+package lotto.domain
+
+class LottoNum(num: Int) {
+ val num: Int
+
+ init {
+ require(num in 1..45) {
+ "๋ก๋ ์ซ์ ๋ฒ์๋ 1 ~ 45 ์
๋๋ค."
+ }
+
+ this.num = num
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (... | Kotlin | inline class๋ฅผ ํ์ฉํด๋ด๋ ์ข์ ๊ฒ ๊ฐ์์!! :)
> ๋ํผํด๋์ค๋ก inline class์ value class ๋ฅผ ์ฌ์ฉํ๋๊ฑฐ ๊ฐ์๋ฐ์!
์ ์ดํด๊ฐ ์๊ฐ์์~
๋ญ๊ฐ ์ข์ ๊ธฐ๋ฅ๊ฐ๊ธฐ๋ ํ๋ฐ, ์ค๋ฌด์์ ์ด๋ป๊ฒ, ์ด๋ค์ํฉ์ ์ฌ์ฉํ๋ฉด ์ข์์ง ์ง๋ฌธ๋๋ฆฝ๋๋ค!
์ฌ์ค ์ ๋ ์ ์ฌ์ฉํ๋ค๊ณ ๋ง์๋๋ฆฌ๊ธฐ๋ ์ด๋ ต์ง๋ง, ์ ๋ ์๋์ ๊ฐ์ ๊ธฐ์ค์ ์ถฉ์กฑ์ํค๋ ๊ฒฝ์ฐ ์ธ๋ผ์ธ ํด๋์ค๋ฅผ ์ฌ์ฉํ๊ณ ์์ด์
* ํด๋น ๋ํผํ์
์ด ์ฌ๋ฌ๊ณณ์์ ํธ์ถ๋๋๊ฐ?
* ํด๋น ํด๋์ค๊ฐ data class์ ํน์ง์ ๊ฐ์ง๊ณ ์๋๊ฐ?
์ค๋ฌด์์ ์ ์ฉ์ ํ์๊ฐ ์๋๊ณ ํ์๋ค๋ง๋ค ์๊ฒฌ์ด ๋ค๋ฅผ ์... |
@@ -0,0 +1,28 @@
+package lotto.domain
+
+class LottoNum(num: Int) {
+ val num: Int
+
+ init {
+ require(num in 1..45) {
+ "๋ก๋ ์ซ์ ๋ฒ์๋ 1 ~ 45 ์
๋๋ค."
+ }
+
+ this.num = num
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) return true
+ if (... | Kotlin | ์ฌ๊ธฐ๋ ๋งค์ง๋๋ฒ๋ฅผ ์์ํํด๋ณด๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1,18 @@
+const GATHERING_TYPE = ["DALLAEMFIT", "OFFICE_STRETCHING", "MINDFULNESS", "WORKATION"] as const;
+
+export type ScoresQuery = {
+ gatheringId?: number;
+ type?: (typeof GATHERING_TYPE)[number];
+};
+
+export type ScoresResponse = {
+ teamId: number;
+ gatheringId: number;
+ type?: (typeof GATHERI... | TypeScript | _:warning: Potential issue_
**ScoresQuery์ type ํ๋ ํ์
์ด ์๋ชป ์ ์๋์ด ์์ต๋๋ค.**
ํ์ฌ `type?: typeof GATHERING_TYPE`๋ ๋ฐฐ์ด ํ์
์ ์๋ฏธํ๋ฉฐ, ์ด๋ ์๋ํ ํ์
์ด ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์์ ํ๋ ๊ฒ์ ์ ์๋๋ฆฝ๋๋ค:
```diff
export type ScoresQuery = {
gatheringId?: number;
- type?: typeof GATHERING_TYPE;
+ type?: (typeof GATHERING_TYPE)[number];
};
```
๋๋ ๋ ... |
@@ -0,0 +1,18 @@
+const GATHERING_TYPE = ["DALLAEMFIT", "OFFICE_STRETCHING", "MINDFULNESS", "WORKATION"] as const;
+
+export type ScoresQuery = {
+ gatheringId?: number;
+ type?: (typeof GATHERING_TYPE)[number];
+};
+
+export type ScoresResponse = {
+ teamId: number;
+ gatheringId: number;
+ type?: (typeof GATHERI... | TypeScript | _:warning: Potential issue_
**ScoresResponse์๋ ๋์ผํ ํ์
์ด์๊ฐ ์์ต๋๋ค.**
ScoresResponse์ type ํ๋๋ ๊ฐ์ ๋ฌธ์ ๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์์ ํด ์ฃผ์ธ์:
```diff
export type ScoresResponse = {
teamId: number;
gatheringId: number;
- type?: typeof GATHERING_TYPE;
+ type?: (typeof GATHERING_TYPE)[number];
averageScore: number;
oneSt... |
@@ -0,0 +1,31 @@
+import { fetchReviewsScores } from "../_utils/api";
+import ScoreProgressBar from "./ScoreProgressBar";
+import Score from "@/components/Score";
+
+export default async function ReviewsAverage() {
+ const [scores] = await fetchReviewsScores();
+
+ const { averageScore, oneStar, twoStars, threeStars,... | Unknown | _:warning: Potential issue_
**map ํจ์์ key prop์ด ํ์ํฉ๋๋ค.**
React ๋ฐฐ์ด ๋ ๋๋ง ์ ๊ฐ ์์๋ฅผ ์๋ณํ๊ธฐ ์ํ key prop์ด ๋๋ฝ๋์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์์ ํ๋ ๊ฒ์ ์ ์๋๋ฆฝ๋๋ค:
```diff
{stars.map((count, index) => (
- <ScoreProgressBar score={5 - index} stars={count} total={total} />
+ <ScoreProgressBar
+ key={5 - index}
+ score={5 - index}
+ stars={... |
@@ -0,0 +1,31 @@
+import { fetchReviewsScores } from "../_utils/api";
+import ScoreProgressBar from "./ScoreProgressBar";
+import Score from "@/components/Score";
+
+export default async function ReviewsAverage() {
+ const [scores] = await fetchReviewsScores();
+
+ const { averageScore, oneStar, twoStars, threeStars,... | Unknown | _:warning: Potential issue_
**๋ฐ์ดํฐ ๋ก๋ฉ ๋ฐ ์๋ฌ ์ํ ์ฒ๋ฆฌ๊ฐ ํ์ํฉ๋๋ค.**
๋น๋๊ธฐ ๋ฐ์ดํฐ ํ์นญ ์ ๋ฐ์ํ ์ ์๋ ์๋ฌ์ ๋ก๋ฉ ์ํ์ ๋ํ ์ฒ๋ฆฌ๊ฐ ๋๋ฝ๋์์ต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ์๋ฌ ์ฒ๋ฆฌ๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์ ์ ์๋๋ฆฝ๋๋ค:
```diff
export default async function ReviewsAverage() {
- const [scores] = await fetchReviewsScores();
+ try {
+ const [scores] = await fetchReviewsScores();
+ } catch (e... |
@@ -0,0 +1,18 @@
+const GATHERING_TYPE = ["DALLAEMFIT", "OFFICE_STRETCHING", "MINDFULNESS", "WORKATION"] as const;
+
+export type ScoresQuery = {
+ gatheringId?: number;
+ type?: (typeof GATHERING_TYPE)[number];
+};
+
+export type ScoresResponse = {
+ teamId: number;
+ gatheringId: number;
+ type?: (typeof GATHERI... | TypeScript | ์ฝ๋๋๋น ๋ง๋๋ก type์ด (typeof GATHERING_TYPE)[number]; ๊ฐ ๋์ด์ผ ํ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,31 @@
+import { fetchReviewsScores } from "../_utils/api";
+import ScoreProgressBar from "./ScoreProgressBar";
+import Score from "@/components/Score";
+
+export default async function ReviewsAverage() {
+ const [scores] = await fetchReviewsScores();
+
+ const { averageScore, oneStar, twoStars, threeStars,... | Unknown | ์ฌ๊ธฐ key prop์ด ํ์ํ ๊ฒ ๊ฐ์ต๋๋ค... ๊ทผ๋ฐ ์ฝ๋๋๋น์ด ์ด๋ฏธ ๋ฆฌ๋ทฐํด์คฌ๋ค์ |
@@ -0,0 +1,141 @@
+package com.fourseason.delivery.domain.review.service;
+
+import com.fourseason.delivery.domain.order.entity.Order;
+import com.fourseason.delivery.domain.order.entity.OrderStatus;
+import com.fourseason.delivery.domain.order.repository.OrderRepository;
+import com.fourseason.delivery.domain.review.d... | Java | collect(Collectors.toList()) ๋ณด๋ค๋ Stream.toList()๋ฅผ ์ ์ฉํ๋ ๊ฒ์ด ์ด๋จ๊น์?
toList()๋ฅผ ์ฌ์ฉํ๋ฉด UnmodifiableList ๋ฅผ ๋ฐํํด List ์ ๋ํ ๋ณ๊ฒฝ์ด ๋ถ๊ฐ๋ฅํ๊ธฐ ๋๋ฌธ์ ์ค๊ฐ์ ์์ ๋ ์ํ์ ์ค์ผ ์ ์์๊ฑฐ ๊ฐ์์! |
@@ -0,0 +1,19 @@
+package com.fourseason.delivery.domain.review.dto.request;
+
+
+import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.PositiveOrZero;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+public record ReviewRequestDto(
+ String co... | Java | dto์ ๊ฒฝ์ฐ record๋ก ์์ฑํ๊ธฐ๋ก ํ๋๊ฑธ๋ก ๊ธฐ์ตํฉ๋๋น. |
@@ -0,0 +1,17 @@
+package com.fourseason.delivery.domain.review.repository;
+
+import com.fourseason.delivery.domain.order.entity.Order;
+import com.fourseason.delivery.domain.review.entity.Review;
+import com.fourseason.delivery.domain.shop.entity.Shop;
+import org.springframework.data.jpa.repository.JpaRepository;
+
... | Java | ๋ฐ์ดํฐ๋ค์ ์ค์ ๋ก ์ญ์ ํ์ง ์๊ณ ๋
ผ๋ฆฌ์ ์ญ์ ์ฒ๋ฆฌ ํ๊ธฐ๋ก ํ๋ ๋ถ๋ถ์ด๋ผ
findByIdAndDeletedAtIsNotNull ๊ณผ ๊ฐ์ ํํ๋ก ์กฐํํด์ฃผ์
์ผ...
์ ๋ ์ด ๋ถ๋ถ ์ฒ์์ ๊น๋จน์์ต๋๋ค. |
@@ -0,0 +1,62 @@
+package com.fourseason.delivery.domain.review.controller;
+
+import com.fourseason.delivery.domain.review.dto.request.ReviewRequestDto;
+import com.fourseason.delivery.domain.review.dto.response.ReviewResponseDto;
+import com.fourseason.delivery.domain.review.service.ReviewService;
+import lombok.Requ... | Java | `String order_id` ๋ ์์ง `Order`๋ฅผ ํธ์ ์ํ๊ธฐ ๋๋ฌธ์ `UUID` ํ์
์ผ๋ก ๋ฐ๊พธ์ง ์์ผ์ ๊ฑธ๊น์? |
@@ -0,0 +1,62 @@
+package com.fourseason.delivery.domain.review.controller;
+
+import com.fourseason.delivery.domain.review.dto.request.ReviewRequestDto;
+import com.fourseason.delivery.domain.review.dto.response.ReviewResponseDto;
+import com.fourseason.delivery.domain.review.service.ReviewService;
+import lombok.Requ... | Java | ์ด ๋ถ๋ถ์ ์ ํํ ์ ๋ชจ๋ฅด๊ฒ ์ง๋ง, `reviewId` ์ฒ๋ผ ์นด๋ฉ์ผ์ด์ค๋ก ์์ฑ๋๋ ๊ฒ์ด ๋ ์ข์ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค์ด์.
๊ทธ๋ ๊ฒ ์๊ฐํ๋ ์ด์ ๋ `@PathVariable` ์์๋ `String review_id` ์ ๊ฐ์ด ์ฌ์ฉ๋๊ธฐ ๋๋ฌธ์ด์์. |
@@ -0,0 +1,28 @@
+package com.fourseason.delivery.domain.review.controller;
+
+import com.fourseason.delivery.domain.review.dto.response.ReviewResponseDto;
+import com.fourseason.delivery.domain.review.repository.ReviewRepository;
+import com.fourseason.delivery.domain.review.service.ReviewService;
+import lombok.Requi... | Java | `/api/shops` ๋ถ๋ถ์ ๊ณตํต์ผ๋ก ํด๋ ๋ ๊ฒ ๊ฐ์์!
์๋๋ฉด, `ShopController`์ ๊ฒน์น๊ธฐ ๋๋ฌธ์ผ๊น์? |
@@ -0,0 +1,17 @@
+package com.fourseason.delivery.domain.review.repository;
+
+import com.fourseason.delivery.domain.order.entity.Order;
+import com.fourseason.delivery.domain.review.entity.Review;
+import com.fourseason.delivery.domain.shop.entity.Shop;
+import org.springframework.data.jpa.repository.JpaRepository;
+
... | Java | ์ํํธ ๋๋ฆฌํธ์ ๋ํด ์ฐพ์๋ณด๋๊น JPA์์ `@SQLDelte` ๋ `@Where`๋ฅผ ์ํฐํฐ ํด๋์ค์ ๋ถ์์ผ๋ก์จ, ์ฝ๊ฒ ๊ตฌํํ ์ ์๋ ๊ฒ ๊ฐ์์. ๊ฐ์ด ๋
ผ์ํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
๋ชจ๋ ์ญ์ ์ฟผ๋ฆฌ๋ฉ์๋๋ฅผ update๋ก ํ๊ฑฐ๋, ์กฐํ ์ `DeleteAtIsNotNull` ์ ์ ๋ฏธ์ฌ๋ก ๋ถ์ธ๋ค๋ฉด, ๋์ค์ ์ ์ฑ
์ด ๋ฐ๋์์ ๋, ์ฝ๋ ์์ ์ด ๋ฒ๊ฑฐ๋ก์ธ ๊ฒ ๊ฐ์์.
์ด๋ ํ ๊ณณ์์ ์ญ์ ์ ์ฑ
์ ๋ฐ๋ผ ๊ณตํต์ผ๋ก ์ฒ๋ฆฌ๋๋ฉด ์ข์ ๊ฒ ๊ฐ๋ค๋ ์๊ฐ์ด ๋ค์์ต๋๋ค. |
@@ -1,9 +1,100 @@
-function Header(logo, searchBox) {
+import Input from './Input';
+import Button from './Button';
+import { handleSearch } from '../services/handleSeach';
+
+function Header({ logoSrc, logoAlt, onSearch }) {
const headerElement = document.createElement('header');
- headerElement.classList.add(... | JavaScript | ์ ๋ ์ด๋ฒคํธ์ ์ด๋ฆ์ด ์๋ฏธํ๋๊ฒ "ํ์์ ๋ฐ์" ์ด๋ผ๊ณ ์๊ฐํด์.
๊ฐ๋ น, `onChange` ๋ ์ค์ ๋ก change๊ฐ ์ผ์ด๋ฌ์ ๋์ด๊ณ , `onKeyDown` ์ ํค๋ฅผ ๋๋ ์ ๋ ์
๋๋ค.
`onSearch`๋ "๊ฒ์์ด ๋์์ ๋ ๋ฐ์" ์ธ๋ฐ, ์ด ์ปดํฌ๋ํธ์์ ์ค์ ๋ก "๊ฒ์"์ด๋ผ๋ ํ์๊ฐ ์ผ์ด๋ฌ๋ค๊ณ ํ ์ ์์๊น์?
์ง๊ธ์ "๊ฒ์"์ด๋ผ๋ ํ์๋ฅผ ๋ฐ์์ ์ฃผ์
ํด์ฃผ๊ณ , ์ด ์ปดํฌ๋ํธ ๋ด๋ถ์์ ์ผ์ด๋ ์ผ์ "์ํฐํค๋ฅผ ๋๋ ์" ์
๋๋ค.
์ฆ, ์ด๋ฒคํธ๋ "๊ฒ์ํ์ ๋ ๋ฐ์ํจ"์ ์ด์ผ๊ธฐํ๊ณ ์๋๋ฐ ๊ฒ์์ด๋ผ๋ ๊ธฐ๋ฅ์ ๋ฐ์์ ์ฃผ์
ํด์ค ์ ๋ฐ์ ์๋ ์ํฉ์ธ๊ฑฐ์ฃ . |
@@ -1,9 +1,100 @@
-function Header(logo, searchBox) {
+import Input from './Input';
+import Button from './Button';
+import { handleSearch } from '../services/handleSeach';
+
+function Header({ logoSrc, logoAlt, onSearch }) {
const headerElement = document.createElement('header');
- headerElement.classList.add(... | JavaScript | ์ด ๋ถ๋ถ๋ ๋์ผํฉ๋๋ค! |
@@ -1,9 +1,100 @@
-function Header(logo, searchBox) {
+import Input from './Input';
+import Button from './Button';
+import { handleSearch } from '../services/handleSeach';
+
+function Header({ logoSrc, logoAlt, onSearch }) {
const headerElement = document.createElement('header');
- headerElement.classList.add(... | JavaScript | ์ฌ๊ธฐ์ ์ฐ์ด๋ 390 ์ด๋ผ๋ ์ซ์๋ ์์๋ก ๋ง๋ค์ด์ ์ฌ์ฉํด์ฃผ๋ฉด ์ด๋จ๊น์!? |
@@ -1,9 +1,100 @@
-function Header(logo, searchBox) {
+import Input from './Input';
+import Button from './Button';
+import { handleSearch } from '../services/handleSeach';
+
+function Header({ logoSrc, logoAlt, onSearch }) {
const headerElement = document.createElement('header');
- headerElement.classList.add(... | JavaScript | ์ ๋ณด๋๊น ๋ก์ง์ด ๊ฑฐ์ ์ ์ฌํ๋ค์! |
@@ -0,0 +1,33 @@
+import handleMovie from '../services/handleMovie';
+import Button from './Button';
+
+function MainContent(initialPage) {
+ let page = initialPage;
+ const mainElement = document.createElement('main');
+ mainElement.id = 'main';
+
+ mainElement.innerHTML = `
+ <section class="item-v... | JavaScript | ```suggestion
const mainElement = html(`
<main id="main">
<section class="item-view">
<h2>์ง๊ธ ์ธ๊ธฐ ์๋ ์ํ</h2>
<ul class="item-list"></ul>
</section>
<main>
`);
```
์ด๋ ๊ฒ ํํํ ์ ์๋๋ก ํจ์๋ฅผ ํ๋ ๋ง๋ค์ด์ฃผ์๋ฉด ์ด๋จ๊น์!? |
@@ -0,0 +1,33 @@
+import handleMovie from '../services/handleMovie';
+import Button from './Button';
+
+function MainContent(initialPage) {
+ let page = initialPage;
+ const mainElement = document.createElement('main');
+ mainElement.id = 'main';
+
+ mainElement.innerHTML = `
+ <section class="item-v... | JavaScript | ์์์๋ html template์ผ๋ก ํํ๋๊ณ ์ฌ๊ธฐ์๋ ์ด๋ ๊ฒ ํํ๋๊ณ ์์ด์ ์ฝ๋๋ฅผ ์ฝ๋ ์ฌ๋ ์
์ฅ์์๋ ์กฐ๊ธ ํท๊ฐ๋ฆฌ์ง ์์๊น ์ถ์ด์! |
@@ -0,0 +1,47 @@
+import { BASE_URL } from '../constants/api';
+import { APIError } from '../apis/error';
+
+interface ApiClientType {
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
+ endpoint: string;
+ params?: Record<string, string>;
+ headers?: Record<string, string>;
+ body?: Record<string, any>;
+}
+... | TypeScript | ์ํ.. ์ด ํ์ผ ๋๋ฌธ์ tsconfig๊ฐ ์๊ธด๊ฑฐ์๊ตฐ์ |
@@ -0,0 +1,47 @@
+import { BASE_URL } from '../constants/api';
+import { APIError } from '../apis/error';
+
+interface ApiClientType {
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
+ endpoint: string;
+ params?: Record<string, string>;
+ headers?: Record<string, string>;
+ body?: Record<string, any>;
+}
+... | TypeScript | try ๊ตฌ๊ฐ์์ ์ค๋ฅ ๋ฐ์ -> catch๋ก ์ง์
-> ๋ฌด์กฐ๊ฑด status๋ 400์ผ๋ก ๊ณ ์ ํ์ฌ ๋ค์ error throw
์ด๋ ๊ฒ ๋ฉ๋๋ค.
์ ์๋ฏธํ ์๋ฌ ํ๋ก์ฐ์ผ๊น์~? |
@@ -0,0 +1,47 @@
+import { BASE_URL } from '../constants/api';
+import { APIError } from '../apis/error';
+
+interface ApiClientType {
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
+ endpoint: string;
+ params?: Record<string, string>;
+ headers?: Record<string, string>;
+ body?: Record<string, any>;
+}
+... | TypeScript | ๊ทธ๋ฐ๋ฐ ์ด ํ์ผ์ด ์ domain ์ ํด๋นํ๋๊ฑธ๊น์~?
domain์ด๋ผ๊ณ ํ๊ธฐ์ ๋ง ๊ทธ๋๋ก ์ฌ์ด๋ ์ดํํธ(client)๋ฅผ ํํํ๊ฑฐ๋ผ์... ์ ํ ์ฐ๊ด์ด ์์ด๋ณด์ฌ์! |
@@ -0,0 +1,24 @@
+import getMovieList from '../apis/getMovieList';
+import ConfirmModal from '../components/modal/ConfirmModal';
+import { Modal } from '../components/modal/container/Modal';
+import { NOT_MORE_MOVIES_MESSAGE } from '../constants/message';
+import renderMovies from '../view/renderMovies';
+import render... | JavaScript | api์์ ๋ฐ์ํ ์๋ฌ ์ค์ message๋ง ์ฌ์ฉํ๊ณ ์๋๋ฐ, CustomError๋ฅผ ๋ง๋ค์ด์ ์ฐ๋ ์๋ฏธ๊ฐ ์๋๊ฑด๊ฐ ์ถ์ด์! |
@@ -0,0 +1,47 @@
+import { BASE_URL } from '../constants/api';
+import { APIError } from '../apis/error';
+
+interface ApiClientType {
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
+ endpoint: string;
+ params?: Record<string, string>;
+ headers?: Record<string, string>;
+ body?: Record<string, any>;
+}
+... | TypeScript | domain์ด apis๋ฅผ ์ฐธ์กฐํ๋๊ฑด ์ด์ํด๋ณด์ฌ์! |
@@ -1,2 +1 @@
export const BASE_URL = 'https://api.themoviedb.org';
-export const IMAGE_BASE_URL = 'https://image.tmdb.org/t/p/w500'; | JavaScript | ์ด๋ฐ ์ ๋ณด๋ ์์ API๋ฅผ ์์ฒญํ๋ ์ชฝ์์ ๊ฐ์ง๊ณ ์์ผ๋ฉด ์ด๋จ๊น์? |
@@ -0,0 +1 @@
+export const NOT_MORE_MOVIES_MESSAGE = '๋์ด์ ์ํ๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค.'; | JavaScript | ์ด๋ฐ ์๋ฌ ๋ฉ์ธ์ง๋ ๋ฉ์ธ์ง๋ฅผ ์ฌ์ฉํ๋ ์ชฝ์์ ๊ฐ์ง๊ณ ์์ผ๋ฉด ์ด๋จ๊น์?
๋ค๋ฅธ ๊ตฌ๊ฐ์์๋ ์์ ์ฌ์ฉ๋ ๊ฒ ๊ฐ์ง ์์์์! |
@@ -1,14 +1,40 @@
-import React from "react";
-import "./PostList.scss";
+import React, { useEffect, useState } from 'react';
+import { useNavigate } from 'react-router-dom';
+import Posts from './components/Posts';
+import './PostList.scss';
const PostList = () => {
+ const [postData, setPostData] = useState([]);
... | JavaScript | import ์์์๋ ์ ์ง๋ณด์ ๋ฐ ๊ฐ๋
์ฑ์ ์ํ ์ปจ๋ฒค์
์ด ์์ต๋๋ค.
์์ฝ๋์ ์ปจ๋ฒค์
์ ๊ฐ๋ตํ๊ฒ ์๋์ ๊ฐ๊ณ , ์ฐธ๊ณ ํด์ ์์ ํด ์ฃผ์ธ์!
- ๋ผ์ด๋ธ๋ฌ๋ฆฌ
- React ๊ด๋ จ ํจํค์ง
- ์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
- ์ปดํฌ๋ํธ
- ๊ณตํต ์ปดํฌ๋ํธ โ ๋จผ ์ปดํฌ๋ํธ โ ๊ฐ๊น์ด ์ปดํฌ๋ํธ
- ํจ์, ๋ณ์ ๋ฐ ์ค์ ํ์ผ
- ์ฌ์ง ๋ฑ ๋ฏธ๋์ด ํ์ผ(`.png`)
- css ํ์ผ (.`scss`) |
@@ -0,0 +1,63 @@
+.postList {
+ margin: 0 auto;
+ display: flex;
+ width: 576px;
+ height: 80vh;
+ padding: 40px 24px;
+ flex-direction: column;
+ align-items: center;
+ border-radius: 16px;
+ border: 1px solid #e5e5e5;
+ background: white;
+
+ .posts {
+ width: 100%;
+ overflow-y: scroll;
+ flex: 1... | Unknown | ๋ถ๋ชจ ์ ํ์(`&`)๋ฅผ ์ฌ์ฉํด์ ํด๋น ์์์๋ง ์ ์ฉ๋๋ ์คํ์ผ์์ ์ข ๋ ๊น๋ํ๊ฒ ๋ช
์ํ ์ ์์ต๋๋ค!
```suggestion
.posts {
overflow-y: scroll;
flex: 1;
&::-webkit-scrollbar {
display: none;
}
}
``` |
@@ -1,7 +1,18 @@
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;400;500;700;900&display=swap');
-
* {
box-sizing: border-box;
font-family: 'Noto Sans KR', sans-serif;
-}
\ No newline at end of file
+}
+
+body {
+ width: 100vw;
+ height: 100vh;
+ display: flex;
+ align-item... | Unknown | ๊ณต์ฉ ํ์ผ์ ์์ ํด์ ์ฌ๋ ค์ฃผ์
จ๋๋ฐ, ๊ณต์ฉ ํ์ผ์ ์์ ์
1. ํ์๊ณผ์ ์ถฉ๋ถํ ์์ ํ์
2. ํด๋น ํ์ผ๋ง ์์ ํ๋ ๋ด์ฉ์ PR
์ ์ฌ๋ ค์ฃผ์
์ผ ํฉ๋๋ค! |
@@ -0,0 +1,8 @@
+import "./css/reset.css";
+import "./css/common.css";
+import App from "./App";
+
+addEventListener("DOMContentLoaded", async () => {
+ const app = new App();
+ app.init();
+}); | JavaScript | ์ ํจ์๊ฐ ๋ฐ๋ก ์ฑ์ ๊ตฌ๋์ํค๋ Entry ํฌ์ธํธ๊ตฐ์!
`controller`๋ฅผ ์ด๊ธฐํํ๋ค? ๋ณด๋ค๋ `App`์ ์ด๊ธฐํํ๋ค๋ ๋๋์ด ์ด๋จ๊น์? |
@@ -0,0 +1,14 @@
+import { apiClient } from "./apiClient";
+import { BASE_URL } from "./constants";
+
+export const fetchPopularMovies = async ({ page = 1 }) => {
+ const param = new URLSearchParams({
+ api_key: process.env.TMDB_API_KEY,
+ language: "ko-KR",
+ page,
+ });
+
+ const response = await apiClien... | JavaScript | ์ค ์ข์ต๋๋ค! |
@@ -0,0 +1,34 @@
+import { ApiError } from "./apiError";
+
+export const apiClient = {
+ get: async (url, headers = {}) => {
+ return apiClient.request("GET", url, null, headers);
+ },
+
+ request: async (method, url, body = null, headers = {}) => {
+ const options = {
+ method,
+ headers: {
+ ... | JavaScript | `request()`์ `get()`์ ์ฐจ์ด๋ ๋ฌด์์ด๊ณ ๋๋ ์ด์ ๋ ๋ฌด์์ผ๊น์? |
@@ -0,0 +1,31 @@
+import { ERROR_MSG } from "./constants";
+
+export class ApiError extends Error {
+ constructor(message, details, status = -1) {
+ super(message);
+ this.details = details;
+ this.status = status;
+ }
+
+ static handle(error) {
+ let errMsg;
+ let errDetails;
+
+ switch (parseInt(... | JavaScript | ์ค ์ข์ ์๋์
๋๋ค ๐ |
@@ -0,0 +1,16 @@
+import { mainTitle, mainMoreButton, movieCardsList } from "./index";
+
+export const mainSection = {
+ render() {
+ const element = document.createElement("section");
+ element.classList.add("item-view");
+
+ const title = mainTitle.render();
+ const itemList = movieCardsList.render();
+ ... | JavaScript | [append()](https://developer.mozilla.org/en-US/docs/Web/API/Element/append)๋ฅผ ํ์ฉํด๋ณด์ธ์! |
@@ -0,0 +1,46 @@
+describe("API ํ
์คํธ", () => {
+ it("์ํ ๋ชฉ๋ก API๋ฅผ ํธ์ถํ๋ฉด 20๊ฐ์ฉ ์ํ๋ฅผ ๋ฐ์์จ๋ค.", () => {
+ const baseUrl = "https://api.themoviedb.org/3/movie/popular";
+ const param = new URLSearchParams({
+ api_key: Cypress.env("TMDB_API_KEY"),
+ language: "ko-KR",
+ page: 1,
+ });
+
+ cy.request(`${b... | JavaScript | ์คํธ?
`exist`๋ก ๊ฒ์ฌํ๋ฉด ๋ฌด์์ด ๋ค๋ฅผ๊น์? |
@@ -0,0 +1,46 @@
+describe("API ํ
์คํธ", () => {
+ it("์ํ ๋ชฉ๋ก API๋ฅผ ํธ์ถํ๋ฉด 20๊ฐ์ฉ ์ํ๋ฅผ ๋ฐ์์จ๋ค.", () => {
+ const baseUrl = "https://api.themoviedb.org/3/movie/popular";
+ const param = new URLSearchParams({
+ api_key: Cypress.env("TMDB_API_KEY"),
+ language: "ko-KR",
+ page: 1,
+ });
+
+ cy.request(`${b... | JavaScript | 40์ผ๋ก ๊ฒ์ฌํ๋ ์ด์ ๋ ์ด๊ธฐ ๋ฆฌ์คํธ 20 + ์ถ๊ฐ ๋๋ณด๊ธฐ 20์ผ๊น์? |
@@ -0,0 +1,34 @@
+import { ApiError } from "./apiError";
+
+export const apiClient = {
+ get: async (url, headers = {}) => {
+ return apiClient.request("GET", url, null, headers);
+ },
+
+ request: async (method, url, body = null, headers = {}) => {
+ const options = {
+ method,
+ headers: {
+ ... | JavaScript | `request()`๋ ๋งค๊ฐ๋ณ์๋ก ๋ฐ๋ method๋ฅผ ํตํด API ์์ฒญ์ ๋ณด๋ด๋ ํจ์์ด๊ณ , `get()`์ ํด๋น `request()` ํจ์์ `GET`์์ฒญ์ ๋ณด๋ด๋ ํจ์์
๋๋ค.
์ด๋ฒ ๊ณผ์ ์์ GET ์์ฒญ๋ง ์กด์ฌํ์ฌ ์ถ๊ฐํ์ง ์์์ง๋ง ์ถํ์ ๋ค๋ฅธ ๋ฉ์๋ ์์ฒญ์ ์ถ๊ฐํ ์ ์๊ฒ ์์ฑํ์์ต๋๋ค! |
@@ -0,0 +1,46 @@
+describe("API ํ
์คํธ", () => {
+ it("์ํ ๋ชฉ๋ก API๋ฅผ ํธ์ถํ๋ฉด 20๊ฐ์ฉ ์ํ๋ฅผ ๋ฐ์์จ๋ค.", () => {
+ const baseUrl = "https://api.themoviedb.org/3/movie/popular";
+ const param = new URLSearchParams({
+ api_key: Cypress.env("TMDB_API_KEY"),
+ language: "ko-KR",
+ page: 1,
+ });
+
+ cy.request(`${b... | JavaScript | ์์ฑ๋ `movieCard`์๋ ์ธ๋ค์ผ, ๋ณ์ , ์ ๋ชฉ element๊ฐ `์กด์ฌ`ํ๋ค๋ ์๋ฏธ์์ ์ฌ์ฉํ ๊ฒ ๊ฐ์ต๋๋ค!
๋ค์ ์๊ฐํด๋ณด๋, ํด๋น element๊ฐ ์กด์ฌํ์ง๋ง ๋ณด์ฌ์ง์ง ์๊ฑฐ๋ ์ด๋ค css issue๊ฐ ์๊ธธ ์๋ ์๋ค๋ ์๊ฐ์ `be.visible`๋ก ๋์ฒดํ์์ต๋๋ค. |
@@ -0,0 +1,46 @@
+describe("API ํ
์คํธ", () => {
+ it("์ํ ๋ชฉ๋ก API๋ฅผ ํธ์ถํ๋ฉด 20๊ฐ์ฉ ์ํ๋ฅผ ๋ฐ์์จ๋ค.", () => {
+ const baseUrl = "https://api.themoviedb.org/3/movie/popular";
+ const param = new URLSearchParams({
+ api_key: Cypress.env("TMDB_API_KEY"),
+ language: "ko-KR",
+ page: 1,
+ });
+
+ cy.request(`${b... | JavaScript | ๋ค ๋ง์ต๋๋ค! ์ด์ ํ
์คํธ์์ 20๊ฐ๊ฐ ๋ ๋๋ง์ด ๋์๊ณ ๋ฒํผ์ ํด๋ฆญํ ํ์, 20๊ฐ๊ฐ ๋ ์ถ๊ฐ๋์ด 40๊ฐ๋ฅผ ๊ฒ์ฌํ๊ฒ ํ์์ต๋๋ค.
์๋กญ๊ฒ ๋ ๋๋ง๋ 20๊ฐ์ ๋ํด์ ํ
์คํธ๋ฅผ ์งํํ๋ ๊ฒ์ด ๋ ์ฌ๋ฐ๋ฅธ ๊ฒ์ฌ์ผ๊น์?
+) ์ถ๊ฐ๋ก, ๋จ์ํ
์คํธ์์๋ ์ํ ๊ฐ์ ํตํด ๋์ถ๋๋ ๊ฐ์ ๊ฒ์ฌํ๋ ๊ณผ์ ์ด ํ
์คํธ์ ํต์ฌ์ด์๋ค๊ณ ์๊ฐ๋๋๋ฐ,
์ด๋ฒ์ e2e์์๋ ๊ฐ์ ์ด์ฉํ์ฌ ๊ฒ์ฌํ๋ ๋ฐฉํฅ๋ณด๋ค ๋ ๋๋ง๋๋ ์์์ ๊ฐ์๋ ์์ฑ ์ฌ๋ถ๋ฅผ ์ค์ฌ์ ์ผ๋ก ์ฝ๋๋ฅผ ์์ฑํ ๊ฒ ๊ฐ์ต๋๋ค.
๊ทธ๋ฐ ๊ณผ์ ์์ ๋จ์ ํ
์คํธ๋ ๊ฐ ์ค์ฌ, e2e๋ ์ ์ฒด์ ์ธ DOM ๋ ๋๋ง ์ค์ฌ ์ด๋ ๊ฒ ์์ฐ์ค๋ ์๊ฐ์ด ์ด์ด... |
@@ -1,11 +1,29 @@
import { useState } from "react";
+import Header from "./components/Header/Header";
+import Product from "./pages/Product";
+import GlobalStyles from "./styles/Global.style";
+import Toast from "./components/common/Toast/Toast";
+import { QuantityContext } from "./store/QuantityContext";
+import { cr... | Unknown | ์ฌ๊ธฐ ์ด `showToast` ์ํ๋ฅผ ํ ์คํธ ์ปดํฌ๋ํธ๊ฐ ์ฑ
์์ ๊ฐ์ง ์ ์์ง ์์๊น ์ถ์๋๋ฐ, ๊ทธ๋ ๋ค๋ฉด createPortal์ ์ฌ์ฉํ ์ ์๊ฒ ๋๋์..? createPortal์ ์ฌ์ฉํด๋ณด์ง ์์์ ์ ๋ชจ๋ฅด๊ฒ ์ง๋ง, ๋ฏธ๋ฆฌ ์ด์ด๋ ์ ์๋ค๋ฉด ๊ทธ์ชฝ์ผ๋ก ์ํ๋ฅผ ์ฎ๊ฒจ๋ด๋ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,52 @@
+import { generateBasicToken } from "../util/auth";
+import { CART_ITEMS_ENDPOINT } from "./config";
+
+const USER_PASSWORD = import.meta.env.VITE_USER_PASSWORD;
+const USER_ID = import.meta.env.VITE_USER_ID;
+const token = generateBasicToken(USER_ID, USER_PASSWORD);
+
+export async function requestFet... | TypeScript | ํ์๋ ์๋์ง๋ง ๋ฐ๋ณต๋๋ fetch ๋ก์ง๋ค์ ์ถ์ํํด๋ณด์
๋ ์ข์ ๊ฒ ๊ฐ์์!ใ
ใ
|
@@ -0,0 +1,52 @@
+import { generateBasicToken } from "../util/auth";
+import { CART_ITEMS_ENDPOINT } from "./config";
+
+const USER_PASSWORD = import.meta.env.VITE_USER_PASSWORD;
+const USER_ID = import.meta.env.VITE_USER_ID;
+const token = generateBasicToken(USER_ID, USER_PASSWORD);
+
+export async function requestFet... | TypeScript | chat GPTํํ
'์ด ์ฝ๋ ์ถ์ํ ํด๋ด'ํ๋ฉด ๊ธฐ๊ฐ๋งํ๊ฒ ํด์ฃผ๋๋ผ๊ตฌ์ |
@@ -0,0 +1,10 @@
+import { generateBasicToken } from "../util/auth";
+
+const API_URL = import.meta.env.VITE_API_URL;
+
+export const PRODUCTS_ENDPOINT = `${API_URL}/products`;
+export const CART_ITEMS_ENDPOINT = `${API_URL}/cart-items`;
+
+export const USER_PASSWORD = import.meta.env.VITE_USER_PASSWORD;
+export const ... | TypeScript | api์์ฒญ์ ํ์ํ ๋ณ์๋ค์ด ์ ๋ชจ์ฌ์์ด ๊ด๋ฆฌํ๊ธฐ ํธํ ๊ฒ ๊ฐ๋ค์! ๐ |
@@ -0,0 +1,87 @@
+import { useContext, useEffect, useRef } from "react";
+import { QuantityContext } from "../../store/QuantityContext";
+import useProductList from "../../hooks/useProductList";
+import useCartItemList from "../../hooks/useCartItemList";
+import ProductItem from "../ProductItem/ProductItem";
+import * ... | Unknown | ํ์ด์ง๋ค์ด์
๊ด๋ จ ๋ก์ง๋ ์ปค์คํ
ํ
์ผ๋ก ๋ถ๋ฆฌํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,87 @@
+import { useContext, useEffect, useRef } from "react";
+import { QuantityContext } from "../../store/QuantityContext";
+import useProductList from "../../hooks/useProductList";
+import useCartItemList from "../../hooks/useCartItemList";
+import ProductItem from "../ProductItem/ProductItem";
+import * ... | Unknown | ์๋ฌด๋๋ ์ด๋ฒ ๋ฏธ์
์์ ๊ฐ์ฅ ๋ฉ์ธ์ด ๋๋(?) ์ปดํฌ๋ํธ์ธ ๊ฒ ๊ฐ์์. ๋น์ฆ๋์ค ๋ก์ง๊ณผ UI ๋ก์ง์ด ์ข ๋ ์ ๋ถ๋ฆฌ๋๋ฉด ๋์ฑ ์ฝ๊ธฐ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,13 @@
+package msa.customer.exception;
+
+public class DeliveryCustomerException extends RuntimeException {
+
+ public DeliveryCustomerException(String message) {
+ super(message);
+ }
+
+ public DeliveryCustomerException(String message, Throwable cause) {
+ super(message, cause);
+ ... | Java | (C) Exception์ ์๋น์ค์ `์ ์ฑ
์๋ฐ`์ ๋ํ๋ด๋ documentation์ ์ญํ ์ ํ๊ธฐ๋ ํฉ๋๋ค.
๋ฐ๋ผ์ Exception์ ํตํด ์๋น์ค ์ ์ฑ
์ ์๋ฐํ๋ ๊ฒฝ์ฐ, ์ ์ฑ
์ ๋ช
ํํ๊ฒ ๋ํ๋ผ ์ ์๋ ์์ฒด exception์ ์ ์ํ๊ณค ํ๋๋ฐ delivery application์ ์ ์ฉํด๋ณผ๋งํ exception ๋ช ๊ฐ๋ฅผ ๊ฐ๋ตํ๊ฒ ๊ตฌ์ฑํด๋ดค์ผ๋ ์ฐธ๊ณ ํด๋ณด์๊ณ Exception๋ค์ ์ ์ ์ํด์ฃผ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -3,6 +3,7 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import msa.customer.entity.store.Store;
+import msa.customer.exception.store.StoreEmptyException;
import msa.customer.service.store.StoreService;
import org.springframework.web.servlet.HandlerIntercepto... | Java | (C) optional์ ๋ฒ๊ฒจ์ง ์ํ๋ก ์ค๋๊ฒ ์ข๊ฒ ์ง๋ง, ์ผ๋จ ํ์ฌ ์ํ๋ฅผ ๊ฐ์ ํ๊ณ custom exception์ throw ํ์ต๋๋ค |
@@ -6,6 +6,7 @@
import msa.restaurant.dto.store.StoreResponseDto;
import msa.restaurant.entity.store.Store;
import msa.restaurant.dto.store.StoreSqsDto;
+import msa.restaurant.exception.store.StoreCreationFailedException;
import msa.restaurant.service.member.MemberService;
import msa.restaurant.sqs.SendingMessageC... | Java | (C) ์ฌ๊ธฐ๋ StoreCreationFailedException์ ๋์ง์ง๋ง, storeService.createStore ๋ด๋ถ์์ exception ์ฒ๋ฆฌ๋ฅผ ํ๊ณ ๋์ค๋ ๊ฒ์ด ๋ ๋ฐ๋์งํด๋ณด์
๋๋ค. |
@@ -18,39 +18,30 @@ public OrderService(OrderRepository orderRepository) {
this.orderRepository = orderRepository;
}
- public void createOrder(Order order){
+ public void createOrder(Order order) {
orderRepository.createOrder(order);
}
- public List<Order> getOrderList(String st... | Java | (C) changeOrderStatusTo~ ๋ฉ์๋์ ๋ด์ฉ์ด ๋๋ถ๋ถ ์ค๋ณต๋์ด์, ํด๋น ๋ฉ์๋๋ค์ changeOrderStatus๋ผ๋ ๋ฉ์๋๋ก ํตํฉํ์์ต๋๋ค.
์ฌ๊ธฐ์ ์๋ก์ด ํด๋์ค์ธ OrderStatusUpdatePolicy๊ฐ ๋ง๋ค์ด์ก๋๋ฐ, ~Policy๋ผ๋ ๋ช
์นญ์ ์๋น์ค ์ ์ฑ
์ ํํํ๊ธฐ ์ํด ๋ฒ์ฉ์ ์ผ๋ก ์ฌ์ฉํ๋ ํด๋์ค ๋ค์ด๋ฐ ์ค ํ๋์
๋๋ค.
delivery-application์๋ ์๋น์ค ์ด์์ ํ์ํ ์ฌ๋ฌ๊ฐ์ง ์ ์ฑ
๋ค์ ๊ฐ๊ณ ์์ํ
๋ฐ์, ์ด๋ฐ ์ ์ฑ
๋ค์ ํด๋์ค๋ก ๋๋ฌ๋ด์ง ์๊ณ ๋ฉ์๋๋ ๋ก์ง์ผ๋ก๋ง ๋ํ๋ด๋ฉด ์ ์ฑ
๋ค์ด ๋ถ์ฐ๋๊ณ , ์์์ ์ผ๋ก ํํ๋์ด์ ์ฐ๋ฆฌ ์๋น์ค๊ฐ... |
@@ -0,0 +1,13 @@
+package msa.customer.exception;
+
+public class DeliveryCustomerException extends RuntimeException {
+
+ public DeliveryCustomerException(String message) {
+ super(message);
+ }
+
+ public DeliveryCustomerException(String message, Throwable cause) {
+ super(message, cause);
+ ... | Java | ์ฐธ๊ณ ํ๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,152 @@
+package nextstep.subway.acceptance;
+
+import static nextstep.subway.acceptance.FavoritesSteps.์ฆ๊ฒจ์ฐพ๊ธฐ_๊ถํ์ด_์์;
+import static nextstep.subway.acceptance.FavoritesSteps.์ฆ๊ฒจ์ฐพ๊ธฐ_๋ชฉ๋ก_์กฐํ_์์ฒญ;
+import static nextstep.subway.acceptance.FavoritesSteps.์ฆ๊ฒจ์ฐพ๊ธฐ_์ญ์ _์์ฒญ;
+import static nextstep.subway.acceptance.FavoritesS... | Java | `์ฆ๊ฒจ์ฐพ๊ธฐ ๋ชฉ๋ก์ ๊ด๋ฆฌํ๋ค` ์์ ์๋๋ฆฌ์ค ํ์์ผ๋ก ์ ์์ฑํด์ฃผ์
์
ํด๋น ํ
์คํธ๋ค์ ์์ฑํด์ฃผ์ง ์์๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์์ ๐ |
@@ -0,0 +1,50 @@
+package nextstep.subway.applicaion;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import nextstep.member.application.MemberService;
+import nextstep.member.domain.LoginMember;
+import nextstep.member.domain.MemberRepository;
+import nextstep.subway.applicaion.dto.FavoriteRequest;
+im... | Java | memberRepository ๋ฅผ ์ฌ์ฉํ๊ณ ์์ง ์๋๋ฐ์,
์ฆ๊ฒจ์ฐพ๊ธฐ ์์ฑ, ์กฐํ, ์ญ์ ์ ์ ์ํ memberId ์ธ์ง ํ์ธํ์ง ์์๋ ๋ ๊น์? ๐ |
@@ -22,10 +22,14 @@ public PathService(LineService lineService, StationService stationService) {
public PathResponse findPath(Long source, Long target) {
Station upStation = stationService.findById(source);
Station downStation = stationService.findById(target);
- List<Line> lines = lineSer... | Java | ์ ๊ทผ์ ์ด์๋ฅผ ์๋ตํ์ ์ด์ ๊ฐ ์์ผ์ ๊ฐ์? ๐ |
@@ -0,0 +1,39 @@
+package nextstep.subway.applicaion.dto;
+
+import nextstep.subway.domain.Favorite;
+
+public class FavoriteResponse {
+ private Long id;
+ private Long memberId;
+ private StationResponse source;
+ private StationResponse target;
+
+ private FavoriteResponse(Long id, Long memberId,
+ ... | Java | ์๊ตฌ์ฌํญ์ memberId ๋ ์๋ค์!
์๊ตฌ์ฌํญ์ ํ์ธํด์ฃผ์ธ์ ๐ |
@@ -0,0 +1,49 @@
+package nextstep.subway.ui;
+
+import java.net.URI;
+import java.util.List;
+import nextstep.auth.authorization.AuthenticationPrincipal;
+import nextstep.member.domain.LoginMember;
+import nextstep.subway.applicaion.FavoriteService;
+import nextstep.subway.applicaion.dto.FavoriteRequest;
+import nexts... | Java | ์ฆ๊ฒจ์ฐพ๊ธฐ ์์ฑ ํ ๋ฐํ๊ฐ์ ๋ํ ์๊ตฌ์ฌํญ์ ํ์ธํด์ฃผ์ธ์! ๐
 |
@@ -1,5 +1,6 @@
package nextstep.subway.domain;
+import java.util.Optional;
import org.jgrapht.GraphPath;
import org.jgrapht.alg.shortestpath.DijkstraShortestPath;
import org.jgrapht.graph.SimpleDirectedWeightedGraph;
@@ -22,6 +23,11 @@ public Path findPath(Station source, Station target) {
DijkstraShort... | Java | Optional ์ ์ฌ์ฉํ์ ์ด์ ๊ฐ ์์ผ์ ๊ฐ์?
์ด๋ ํ ์ด์ ์ด ์๋์? ๐
```suggestion
if (Objects.isNull(result)) {
throw new IllegalArgumentException("์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ด ์ฐ๊ฒฐ๋์ด ์์ง ์์ต๋๋ค.");
}
``` |
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
@@ -7,6 +7,7 @@
<title>react-shopping-products</title>
</head>
<body>
+ <div id="toast"></div>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body> | Unknown | ์๊ฒ๋ fileChanged์ ์ฌ๋ผ์์ ์ ๊ธฐํด์ ๋จ๊ฒจ๋ด ใ
ใ
|
@@ -0,0 +1,96 @@
+import objectToQueryString, { ObjectQueryParams } from '@/utils/objectToQueryString';
+import { generateBasicToken } from '../utils/auth';
+
+type Method = 'GET' | 'POST' | 'PATCH' | 'DELETE';
+
+type Body = ReadableStream | XMLHttpRequestBodyInit;
+type HeadersType = [string, string][] | Record<strin... | TypeScript | ์ด ํ์ผ์์ ๊ฐ request๋ฅผ ์ถ์ํํด์ค๊ฒ ์์ฃผ ์ธ์๊น์์ต๋๋ค!!!
๋ฐฐ์๊ฐ ์ด์ด์ด,, |
@@ -0,0 +1,96 @@
+import objectToQueryString, { ObjectQueryParams } from '@/utils/objectToQueryString';
+import { generateBasicToken } from '../utils/auth';
+
+type Method = 'GET' | 'POST' | 'PATCH' | 'DELETE';
+
+type Body = ReadableStream | XMLHttpRequestBodyInit;
+type HeadersType = [string, string][] | Record<strin... | TypeScript | ์ด๊ฑฐ ์ ์ํจ ใ
ใ
ใ
|
@@ -0,0 +1,96 @@
+import objectToQueryString, { ObjectQueryParams } from '@/utils/objectToQueryString';
+import { generateBasicToken } from '../utils/auth';
+
+type Method = 'GET' | 'POST' | 'PATCH' | 'DELETE';
+
+type Body = ReadableStream | XMLHttpRequestBodyInit;
+type HeadersType = [string, string][] | Record<strin... | TypeScript | ์ฌ๊ธฐ์ ๋์ง๋ ์ค๋ฅ ๋ฉ์์ง๊ฐ showToast์์ ๋ณด์ด๋ ๋ฉ์์ง์์๋ ํ์ฉ์ ์ํ๊ณ ์๋ ๊ฒ ๊ฐ์์
ํต์ผ์ํค๋ ๋ฐฉ์์ด๋ ์ฌ์ฉ์์๊ฒ ๋ณด์ด๋ ์ค๋ฅ ๋ฉ์์ง๋ฅผ ์ด๋ป๊ฒ ๊ด๋ฆฌํ ์ง๋ ๊ณ ๋ฏผํด๋ณด๋ฉด ์ข์ ๋ฏ์!
(๋๋ ํด์ผํจ ใ
) |
@@ -0,0 +1,75 @@
+import { CartItem } from '@/types/cartItem.type';
+import { BASE_URL } from '../baseUrl';
+import { requestGet, requestPost, requestDelete } from '../fetcher';
+import { ENDPOINT } from '../endpoints';
+
+type ResponseCartItemList = {
+ content: CartItem[];
+ pageable: {
+ sort: {
+ sorted: ... | TypeScript | ์ฌ์ํ ์๊ฒฌ์ธ๋ฐ, ์ ๋ api ์๋ต์ด ์ธ์ ๋ ๋ฐ๋ ์ ์๋ค๊ณ ์๊ฐํด์ ์๋ฐ ํ์
์ type๋ณด๋ค interface๋ก ์ ์ธํ๋ ค๋ ํธ์ด๊ธด ํจ๋ค
๊ทธ๋ฌ๋ฉด pageable ๊ฐ์ด ์์ฐ๊ณ ๋ญ๊ฐ ๋ค๋ฅธ ์ ๋ณด๋ ์ค๋ณต๋๋ ์น๊ตฌ๋ค์ ์์จ์ค ์๋ ์์ด์ ์คํ๋ ค ๋ฆฌ๋ทฐ์ด์๊ฒ ์ธ ์น๊ตฌ๋ค๋ง interface์ ์ ์ธํด์ค ์ ์๋ค๋ ์ฅ์ ๋ ์๋ค๊ณ ์๊ฐํ์ด๋ค.
(interface์ ๋จ์ ์ ์์๊น ์๊ฐ๋ ๋๋๋ฐ ํจ ์ฐพ์๋ด์ผ๊ฒ ๋ค) |
@@ -0,0 +1,29 @@
+.container {
+ position: relative;
+}
+
+.cartIcon {
+ cursor: pointer;
+}
+
+.amountContainer {
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ width: 19px;
+ height: 19px;
+ background: #fff;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+}
+
+... | Unknown | ์ด๊ฑฐ ๊ฐ ์ ์ธ ๊ถ๊ธ์ฆ์ธ๋ฐ ์ด๊ฑฐ ๋๊ฐ ํ์ํจ?! |
@@ -1,4 +1,4 @@
-<!DOCTYPE html>
+<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
@@ -7,6 +7,7 @@
<title>react-shopping-products</title>
</head>
<body>
+ <div id="toast"></div>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body> | Unknown | ์ ๋ ์ด๊ฒ ์ ๋์ง ๋ชจ๋ฅด๊ฒ ๋ค์.... ใ
.ใ
|
@@ -0,0 +1,96 @@
+import objectToQueryString, { ObjectQueryParams } from '@/utils/objectToQueryString';
+import { generateBasicToken } from '../utils/auth';
+
+type Method = 'GET' | 'POST' | 'PATCH' | 'DELETE';
+
+type Body = ReadableStream | XMLHttpRequestBodyInit;
+type HeadersType = [string, string][] | Record<strin... | TypeScript | ๋ง์์. ์ฌ์ค ์ด๋์ ๋์ง ์ค๋ฅ๊ฐ ์บ์น๋๊ณ ๊ทธ๋ฐ๊ฑธ ํ์ธ์ ์ํด์ ์๋ฌ ๋ฐ์ด๋๋ฆฌ์ ๋น์ทํ ์ค๊ณ๋ก ์ด๋ฅผ ํด๊ฒฐํ ์ ์์ง ์์๊น ์ถ์ต๋๋ค. ํ๋ฒ ์๋ํด๋ณผ๊ฒ์! |
@@ -0,0 +1,29 @@
+.container {
+ position: relative;
+}
+
+.cartIcon {
+ cursor: pointer;
+}
+
+.amountContainer {
+ position: absolute;
+ bottom: 0;
+ right: 0;
+ width: 19px;
+ height: 19px;
+ background: #fff;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ border-radius: 50%;
+}
+
+... | Unknown | ๊ธ์ด์จ ๊ฒ ๊ฐ๋ค์. ํ์ ์์๋ฏ...! |
@@ -41,7 +41,7 @@ public Object checkReviewGroupAccess(ProceedingJoinPoint joinPoint,
private boolean canMemberAccess(ReviewGroup reviewGroup, HttpServletRequest request) {
GitHubMember gitHubMember = sessionManager.getGitHubMember(request);
- return gitHubMember != null && reviewGroup.getMemberI... | Java | **๋ฌธ์ ๊ฐ ๋๋ ๋ถ๋ถ์ ์ด ๋ถ๋ถ์ด์์ต๋๋ค.**
ํ์์ด ์ ๊ทผํ๋ ค๋ ๋ฆฌ๋ทฐ ๊ทธ๋ฃน์ด "๋นํ์์ด ๋ง๋ ๋ฆฌ๋ทฐ๊ทธ๋ฃน"์ธ ๊ฒฝ์ฐ,
reviewGroup.getMemberId() ๊ฐ null ์ด๊ธฐ ๋๋ฌธ์
long์ธ gitHubMember.getMemberId() ์์ == ์ฐ์ฐ์ ๋ชปํ๋ฏ๋ก NPE๊ฐ ๋ฐ์ํฉ๋๋ค.
์ด๋ฐ ์ผ์ด ์๊ธฐ์ง ์๊ฒํ๋ ค๋ฉด 1์ฐจ์์ ์ผ๋ก
`gitHubMember != null && (reviewGroup.getMemberId() != null && reviewGroup.getMemberId() == gitHubMember.getMemberId())` ๋ฅผ ํ ์... |
@@ -57,6 +57,13 @@ void setUp() {
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(request));
}
+ @Test
+ void ์กด์ฌํ์ง_์๋_๋ฆฌ๋ทฐ์_์ ๊ทผํ๋ฉด_NotFound_์์ธ๊ฐ_๋ฐ์ํ๋ค() {
+ // when & then
+ assertThatCode(() -> aopTestClass.testReviewMethod(1L))
+ .isInstanceOf(Review... | Java | ์์ํ๊ฒ ํ
์คํธ ์ฝ๋ ๋ฆฌํฉํฐ๋งํ์ต๋๋ค.
์๊ฐํด๋ณด๋ฉด ๋นํ์์ ์๊ธฐ๊ฐ ๋ง๋ค์ง ์์๋๋ผ๋ ๋น๋ฐ๋ฒํธ๊ฐ ์ผ์นํ๋ฉด ํต๊ณผ๋๋๊ฑฐ๋ผ "๋ฆฌ๋ทฐ ๊ทธ๋ฃน์ ์ธ์ฆํ" ์ผ๋ก ๋ช
ํํ ์๋ฏธ๋ฅผ ์ ๋ฌํ๋ ค ํ์๋๋ค~ |
@@ -0,0 +1,99 @@
+## ์ฐ์ํ ํ
ํฌ์ฝ์ค ํ๋ฆฌ์ฝ์ค ํฌ๋ฆฌ์ค๋ง์ค ํ๋ก๋ชจ์
+
+### ์งํ๋ฐฉ์
+- ์์ ๋ฉ์์ง ์ถ๋ ฅ
+- ๋ฐฉ๋ฌธ ๋ ์ง ์
๋ ฅ
+- ์ฃผ๋ฌธ ๋ฉ๋ด์ ๊ฐ์ ์
๋ ฅ
+- ์
๋ ฅ ์์ผ ์ด๋ฒคํธ ๋ฉ์์ง ์ถ๋ ฅ
+- ์ด๋ฒคํธ ํํ ์ถ๋ ฅ
+ - ์ฃผ๋ฌธ ๋ฉ๋ด
+ - ํ ์ธ ์ ์ด ์ฃผ๋ฌธ ๊ธ์ก
+ - ์ฆ์ ๋ฉ๋ด ์ฌ๋ถ
+ - ํํ ๋ด์ญ ์ฌ๋ถ
+ - ํ ์ธ ํ ์์ ๊ฒฐ์ ๊ธ์ก
+ - 12์ ์ด๋ฒคํธ ๋ฐฐ์ง ์ฌ๋ถ
+
+### ์ฃผ์ ๊ตฌํ ์ฌํญ
+- [x] ์
๋ ฅ ๋ทฐ ๊ตฌํ
+- [x] ์ถ๋ ฅ ๋ทฐ ๊ตฌํ
+
+- [x] ๋ ์ง ์
๋ ฅ ๋ฐ ์ ์ฅ ๊ฐ์ฒด ๊ตฌํ
+- [x] ๋ ์ง ์
๋ ฅ ์ ๋ ์ง๊ด๋ จ ํด... | Unknown | README์ ํด๋์ค์ด๋ฆ์ ์์ฑํ๊ธฐ๋ณด๋ค ์ด๋ค ์ญํ ์ ํด๋์ค์ธ์ง ์ ๋๋ง ์์ฑํ์๋๊ฒ ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค! ์๋ฌด๋๋ ํด๋์ค์ด๋ฆ์ด๋ ๋ฉ์๋ ์ด๋ฆ์ ๊ฐ๋ณ์ฑ์ด ๋๋ค๋ณด๋ README๋ ์ฃผ๊ธฐ์ ์ผ๋ก ์
๋ฐ์ดํธํด์ผํด์ ๋ฒ๊ฑฐ๋ก์์ด ํฌ๊ฑฐ๋ ์ |
@@ -0,0 +1,20 @@
+package christmas.exception;
+
+public enum ExceptionMessage {
+ INVALID_INPUT_DATE("์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_INPUT_ORDER("์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_MENU_ITEM("ํด๋น ๋ฉ๋ด๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค."),
+ INVALID_WEEK_DISCOUNT_TYPE("์๋ชป๋ ์ฃผ๊ฐ ํ ์ธ ํ์
์
๋๋ค."),
+ ;
+
+ private static f... | Java | ์ถ๊ฐ๋ enum์ ๊ณ ๋ คํ์
์ ์ด๋ ๊ฒ ์์ฑํ ์๋๋ผ๊ณ ์๊ฐ์ ๋์ง๋ง, ๊ผผ๊ผผํ๊ณ ํ๊ณ ๋ค์๋ฉด ,;๋ณด๋ค ;๋ก ๋๋ด๋๊ฒ ๋ ์ข์ง ์์๊น์?? ๊ฐ์ธ์ ์ธ ์๊ฐ์
๋๋ค ใ
ใ
ใ
|
@@ -1,7 +1,20 @@
package christmas;
+
+import camp.nextstep.edu.missionutils.Console;
+import christmas.run.PromotionRun;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
public class Application {
public static void main(String[] args) {
- // TODO: ํ๋ก๊ทธ๋จ ๊ตฌํ
+ try {
+ ... | Java | ๋ทฐ๋ฅผ ์ฑ๊ธํค์ผ๋ก ๊ด๋ฆฌํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค! |
@@ -0,0 +1,20 @@
+package christmas.exception;
+
+public enum ExceptionMessage {
+ INVALID_INPUT_DATE("์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_INPUT_ORDER("์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_MENU_ITEM("ํด๋น ๋ฉ๋ด๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค."),
+ INVALID_WEEK_DISCOUNT_TYPE("์๋ชป๋ ์ฃผ๊ฐ ํ ์ธ ํ์
์
๋๋ค."),
+ ;
+
+ private static f... | Java | ์ถ๊ฐ์ ์ผ๋ก ์๊ตฌ์ฌํญ์ ์๋ฌ๋ฉ์์ง๋ "[ERROR] ์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."์ผ๋ก ํต์ผํ๋ผ๊ณ ๊ธฐ์ฌ๋์ด ์์ด ์ต์ข
์ฝ๋ฉํ
์คํธ๋ก ๊ฐ์๊ฒ ๋๋ฉด ๊ผผ๊ผผํ ๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,33 @@
+package christmas.model.event;
+
+import christmas.model.date.ReservationDate;
+
+public class ChristmasDiscount {
+ private static final int FIRST_DAY = 1;
+ private static final int CHRISTMAS_DAY = 25;
+ private static final int BASIC_DISCOUNT = 1000;
+ private static final int PLUS_DISC... | Java | ReservationDate์์ ์ค์ค๋ก ์์ ์ด ๊ฐ์ง ๊ฐ์๋ํด ๊ฒ์ฆํ๋๋ก ๋ฉ์๋๋ฅผ ๊ตฌํํ์๋ ๊ฒ์ด ๋ ๊ฐ์ฒด์งํฅ์ ์ธ ์ฝ๋๋ผ๊ณ ์๊ฐํฉ๋๋ค.
date.isChristmasDay() ์ ๊ฐ์ด ๋ง์ด์ฃ !! 'getter๋ฅผ ์ง์ํ๋ผ'๋ ์๋ฏธ๋ VO์๊ฒ๋ ๋์ผํ๊ฒ ์ ์ฉ๋ฉ๋๋ค.
๊ด๋ จ ๋ฌธ์๋ฅผ ์๋ ๋งํฌ๋ก ๋ฌ์๋๊ฒ์!
https://tecoble.techcourse.co.kr/post/2020-04-28-ask-instead-of-getter/ |
@@ -0,0 +1,62 @@
+package christmas.model.event;
+
+import christmas.model.event.dto.ReservationDateEventDTO;
+
+public class DiscountDetail {
+ private final int totalPriceBeforeDiscount;
+ private final int totalPriceAfterDiscount;
+ private final WeekDiscountType weekDiscountType;
+ private final int chr... | Java | DiscountDetil์ ํ๋๋ก ์ด ๊ฐ๋ค์ ๊ตณ์ด ๊ฐ์ ธ์ผ ํ ์ด์ ๊ฐ ์์๊น์? ์ฌ์ฌ์ฉ์ ์ฌ์ง๊ฐ ์๋ค๋ฉด ๋ฉ์๋๋ฅผ ํตํด ๋ฉ์์ง๋ฅผ ์ ๋ฌํ๋ ๋ฐฉ์์ด ๋ ์ข๋ค๊ณ ์๊ฐํด์! |
@@ -0,0 +1,62 @@
+package christmas.model.event;
+
+import christmas.model.event.dto.ReservationDateEventDTO;
+
+public class DiscountDetail {
+ private final int totalPriceBeforeDiscount;
+ private final int totalPriceAfterDiscount;
+ private final WeekDiscountType weekDiscountType;
+ private final int chr... | Java | ์ธ๋ถ ์์ฑ์ ๋ง๊ธฐ ์ํด ์์ฑ์๋ฅผ protected๋ก ๊ด๋ฆฌํ์ ๊ฒ์ผ๋ก ๋ณด์ด๋๋ฐ, private์ผ๋ก ์์ฑ์๋ฅผ ๋ง๊ณ ์ ์ ํฉํ ๋ฆฌ๋ฉ์๋ ์์ฑ์๋ฅผ ์ฌ์ฉํ๋ฉด ๋ ์๋ฐํ๊ฒ ์บก์ํํ ์ ์์ต๋๋ค! ๊ด๋ จ ์๋ฃ๋ฅผ ์๋ ๋งํฌ๋ก ๋ฌ์๋๊ฒ์!
https://hudi.blog/effective-java-static-factory-method/ |
@@ -0,0 +1,91 @@
+package christmas.model.event;
+
+import christmas.model.event.dto.ReservationDateEventDTO;
+import christmas.model.menu.MenuItem;
+
+import java.util.*;
+import java.util.stream.Stream;
+
+public class EventResult {
+ private static final int MIN_EVENT_AMOUNT = 10_000;
+ private static final in... | Java | ํ๋ ์๋ฅผ ์ค์ฌ ์์ง๋๋ฅผ ๋ฎ์ถ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. ๋ฒ๊ทธ๊ฐ ๋ฐ์ํ๋ฉด ๋ฆฌํํ ๋งํ ๋ถ๋ถ์ด ๋ง์์ ธ์!! |
@@ -0,0 +1,91 @@
+package christmas.model.event;
+
+import christmas.model.event.dto.ReservationDateEventDTO;
+import christmas.model.menu.MenuItem;
+
+import java.util.*;
+import java.util.stream.Stream;
+
+public class EventResult {
+ private static final int MIN_EVENT_AMOUNT = 10_000;
+ private static final in... | Java | ์ด ๋ถ๋ถ๋ getter๋ก ๊บผ๋ด์์ ๊ฒ์ฆํ๊ธฐ๋ณด๋ค ๊ฐ์ฒด ๋ด๋ถ์์ ์ค์ค๋ก๊ฒ์ฆํ๋๋ก ํ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,28 @@
+package christmas.model.event;
+
+public enum SpecialDayDiscount {
+ THIRD_DAY(3, 1000),
+ TENTH_DAY(10, 1000),
+ SEVENTEENTH_DAY(17, 1000),
+ TWENTY_FOURTH_DAY(24, 1000),
+ TWENTY_FIFTH_DAY(25, 1000),
+ THIRTY_FIRST_DAY(31, 1000),
+ OTHER_DAY(0, 0),
+ ;
+
+ private final in... | Java | 1000์์ด๋ผ๋ ๋์ผํ ํ ์ธ๊ธ์ก์ ๊ฐ์ง๊ณ ์์ผ๋ List๋ก ๊ด๋ฆฌํ๋ ๋ฐฉ๋ฒ๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ต๋๋ค! |
@@ -0,0 +1,55 @@
+package christmas.model.menu;
+
+import christmas.exception.ExceptionMessage;
+import christmas.exception.PromotionException;
+
+import java.util.Arrays;
+
+public enum MenuItem {
+ APPETIZER_MUSHROOM_SOUP("์์ก์ด์ํ", 6_000, MenuCategory.APPETIZER),
+ APPETIZER_TAPAS("ํํ์ค", 5_500, MenuCategory.APPE... | Java | MenuCategory, MenuItem์์ ์ค๋ณต๋๋ ์์๋ค์ด ์๋๋ฐ ํ๋๋ก ๋ฌถ์ด๋ ๋ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,79 @@
+package christmas.model.menu;
+
+import christmas.exception.ExceptionMessage;
+import christmas.exception.PromotionException;
+
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class OrderMenus {
+ private static final int MIN_ORDER_MENU_NUMBER = ... | Java | Integer๋ ์์๊ฐ์ ํฌ์ฅํ๋ ๊ฒ์ ์ด๋จ๊น์?? |
@@ -0,0 +1,76 @@
+package christmas.run;
+
+import christmas.controller.PromotionController;
+import christmas.exception.PromotionException;
+import christmas.model.event.dto.EventResultDTO;
+import christmas.model.event.dto.ReservationDateEventDTO;
+import christmas.model.menu.dto.OrderMenusDTO;
+import christmas.view... | Java | ํ๋์ฃผ์
๋ณด๋ค ์์ฑ์ ์ฃผ์
์ด ์ ์ง๋ณด์ ๊ด์ ์์ ๋ ์ข์ ๊ฒ ๊ฐ์์.!! |
@@ -0,0 +1,76 @@
+package christmas.run;
+
+import christmas.controller.PromotionController;
+import christmas.exception.PromotionException;
+import christmas.model.event.dto.EventResultDTO;
+import christmas.model.event.dto.ReservationDateEventDTO;
+import christmas.model.menu.dto.OrderMenusDTO;
+import christmas.view... | Java | ์ ๋๋ฆญ์ ์ฌ์ฉํ์ ๋ถ๋ถ์ด ์ธ์๊น์ต๋๋ค.! |
@@ -0,0 +1,27 @@
+package christmas.util;
+
+enum EventResultText {
+ ORDER_OUTPUT_REGEX("%s %d%s"),
+ EMPTY_TEXT(""),
+ SPACE(" "),
+ MENU_NUMBER("๊ฐ"),
+ MENU_PRICE_UNIT("์"),
+ CHRISTMAS_D_DAY_DISCOUNT("ํฌ๋ฆฌ์ค๋ง์ค ๋๋ฐ์ด ํ ์ธ"),
+ SPECIAL_DISCOUNT("ํน๋ณ ํ ์ธ"),
+ GIFT_EVENT("์ฆ์ ์ด๋ฒคํธ"),
+ NONE_BENEFIT("์์"... | Java | ์ฐ๊ด์ฑ์ด ์๋ ์์๋ค์ static final๋ก ๊ด๋ฆฌํ๋ ๊ฒ์ด ๋ ๊ฐ๋
์ฑ ์ธก๋ฉด์์ ์ข๋ค๊ณ ์๊ฐํด์ ! |
@@ -0,0 +1,99 @@
+## ์ฐ์ํ ํ
ํฌ์ฝ์ค ํ๋ฆฌ์ฝ์ค ํฌ๋ฆฌ์ค๋ง์ค ํ๋ก๋ชจ์
+
+### ์งํ๋ฐฉ์
+- ์์ ๋ฉ์์ง ์ถ๋ ฅ
+- ๋ฐฉ๋ฌธ ๋ ์ง ์
๋ ฅ
+- ์ฃผ๋ฌธ ๋ฉ๋ด์ ๊ฐ์ ์
๋ ฅ
+- ์
๋ ฅ ์์ผ ์ด๋ฒคํธ ๋ฉ์์ง ์ถ๋ ฅ
+- ์ด๋ฒคํธ ํํ ์ถ๋ ฅ
+ - ์ฃผ๋ฌธ ๋ฉ๋ด
+ - ํ ์ธ ์ ์ด ์ฃผ๋ฌธ ๊ธ์ก
+ - ์ฆ์ ๋ฉ๋ด ์ฌ๋ถ
+ - ํํ ๋ด์ญ ์ฌ๋ถ
+ - ํ ์ธ ํ ์์ ๊ฒฐ์ ๊ธ์ก
+ - 12์ ์ด๋ฒคํธ ๋ฐฐ์ง ์ฌ๋ถ
+
+### ์ฃผ์ ๊ตฌํ ์ฌํญ
+- [x] ์
๋ ฅ ๋ทฐ ๊ตฌํ
+- [x] ์ถ๋ ฅ ๋ทฐ ๊ตฌํ
+
+- [x] ๋ ์ง ์
๋ ฅ ๋ฐ ์ ์ฅ ๊ฐ์ฒด ๊ตฌํ
+- [x] ๋ ์ง ์
๋ ฅ ์ ๋ ์ง๊ด๋ จ ํด... | Unknown | ์ ์ข์ ์๊ฐ์ด๋ค์. ์ดํ ๊ด๋ฆฌ์๋ ์๊ฐํ์ง ์์๋ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -1,7 +1,20 @@
package christmas;
+
+import camp.nextstep.edu.missionutils.Console;
+import christmas.run.PromotionRun;
+import christmas.view.InputView;
+import christmas.view.OutputView;
+
public class Application {
public static void main(String[] args) {
- // TODO: ํ๋ก๊ทธ๋จ ๊ตฌํ
+ try {
+ ... | Java | ํ๋ฒ๋ง ์์ฑ๋๋ฉด ๋๊ณ ์๋ก์ด ๊ฐ์ฒด๋ฅผ ์์ฑํ ํ์๊ฐ ์๊ฒ ๋ค ์ถ์ด ์ ์ฉํ๋๋ฐ ์ปจํธ๋กค๋ฌ, ์๋น์ค ๋ชจ๋ ์ ์ฉํด์ผํ๋ ์ถ๋ค๊ฐ ๋ทฐ๋ง ์์ฑํ๊ฒ ๋์์ต๋๋ค.. |
@@ -0,0 +1,20 @@
+package christmas.exception;
+
+public enum ExceptionMessage {
+ INVALID_INPUT_DATE("์ ํจํ์ง ์์ ๋ ์ง์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_INPUT_ORDER("์ ํจํ์ง ์์ ์ฃผ๋ฌธ์
๋๋ค. ๋ค์ ์
๋ ฅํด ์ฃผ์ธ์."),
+ INVALID_MENU_ITEM("ํด๋น ๋ฉ๋ด๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค."),
+ INVALID_WEEK_DISCOUNT_TYPE("์๋ชป๋ ์ฃผ๊ฐ ํ ์ธ ํ์
์
๋๋ค."),
+ ;
+
+ private static f... | Java | ์ ํด๋น ์์ธ๋ ์ด๋ฏธ ์ฒ๋ฆฌ๋ ๊ฒฐ๊ณผ DTO ๋ค์ ๊ฐ์ง๊ณ ๋ฐ์๋๋ ์์ธ๋ผ์ ์ ์์ ์ด๋ผ๋ฉด ํฐ์ง์ง ์๋ ์์ธ ์
๋๋ค. ์ผ๋จ ์ ์๊ฐ์ผ๋ก๋ ๋ฌด์จ ์ง์ ํด๋ ์
๋ ฅ์ ๋ํด ํด๋น ์์ธ๋ ํฐ์ง์ง๋ ์์ ๊ฑฐ๋ผ ์๊ฐํ๋๋ฐ ํด๋น ๊ธฐ๋ฅ์์๋ง ํฐ์ง๋ ์์ธ๋ฅผ ๊ตฌ๋ถํ๊ธฐ ์ํด์ ์ฌ์ฉํ์ต๋๋ค! |
@@ -0,0 +1,33 @@
+package christmas.model.event;
+
+import christmas.model.date.ReservationDate;
+
+public class ChristmasDiscount {
+ private static final int FIRST_DAY = 1;
+ private static final int CHRISTMAS_DAY = 25;
+ private static final int BASIC_DISCOUNT = 1000;
+ private static final int PLUS_DISC... | Java | ์์ฝ ์ผ์ ๊ฐ์ฒด๋ ์์ฝ๋ ์ผ์์ ๋ํด์๋ง ๊ฐ์ ๊ฐ์ง๊ณ ์์ด ํ ์ธ์ ์ ์ฉํ๊ธฐ ์ํ ์ ํจ์ฑ ๊ฒ์ฌ๋ฅผ ํด๋น ํ ์ธ ๊ฐ์ฒด๊ฐ ์ํํด์ผ ํ๋ค๊ณ ์๊ฐํด์ ๋ฃ์๋๋ฐ ๊ณ ๋ฏผ์ด ๋๋ค์.. |
@@ -0,0 +1,62 @@
+package christmas.model.event;
+
+import christmas.model.event.dto.ReservationDateEventDTO;
+
+public class DiscountDetail {
+ private final int totalPriceBeforeDiscount;
+ private final int totalPriceAfterDiscount;
+ private final WeekDiscountType weekDiscountType;
+ private final int chr... | Java | ๊ฐ์ฒด๊ฐ ๊ฐ์ง๊ณ ์๋ ์ํ์ ๊ฐ์ฒด๋ฅผ ํํํ๋ ค ํ๋ค๋ณด๋ ์ด๋ ๊ฒ ๋์๋๋ฐ ์์ง๋ ๋ฉ์๋๋ก ๋ฉ์์ง๋ฅผ ์ ๋ฌํ๋ ๋ฐฉ๋ฒ์ ์์ง ๋ฏ์ ๊ฒ ๊ฐ์ต๋๋ค.. ์ค๊ฐ์ค๊ฐ ์ธ์งํ๋ คํด๋ ๋์น๋ ๋ถ๋ถ์ด ๋ง๋ค์.. |
@@ -0,0 +1,62 @@
+package christmas.model.event;
+
+import christmas.model.event.dto.ReservationDateEventDTO;
+
+public class DiscountDetail {
+ private final int totalPriceBeforeDiscount;
+ private final int totalPriceAfterDiscount;
+ private final WeekDiscountType weekDiscountType;
+ private final int chr... | Java | ์ฌ๋ฌ ๊ฐ์ฒด๋ฅผ ์์ฑํ๊ณ static์ผ๋ก ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ ๋ฐฉ๋ฒ๋ณด๋ค๋ ์ ๋ ๊ฐ์ธ์ ์ผ๋ก ํด๋น ๊ธฐ๋ฅ์ ํ ์ธ์ด ์์ ๊ฒฝ์ฐ์ ๊ฐ์ฒด๋ฅผ ์ค๋ฒ๋ก๋ฉ์ ํตํด ์์ฑํ๋๊ฒ ์ข๋ค๊ณ ์๊ฐ๋ฉ๋๋ค |
@@ -0,0 +1,91 @@
+package christmas.model.event;
+
+import christmas.model.event.dto.ReservationDateEventDTO;
+import christmas.model.menu.MenuItem;
+
+import java.util.*;
+import java.util.stream.Stream;
+
+public class EventResult {
+ private static final int MIN_EVENT_AMOUNT = 10_000;
+ private static final in... | Java | ๊ทธ ๋ถ๋ถ์ @Dongwoongkim ๋์ ์ฝ๋๋ฅผ ๋ณด๊ณ ํ์คํ ๊ทธ๋ ๋ค๊ณ ๋๊ปด์ก๋ ๊ฒ ๊ฐ์ต๋๋ค. ํด๋น ๊ฐ์ฒด ์์ ์์ด์ผํ๋ค๊ณ ๋ฐ๋ผ๋ณด๋ ๊ทธ๋ ๊ฒ ์๊ฐ์ ๋ชปํ๋ ๊ฒ ๊ฐ์์.. EventResult๋ฅผ ํ๋ผ๋ฏธํฐ๋ก ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ ๋ฐฉ๋ฒ์ด ์ ๋ ๋ ์ฌ๋ฐ๋ฅธ ๊ฒ ๊ฐ์ต๋๋ค |
@@ -0,0 +1,28 @@
+package christmas.model.event;
+
+public enum SpecialDayDiscount {
+ THIRD_DAY(3, 1000),
+ TENTH_DAY(10, 1000),
+ SEVENTEENTH_DAY(17, 1000),
+ TWENTY_FOURTH_DAY(24, 1000),
+ TWENTY_FIFTH_DAY(25, 1000),
+ THIRTY_FIRST_DAY(31, 1000),
+ OTHER_DAY(0, 0),
+ ;
+
+ private final in... | Java | ์ข์ ์๊ฐ์
๋๋ค! enum์ ์๋ฃ๊ตฌ์กฐ๋ฅผ ๋ฃ์ ์๊ฐ์ ๋ชปํ๋ ๊ฒ ๊ฐ์์ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.