code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -1,19 +1,28 @@
+import './InputBox.css';
+
type InputBoxProps = {
+ type: string;
id: string;
- checked: boolean;
- onChange: any;
+ value: string;
+ onChange: (e : React.FormEvent<HTMLInputElement>) => void;
+ label: string;
+ required: boolean;
}
-const InputBox = ({id, checked, onChange}: InputBoxPr... | Unknown | ์ปดํฌ๋ํธ ์ด๋ฆ์ด InputBox๋๊น checkbox์ฉ input ์์๋ฅผ ์ํ ์ปดํฌ๋ํธ ๊ฐ์๋ฐ, type props๋ฅผ ์ถ๊ฐํ๊ณ checked ์์ฑ ๋์ value ์์ฑ์ผ๋ก ๋ณ๊ฒฝํ์ ์ด์ ๊ฐ ์์๊น์? |
@@ -1,19 +1,28 @@
+import './InputBox.css';
+
type InputBoxProps = {
+ type: string;
id: string;
- checked: boolean;
- onChange: any;
+ value: string;
+ onChange: (e : React.FormEvent<HTMLInputElement>) => void;
+ label: string;
+ required: boolean;
}
-const InputBox = ({id, checked, onChange}: InputBoxPr... | Unknown | ์! ๋ฐ์ InputCheckBox๊ฐ ๋ฐ๋ก ์๊ณ ์๋์ Input์ด InputBox๋ก ๋ณ๊ฒฝ๋๊ฑฐ์๊ตฐ์. ์ ๋ ์์ ์ ๊ทธ๋๋ก Input๊ณผ InputCheckBox๊ฐ ๋ ๋์๋ณด์ฌ์..! |
@@ -1,9 +1,10 @@
import { useState } from "react";
-import Input from "../components/Input";
import InputBox from "../components/InputBox";
-import validation from "../utils/validation";
+import InputCheckBox from "../components/InputCheckBox";
+import validateFormInfos from "../utils/validation";
import checking fr... | Unknown | ์ ํํ ํ์
์ข์ต๋๋ค~! |
@@ -0,0 +1,28 @@
+import './InputCheckBox.css';
+
+type InputCheckBoxProps = {
+ id: string;
+ checked: boolean;
+ onChange: (e : React.FormEvent<HTMLInputElement>) => void;
+ label?: string;
+ required?: boolean;
+}
+
+const InputCheckBox = ({id, checked, onChange, label, required}: InputCheckBoxProps) => {
+ re... | Unknown | label์ className์ ๊ฒฐ์ ํ๋ ๋ถ๋ถ์ด inputBox์ inputCheckBox์์ ๋ฐ๋ณต๋ฉ๋๋ค. ์ด ๋ถ๋ถ์ ํ์ className๊ณผ ํ๋๊ทธ์ ๋ฐ๋ผ ์ถ๊ฐ์ฌ๋ถ๊ฐ ์ ํด์ง๋ className, ๊ทธ๋ฆฌ๊ณ ํ๋๊ทธ๋ฅผ ์ธ์๋ก ๋ฐ์์ ํด๋์ค ๋ค์์ ๋ฆฌํดํด์ฃผ๋ ํจ์๋ก ๋ฐ๊ฟ๋ณด๋ฉด ์ด๋จ๊น์?
```suggestion
const InputCheckBox = ({id, checked, onChange, label, required}: InputCheckBoxProps) => {
const labelClassName = getClassNameByRequired('inputC... |
@@ -0,0 +1,65 @@
+
+package basball.view;
+
+import basball.baseball.model.GameStatus;
+
+import java.util.Arrays;
+import java.util.Scanner;
+import java.util.regex.Pattern;
+
+public final class InputView {
+
+ private static final String INPUT_NUMBER_MESSAGE = "์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์ : ";
+ private static final Scanner s... | Java | (nit) Inner class๋ก ๋์ค๊ฑฐ๋ฉด Validator์ ๋ด๋ถ ๋ฉ์๋ ๋ชจ๋ private์ผ๋ก ํ๋๊ฒ ์ข๊ฒ ์ด์. |
@@ -0,0 +1,65 @@
+
+package basball.view;
+
+import basball.baseball.model.GameStatus;
+
+import java.util.Arrays;
+import java.util.Scanner;
+import java.util.regex.Pattern;
+
+public final class InputView {
+
+ private static final String INPUT_NUMBER_MESSAGE = "์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์ : ";
+ private static final Scanner s... | Java | ๋ฉํ ๋ ์๋
ํ์ธ์ ! ๋ต๋ณ ๋จ๊ฒจ์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค ๊ทธ๋ฐ๋ฐ Validator ๋ฅผ private ๋ก ๋ฐ๊พธ๋ฉด Balls ๋ InputView ํ
์คํธ ๊ฐ์ ๊ณณ ์์๋ ์ด๋ป๊ฒ ์ฌ์ฉํด์ผ ํ๋์ ?
์ ์๊ฐ์ผ๋ก๋ InputView ์์ get ๋ฉ์๋๋ก ์ ๊ทผ ๋ฉ์๋๋ฅผ ์ ๊ณตํ๋ ๋ฐฉ๋ฒ ๋ฟ์ธ๋ฐ ์ด๋ ๊ฒ ๋๋ฉด InputView ํ
์คํธ๋ ๊ทธ๋ ๋ค ์ณ๋ Balls ๋ถ๋ถ์์ Validator ๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด ๋ถํ์ํ๊ฒ InputView ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ด์ผ ํ๋๋ฐ ๋ง์๊น์ !?
์๋๋ฉด ์ ๋ฒ์ ๋จ๊ฒจ์ฃผ์ static class ๋ก ๋ฐ๊พธ๋ผ๋๊ฒ ์ด๋ ๊ฒ ๋ฐ๊พธ๋ผ๊ณ ํ์ ๊ฒ ์๋์๋์ !?? |
@@ -0,0 +1,65 @@
+
+package basball.view;
+
+import basball.baseball.model.GameStatus;
+
+import java.util.Arrays;
+import java.util.Scanner;
+import java.util.regex.Pattern;
+
+public final class InputView {
+
+ private static final String INPUT_NUMBER_MESSAGE = "์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์ : ";
+ private static final Scanner s... | Java | ์ ์ ๋จ๊ฒจ๋๋ฆฐ๊ฑด static ๊ฐ๋ณ ํด๋์ค๋ก ๋๋ผ๋ ์๊ธฐ์์ด์ ใ
ใ
์ ๊ฐ private๋ก ํ๋ผ๊ณ ๋ง์๋๋ฆฐ๊ฑด ์ฌ์ค InputView ๋ด์์๋ง ์ฐ์ฌ์ ๊ทธ๋ ๊ฒ ๋ง์๋๋ฆฐ๊ฑฐ์์ด์. ๋ง์ฝ Validator ์์ฒด๊ฐ ๋ฐ์ผ๋ก ๋์์์ ์ด์ ๊ฐ ์๋ค๋ฉด ํ
์คํธ๋ ํ์์๋๊ฑฐ๊ฒ ์ฃ . (์บก์ํ์ ์๋ฏธ์์ด์. Validator๋ฅผ ๊ฐ์ ธ๋ค ์ธ ๋ฐ๊ฐ InputView ์ธ์ ์๋ค๋ฉด ๊ตณ์ด Validator๊ฐ ์ด๋ป๊ฒ ๊ตฌํ๋์๋์ง ํ
์คํธ๋ฅผ ์ด๋ป๊ฒ ํ ์ง๋ ๊ณ ๋ฏผํ ํ์๊ฐ ์๋๊ฑฐ๊ฒ ์ฃ )
ํ์ง๋ง Validator๊ฐ ๋ค๋ฅธ๋ฐ์๋ ์ฐ์ผ๊ฑฐ๋ผ๋ฉด ๊ฐ๋ณ static ํด๋์ค๋ก ๋นผ๋๋๊ฒ ๋ ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,65 @@
+
+package basball.view;
+
+import basball.baseball.model.GameStatus;
+
+import java.util.Arrays;
+import java.util.Scanner;
+import java.util.regex.Pattern;
+
+public final class InputView {
+
+ private static final String INPUT_NUMBER_MESSAGE = "์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์ : ";
+ private static final Scanner s... | Java | ์๋
ํ์ธ์ ๋ฉํ ๋ ! `๊ฐ๋ณ static ํด๋์ค` ๋ผ๋ ๋ง์ด ์ ์ดํด๊ฐ ์๋๋๋ฐ ํน์ `Math` ํด๋์ค ์ฒ๋ผ `final ๊ณผ private ์์ฑ์` ๋ฅผ ํตํด ์์ฑ์ ๋ง๊ณ ๋จ์ง `Utils` ํด๋์ค ์ฒ๋ผ ์ฌ์ฉ ์ ์๋ฏธ ํ์๋๊ฑด๊ฐ์ ? ?์๋๋ฉด
์ธ๋ถ๋ `public ํด๋์ค` ๋ก ๋ง๋ค๊ณ ๋ด๋ถ์ `public static class` ๋ก ๋ง๋ค๋ผ๊ณ ํ์๋ ๊ฑด๊ฐ์ ??
< final ์ฌ์ฉ >
```
public final class Validator {
private Validator() {
}
private static... |
@@ -0,0 +1,65 @@
+
+package basball.view;
+
+import basball.baseball.model.GameStatus;
+
+import java.util.Arrays;
+import java.util.Scanner;
+import java.util.regex.Pattern;
+
+public final class InputView {
+
+ private static final String INPUT_NUMBER_MESSAGE = "์ซ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์ : ";
+ private static final Scanner s... | Java | ์ ์..์ ๊ฐ ๋ง์๋๋ฆฐ๊ฑธ ๋๋ฌด ํฌ๊ฒ ์๊ฐํ์ ๊ฒ ๊ฐ๊ตฐ์..^^;
์ ๊ฐ ๋ง์๋๋ฆฐ๊ฑด ๋จ์ํ Validator.java ํ์ผ์ ํ๋ ๋ ๋ง๋ค์ด์ ๊ฑฐ๊ธฐ๋ค ๋ฃ๋๋ค๋ ์๊ธฐ์์ด์.
๊ทธ๋ฌ๋ฉด ๊ตณ์ด InputView์ ์ข
์์ ์ธ namespace๋ฅผ ๊ฐ์ง ํ์๊ฐ ์์ผ๋๊น์ ใ
ใ
|
@@ -88,5 +88,186 @@ export default {
display: flex;
align-items: center;
justify-content: center;
+ html,
+ body {
+ height: 100%;
+ width: 100%;
+ padding: 0;
+ margin: 0;
+ }
+ .container {
+ background: white;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ flex-direction: c... | Unknown | ์ฌ๊ธฐ์ด๋ ๊ฒํ๋ฉด์๋ผ์ |
@@ -88,5 +88,186 @@ export default {
display: flex;
align-items: center;
justify-content: center;
+ html,
+ body {
+ height: 100%;
+ width: 100%;
+ padding: 0;
+ margin: 0;
+ }
+ .container {
+ background: white;
+ width: 100%;
+ height: 100%;
+ display: flex;
+ flex-direction: c... | Unknown | ์์ ํ์ต๋๋ค |
@@ -3,83 +3,63 @@
import homeTry.chatting.dto.request.ChattingMessageRequest;
import homeTry.chatting.dto.response.ChattingMessageResponse;
import homeTry.chatting.exception.badRequestException.InvalidTeamIdException;
-import homeTry.chatting.model.entity.Chatting;
import homeTry.chatting.repository.ChattingReposit... | Java | Chatting์ TeamMember์ ์ฐ๊ด๊ด๊ณ๋ฅผ ๋งบ๊ณ ์์ผ๋, TeamMember์ ๋ํ ์ ๋ณด๋ง์ ์๊ณ ์์ต๋๋ค.
Chatting์์ Team ๋๋ Member์ ๋ํ ์ ๋ณด๋ฅผ ์ป๊ณ ์ ํ๋ค๋ฉด,, TeamMemberService๋ฅผ ๋จ์ผ ์ง์
์ ์ผ๋ก ํ์ฉํ๋ฉด ์ด๋จ๊น์? ๐ฒ |
@@ -1,8 +1,12 @@
package homeTry.chatting.interceptor;
+import homeTry.chatting.exception.badRequestException.InactivatedMemberWithValidTokenException;
import homeTry.chatting.exception.badRequestException.InvalidChattingTokenException;
-import homeTry.common.auth.JwtAuth;
+import homeTry.chatting.exception.badRequ... | Java | StompInterceptor๋ ํ ํฐ ์ ๋ณด๋ฅผ ๋ณด๊ณ , ๋ฉค๋ฒ๊ฐ ์กด์ฌํ์ง ์์ผ๋ฉด,, Exception์ ๋ฑ๋๋ก ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๊ทธ๋ ๋ค๋ฉด, stompInterceptor๋ ํ ํฐ์ด bearerToken์ธ์ง, ๋ค๋ฅธ ํ ํฐ์ ์ข
๋ฅ์ธ์ง? ์ ๋ํด์๋ ์๋ฌด๋ฐ ๊ด์ฌ์ฌ๊ฐ ์์ต๋๋ค. BearerToken์ด ์ ํจํ์ง? ๋ ๊ด์ฌ์ฌ๊ฐ ์์ต๋๋ค. ๋จ์ํ ํ์ฌ interceptor์ ๋์ด์จ ํ ํฐ ์ ๋ณด๋ฅผ ๋ณด๊ณ , ์ฐ๋ฆฌ ์ฌ์ฉ์๋ผ๋ฉด ์ธ์
์ ๊ทธ ๊ฐ์ ๋ฃ๋ ๊ฒ์ ๊ด์ฌ์ด ์์ต๋๋ค.
์ด๋ ๊ฒ ๊ฐ ํด๋์ค์ ๊ด์ฌ์ฌ๋ค์ ์๊ฐํ๋ฉฐ ์ ์ ํ๊ฒ ๋ถ๋ฆฌํ๊ณ , ์บก์ํ ํด๋ณด์๋ฉด ์ฌ๋ฏธ์์ ๊ฒ ๊ฐ์์ ๐ |
@@ -0,0 +1,105 @@
+import { Helmet } from 'react-helmet-async';
+import titles from '../routes/titles';
+import styled from 'styled-components';
+import MainCard from './components/MainCard';
+import Tag from './components/Tag';
+import Card from './components/Card';
+import { useQuery } from 'react-query';
+import { g... | Unknown | P4: margin์ด๋ margin-bottom ๊ฐ์ด ์ด ์ด์ ๊ฐ ์์๊น์? ํ๋๋ก ํต์ผํ๋ฉด ๋ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,105 @@
+import { Helmet } from 'react-helmet-async';
+import titles from '../routes/titles';
+import styled from 'styled-components';
+import MainCard from './components/MainCard';
+import Tag from './components/Tag';
+import Card from './components/Card';
+import { useQuery } from 'react-query';
+import { g... | Unknown | P1: suspense๋ก ์ฎ๊ธฐ๋ ๊ฒ ๊ณต๋ถ
https://blog.jbee.io/react/React%EC%97%90%EC%84%9C+%EC%84%A0%EC%96%B8%EC%A0%81%EC%9C%BC%EB%A1%9C+%EB%B9%84%EB%8F%99%EA%B8%B0+%EB%8B%A4%EB%A3%A8%EA%B8%B0 |
@@ -0,0 +1,32 @@
+import styled from 'styled-components';
+
+const TagWrapper = styled.div<{ $isActive: boolean }>`
+ border-radius: 40px;
+ border: none;
+ padding: 14px 20px;
+ font-size: 18px;
+ cursor: pointer;
+ line-height: 22px;
+ color: ${(props) => (props.$isActive ? '#ffffff' : '#868b94')};
+ backgrou... | Unknown | P3: ์ดํ์ css variables๋ก ๋นผ์ ๊ด๋ฆฌํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,31 @@
+class VisitDateError {
+ #notInputDate(visitDate) {
+ if (visitDate.length === 0) {
+ throw new Error('[ERROR] ๋ฐฉ๋ฌธ ๋ ์ง๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.');
+ }
+ }
+
+ #dateNotNum(visitDate) {
+ if (
+ Number.isNaN(Number(visitDate)) ||
+ Number.isInteger(Number(visitDate)) === false ||
+ visitD... | JavaScript | ํด๋น ๋ถ๋ถ ์ ๊ท ํํ์์ผ๋ก ํ๋ฉด if๋ฌธ์ ํ๋๋ก ์ค์ผ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค ! |
@@ -0,0 +1,31 @@
+class VisitDateError {
+ #notInputDate(visitDate) {
+ if (visitDate.length === 0) {
+ throw new Error('[ERROR] ๋ฐฉ๋ฌธ ๋ ์ง๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.');
+ }
+ }
+
+ #dateNotNum(visitDate) {
+ if (
+ Number.isNaN(Number(visitDate)) ||
+ Number.isInteger(Number(visitDate)) === false ||
+ visitD... | JavaScript | ํด๋น ๋ฌธ๊ตฌ๋ constant์ ๋ฐ๋ก error.js๋ฅผ ์์ฑํ์
์ ํ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค ! |
@@ -0,0 +1,61 @@
+import { MENU_NAMES, MENUS } from '../../constant/menu.js';
+
+class OrderMenuError {
+ #orderNotInput(orderMenu) {
+ if (
+ orderMenu.length === 1 &&
+ orderMenu[0].menu.trim() === ''
+ ) {
+ throw new Error('[ERROR] ์ฃผ๋ฌธํ์ค ๋ฉ๋ด์ ๊ฐ์๋ฅผ ์
๋ ฅํด ์ฃผ์ธ์.');
+ }
+ }
+
+ #orderWrongInput(ord... | JavaScript | ์ ๋ ์ค์๋ก ๋์น ๋ถ๋ถ์ด์ง๋ง 1.0์ ํฌํจํ ์ง ์ํ ์ง ๊ณ ๋ฏผํ์
จ๋ค๊ณ ํ์
จ๋๋ฐ ๊ทธ ๋ถ๋ถ ์ดํดํฉ๋๋ค...
๋ฏธ์
์ด ๋๋๊ณ ์๊ฐ๋๊ฑฐ์ง๋ง 1.0๋ ํฌํจ์ ํ๋ค๋ฉด 1.000000000000000... ๋ 1๋ก ๋๋๊ฑฐ๋ผ 0์ ๋ฌดํ๋๋ก ์
๋ ฅํ๋ฉด ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ง ์์๊น ํ๋ ์ฐ๋ ค๊ฐ ๋๋๋ฐ ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -0,0 +1,28 @@
+const EVENT_NAMES = ['ํฌ๋ฆฌ์ค๋ง์ค ๋๋ฐ์ด ํ ์ธ', 'ํ์ผ ํ ์ธ', '์ฃผ๋ง ํ ์ธ', 'ํน๋ณ ํ ์ธ', '์ฆ์ ์ด๋ฒคํธ'];
+
+const WEEKDAY_DISCOUNT_DATE = [
+ 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 17,
+ 18, 19, 20, 21, 24, 25, 26, 27, 28, 31,
+];
+
+const WEEKEND_DISCOUNT_DATE = [
+ 1, 2, 8, 9, 15, 16, 22, 23, 29, 30,
+];
+
+const SPECIAL_DISCOUNT... | JavaScript | ํด๋น ๋ถ๋ถ์ `new Date()` ๋ฉ์๋๋ก ํํ์ด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ต๋๋ค !
`new Date()`๋ฅผ ์ฌ์ฉํ์๋ฉด 0-์ผ์์ผ ~ 6-ํ ์์ผ๋ก 0~6๊น์ง์ number๋ก ์ถ๋ ฅ๋ฉ๋๋ค ! |
@@ -0,0 +1,66 @@
+import OUTPUT from '../../utils/constant/output.js';
+import OutputView from '../../utils/view_type/OutputView.js';
+import { EVENT_NAMES } from '../../utils/constant/event.js';
+
+class PrintEventResult {
+ #totalOrderAmount(TOTAL_AMOUNT) {
+ OutputView.printOutput(`${OUTPUT.TOTAL_AMOUNT.BEFORE_D... | JavaScript | ```jsx
OutputView.printOutput('');
```
์ด ๋ฌธ๊ตฌ ๊ฐํ๋๋ฌธ์ ์
๋ ฅํ์ ๊ฒ ๊ฐ์๋ฐ `์`๋ ๋ณ์ํ ํ์
์ `์\n`์ ํ์
๋ ๋๊ณ
๊ทธ ๋ค์ ๋ฌธ๊ตฌ์ `OutputView.printOutput(${OUTPUT.EVENT.BADGE});`๊ฐ ๋์ค๋
`BADGE: '\n<12์ ์ด๋ฒคํธ ๋ฐฐ์ง>'` ์ด๋ฐ์์ผ๋ก ์ถ๊ฐํ๋ฉด ์ฝ๋๊ฐ ์กฐ๊ธ ๋ ๊น๋ํด ์ง ๊ฒ ๊ฐ์์ ! |
@@ -0,0 +1,56 @@
+import { WEEKDAY_DISCOUNT_DATE, WEEKEND_DISCOUNT_DATE, SPECIAL_DISCOUNT_DATE } from '../../utils/constant/event.js';
+import { MENUS } from '../../utils/constant/menu.js';
+
+class CalculateEventBenefit {
+ #event = {
+ christmas: 0,
+ weekday: 0,
+ weekend: 0,
+ special: 0,
+ giveaway... | JavaScript | ```jsx
#event = {
christmas: 0,
weekday: 0,
weekend: 0,
special: 0,
giveaway: 0,
};
```
์ด๋ ๊ฒ ์์ฑํ์ ๊ฒ ์ฒ๋ผ ํด๋น ์์ ๊ฐ๋ ๊ณ ์ ๊ฐ์ด๋ ๋ณ์ํํด์ ์๋ฏธ๋ฅผ ๋ถ์ฌํ๋ ๊ฒ๋ ๊ด์ฐฎ์ ๊ฒ ๊ฐ์ต๋๋ค ! |
@@ -0,0 +1,41 @@
+import VisitDateError from '../../../utils/error/type/visit_date_error.js';
+import printError from '../../../utils/error/print_error.js';
+import INPUT_QUESTION from '../../../utils/constant/input_question.js';
+import OUTPUT from '../../../utils/constant/output.js';
+import InputView from '../../../... | JavaScript | ์๊ตฌ์ฌํญ์ ์๋ ๋ง์ฝ ํ์์ ๋ง์ง ์์ผ๋ฉด ์๋ก์ด ๊ฐ์ ๋ฐ์์ค๋ ๊ณผ์ ์ด ์๋๊ฒ ๊ฐ์ต๋๋ค.
(ํน์ ์ ๊ฐ ๋ชป ์ฐพ๋ ๊ฒ์ด๋ผ๋ฉด ์ ์ํด์ฃผ์๊ธฐ ๋ฐ๋๋๋ค)
ํด๋น ๊ตฌ๋ฌธ์์๋ return false๋ฅผ ํ๊ณ ๊ทธ๋ฅ break์จ์ ๋น ์ ธ ๋์จ๊ฒ ๊ฐ์๋ฐ return false ๋์ return this.#inputVisitDate() ํ๋ฉด ๋ค์ ๊ฐ์ ๋ฐ์ ์ฌ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,48 @@
+import CalculateOrderMenu from '../../model/calculate_order_menu.js';
+import PrintOrderMenu from '../../view/print_order_menu.js';
+import OrderMenuError from '../../../utils/error/type/order_menu_error.js';
+import printError from '../../../utils/error/print_error.js';
+import INPUT_QUESTION from '.... | JavaScript | ์ด ๋ถ๋ถ๋ ๋ ์ง ๋ฐ์์ฌ๋์ ๋ง์ฐฌ๊ฐ์ง๋ก ์๋ชป๋ ๊ฒฝ์ฐ ์ ๊ฐ์ ๊ฐ์ ธ์ค๋ ๊ณผ์ ์ด ์์ด๋ณด์
๋๋ค |
@@ -0,0 +1,67 @@
+import CalculateTotalOrderAmount from '../../model/calculate_total_order_amount.js';
+import CalculateEventDetails from '../../model/calculate_event_details.js';
+import PrintEventResult from '../../view/print_event_result.js';
+
+class EventManage {
+ #visitDate;
+ #orderMenu;
+
+ constructor(visi... | JavaScript | ์ด ๋ถ๋ถ์์ 10000์ด ์ด๋ค ์๋ฏธ๋ฅผ ๊ฐ๊ณ ์๋์ง ํ๋จํ๊ธฐ ํ๋ญ๋๋ค. ์ด ํ๋ก๋ ์ซ์๊ฐ ํ๋์ฝ๋ฉ ๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ฐ ์๋ฏธ๋ฅผ ๊ฐ์ง ์ ์๋๋ก ์์์ชฝ์ผ๋ก ๋นผ์ฃผ๋ ๊ฒ์ ์ด๋จ๊น์? |
@@ -0,0 +1,67 @@
+import CalculateTotalOrderAmount from '../../model/calculate_total_order_amount.js';
+import CalculateEventDetails from '../../model/calculate_event_details.js';
+import PrintEventResult from '../../view/print_event_result.js';
+
+class EventManage {
+ #visitDate;
+ #orderMenu;
+
+ constructor(visi... | JavaScript | else๋ฅผ ์ง์ํ๋ผ๊ณ ํ ๊ฒ์ ์๋ฏธ๊ฐ ๊ฑฐ์ ๋น์ทํ ์๋ฏธ๋ฅผ ๊ฐ๊ณ ์๋ ์ผํญ ์ฐ์ฐ์๋ฅผ ์ฐ๋ผ๊ณ ํ ๊ฒ์ ์๋๋ผ๊ณ ์๊ฐํ๋๋ฐ, ์ผํญ ์ฐ์ฐ์๋ฅผ ์ด ์ด์ ๊ฐ ๋ฐ๋ก ์์๊น์? |
@@ -0,0 +1,67 @@
+import CalculateTotalOrderAmount from '../../model/calculate_total_order_amount.js';
+import CalculateEventDetails from '../../model/calculate_event_details.js';
+import PrintEventResult from '../../view/print_event_result.js';
+
+class EventManage {
+ #visitDate;
+ #orderMenu;
+
+ constructor(visi... | JavaScript | ์
๋ ฅ 2๊ฐ์ ์ด๋ฒคํธ๋ก ํด๋์ค๋ฅผ ๋๋์
จ๋๋ฐ ๋ฐฐ์ง๋ ๋๋จธ์ง ์ชฝ(ํ ์ธ์ด๋ ํํ ๋ฑ ๊ณ์ฐํํธ)์ ๊ธฐ๋ฅ์ด ๋ฌ๋ผ๋ณด์ด๋๋ฐ ๋ค๋ฅธ ํด๋์ค๋ก ๋นผ๋๊ฒ์ ์ด๋จ๊น์ |
@@ -0,0 +1,41 @@
+import VisitDateError from '../../../utils/error/type/visit_date_error.js';
+import printError from '../../../utils/error/print_error.js';
+import INPUT_QUESTION from '../../../utils/constant/input_question.js';
+import OUTPUT from '../../../utils/constant/output.js';
+import InputView from '../../../... | JavaScript | 3์ฃผ์ฐจ ๊ณตํต ํผ๋๋ฐฑ์ "๊ฐ์ฒด๋ก๋ถํฐ ๋ฐ์ดํฐ๋ฅผ ๊บผ๋ด๋ ๊ฒ(get)์ด ์๋๋ผ, ๋ฉ์์ง๋ฅผ ๋์ง๋๋ก ๊ตฌ์กฐ๋ฅผ ๋ฐ๊ฟ ๋ฐ์ดํฐ๋ฅผ ๊ฐ์ง๋ ๊ฐ์ฒด๊ฐ ์ผํ๋๋ก ํด์ผํ๋ค"๊ณ ํ๋๋ฐ, getter๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ํด๊ฒฐํ ๋ฐฉ๋ฒ์ ๊ณ ๋ฏผํด๋ณด๋ ๊ฒ๋ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,41 @@
+import VisitDateError from '../../../utils/error/type/visit_date_error.js';
+import printError from '../../../utils/error/print_error.js';
+import INPUT_QUESTION from '../../../utils/constant/input_question.js';
+import OUTPUT from '../../../utils/constant/output.js';
+import InputView from '../../../... | JavaScript | ๋ณ์๋ช
์ `ERROR`๋ก ํ์ ์ด์ ๊ฐ ๊ถ๊ธํฉ๋๋ค. |
@@ -0,0 +1,41 @@
+import VisitDateError from '../../../utils/error/type/visit_date_error.js';
+import printError from '../../../utils/error/print_error.js';
+import INPUT_QUESTION from '../../../utils/constant/input_question.js';
+import OUTPUT from '../../../utils/constant/output.js';
+import InputView from '../../../... | JavaScript | (์ง๋๊ฐ๋ค) ์์ธ๊ฐ ๋ฐ์ํ์ฌ `return false`๋ฅผ ํ๋ฉด `#inputVisitDate()` ๋ฉ์๋์์ ์กฐ๊ฑด์์ ๊ฑธ๋ฆฌ์ง ์์ ๊ฒ์ด๊ณ , ๋ฌดํ ๋ฃจํ์ ์ํด ์ฌ์
๋ ฅ์ ๋ฐ๊ฒ๋ ๊ฒ ๊ฐ๋ค์!
๋ฌดํ ๋ฃจํ๊ฐ ์๋ ๋ค๋ฅธ ๋ฐฉ์์ ํด๊ฒฐ๋ฐฉ๋ฒ๋ ๊ณ ๋ฏผํด๋ณด๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,29 @@
+import VisitDateManage from '../child/visit_date_manage.js';
+import OrderMenuManage from '../child/order_menu_manage.js';
+import EventManage from '../child/event_manage.js';
+
+class PlannerManage {
+ #VISIT_DATE = null;
+ #ORDER_MENU = null;
+
+ async visitDate() {
+ const visitDateManage = n... | JavaScript | 3์ฃผ์ฐจ ๊ณตํต ํผ๋๋ฐฑ์ ํ๋์ ์๋ฅผ ์ต์ํํ๋ค๋ ์ฝ๋ฉํธ๊ฐ ์๋๋ฐ, ํ๋๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ์ธ์๋ก ์ ํด์ฃผ์ด ์ฌ์ฉํ๋ค๋ฉด ์ด๋ ์๊น์? |
@@ -0,0 +1,29 @@
+import VisitDateManage from '../child/visit_date_manage.js';
+import OrderMenuManage from '../child/order_menu_manage.js';
+import EventManage from '../child/event_manage.js';
+
+class PlannerManage {
+ #VISIT_DATE = null;
+ #ORDER_MENU = null;
+
+ async visitDate() {
+ const visitDateManage = n... | JavaScript | ๋๋ฉ์ธ ๋ก์ง๊ณผ UI ๋ก์ง์ด ๋ถ๋ฆฌ๋์ด ์์ง์์ ์ฑ ๋ก์ง์ด ์ ๊ฐ๋๋ค ๋ณด๋ ํฐ ํ๋ฆ์ ํ์
ํ๊ธฐ ์ด๋ ค์๋ณด์
๋๋ค.
PlannerManage์์๋ ํ์ด์ฆ๋ฅผ ๋๋๊ณ ๋ค์ด๋ฐ์ ํตํด ํฐ ํ๋ก์ธ์ค๋ฅผ ํํํ๊ณ , ๋ด๋ถ ๋์์ ๋๋ฉ์ธ, UI ๋ก์ง์ ๋ถ๋ฆฌํ์ฌ ๋ด๋นํ๋๋ก ํ๋ฉด ๋์ฑ ์๋ฏธ๊ฐ ๋๋ฌ๋๊ณ ํ๋ก์ธ์ค๋ฅผ ์ดํดํ๊ธฐ ์์ํ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,67 @@
+import CalculateTotalOrderAmount from '../../model/calculate_total_order_amount.js';
+import CalculateEventDetails from '../../model/calculate_event_details.js';
+import PrintEventResult from '../../view/print_event_result.js';
+
+class EventManage {
+ #visitDate;
+ #orderMenu;
+
+ constructor(visi... | JavaScript | 10,000๋ ์์๋ก ๊ด๋ฆฌํด์ฃผ๋ฉด ๋์ฑ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค. ์๋ฏธ๋ฅผ ํ์
ํ๊ธฐ๋ ์์ํ๊ณ , ๋ง์ฝ ์กฐ๊ฑด์ด ๋ณ๊ฒฝ๋๋ ์ํฉ์ด ์๋ ๊ฒฝ์ฐ ์์ ํ๊ธฐ ์์ํ๋ค๊ณ ์๊ฐํฉ๋๋ค. |
@@ -0,0 +1,67 @@
+import CalculateTotalOrderAmount from '../../model/calculate_total_order_amount.js';
+import CalculateEventDetails from '../../model/calculate_event_details.js';
+import PrintEventResult from '../../view/print_event_result.js';
+
+class EventManage {
+ #visitDate;
+ #orderMenu;
+
+ constructor(visi... | JavaScript | ์ฌ์ํ์ง๋ง, ์กฐ๊ฑด์ ์ญ์์ผ๋ก ์ ์๋ค๋ฉด ๋ ์ดํดํ๊ธฐ ์์ํ ๊ฒ ๊ฐ์ต๋๋ค.
`20000 ์ด์: ์ฐํ / 10000 ์ด์: ํธ๋ฆฌ / 5000 ์ด์: ๋ณ / ๋๋จธ์ง: ์์` |
@@ -0,0 +1,28 @@
+const EVENT_NAMES = ['ํฌ๋ฆฌ์ค๋ง์ค ๋๋ฐ์ด ํ ์ธ', 'ํ์ผ ํ ์ธ', '์ฃผ๋ง ํ ์ธ', 'ํน๋ณ ํ ์ธ', '์ฆ์ ์ด๋ฒคํธ'];
+
+const WEEKDAY_DISCOUNT_DATE = [
+ 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 17,
+ 18, 19, 20, 21, 24, 25, 26, 27, 28, 31,
+];
+
+const WEEKEND_DISCOUNT_DATE = [
+ 1, 2, 8, 9, 15, 16, 22, 23, 29, 30,
+];
+
+const SPECIAL_DISCOUNT... | JavaScript | ์ฌ๋ฌ ๊ฐ์ ์ธ์๋ฅผ ๋๊ฒจ์ฃผ๊ณ freeze ๋ฉ์๋๋ฅผ ํธ์ถํ๋ฉด ํ๋ฆฌ์ง๋์ง ์์ ๊ฒ ๊ฐ์ต๋๋ค. |
@@ -0,0 +1,33 @@
+const MENU_NAMES = [
+ '์์ก์ด์ํ', 'ํํ์ค', '์์ ์๋ฌ๋',
+ 'ํฐ๋ณธ์คํ
์ดํฌ', '๋ฐ๋นํ๋ฆฝ', 'ํด์ฐ๋ฌผํ์คํ', 'ํฌ๋ฆฌ์ค๋ง์คํ์คํ',
+ '์ด์ฝ์ผ์ดํฌ', '์์ด์คํฌ๋ฆผ',
+ '์ ๋ก์ฝ๋ผ', '๋ ๋์์ธ', '์ดํ์ธ',
+];
+
+const MENUS = {
+ Epitizer: {
+ ์์ก์ด์ํ: 6000,
+ ํํ์ค: 5500,
+ ์์ ์๋ฌ๋: 8000,
+ },
+ Main: {
+ ํฐ๋ณธ์คํ
์ดํฌ: 55000,
+ ๋ฐ๋นํ๋ฆฝ: 54000,
+ ํด์ฐ๋ฌผํ์คํ: 35000... | JavaScript | ์ค์ฒฉ๋ ๊ฐ์ฒด์ ๊ฒฝ์ฐ, ์ธ๋ถ๋ฅผ ํ๋ฆฌ์ง ํด์ฃผ์ด๋ ๋ด๋ถ๋ ํ๋ฆฌ์ง ๋์ง ์์ต๋๋ค. deep freeze ํค์๋๋ก ํ์ตํด๋ณด๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. |
@@ -0,0 +1,31 @@
+package dto;
+
+import domain.car.Car;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static util.Splitter.BLANK;
+
+public class CarDto {
+ private String name;
+ private List<String> whiteSpaceList;
+
+ public CarDto(Car car) {
+... | Java | carDto์ position์ ์์ฑ์์์ whiteSpaceList ๋ง๋๋ ๊ฑธ ์ ์ธํ๊ณค ์ฐ๋๋ฐ๊ฐ ์๋ ๊ฒ ๊ฐ์๋ฐ, carDto์์ ๋นผ๋ ๊ฑด ์ด๋ป๊ฒ ์๊ฐํ์๋์? |
@@ -1,79 +1,83 @@
<!DOCTYPE html>
<html>
+
<head>
-<meta charset="UTF-8">
-<title>๋ ์ด์ค!</title>
+ <meta charset="UTF-8">
+ <title>๋ ์ด์ค!</title>
-<!-- Latest compiled and minified CSS -->
-<link rel="stylesheet"
- href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
- integrity="sha384-B... | Unknown | ์ด ๋ถ๋ถ์ ์ด๋ป๊ฒ ํ ๊น ๊ณ ๋ฏผํ๋ค๊ฐ..๊ทธ๋ฅ ๋ฌธ๊ตฌ๋ฅผ ์์ ํ๋๋ฐ, ์ด ๋ถ๊ธฐ๋ฌธ ๋ฃ๋ ๊ฒ๋ ์๊ฐํด๋ด์ผ๊ฒ ๋ค์๐ |
@@ -0,0 +1,79 @@
+package view;
+
+import domain.car.Car;
+import domain.game.RacingGame;
+import domain.game.Track;
+import domain.random.RandomGenerator;
+import domain.strategy.RandomMovingStrategy;
+import dto.CarDto;
+import dto.RacingGameRequestDto;
+import spark.Route;
+import util.Splitter;
+
+import java.util.... | Java | ๊ฒ์์์์ ํ์ํ input๊ณผ ๊ฒฐ๊ณผ๊ฐ์ธ result๋ฅผ ๊ฐ์ ธ์ค๋ ๋ก์ง์ ๋ฉ์๋๋ก ๋ถ๋ฆฌํ๋ฉด ๋ ๊น๋ํด ์ง๊ฑฐ ๊ฐ์์ |
@@ -0,0 +1,79 @@
+package view;
+
+import domain.car.Car;
+import domain.game.RacingGame;
+import domain.game.Track;
+import domain.random.RandomGenerator;
+import domain.strategy.RandomMovingStrategy;
+import dto.CarDto;
+import dto.RacingGameRequestDto;
+import spark.Route;
+import util.Splitter;
+
+import java.util.... | Java | ๋ฉ์๋๋ฅผ ๋ถํดํด๋ ์ข์๊ฒ ๊ฐ์ต๋๋ค ๐ ! |
@@ -0,0 +1,25 @@
+import view.WebRacingHandler;
+
+import java.util.HashMap;
+
+import static spark.Spark.*;
+import static util.RenderUtil.render;
+
+public class WebMain {
+ public static final int PORT = 8080;
+ private static WebRacingHandler webRacingHandler = new WebRacingHandler();
+
+ public static voi... | Java | ํ, ๋ณ๊ฑด์๋๋ฐ `post`๊ฐ ์๊ตฌ์ฌํญ์ด์์ต๋๋ค ๐ |
@@ -0,0 +1,79 @@
+package view;
+
+import domain.car.Car;
+import domain.game.RacingGame;
+import domain.game.Track;
+import domain.random.RandomGenerator;
+import domain.strategy.RandomMovingStrategy;
+import dto.CarDto;
+import dto.RacingGameRequestDto;
+import spark.Route;
+import util.Splitter;
+
+import java.util.... | Java | ์๊ฑด ๋ฐํ๊ฐ์ด ๋ฐ๋ก ์๋์ด์ ๊ฐ ์์๊น์ ?
`getTracks()`๋ ๋ฉ์๋๊ฐ ๋ฐ๋ก์์ด์์! |
@@ -0,0 +1,79 @@
+package view;
+
+import domain.car.Car;
+import domain.game.RacingGame;
+import domain.game.Track;
+import domain.random.RandomGenerator;
+import domain.strategy.RandomMovingStrategy;
+import dto.CarDto;
+import dto.RacingGameRequestDto;
+import spark.Route;
+import util.Splitter;
+
+import java.util.... | Java | ํด๋น ์์ญ์ ๋ถ๋ฆฌํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,39 @@
+package nextstep.auth.authentication;
+
+import nextstep.member.application.UserDetailsService;
+import nextstep.member.domain.User;
+import org.springframework.web.servlet.HandlerInterceptor;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java... | Java | ์๋ ์๊ตฌ์ฌํญ์ด ๋ฐ์๋์ง ์์ ๊ฒ ๊ฐ์์ ๐ข
<img width="516" alt="แแ
ณแแ
ณแ
แ
ตแซแแ
ฃแบ 2022-08-16 แแ
ฉแแ
ฎ 10 07 08" src="https://user-images.githubusercontent.com/17218212/184886987-febc108f-8b2f-403b-a53e-bf36f069cc24.png"> |
@@ -1,51 +1,45 @@
package nextstep.auth.token;
import com.fasterxml.jackson.databind.ObjectMapper;
-import nextstep.auth.authentication.AuthenticationException;
-import nextstep.member.application.LoginMemberService;
-import nextstep.member.domain.LoginMember;
+import nextstep.auth.authentication.AuthenticationToke... | Java | `ObjectMapper` ๋ ์์ฑ ๋น์ฉ์ด ๋น์ธ๋ค๊ณ ์๋ ค์ง ๊ฐ์ฒด์
๋๋ค. ์์กด์ฑ ์ฃผ์
์ ํตํด ํด๊ฒฐํด๋ณผ ์ ์์๊น์? ๐ |
@@ -0,0 +1,8 @@
+package nextstep.member.application;
+
+import nextstep.member.domain.User;
+
+public interface UserDetailsService {
+
+ User loadUserByUsername(String email);
+} | Java | ์ด ์ธํฐํ์ด์ค๊ฐ `member` ํจํค์ง์ ์๋๊ฒ ๋ง์๊น์? ๐ค |
@@ -0,0 +1,83 @@
+package nextstep.subway.unit;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import nextstep.auth.authentication.AuthenticationToken;
+import nextstep.auth.authentication.LoginMember;
+import nextstep.auth.token.JwtTokenProvider;
+import nextstep.auth.token.TokenAuthenticationInterceptor;
+im... | Java | ์ด๋ฐํํ๋ก ๊ฒ์ฆ๋ ๊ฐ๋ฅํฉ๋๋ค ๐
```suggestion
given(jwtTokenProvider.createToken(any(), any())).willReturn(JWT_TOKEN);
boolean result = interceptor.preHandle(createMockRequest(), response, new Object());
assertThat(result).isFalse();
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK... |
@@ -10,7 +10,7 @@
import static org.assertj.core.api.Assertions.assertThat;
class MemberAcceptanceTest extends AcceptanceTest {
- public static final String EMAIL = "email@email.com";
+ public static final String EMAIL = "email2@email.com";
public static final String PASSWORD = "password";
public st... | Java | ์ธ์ํ
์คํธ๋ฅผ ์ฝ๋ ์ฌ๋์ด ๋๊ตฌ์ธ๊ฐ์ ๋ํด ๊ณ ๋ฏผํด๋ด์ผ ํ๋๋ฐ์.
ํด๋ฆฐ ์ ์์ผ์ ๊ตฌ์ ์ ์ธ์ฉํ๋ฉด
>์ธ์ํ
์คํธ๋ ์
๋ฌด ๋ถ์๊ฐ์ QA, ๊ฐ๋ฐ์๊ฐ ํจ๊ป ํ์ ๋ชจ์ ์์ฑํ๋ค.
์ด์ ๊ฐ์ด ์ธ์ํ
์คํธ๋ฅผ ์ฝ๋ ์ฌ๋์ด ๋ชจ๋ ๊ฐ๋ฐ์๋ ์๋ ์ ์๋ค๊ณ ์๊ฐํฉ๋๋ค ๐. |
@@ -0,0 +1,8 @@
+package nextstep.member.application;
+
+import nextstep.member.domain.User;
+
+public interface UserDetailsService {
+
+ User loadUserByUsername(String email);
+} | Java | ๋ง๋ค๋ฉด์ ๋ฐฐ์ฐ๋ ํด๋ฆฐ์ํคํ
์ณ๋ฅผ ๋ณด๋ฉด ์๋น์ค์ ์ธํฐํ์ด์ค์ ๊ทธ ๊ตฌํ์ฒด๋ฅผ ๊ฐ์ด ๋๊ธฐ์ ๊ทธ๊ฒ ์ต์ํด์ member์ ๋์๋ค์ ใ
ใ
UserDetailService๋ฅผ auth์์๋ง ์ฌ์ฉํ์ง ์์ ์๋ ์๊ธฐ์ ๊ตฌํ์ฒด์ ๊ฐ์ด ๋๋๊ฒ ํ๋์ ๋ ๋ค์ด์ฌ ๊ฒ ๊ฐ์ต๋๋ค!
๋ฌผ๋ก ์ธํฐํ์ด์ค์ ๊ตฌํ์ฒด์ ๊ตฌ๋ถ์ ํด๋๋ก๋ผ๋ ํ๋ฉด ์ข์๋ฐ ๊ธํ๊ฒ ํ๋๋ผ... ๐ |
@@ -0,0 +1,83 @@
+package nextstep.subway.unit;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import nextstep.auth.authentication.AuthenticationToken;
+import nextstep.auth.authentication.LoginMember;
+import nextstep.auth.token.JwtTokenProvider;
+import nextstep.auth.token.TokenAuthenticationInterceptor;
+im... | Java | bool๋ง ํ์ธํ๊ธฐ์๋ ๋ถ์กฑํ๋ค๊ณ ์๊ฐํ๋๋ฐ ์ข๋ค์! ๊ฐ์ฌํฉ๋๋ค. |
@@ -10,7 +10,7 @@
import static org.assertj.core.api.Assertions.assertThat;
class MemberAcceptanceTest extends AcceptanceTest {
- public static final String EMAIL = "email@email.com";
+ public static final String EMAIL = "email2@email.com";
public static final String PASSWORD = "password";
public st... | Java | ๋ตใ
ใ
์ข๋ ํ๊ธํ๊ฐ ๋ค์ด๊ฐ๋ฉด ์ข์ ๊ฒ ๊ฐ๊ตฐ์ |
@@ -0,0 +1,39 @@
+package nextstep.auth.authentication;
+
+import nextstep.member.application.UserDetailsService;
+import nextstep.member.domain.User;
+import org.springframework.web.servlet.HandlerInterceptor;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java... | Java | ๋ฏธ์
์ `auth` ํจํค์ง ๋ด์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ์ธํ ๋น์ฆ๋์ค ํจํค์ง๋ค์ด ๋ค์ด์ค์ง ์์์ผ ์๋ฃ๋ฉ๋๋ค ๐ข
ํ์ฌ `auth` ํจํค์ง๊ฐ `member` ์ ์์กดํ๊ณ ์์ด์ |
@@ -1,9 +1,12 @@
-package nextstep.member.domain;
+package nextstep.auth.authentication;
+import nextstep.member.domain.Member;
+import nextstep.member.domain.User;
+
import java.util.List;
-public class LoginMember {
+public class LoginMember implements User {
private String email;
private String pass... | Java | `LoginMember` ๋ฅผ ์ฎ๊ธฐ์์ง ์์์ ๋ฉ๋๋ค ๐ข |
@@ -0,0 +1,8 @@
+package nextstep.member.application;
+
+import nextstep.member.domain.User;
+
+public interface UserDetailsService {
+
+ User loadUserByUsername(String email);
+} | Java | ํด๋น ์ฑ
์์์ ๊ตฌํ์๋๋ ๋จ์ํ ์ธํฐํ์ด์ค์ ๊ตฌํ์ฒด๋ฅผ ๊ฐ์ ํจํค์ง์ ๋๋ ๊ฒ์ ์๋๋๋ค ๐
ํด๋ฆฐ ์ํคํ
์ฒ์์ ๋ก๋ฒํธ C.๋งํด์ ์๋์ ๊ฐ์ ์์ ๊ทธ๋ ค์ ์ค๋ช
ํ๋๋ฐ์.
์กฐ๊ธ ๋จ์ํํด์ ๋ง์๋๋ฆฌ๋ฉด ์ ์ธ๋ถ์ ๊ฐ์ฒด๋ง์ด ์ ๋ด๋ถ์ ๊ฐ์ฒด์ ์์กดํด์ผ ํ๋ค๋ ๊ฒ์ ์ฃผ์ฅํฉ๋๋ค.
๋ง์ํ์ ๋ง๋ค๋ฉด์ ๋ฐฐ์ฐ๋ ํด๋ฆฐ์ํคํ
์ฒ๋ `DIP`๋ฅผ ํตํด ์์กด์ฑ ๊ฒฉ๋ฆฌํ๊ธฐ ์ํด ์ธํฐํ์ด์ค๋ฅผ ๋๊ณ , ํด๋น ์ธํฐํ์ด์ค๋ฅผ ๋ด๋ถ์ ๊ฐ์ฒด๊ฐ ๊ตฌํํ๊ณ , ์ธ๋ถ์ ๊ฐ์ฒด๋ ๊ทธ ์ธํฐํ์ด์ค๋ฅผ `์ฌ์ฉ`ํจ์ผ๋ก์จ ์ธ๋ถ์ ๊ฐ์ฒด๊ฐ ๋ด๋ถ์ ์ค์ ๊ตฌํ๊ฐ์ฒด๋ฅผ ์์ง ๋ชปํ๊ฒ ๋๋ ์ญํ ์ ํฉ๋๋ค.
์ง๊ธ ๋ฏธ์
์์ ์๊ตฌํ๋ ๊ฒ๋ ์ฌ์ค์ `... |
@@ -0,0 +1,8 @@
+package nextstep.member.application;
+
+import nextstep.member.domain.User;
+
+public interface UserDetailsService {
+
+ User loadUserByUsername(String email);
+} | Java | ๋ค ๋ง์ํ์ ๋๋ก ์ ์ธ๋ถ์ ๊ฐ์ฒด๋ง์ด ์ ๋ด๋ถ์ ๊ฐ์ฒด๋ฅผ ์ฐธ์กฐํด์ผ ํ๋ค๋ ๊ฒ์ ๋์ํฉ๋๋ค.
๊ทธ๋ฐ๋ฐ ํ์ฌ ๊ตฌ์กฐ๋ก๋ ์์กด์ฑ ๊ฒฉ๋ฆฌ๊ฐ ์ถฉ๋ถํ ๋์ง ์์๋ค๋ ๋ง์์ผ๊น์? ํ์ฌ๋ member ๊ณผ auth๊ฐ์ usecase๋ฅผ ํตํด ํต์ ์ด ์ด๋ฃจ์ด์ง๊ณ ์๊ธฐ์, dip๋ฅผ ํตํด ๊ตฌํ์ฒด๋ ์ง์ ์ ์ผ๋ก ์ฐธ์กฐ๊ฐ ์ด๋ค์ง์ง ์๊ณ ์์ด์ usecase๋ฅผ ์ด๋์ ๋ ๊ฒ์ธ๊ฐ๋ ๋ถ์ฐจ์ ์ธ ๋ฌธ์ ๋ผ๊ณ ์๊ฐํ์ต๋๋ค. (๊ทธ๋์ ๊ทธ์ค ํ๋๋ก ๋ง๋ค๋ฉด์ ๋ฐฐ์ฐ๋ ํด๋ฆฐ์ํคํ
์ณ ๋ด์ฉ์ ์์๋ก ๋ ๊ฒ์ด๊ณ ์. ์ฒจ๋ถํด์ฃผ์ ์์์์๋ import๋ฌธ์ด ์กด์ฌํ๊ธฐ๋ง ํด๋ ์์กด๊ด๊ณ๊ฐ ์๋ค๊ณ ํ๋ค์!)
๋ฏธ์
์ด ๊ทธ๋ฐ ์๋ฏธ๋ผ๋ฉด ์์ ํ๋๊ฑด ... |
@@ -0,0 +1,8 @@
+package nextstep.member.application;
+
+import nextstep.member.domain.User;
+
+public interface UserDetailsService {
+
+ User loadUserByUsername(String email);
+} | Java | ํด๋ฆฐ์ํคํ
์ฒ๋ฅผ ์ธ๊ธํ๊ฑด ์์๋์ด ์๊ธฐํ์ ๋ถ๋ถ์ ๋ํด ์ถ๊ฐ์ ์ธ ์ธ๊ธ์ ๋๋ฆฌ๋ค๋ณด๋ ๊ทธ๋ ๊ฒ ๋์๋ค์ ๐
ํด๋ฆฐ์ํคํ
์ฒ์ ๋ด์ฉ์ด ๋จ์ํ ์ธํฐํ์ด์ค์ ๊ตฌํ์ฒด๋ฅผ ๊ฐ์ ํจํค์ง์ ๋๋ผ๋ ์๋ฏธ๋ ์๋๋ผ๊ณ ์๊ฐํด์ ์ฒจ์ธ์ ๋๋ ค๋ดค์ต๋๋ค
ํ์ฌ ๋ฏธ์
์ ๋ํด ์ด์ผ๊ธฐํ๋ฉด auth ์ member ์ ์ฑ์ง์ ๋ํด ๊ณ ๋ฏผํด๋ด์ผํ๋ ๋ฐ์.
`auth` ๋ ์ธ์ฆ/์ธ๊ฐ์ ๋ํ ์ฑ
์์ ๊ฐ์ง๋ `๋น์ฆ๋์ค ๊ท์น`๊ณผ๋ ์กฐ๊ธ ๋๋จ์ด์ง `๊ณตํต`์ ์ฑ์ง์ ์ง๋ ํจํค์ง๋ผ๊ณ ์๊ฐ๋ฉ๋๋ค
๋ฐ๋ฉด์ `member`๋ ์ด ์ ํ๋ฆฌ์ผ์ด์
๋ง์ `๋น์ฆ๋์ค ๊ท์น`์ ๋ด์์๋ ์๋ ์ฌ์ฉ์์ ๋ํ ํจํค์ง๋ผ๊ณ ๋ณผ ์ ์์ ๊ฒ ๊ฐ... |
@@ -0,0 +1,8 @@
+package nextstep.member.application;
+
+import nextstep.member.domain.User;
+
+public interface UserDetailsService {
+
+ User loadUserByUsername(String email);
+} | Java | ์์๋ฅผ ๋ค์ด์ฃผ์ ๋ง๋ค๋ฉด์ ๋ฐฐ์ฐ๋ ํด๋ฆฐ ์ํคํ
์ฒ์์๋ application ํจํค์ง์ ์ธํฐํ์ด์ค๋ฅผ adapter ์์ ๊ตฌํ ํ๋ ํํ๋ก ๊ฐ๋ฐ์ ํ๊ณ ์์ต๋๋ค. ์์กด์ฑ ๊ฒฉ๋ฆฌ๋ฅผ ์ํด `DIP`๋ฅผ ์ฌ์ฉํ๋ฉด ๊ฐ๋
์์ผ๋ก๋ ์ด๊ฒ ์ ๊ฒ ์ด์ผ๊ธฐ ํ ์ ์๊ฒ ์ง๋ง, ๊ฒฐ๊ตญ์ ๋ด๋ถ์ ๊ฐ์ฒด๋ค์ด ์ธ๋ถ์ ์์กดํ์ง ์๋๋ก ๋ง๋๋ ์ฌ๋ฌ๊ฐ์ง ๋ฐฉ๋ฒ๋ค์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค ๐ |
@@ -0,0 +1,8 @@
+package nextstep.member.application;
+
+import nextstep.member.domain.User;
+
+public interface UserDetailsService {
+
+ User loadUserByUsername(String email);
+} | Java | > MemberControllerย ๊ฐย @AuthenticationPrincipal๋ฅผ ์ฌ์ฉํ๊ณ ,ย LoginMember๊ฐย User๋ฅผ ๊ตฌํํ๊ธฐ ๋๋ฌธ์ ํจํค์ง ๊ฐ์ ์ํ์ฐธ์กฐ๊ฐ ์๊ฒผ์ต๋๋ค.
์ฌ๊ธฐ์ ์ฐธ์กฐ๊ฐ ์๋ค๋๊ฑด ์๊ฐ๋ชปํ๋ค์! ๋ต ์์ ํ๊ฒ ์ต๋๋ค
> ์์๋ฅผ ๋ค์ด์ฃผ์ ๋ง๋ค๋ฉด์ ๋ฐฐ์ฐ๋ ํด๋ฆฐ ์ํคํ
์ฒ์์๋ application ํจํค์ง์ ์ธํฐํ์ด์ค๋ฅผ adapter ์์ ๊ตฌํ ํ๋ ํํ๋ก ๊ฐ๋ฐ์ ํ๊ณ ์์ต๋๋ค
๋ต ์ฒ์ ๋๊ธ์์ ๋ง์๋๋ ธ๋ฏ์ด `๋ฌผ๋ก ์ธํฐํ์ด์ค์ ๊ตฌํ์ฒด์ ๊ตฌ๋ถ์ ํด๋๋ก๋ผ๋ ํ๋ฉด ์ข์๋ฐ ๊ธํ๊ฒ ํ๋๋ผ...ย ๐` ๐ ์์ผ๋ก ์ฐธ๊ณ ํ๊ฒ ์ต๋๋ค. ์ง๊ธ๊น์ง ๊ธด ์ค๋ช
... |
@@ -0,0 +1,8 @@
+package nextstep.member.application;
+
+import nextstep.member.domain.User;
+
+public interface UserDetailsService {
+
+ User loadUserByUsername(String email);
+} | Java | ์ ๋ ํ ๋ก ํ๋ฉฐ ์ฌ๋ฏธ์์์ต๋๋ค
[์ฐธ๊ณ ](https://github.com/wikibook/clean-architecture) ์ ์์ ์ ์์กด๊ด๊ณ๋ฅผ ์ง์ ๊ทธ๋ฆผ์ผ๋ก ๊ทธ๋ ค๋ณด์๋ฉด ๋ ์ข์ ์ธ์ฌ์ดํธ๋ฅผ ์ป์ผ ์ค ์ ์์๊ฒ ๊ฐ์์ ๐ |
@@ -0,0 +1,39 @@
+package nextstep.subway.unit;
+
+import nextstep.subway.applicaion.LineService;
+import nextstep.subway.applicaion.PathService;
+import nextstep.subway.applicaion.StationService;
+import nextstep.subway.domain.Station;
+import nextstep.subway.utils.TestObjectFactory;
+import org.junit.jupiter.api.Disp... | Java | StationService์ createStationResponse ๋ฉ์๋๋ฅผ ๊ทธ๋๋ก ์ฌ์ฉํ๊ณ ์ถ์ด์, stationService๋ฅผ ๋ชจํนํ์ง ์๊ณ ๋ฐ๋ก ์์ฑํ๋๋ก ํ์๋๋ฐ์
@InjectMocks๋ ์ฌ์ฉํ ์ ์์ด ๋ถํธํ๊ณ , ํ
์คํธํ ๋์ ํ๋๋ง ์๋ณธ ํด๋์ค๋ฅผ ๊ฐ์ ธ๋ค ์ฐ๊ณ ๋๋จธ์ง๋ ๋ค ๋ชฉ์ผ๋ก ์งํํด์ผ ํ๋ค๋ ๋ชฉ ํ
์คํธ์ ์ด๋
(?) ์๋ ๋ง์ง ์๋ ๊ฒ ๊ฐ์ ๊ณ ๋ฏผ์ด ๋ฉ๋๋ค.
ํน์ ๋ค๋ฅธ ๊น๋ํ ํ
์คํธ ๋ฐฉ๋ฒ์ด๋ ๋ฆฌํฉํ ๋ง ๋ฐฉ๋ฒ์ด ์์๊น์? |
@@ -0,0 +1,39 @@
+package nextstep.subway.unit;
+
+import nextstep.subway.applicaion.LineService;
+import nextstep.subway.applicaion.PathService;
+import nextstep.subway.applicaion.StationService;
+import nextstep.subway.domain.Station;
+import nextstep.subway.utils.TestObjectFactory;
+import org.junit.jupiter.api.Disp... | Java | ์ฃผ๋ก ์ง๊ธ๊ณผ ๊ฐ์ด layered ์ํคํ
์ฒ์์๋ application(service) layer๋ domain ๊ฐ์ฒด๋ค์ ์กฐํฉํ๋ ์ญํ ์ ํ๋๋ฐ์,
์ง๊ธ ์ฝ๋์์๋ ์๋ต Response ๊ฐ์ฒด๋ฅผ ์์ฑํ๋ ์ญํ ๋ํ service๊ฐ ๊ฐ๊ณ ์์ด์ injectํด์ผํ๋ ๋ฌธ์ ๊ฐ ์๊ธฐ๋ ๊ฒ ๊ฐ์์.
mock testing ๋ฐฉ์์ ์ฌ์ฉํ์ ๋ ํฌ๊ฒ ๋๊ปด์ง๋ ๋จ์ ์ค ํ๋๋ ์์กดํ๋ ๊ฐ์ฒด๊ฐ ๋ง์ผ๋ฉด ๋ง์์ง์๋ก ํ
์คํธ ์์ฑ์ด ๊น๋ค๋ก์์ง๋ค๋ ๊ฑฐ์์.
(when, thenReturn์ ํด์ผํ๋ ๋ด๋ถ ๊ตฌํ ์์ฒด๋ฅผ ์ง์ ์ ์ผ๋ก ์์์ผ๊ฒ ์ฃ )
๊ทธ๋ฐ ์ ์์ service๋ผ๋ฆฌ ์์กด์ ํด์ผ๋๋... |
@@ -0,0 +1,134 @@
+package nextstep.subway.acceptance;
+
+import io.restassured.response.ExtractableResponse;
+import io.restassured.response.Response;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.springframework.http.HttpStatus;
+
... | Java | ๊ณต๊ฐ๊ณผ ๊ด๋ จ๋ ์๊ณ ๋ฆฌ์ฆ์ ํ
์คํธ๋ฅผ ํ๊ธฐ ๋๋ฌธ์
๋์ค์ ์์ ์ด ๋ณด๊ฑฐ๋ ๋ค๋ฅธ ๊ฐ๋ฐ์๊ฐ ์ด ํ
์คํธ ์ฝ๊ณ ํ์
ํ๊ธฐ๊ฐ ํ๋ค ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค.

์ด๋ฒ ๋จ๊ณ ์์์ ์๋ ๊ฒ ์ฒ๋ผ ์ฃผ์์ผ๋ก ํฝ์ค์ณ๋ฅผ ์ค๋ช
ํด์ฃผ๋ฉด ๋์ค์ ๋ค์ ๋ณด์์ ๋๋ ์ฝ๊ฒ ํ
์คํธ๋ฅผ ํ์
ํ ์ ์์ ๊ฒ ๊ฐ์ต๋๋ค :) |
@@ -0,0 +1,39 @@
+package nextstep.subway.unit;
+
+import nextstep.subway.applicaion.LineService;
+import nextstep.subway.applicaion.PathService;
+import nextstep.subway.applicaion.StationService;
+import nextstep.subway.domain.Station;
+import nextstep.subway.utils.TestObjectFactory;
+import org.junit.jupiter.api.Disp... | Java | ์ถ๊ฐ์ ์ผ๋ก ์์ธ ์ํฉ์ ๋ํด์ ํ
์คํธ๋ฅผ ํด์ฃผ์๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ค!

๋์ ์ ์ง๊ธ๊ณผ ๊ฐ์ด service layer์ ๋น์ฆ๋์ค ๋ก์ง์ด ๋ค์ด๊ฐ๊ฒ ๋๋ฉด ํ
์คํธ ํด๋ด์ ์์๊ฒ ์ง๋ง
service์์ ํ์ํ (test double์ด๋ ์ค์ ๊ฐ์ฒด๋ )์์กด์ฑ์ด ๊ฐ์ถฐ์ง ์ํ์์ ํ
์คํธ๋ฅผ ํด์ผํ๋ ํ
์คํธ ์์ฑ์ด ๋ฒ๊ฑฐ๋กญ๊ฑฐ๋ ๊น๋ค๋ก์์ง๋๋ฐ์.
์ฒซ๋ฒ์งธ ๋จ๊ณ์ ์๊ตฌ์ฌํญ์ ํตํด ๊ฒฝํ... |
@@ -0,0 +1,39 @@
+package nextstep.subway.unit;
+
+import nextstep.subway.applicaion.LineService;
+import nextstep.subway.applicaion.PathService;
+import nextstep.subway.applicaion.StationService;
+import nextstep.subway.domain.Station;
+import nextstep.subway.utils.TestObjectFactory;
+import org.junit.jupiter.api.Disp... | Java | ํด๋น ๋ฆฌ๋ทฐ๋ฅผ ๋ฐ์ํ๋ฉด์
`์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ด ์ฐ๊ฒฐ์ด ๋์ด ์์ง ์์ ๊ฒฝ์ฐ` ์ ๋ํด pathService ์๋น์ค ๋ ์ด์ด mock ํ
์คํธ๋ฅผ ์ง๋๋ฐ,
์ด๋ฅผ pathService์์ ํ
์คํธํ๋ ค๋ stationService๋ฅผ ๋ชฉ์ฒ๋ฆฌํด๋ฌ์, ํ
์คํธ๋ฅผ ์ง๋ ค๋ฉด stationService.findById์์ ์๋ฌ๋ฅผ ๋์ง๋๋ก ๋ชฉ ํ
์คํธ๋ฅผ ์งํํด์ผ ํ์ต๋๋ค. ํ์ง๋ง, ์ด๋ ์ฝ๋์ ๋ํ ํ
์คํธ๋ฅผ ์ง๊ธฐ๋ณด๋ค๋ ํ
์คํธ๋ฅผ ์ํ ํ
์คํธ๋ผ๋ ์๊ฐ์ด ๋ค์ด์ ๊ฒฐ๊ตญ ์ด ๊ฒฝ์ฐ๋ ์ค์ ๊ฐ์ฒด ํ
์คํธ์์ ์งํํด์ผ ํ๋๋ฐ์.
์ด์ ๊ฐ์ ๊ฒฝ์ฐ๋ ์ ๊ฐ ํ ๊ฒ์ฒ๋ผ mockํ
์คํธ๋ฅผ ํผํ๋๊ฒ ๋ง๋ ๊ฒ์ธ์ง? ์๋๋ฉด ... |
@@ -0,0 +1,39 @@
+package nextstep.subway.unit;
+
+import nextstep.subway.applicaion.LineService;
+import nextstep.subway.applicaion.PathService;
+import nextstep.subway.applicaion.StationService;
+import nextstep.subway.domain.Station;
+import nextstep.subway.utils.TestObjectFactory;
+import org.junit.jupiter.api.Disp... | Java | @sang-eun
๋ค๋ค mock์ ์ฌ์ฉํ ํ
์คํ
์ ๊ฒฝ์ฐ ์์กดํ๋ ๊ฐ์ฒด๋ฅผ ๋งค๋ฒ ์ค์ ์ ํ๋ ๊ฒ์ด ๋งค์ฐ ๋ฒ๊ฑฐ๋กญ์ฃ ...!
๊ทธ๋์ ์ฒซ๋ฒ์งธ ๋จ๊ณ์์ ์๊ธฐ๋๋ ธ๋ฏ์ด ์ ๋ fake ๊ฐ์ฒด๋ฅผ ์ฌ์ฉํ๋ ๊ฑธ ์ ํธํ๋ ํธ์
๋๋ค!
์ง๊ธ๊ณผ ๊ฐ์ ๊ฒฝ์ฐ ๊ธธ์ ์ฐพ๋ ์ญํ ์ ๊ฐ๋ ๊ฐ์ฒด๋ฅผ ๋ฐ๋ก ๋ง๋ ๋ค๋ฉด ์ข ๋ ๊ฐ๋ฒผ์ด ํ
์คํ
์ด ๊ฐ๋ฅํ ๊ฒ ๊ฐ์ต๋๋ค!
(์ด๋ฏธ `Path` ๊ฐ์ฒด์์ ์ฒ๋ฆฌํ๋๋ก ํ์
จ๋ค์ ๐ ) |
@@ -0,0 +1,25 @@
+package com.example.chatgptcodereviewtest.controller;
+
+import com.example.chatgptcodereviewtest.dto.InputDto;
+import com.example.chatgptcodereviewtest.service.TestService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * ์ค๋ช
:
+ *
+ * @author ์ตํ๋ฒ(J... | Java | ์ ์ฝ๋ ์กฐ๊ฐ์์๋ `TestController` ํด๋์ค๋ฅผ ์ ์ํ๊ณ ์์ผ๋ฉฐ, ํด๋น ์ปจํธ๋กค๋ฌ์ `convertText` ๋ฉ์๋๋ `InputDto` ๊ฐ์ฒด๋ฅผ ๋ฐ์๋ค์ฌ `testService`์์ `addAgeAndNameLength` ๋ฉ์๋๋ฅผ ํธ์ถํ ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํฉ๋๋ค.
์ด ์ฝ๋ ์กฐ๊ฐ์ ๋ํ ์ฃผ์ ๊ฐ์ ์ ์์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
1. ์ปจํธ๋กค๋ฌ์ ์๋น์ค ํด๋์ค์ ์ด๋ฆ์ ๋ ๋ช
ํํ๊ฒ ๋ํ๋ผ ์ ์๋๋ก ๋ณ๊ฒฝํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
2. ์ปจํธ๋กค๋ฌ์์ ์ฌ์ฉ๋ ๊ฒฝ๋ก๋ช
(`"/test"`) ๋ฐ HTTP ๋ฉ์๋(`@PostMapping`)์ ๋ํด ์ถฉ๋ถํ ์ค๋ช
์ด ์์ผ๋ฏ๋ก API์ ์๋๋ฅผ ๋ ... |
@@ -0,0 +1,22 @@
+package com.example.chatgptcodereviewtest.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+/**
+ * ์ค๋ช
:
+ *
+ * @author ์ตํ๋ฒ(Jayce) / hb.choi@dreamus.io
+ * @since 2023/03/23
+ */
+@Getter
+@ToString
+@NoArgsConstructor
+@AllA... | Java | ์ ์ฝ๋๋ lombok ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ด์ฉํด InputDto ํด๋์ค๋ฅผ ์์ฑํ๊ณ ์๋ ๊ฒ์ผ๋ก ๋ณด์
๋๋ค.
๊ฐ์ ์ :
1. ํด๋์ค์ ๋ณ์ ์ด๋ฆ์ ๋ ๋ช
ํํ๊ฒ ์ ์ด์ฃผ๋ฉด ์ข๊ฒ ์ต๋๋ค.
2. Setter๊ฐ ์๊ธฐ ๋๋ฌธ์ name๊ณผ age์ ๋ํ ์ผ๋ถ ์ ๋ณด ๋ณ๊ฒฝ์ด ๋ถ๊ฐ๋ฅํฉ๋๋ค. ๋ฐ๋ผ์, ํด๋น DTO๋ฅผ ์ฌ์ฉํ๋ ํด๋์ค์์ ์ ์ดํ ์ ์๋๋ก Setter ๋ฉ์๋ ์ถ๊ฐ๋ฅผ ๊ณ ๋ คํด๋ณผ ํ์์ฑ์ด ์์ต๋๋ค.
๋ฒ๊ทธ ๊ฐ๋ฅ์ฑ:
ํ์ฌ ํด๋น ์ฝ๋์์ ๋ฒ๊ทธ๋ ๋ณด์ด์ง ์์ต๋๋ค. |
@@ -0,0 +1,20 @@
+package com.example.chatgptcodereviewtest.service;
+
+import com.example.chatgptcodereviewtest.dto.InputDto;
+import org.springframework.stereotype.Service;
+
+/**
+ * ์ค๋ช
:
+ *
+ * @author ์ตํ๋ฒ(Jayce) / hb.choi@dreamus.io
+ * @since 2023/03/23
+ */
+@Service
+public class TestService {
+
+ public int... | Java | ์์ ์ฝ๋ ๋ฆฌ๋ทฐ์ ๋ํ ์ ์๊ฐ์
๋๋ค.
๊ธฐ๋ฅ์ ์ผ๋ก ๋ฌธ์ ๊ฐ ์์ด ๋ณด์ด๋ฉฐ, ์ถ๊ฐ ๊ฐ์ ์ฌํญ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ช ๊ฐ์ง ์์ ์์ ์ฌํญ์ ์ ์ํด ๋๋ฆฌ๊ฒ ์ต๋๋ค:
- ์ฃผ์์ด ์์ธํ์ง ์์ ๋ณ๊ฒฝ ๋ ํ๋ก์ ํธ์ ๋ํด ์ถฉ๋ถํ ์ค๋ช
์ ์ ๊ณตํ์ง ์์ต๋๋ค. ๋ฉ์๋ ์ด๋ฆ 'addAgeAndNameLength' ์์ฒด๊ฐ ๊ธฐ๋ฅ์ ์ค๋ช
ํ๋ ๋ฐ ๋งค์ฐ ํฌ๊ด์ ์
๋๋ค. ์ข ๋ ๊ตฌ์ฒด์ ์ธ ๋ฉ์๋ ๋ฐ ํด๋์ค ์ค๋ช
๊ณผ ํจ๊ป ์ฃผ์์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
- ๋ชจ๋ ์์ธ๋ฅผ ์ฒ๋ฆฌ ํ ์ ์๋๋ก try-catch ๋ธ๋ก์ ์ถ๊ฐํ ์ ์์ต๋๋ค.
์์ธกํ ์์๋ ๊ฐ์ ์ ๋ฌํ์ฌ ์ถ๋ ฅ ๊ฐ์ด ์์๊ฐ๋๋ ๊ฒฝ์ฐ ๋ฑ ์ํ์ฑ์ด ... |
@@ -0,0 +1,32 @@
+package nextstep.subway.exception;
+
+import nextstep.subway.auth.application.AuthorizationException;
+import org.springframework.dao.DataIntegrityViolationException;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.anno... | Java | ๊ณตํต ์์ธ ์ฒ๋ฆฌ ์ข์ต๋๋ค. ๐ |
@@ -0,0 +1,50 @@
+package nextstep.subway.fare.domain;
+
+import java.util.Arrays;
+
+public enum DiscountPolicy {
+ ADULT(19, 500, 0, 0),
+ TEENAGER(13, 19, 350, 0.2),
+ CHILD(6, 13, 350, 0.5),
+ INFANT(0, 6, 0, 1);
+
+ private int ageStart;
+ private final int ageEnd;
+ private final int minusFar... | Java | ๋์ด์ ๋ฐ๋ฅธ ํ ์ธ ์๊ธ ๊ณ์ฐ ๋ก์ง ์ ๊ตฌํํด์ฃผ์
จ์ต๋๋ค. ๐
`ageStart`, `ageEnd`๋ ์ถฉ๋ถํ ๋ฌด์จ ์ญํ ์ ํ๋์ง ์ ์ ์๋ ์ด๋ฆ์ธ๋ฐ, ๋น๊ต์ ์ฌ์ฉ๋๋๊น ์ด์/์ด๊ณผ, ์ดํ/๋ฏธ๋ง ๊ตฌ๋ถ์ ์ํด `ageMinInclusive`, ageMaxExclusive`์ ๊ฐ์ด ์์ ํด๋ณด์
๋ ์ข๊ฒ ์ต๋๋ค. |
@@ -0,0 +1,50 @@
+package nextstep.subway.fare.domain;
+
+import java.util.Arrays;
+
+public enum DiscountPolicy {
+ ADULT(19, 500, 0, 0),
+ TEENAGER(13, 19, 350, 0.2),
+ CHILD(6, 13, 350, 0.5),
+ INFANT(0, 6, 0, 1);
+
+ private int ageStart;
+ private final int ageEnd;
+ private final int minusFar... | Java | ์์ธ๋ฅผ ๋ฐ์์ํฌ ๋ ์์ธ ๋ด์ฉ, ๋๋ฒ๊น
์ ํ์ํ ๊ฐ์ ๋ฉ์์ง๋ก ํจ๊ป ์ ๋ฌํ์๋ฉด, ๋ฌธ์ ์ํฉ์์ ์์ธ ์ถ์ ์ด ์์ํด์ ์ข์ต๋๋ค. :) |
@@ -0,0 +1,42 @@
+package nextstep.subway.fare.domain;
+
+import java.util.Arrays;
+
+public enum DistanceExtraFare {
+ NEAR(10, 50, 100, 5),
+ FAR(50, 500, 100, 8);
+
+ private final int distanceStart;
+ private final int distanceEnd;
+ private final int fare;
+ private final int unitDistanceInKiloMe... | Java | 16km๋ฅผ ๊ฐ๋ ๊ฒฝ์ฐ ์ถ๊ฐ ์๊ธ์ ((16 - 10) / 5) * 100 = 100์์ด ๋ ๊ฒ ๊ฐ์์!
์ฐธ๊ณ ๋งํฌ์ ์๋ ๊ฐ๊ณผ ๊ฒฐ๊ณผ๊ฐ ๋ค๋ฅธ ๊ฒ ๊ฐ์ต๋๋ค.
> http://www.seoulmetro.co.kr/kr/page.do?menuIdx=354
๋ฏธ์
ํ์ด์ง์ ์๋ ์์ ์ฌ์ฉํด์ ์ถ๊ฐ ์๊ธ์ ๊ณ์ฐํด๋ณด์๋ฉด ์ข๊ฒ ์ต๋๋ค. :)
> https://edu.nextstep.camp/s/urD8knTu/ls/4r6iyUcO |
@@ -0,0 +1,44 @@
+package nextstep.subway.fare.domain;
+
+import java.util.Objects;
+
+public class Fare {
+ private static final int basicFare = 1250;
+
+ private int fare;
+ private final DiscountPolicy discountPolicy;
+
+ private Fare(int fare, DiscountPolicy discountPolicy) {
+ this.fare = fare;
... | Java | ๊ฐ ๊ฐ์ฒด ์ฌ์ฉ ์ข์ต๋๋ค. ๐
๊ณ ๋ฏผํด๋ณด์๋ฉด ์ข์ ๊ฒ ๊ฐ์ ๋ถ๋ถ์, `Fare` ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ ์ฌ๋์ด `plus`, `discount` ์์๋ฅผ ์ ์๊ณ ํธ์ถํด์ผ ์๊ธ ๊ณ์ฐ์ด ์ ์์ ์ผ๋ก ๋ ๊ฒ ๊ฐ์์. ๊ทธ๋ฆฌ๊ณ , ํ ์ธ ์ ์ฑ
์ ์์ฑํ๋ ์์ ์ ๋ฐ์ง๋ง, ์ค์ ๋ก๋ ์ถ๊ฐ ์๊ธ ๊ณ์ฐ์ด ๋๋ ํ ์ฌ์ฉ์ด ๋์ด์ผ ํ๋ค์.
์๊ธ ๊ณ์ฐ์ `FareCalculator`๊ฐ ๋ด๋นํ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋, `DiscountPolicy`๋ฅผ ์๊ธ ๊ณ์ฐ ๋ฉ์๋์์ ๊ด๋ฆฌํด๋ณด์
๋ ์ข๊ฒ ์ต๋๋ค. :) |
@@ -17,12 +17,11 @@
import java.util.stream.Collectors;
@Service
-@Transactional(readOnly = true)
+@Transactional
public class FavoriteService {
private final String MESSAGE_FAVORITE_ENTITY_NOT_FOUND = "์ฆ๊ฒจ์ฐพ๊ธฐ๊ฐ๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค";
-
private FavoriteRepository favoriteRepository;
private MemberService mem... | Java | ์ต๋จ ๊ฒฝ๋ก๋ฅผ ์กฐํํ๋ ๋ฉ์๋๊ฐ ์๊ธ ๊ณ์ฐ๋ ํ๊ธฐ ๋๋ฌธ์ `memberId`๊ฐ ํ์ํ๊ฒ ๋ ๊ฑธ๊น์?
๊ฒฝ๋ก ์กฐํ์ ์๊ธ ๊ณ์ฐ์ ๋ถ๋ฆฌํด๋ด๋ ์ข์ ๊ฒ ๊ฐ๋ค์! :) |
@@ -1,14 +1,16 @@
package nextstep.subway.path.application;
import nextstep.subway.line.domain.Section;
+import nextstep.subway.path.domain.SectionEdge;
+import nextstep.subway.path.domain.ShortestPath;
import nextstep.subway.station.domain.Station;
-import org.jgrapht.graph.DefaultWeightedEdge;
+import org.jgraph... | Java | ์ฌ์ฉ์ฒ๊ฐ ์์ด์ง ๊ฒ ๊ฐ์ผ๋, ์ด ๋ฉ์๋๋ฅผ ํฌํจํด `PathFindAlgorithm`์ `findShortestPathStations`๋ฅผ ์ญ์ ํ์๋ฉด ์ข๊ฒ ์ต๋๋ค. :) |
@@ -1,8 +1,12 @@
package nextstep.subway.path.application;
+import nextstep.subway.fare.domain.FareCalculator;
import nextstep.subway.line.domain.Section;
import nextstep.subway.line.domain.SectionRepository;
import nextstep.subway.line.dto.PathResponse;
+import nextstep.subway.member.application.MemberService;
+... | Java | ๊ฒฝ๋ก ๊ณ์ฐํ๋ ๋ถ๋ถ๊ณผ ์๊ธ ๊ณ์ฐํ๋ ๋ก์ง์ ์ ๋ถ๋ฆฌํ ์ ์๊ฒ ๊ตฌํํ์ ๊ฒ์ผ๋ก ๋ณด์ฌ์.
์ค์ ๋ก ๋ด๋นํ๋ ํด๋์ค๋ฅผ ๋๋ ๋ณด๋ฉด ์ด๋จ๊น์? `FavoriteService` ์์๋ ๊ฒฝ๋ก๊ฐ ์กด์ฌํ๋์ง๋ง ํ์ธํ๋ฉด ๋๋ ์ฌ์ฌ์ฉ๋ ์ข ๋ ํจ์จ์ ์ผ๋ก ํ ์ ์์ ๊ฒ ๊ฐ๋ค์! |
@@ -1,14 +1,13 @@
package nextstep.subway.path.ui;
+import nextstep.subway.auth.domain.AuthenticationPrincipal;
+import nextstep.subway.auth.domain.LoginMember;
import nextstep.subway.line.dto.PathResponse;
-import nextstep.subway.member.dto.MemberRequest;
-import nextstep.subway.member.dto.MemberResponse;
import ... | Java | ๋ก๊ทธ์ธํ์ง ์์ ๊ฒฝ์ฐ์๋ ๊ฒฝ๋ก๋ฅผ ์กฐํํ ์ ์์ด์ผ ํ ๊ฒ ๊ฐ์์.
์ด๋ฅผ ์ํด AuthenticationPrincipal์ ์ธ์ฆ์ด ํ์ํ์ง ์ฌ๋ถ ํ๋๋ฅผ ์ถ๊ฐํ๊ณ , ์ด๋ฅผ ํตํด ์ธ์ฆ์ ํ์ง ์์ ํ์๋ ์ฌ์ฉํ ์ ์๋ ๊ธฐ๋ฅ(๊ฒฝ๋ก ์กฐํ ๋ฑ)๊ณผ ์ธ์ฆ์ ํด์ผ๋ง ์ฌ์ฉํ ์ ์๋ ๊ธฐ๋ฅ(ํ์ ์ ๋ณด ๋ณ๊ฒฝ ๋ฑ)์์ ๋ชจ๋ LoginMember๋ฅผ ์ด์ฉํ ์ ์๋๋ก ๊ด๋ฆฌํด๋ณด์๋ฉด ์ข๊ฒ ์ต๋๋ค.
> https://edu.nextstep.camp/s/urD8knTu/ls/4r6iyUcO
"/paths ์์ฒญ ์ LoginMember ๊ฐ์ฒด ์ฒ๋ฆฌ" ๋ถ๋ถ์ ์ฐธ๊ณ ๋ถํ๋๋ฆฝ๋๋ค. |
@@ -1,7 +1,111 @@
package lotto;
+import camp.nextstep.edu.missionutils.Console;
+import lotto.domain.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+
public class Application {
+ private static final String REQUEST_PURCHASE_AMOUNT = "๊ตฌ์
๊ธ์ก์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ private s... | Java | ์์ฃผ ํน๋ณํ ๊ฒฝ์ฐ๊ฐ ์๋๋ผ๋ฉด, static๋ณ์๋ฅผ ๋ง๋ค๊ณ , ๊ทธ ๊ฐ์ ๊ด๋ฆฌํ๋ application์ ๋ง๋๋ ๊ฒ์ ์ข์ ๋ฐฉ๋ฒ์ ์๋๋๋ค. ์๋ํ๋ฉด, ์ด๋ ๊ฒ ํ์๋ฉด, ํ๋์ ์ดํ๋ฆฌ์ผ์ด์
์ lottery๋ณ์๋ ํ๋๋ฐ์ ์๊ฒ ๋๊ณ , ๊ทธ๋ ๊ฒ ๋๋ฉด, ๋ ๋ช
์ด์์ด ์ด ๋ก์ง์ ์ฌ์ฉํ ๊ฒฝ์ฐ ๋ฌธ์ ๊ฐ ์๊ธธ ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค. ์ฆ ํ์ฅ์ฑ์ ๋ฌธ์ ๊ฐ ์๊น๋๋ค. |
@@ -1,7 +1,111 @@
package lotto;
+import camp.nextstep.edu.missionutils.Console;
+import lotto.domain.*;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+
public class Application {
+ private static final String REQUEST_PURCHASE_AMOUNT = "๊ตฌ์
๊ธ์ก์ ์
๋ ฅํด ์ฃผ์ธ์.";
+ private s... | Java | ```suggestion
private static boolean setLottery() {
System.out.println(REQUEST_PURCHASE_AMOUNT);
int price = getNumber();
if (price % 1000 != 0) {
System.out.println("[ERROR] ์ฒ์ ๋จ์๋ก ์
๋ ฅํด์ฃผ์ธ์.");
return false;
}
lottery = price / 1000;
... |
@@ -0,0 +1,80 @@
+## ๋ก๋
+
+### ๊ท์น
+1. ๋ก๋ ๋ฒํธ์ ์ซ์ ๋ฒ์๋ 1~45๊น์ง ์ด๋ค.
+2. ๋ก๋ ๋ฒํธ๋ ์ด 6๊ฐ์ ์ซ์๋ก ์ด๋ฃจ์ด์ ธ์๋ค.
+3. ๋ณต๊ถ์ ํ์ฅ๋น 1,000์์ด๋ค.
+4. ์ฌ์ฉ์๋ ๊ตฌ์
ํ ๋ณต๊ถ ์ฅ ์ ๋งํผ ๋น์ฒจ์ ๊ณ์ฐํ๋ค.
+5. ์ฌ์ฉ์๋ ๋น์ฒจ ๋ฒํธ์ ๋ณด๋์ค ๋ฒํธ๋ฅผ ์
๋ ฅํ๋ค.
+6. ๊ตฌ๋งคํ ๋ก๋ ๋ฒํธ์ ๋น์ฒจ ๋ฒํธ๋ฅผ ๋น๊ตํ์ฌ ๋น์ฒจ ๊ธฐ์ค์ ๋ฐ๋ผ ๊ธ์ก์ ๋ฐ๋๋ค. ๋น์ฒจ ๊ธฐ์ค๊ณผ ๊ธ์ก์ ์๋์ ๊ฐ๋ค.
+ - 1๋ฑ: 6๊ฐ ๋ฒํธ ์ผ์น / 2,000,000,000์
+ - 2๋ฑ: 5๊ฐ ๋ฒํธ + ๋ณด๋์ค ๋ฒํธ ์ผ์น / 30,000,000... | Unknown | ~~์ด ๋ถ๋ถ์ด ๊ถ๊ธํ๊ฒ ์๋๋ฐ, ์ผ๋ฐ์ ์ผ๋ก ์ฐ๋ฆฌ๊ฐ ๋ก๋๋ฅผ ์ด ๋๋ ๊ทธ๋ฅ ์ซ์ 6๊ฐ๋ฅผ ์ ํํ๊ณ , 2๋ฑ์ ๋ฝ์ ๋, ๋ณด๋์ค ๋ฒํธ๋ฅผ ์ถ์ฒจํด์ ๋น๊ตํ๋๋ฐ, ์ด๊ฒ๊ณผ๋ ๋ค๋ฅธ ์๊ตฌ์ฌํญ์ด์๋ ๊ฒ์ธ๊ฐ์?~~
์ // ์ฝ๋ ํ์ธํ์ต๋๋ค. WinningLotto๋ผ๋ ํด๋์ค๊ฐ ์๋ ๊ฒ์ด๊ตฐ์. |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | ํ๋ก์์ด 100๋ช
์ด ๋์ผ๋ฉด ํน์ ์ด๋ป๊ฒ ๋๋์? |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | Github API ์์๋ [API ๋ฒ์ ๋์ ์ํด ํค๋์ API ๋ฒ์ ์ ๋ณด๋ฅผ ํฌํจ์์ผ ์์ฒญ](https://docs.github.com/en/rest/about-the-rest-api/api-versions?apiVersion=2022-11-28)ํ๋ ๊ฒ์ ๊ถ์ฅํ๊ณ ์์ด์. ์ด๋ฅผ ์ถ๊ฐํด์ฃผ๋๊ฒ ์ข์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | ์ด๋ฐ ๋ฐฉ๋ฒ๋ ์์ด์!
```suggestion
const { data } = followingData;
``` |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | try catch ๋ฌธ์ ์ผ๋ฐ์ ์ผ๋ก ์๋ฌ ์ํฉ์์ ์๋ฌ๋ฅผ ๋ณต๊ตฌํด ์ ์ ๋์์ ์ํค๊ฑฐ๋, ๋ก๊น
ํ๋ ์ฉ๋๋ก ์ฌ์ฉ๋ผ์. ๊ทธ๋ฐ๋ฐ ํ์ฌ์ ๊ฐ์ด ํน๋ณํ ๋ชฉ์ ์ด ์์ง ์๋ try catch ๋ฌธ์ ์คํ๋ ค ๋๋ฒ๊ทธํ ๋ ์์ฒญ ํท๊ฐ๋ฆฌ๊ฒ ๋ ์ ์์ด ๊ถ์ฅํ์ง ์์์. |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | ํ์ฌ ์ด๋ ๊ฒ recoil ์ setter ๋ฅผ ๋ฐ์ ์ฌ์ฉํ๋๋ก ๋์ด์๋ ์ํฉ์์๋ ์์์์ ํญ์ recoil๊ณผ ํจ๊ป ์ฌ์ฉํด์ผ ํ๋ ์์กด์ฑ์ด ์๊ฒจ์ ํจ์์ ์ฌ์ฉ ๋ฐฉ์์ด ํน์ ๋ฐฉ๋ฒ์ผ๋ก ๊ฐ์ ๋ผ์. ๊ทธ๋ฐ๋ฐ ๊ทธ๋ด ํ์๊ฐ ์์๊น์? ๋ง์ฝ recoil์ด ์๋ useState๋ฅผ ์ฌ์ฉํ๋๋ก ๋ณ๊ฒฝ๋๋ค๋ฉด ์ด๋ป๊ฒ ๋ ๊น์?
๊ทธ๋ฆฌ๊ณ ์ด ํจ์๋ ํ๋ฒ์ ๋ ๊ฐ์ง ์ผ์ ํ๊ณ ์์ด์.
1. ์๋ฒ์์ ํ๋ก์ ๋ชฉ๋ก์ ๋ถ๋ฌ์จ๋ค.
2. Follower ์ํ์ ๊ฐ์ ์ค์ ํ๋ค.
getFollowerList ํจ์๋ฅผ ์๋ฒ์์ ํ๋ก์ ๋ชฉ๋ก์ ๋ถ๋ฌ์ค๋ ์ญํ ๋ง ํ๊ฒ ํ๊ณ , ๊ฐ ์ค์ ์ ์ด ํจ์๋ฅผ ์ฌ์ฉํ๋ ์ชฝ... |
@@ -0,0 +1,35 @@
+'use client';
+
+import FollowList from '@/components/checkfollow/FollowList';
+import { useRecoilValue, useSetRecoilState } from 'recoil';
+import FollowOrNotBtn from '../../components/checkfollow/FollowOrNotBtn';
+import Profile from '../../components/checkfollow/Profile';
+import { putFollowList } ... | Unknown | ํ์ด์ง๋ฅผ ์ ์ฒด ์๋ก๊ณ ์นจํ๋ฉด ํฐ ์ฑ๋ฅ์์ ์ด์๊ฐ ์์ ๊ฒ ๊ฐ์๋ฐ, ํน์ ์ด๋ ๊ฒ ํ ์ด์ ๊ฐ ๋ฌด์์ผ๊น์? |
@@ -0,0 +1,89 @@
+'use client';
+
+import { getFollowerList, getFollowingList } from '@/apis/getFollowList';
+import { checkState, followState, followerList, followingList, inputToken, loginClick } from '@/recoil/atoms';
+import { followList } from '@/types/types';
+import { useEffect } from 'react';
+import { useRecoi... | Unknown | ์ํ์ useEffect๋ฅผ ์ฌ์ฉํ๋ฉด ์ ํํ ์ธ์ useEffect ์์ชฝ์ด ํธ์ถ๋๋์ง ์ถ์ ํ๊ธฐ ํ๋ ๋ฌธ์ ๊ฐ ์์ด์.
์ด ๊ฒฝ์ฐ์๋ [๊ณต์ ๋ฌธ์์์ ์ ์ํ๋ ๊ฒ](https://react.dev/learn/you-might-not-need-an-effect#sharing-logic-between-event-handlers) ์ฒ๋ผ ๋ก์ง์ follow ๋ฒํผ์ด ์ ํ๋๋ ๊ณณ์ผ๋ก ์ฎ๊ธฐ๋ ๊ฒ์ด ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,27 @@
+'use client';
+
+import { followState } from '@/recoil/atoms';
+import { useSetRecoilState } from 'recoil';
+
+export default function FollowOrNotBtn() {
+ const setBtnState = useSetRecoilState(followState);
+
+ const onClickFollow = () => {
+ setBtnState('follow');
+ };
+
+ const onClickNotFol... | Unknown | ์ฌ๊ธฐ์๋ FollowOrNotBtn ์ปดํฌ๋ํธ๊ฐ onChange ๋ฑ์ ํ๋กญ์ผ๋ก ์์ ์ปดํฌ๋ํธ์ ์ํ ๋ณ๊ฒฝ์ ์๋ฆฌ๊ณ , ํด๋น ์ปดํฌ๋ํธ์์ ์ฒ๋ฆฌํ๋๋ก ๋ณ๊ฒฝํ๋๊ฒ ์ข์ ๊ฒ ๊ฐ์์.
๊ด๋ จ๋ PR: https://github.com/SimSimS-ToyProject-TEAM3/SimSimS-ToyProject-TEAM3/pull/24#discussion_r1436797019 |
@@ -0,0 +1,34 @@
+export interface ProfileType {
+ login: string;
+ avatar_url: string;
+ bio: string;
+ followers: number;
+ following: number;
+}
+
+export interface followList {
+ id: number;
+ login: string;
+ avatar_url: string;
+ onClick?: () => void;
+}
+export interface FollowUserType {
+ avatar_url: ... | TypeScript | ์ผ๋ฐ์ ์ผ๋ก ์ฌ์ฉ๋๋ ํ์
์คํฌ๋ฆฝํธ์ ์ปจ๋ฒค์
์ฒ๋ผ, ํ์ค์นผ ์ผ์ด์ค๋ก ์์ฑํ๋ฉด ์ข์ ๊ฒ ๊ฐ์์.
https://basarat.gitbook.io/typescript/styleguide#interface |
@@ -0,0 +1,89 @@
+'use client';
+
+import { getFollowerList, getFollowingList } from '@/apis/getFollowList';
+import { checkState, followState, followerList, followingList, inputToken, loginClick } from '@/recoil/atoms';
+import { followList } from '@/types/types';
+import { useEffect } from 'react';
+import { useRecoi... | Unknown | ์ ๋ถ๋ถ์์ recoil selector ๋ฅผ ํ์ฉํด ๋ณผ ์๋ ์์ ๊ฒ ๊ฐ์์.
```tsx
const followerIdSelector = selector({
key: 'followerIdSelector',
({ get }) => {
const followers = get(followerList);
return followers.map(user => user.id);
}
});
``` |
@@ -0,0 +1,14 @@
+import { useRouter } from 'next/navigation';
+
+export default function ConfirmFollowButton() {
+ const router = useRouter();
+
+ const handleOnclick = () => {
+ router.push('/checkfollow');
+ };
+ return (
+ <div className="commonFlex followBackButton hover:bg-grey02" onClick={handleOnclic... | Unknown | onClick ์ผ๋ก ๋งํฌ๋ฅผ ์ฒ๋ฆฌํ๋ฉด HTML ํ๊ทธ์์ ๋งํฌ๋ฅผ ๋ณผ ์ ์๊ณ , ์ปจํธ๋กค + ํด๋ฆญ, ์ฐํด๋ฆญ ๋ฑ์ ๋์์ด ๋จนํ์ง ์๋ ์ ๊ทผ์ฑ ์ด์๊ฐ ์์ด์. ๋ฐ๋ผ์ ์ฌ์ดํธ ๋ด ํ์ด์ง ์ด๋ ๋งํฌ๋ next/link ๋ฅผ ์ฌ์ฉํด์ผ ํด์.
```tsx
<Link href="/checkfollow" className="commonFlex followBackButton hover:bg-grey02">
๋์ ๋งํ ํ์ธํ๋ฌ ๊ฐ๊ธฐ
</Link> |
@@ -0,0 +1,46 @@
+import { ProfileType, followList } from '@/types/types';
+import { atom } from 'recoil';
+import { recoilPersist } from 'recoil-persist';
+const { persistAtom } = recoilPersist();
+
+export const profileInfo = atom<ProfileType>({
+ key: 'profileInfo',
+ default: {
+ login: '',
+ avatar_url: ''... | TypeScript | ๋ฏธ์ธ ํ: ์ด๋ฆ์ suffix๋ก Atom ์ ๋ถ์ด๋ฉด ์ปดํฌ๋ํธ์์ ์ด๋ฅผ ํ์ฉํ ๋ ์ด๋ฆ ์ถฉ๋ ๋ฌธ์ ์์ ์์ ๋ก์์ง ์ ์์ด์.
```tsx
// ์ ์ธ
export const profileInfoAtom = atom<ProfileType>({
key: 'profileInfo',
default: {
login: '',
avatar_url: '',
bio: '',
followers: 0,
following: 0,
},
});
// ์ฌ์ฉํ ๋
const profileInfo = useRecoilV... |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | ๊ฑด์์ด๊ฐ [์ฌ๊ธฐ](https://github.com/sopt-web-advanced-study/TOY-PROJECT/pull/13/files#r1436888989)์ ๋จ๊ฒจ์ฃผ๊ธด ํ๋๋ฐ์! ์ฌ๊ธฐ์ ํ์
์ camelCase๋ก ์ง์ด์ฃผ๋ค ๋ณด๋,
`followList`์ `followingList`๋ ๊ฐ๊ฐ ํ์
, ๋ณ์๋ก ์์ ๋ค๋ฅธ ์๋ฏธ๋ก ์ฌ์ฉ๋๋๋ฐ์, ํ ๋์ ํ์
ํ๊ธฐ๊ฐ ์ด๋ ค์ ์ด์! ๊ฐ ์ฉ๋์ ๋ฐ๋ผ ์ปจ๋ฒค์
์ ๋ง๊ฒ ์ด๋ฆ์ ์ง์ด์ฃผ๋ฉด ์ข์ ๊ฒ ๊ฐ์์. |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | (๊ฑด์์ด๊ฐ ์จ์ค to-be์ ์ธ์์ setFollowers๋ ๋น ์ง๋๊ฑธ ์๋ํ๊ฑธ๊ฑฐ์์!)
```tsx
export const getFollowerList = async (tokenValue: string) => { ... }
``` |
@@ -0,0 +1,47 @@
+import { FollowUserType, followList } from '@/types/types';
+import axios from 'axios';
+import { SetterOrUpdater } from 'recoil';
+
+const PER_PAGE = 100;
+export const getFollowingList = async (setFollowings: SetterOrUpdater<followList[]>, tokenValue: string) => {
+ try {
+ const followingData =... | TypeScript | ๋ง์ฝ console.error๋ก ๋ง ๋จ๊ฒจ๋๊ณ ์ถ์๋๋ผ๋ ์ด๋ ๊ฒ ํ๋ฉด ํ๋์ฝ๋ฉ๋ 'error'๋ง ๋จ๊ฒ๋์ด ํท๊ฐ๋ฆด ๊ฒ ๊ฐ์์.
`error.message`๋ฅผ ์ฐ๊ฑฐ๋([mdn ์์](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Error#%EC%9D%BC%EB%B0%98%EC%A0%81%EC%9D%B8_%EC%98%A4%EB%A5%98_%EB%8D%98%EC%A7%80%EA%B8%B0)), ์๋๋ฉด ๋ณดํต [Sentry](https://docs.sentry.io/platform... |
@@ -0,0 +1,35 @@
+'use client';
+
+import FollowList from '@/components/checkfollow/FollowList';
+import { useRecoilValue, useSetRecoilState } from 'recoil';
+import FollowOrNotBtn from '../../components/checkfollow/FollowOrNotBtn';
+import Profile from '../../components/checkfollow/Profile';
+import { putFollowList } ... | Unknown | ์ ์ฒด ์๋ก๊ณ ์นจ์ ํ๋ฉด ์ฌ์ฉ์ ๊ฒฝํ ์ธก๋ฉด์์๋ ์ข์ง ์์ ๊ฒ ๊ฐ์์! |
@@ -0,0 +1,89 @@
+'use client';
+
+import { getFollowerList, getFollowingList } from '@/apis/getFollowList';
+import { checkState, followState, followerList, followingList, inputToken, loginClick } from '@/recoil/atoms';
+import { followList } from '@/types/types';
+import { useEffect } from 'react';
+import { useRecoi... | Unknown | ๋ง์ฝ ์์ ์ด ์ผ์ด๋๊ฒ ๋์๋, onClickRemove๊ฐ ์ด๋ ์์ ์ ์คํ๋๋์ง์ ๋ํ ๊ณ ๋ ค๊ฐ ํญ์ ์ด๋ค์ ธ์ผ ํด์ ์ฌ์ด๋ ์ดํํธ๊ฐ ์๊ฒจ ๋ณ๊ฒฝํ๊ธฐ๋ ์์ฃผ ๊น๋ค๋ก์ ์ง๋ ๋ฌธ์ ๊ฐ ์์ด์.
>๋ก์ง์ follow ๋ฒํผ์ด ์ ํ๋๋ ๊ณณ์ผ๋ก ์ฎ๊ธฐ๋ ๊ฒ์ด ์ข์ ๊ฒ ๊ฐ์์.
์๋ ๊ฒ ํด์ผ ํด๋น ๋ก์ง์ด ์คํ๋๋ ์์ ์๋ง onClickRemove๊ฐ ์คํ๋จ์ด ๋ณด์ฅ๋๊ธฐ ๋๋ฌธ์ ์ฌ์ด๋ ์ดํํธ๋ฅผ ์ต์ํํ ์ ์์ต๋๋น |
@@ -0,0 +1,89 @@
+'use client';
+
+import { getFollowerList, getFollowingList } from '@/apis/getFollowList';
+import { checkState, followState, followerList, followingList, inputToken, loginClick } from '@/recoil/atoms';
+import { followList } from '@/types/types';
+import { useEffect } from 'react';
+import { useRecoi... | Unknown | ๋๋ฒ๊น
์ฉ์ผ๋ก ์ฌ์ฉํ ๋ค์์ ์ง์ฐ๋ฉด ์ข์ ๊ฒ ๊ฐ์ต๋๋ท ใ
ใ
|
@@ -0,0 +1,14 @@
+import { useRouter } from 'next/navigation';
+
+export default function ConfirmFollowButton() {
+ const router = useRouter();
+
+ const handleOnclick = () => {
+ router.push('/checkfollow');
+ };
+ return (
+ <div className="commonFlex followBackButton hover:bg-grey02" onClick={handleOnclic... | Unknown | ์๋ ๊ฒ ์๋์ ์ด๋๋ก ์ด๋ํ ๊ฑด์ง ํ๋ฆฌ๋ทฐ๋ก๋ ์๋ ค์ค๋ต๋๋น! Link๋ next.js์์ `<a>` ํ๊ทธ๋ฅผ ๋ํํด์ค ์ปดํฌ๋ํธ์์. (์ค์ ๋ก ๋งํ ์ ๊ทผ์ฑ์ aํ๊ทธ๊ฐ ์ฑ๊ฒจ์ฃผ๋ ๊ฒ ์
๋๋น)
<img width="1624" alt="image" src="https://github.com/sopt-web-advanced-study/TOY-PROJECT/assets/26808056/af8d6f55-393a-49ba-be04-f00972a2a478"> |
@@ -0,0 +1,14 @@
+import { useRouter } from 'next/navigation';
+
+export default function ConfirmFollowButton() {
+ const router = useRouter();
+
+ const handleOnclick = () => {
+ router.push('/checkfollow');
+ };
+ return (
+ <div className="commonFlex followBackButton hover:bg-grey02" onClick={handleOnclic... | Unknown | ์์ํ ๋ด์ฉ์ธ๋ฐ, ์ด๋ฒคํธ ํธ๋ค๋ฌ ํจ์ ์ด๋ฆ์ ์ง์๋ ๋ณดํต
`onClick~`
`handleClick~`
๋ ์ค ํ๋๋ก ์ง๋ ๊ฒ ๊ฐ์์. ์ ๋์ฌ๊ฐ ๋ ๋ค ๋ถ์ด์์ด์ ๋จ๊ฒจ๋ดค์ต๋๋ค! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.