code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | checkId에 들어가는데이터는 어떤걸 의미하는건가여???? |
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | > checkId에 들어가는데이터는 어떤걸 의미하는건가여????
입력한 아이디가 이메일 형식에 맞는지 체크하는 정규표현식이에요! 네이밍이 직관적이지 않은가요?? |
@@ -0,0 +1,83 @@
+@import '../../../../../Styles/common.scss';
+
+.navYeseul {
+ position: fixed;
+ top: 0;
+ left: 50%;
+ right: 0;
+ transform: translateX(-50%);
+ padding: 8px 0;
+ border-bottom: 1px solid $main-border;
+ background-color: #fff;
+ z-index: 9999;
+
+ .inner-nav {
+ display: flex;
+ ju... | Unknown | 오 꼼꼼히 봐주셨네요 감사합니당 :) 고치러가유 |
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | (안넣으면 오류가 뜨더라구요..) |
@@ -0,0 +1,83 @@
+@import '../../../../../Styles/common.scss';
+
+.navYeseul {
+ position: fixed;
+ top: 0;
+ left: 50%;
+ right: 0;
+ transform: translateX(-50%);
+ padding: 8px 0;
+ border-bottom: 1px solid $main-border;
+ background-color: #fff;
+ z-index: 9999;
+
+ .inner-nav {
+ display: flex;
+ ju... | Unknown | 왜 제 common엔 없죠?!?! |
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | 아니에여 제가 잘몰랐어요 ㅋㅋㅋㅋ 잘하셨어요!! |
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | 저는 이벤트를 준 input에 name attribute를 부여해서 handleInputId이랑 handleInputPw 함수를 하나로 합쳤는데 참고 하셔서 반영해도 좋을 것 같아욤!
handleInput = e => {
this.setState({
[e.target.name]: e.target.value,
});
}; |
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | - API 부는 이후에 src/config.js 파일을 만들어 해당 파일에서 일괄적으로 관리합니다.
```js
// config.js
const IP = '10.58.6.252:8000';
export const SIGN_IN_API = `http://${IP}/user/signin`;
// Login.js
import { SIGN_IN_API } from '../../config.js';
...
fetch(SIGN_IN_API).then().then()
...
```
- 위와 같이 config.js 에서 일괄적으로 관리할경우... |
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | - 정규식 👍 👍 |
@@ -0,0 +1,125 @@
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import { API } from '../../../config';
+import './Login.scss';
+
+class LoginYeseul extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ inputId: '',
+ inputPw: '',
+ ... | JavaScript | - 클래스 네임 네이밍 👍 |
@@ -0,0 +1,60 @@
+@import '../../../Styles/common.scss';
+
+.loginYeseul {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -60%);
+ padding: 32px 0 25px;
+ width: 350px;
+ text-align: center;
+
+ h1 {
+ font-size: 40px;
+ }
+
+ .login-form {
+ margin: 35px 40px 120px;
+
+ &__... | Unknown | - & 연산자 활용 굿입니다! |
@@ -0,0 +1,55 @@
+import React, { Component } from 'react';
+import { Link } from 'react-router-dom';
+import './Comment.scss';
+
+class Comment extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ isLiked: false,
+ };
+ }
+
+ likeComment = () => {
+ this.setState({ isLiked:... | JavaScript | - id 값은 프로젝트 전체 내에서 유일해야하기 때문에, 꼭 필요한 경우에만 사용해주세요!
- id 대신에 onClick 이벤트에 바로 인자를 넘겨주실 수도 있습니다. 참고해주세요!
```js
onClick = {() => this.props.handleClick(info.id)}
``` |
@@ -0,0 +1,140 @@
+import React, { Component } from 'react';
+import { Link } from 'react-router-dom';
+import User from '../User/User';
+import Comment from '../Comment/Comment';
+import IconButton from '../Button/IconButton';
+import { API } from '../../../../../config';
+import './Feed.scss';
+
+class Feed extends C... | JavaScript | - get 메서드는 기본 메서드이기 때문에 생략해주실 수 있습니다.
```suggestion
fetch('/data/Yeseul/commentData.json')
``` |
@@ -0,0 +1,140 @@
+import React, { Component } from 'react';
+import { Link } from 'react-router-dom';
+import User from '../User/User';
+import Comment from '../Comment/Comment';
+import IconButton from '../Button/IconButton';
+import { API } from '../../../../../config';
+import './Feed.scss';
+
+class Feed extends C... | JavaScript | - 불변성 잘 지켜주셨네요! 👍 👍 |
@@ -0,0 +1,140 @@
+import React, { Component } from 'react';
+import { Link } from 'react-router-dom';
+import User from '../User/User';
+import Comment from '../Comment/Comment';
+import IconButton from '../Button/IconButton';
+import { API } from '../../../../../config';
+import './Feed.scss';
+
+class Feed extends C... | JavaScript | - setState 가 기존의 state 값에 **병합** 하는 오퍼레이션 이기 때문에, ...this.state 를 해주실 필요가 없습니다.
```suggestion
this.setState({
comments: comments.filter(comment => comment.id !== clickedId),
});
``` |
@@ -0,0 +1,14 @@
+const flowTypeDao = require('../models/flowTypeDao');
+const error = require('../utils/error');
+
+const getFlowTypes = async () => {
+ const flowTypes = await flowTypeDao.getFlowTypes();
+ if (flowTypes.length === 0) {
+ error.throwErr(404, 'NOT_FOUND_TYPE');
+ }
+ return flowTypes;
+}
+
+modu... | JavaScript | ```suggestion
return flowTypes;
}
```
else 없어도 될 것 같습니다 :) |
@@ -2,12 +2,11 @@ import styled from '@emotion/styled';
import { useRouter } from 'next/router';
import React, { useCallback, useMemo } from 'react';
import { FieldValues } from 'react-hook-form';
-import { useMutation } from 'react-query';
import { useRecoilValue } from 'recoil';
import { useGetFlavors } from '... | Unknown | @hy57in
mutation도 한 번 래핑해서 사용하는건 어떠신가요?
```typescript
export const useCreateReviewMutation = () => {
const cache = useQueryClient();
const { mutateAsync: createReviewMutation, ...rest } = useMutation(createReview, {
onSuccess: async () => {
await cache.invalidateQueries(queryKeyFactory.GET_R... |
@@ -2,12 +2,11 @@ import styled from '@emotion/styled';
import { useRouter } from 'next/router';
import React, { useCallback, useMemo } from 'react';
import { FieldValues } from 'react-hook-form';
-import { useMutation } from 'react-query';
import { useRecoilValue } from 'recoil';
import { useGetFlavors } from '... | Unknown | @hy57in
`useGetReviewsByBeer` 도 queryKey를 queryKeyFactory에서 가져오는 방식으로 변경하는거 어떨까요!?
ref
- https://github.com/beerair/beerair-web/blob/8a3fb178139646a813eac410820e31846c3460c3/src/commons/queryKeyFactory.ts |
@@ -2,12 +2,11 @@ import styled from '@emotion/styled';
import { useRouter } from 'next/router';
import React, { useCallback, useMemo } from 'react';
import { FieldValues } from 'react-hook-form';
-import { useMutation } from 'react-query';
import { useRecoilValue } from 'recoil';
import { useGetFlavors } from '... | Unknown | [bf34ee2](https://github.com/beerair/beerair-web/pull/162/commits/bf34ee2ba98545a4e64603f0bdad6d5195f50a47)
만들어두신 queryKeyFactory 를 잊고 있었네요. 해당부분 수정했습니다!
mutaion도 래핑해서 수정했습니다! |
@@ -0,0 +1,45 @@
+import { useMutation, useQueryClient } from 'react-query';
+
+import request from '@/commons/axios';
+import { queryKeyFactory } from '@/commons/queryKeyFactory';
+import { IBaseResponse, IReview } from '@/types';
+
+/**
+ * 리뷰 등록
+ */
+
+export interface ICreateReviewResponseData extends IBaseRespons... | TypeScript | @hy57in
리뷰 생성되고 호출되는 success 함수 내부에서는 리뷰 리스트를 invalidate 시켜야하지 않나요..? |
@@ -0,0 +1,45 @@
+import { useMutation, useQueryClient } from 'react-query';
+
+import request from '@/commons/axios';
+import { queryKeyFactory } from '@/commons/queryKeyFactory';
+import { IBaseResponse, IReview } from '@/types';
+
+/**
+ * 리뷰 등록
+ */
+
+export interface ICreateReviewResponseData extends IBaseRespons... | TypeScript | 아핫..! 리뷰 리스트를 invalidate 하는 것으로 수정했습니다. 리뷰 감사합니다 🫢 |
@@ -97,12 +97,12 @@ const BeerTicketTitle: React.FC<BeerTicketTitleProps> = ({
{sliceAndUpperCase(beer?.country?.engName || 'non', 3)}
</span>
<div className="ticket-detail">
- {`${beer?.alcohol?.toFixed(1)}%`}
+ {beer?.alcohol ? `${beer.alcohol?.toFixed(1)}%` : '-'}
... | Unknown | '?' 없어도 괜찮을 것 같아요!
```suggestion
{beer?.alcohol ? `${beer.alcohol.toFixed(1)}%` : '-'}
``` |
@@ -0,0 +1,41 @@
+package nextstep.security.authorization.manager;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization.Secured;
+import org.aopalliance.intercept.MethodInvocation;
+import org.springframework.co... | Java | ```suggestion
if (authentication == null) {
return AuthorizationDecision.ACCESS_DENIED;
}
```
권한에 따른 예외 처리는 Interceptor의 역할로 넘겨주면 어떨까요? |
@@ -0,0 +1,28 @@
+package nextstep.security.authorization.manager;
+
+import jakarta.servlet.http.HttpServletRequest;
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization.access.RequestMatcherEntry;
+
+import java... | Java | AuthorizationManager에 대한 추상화를 잘 해주셨네요 👍 |
@@ -1,13 +1,23 @@
package nextstep.app;
+import jakarta.servlet.http.HttpServletRequest;
import nextstep.app.domain.Member;
import nextstep.app.domain.MemberRepository;
import nextstep.security.authentication.AuthenticationException;
import nextstep.security.authentication.BasicAuthenticationFilter;
import next... | Java | `그 외 모든 요청은 권한을 제한하기 위해 DenyAllAuthorizationManager로 처리`
해당 요구사항이 반영 안되어 있는 것 같네요! |
@@ -1,13 +1,23 @@
package nextstep.app;
+import jakarta.servlet.http.HttpServletRequest;
import nextstep.app.domain.Member;
import nextstep.app.domain.MemberRepository;
import nextstep.security.authentication.AuthenticationException;
import nextstep.security.authentication.BasicAuthenticationFilter;
import next... | Java | 명확한 역할을 구분하기 위해 AuthenticatedAuthorizationManager와 HasAuthorityAuthorizationManager를 분리해서 구현해봐도 좋겠네요! |
@@ -0,0 +1,41 @@
+package nextstep.security.authorization.manager;
+
+import nextstep.security.authentication.Authentication;
+import nextstep.security.authorization.AuthorizationDecision;
+import nextstep.security.authorization.Secured;
+import org.aopalliance.intercept.MethodInvocation;
+import org.springframework.co... | Java | 예외 책임은 Interceptor에서 하는 것이 맞는 것 같아서 수정 하였습니다 ! |
@@ -1,13 +1,23 @@
package nextstep.app;
+import jakarta.servlet.http.HttpServletRequest;
import nextstep.app.domain.Member;
import nextstep.app.domain.MemberRepository;
import nextstep.security.authentication.AuthenticationException;
import nextstep.security.authentication.BasicAuthenticationFilter;
import next... | Java | 앗 이부분을 빼먹었군요 ㅎㅎㅎ permitAll()이 아니라 denyAll()로 처리한 뒤, 테스트 추가하도록 하겠습니다. |
@@ -1,13 +1,23 @@
package nextstep.app;
+import jakarta.servlet.http.HttpServletRequest;
import nextstep.app.domain.Member;
import nextstep.app.domain.MemberRepository;
import nextstep.security.authentication.AuthenticationException;
import nextstep.security.authentication.BasicAuthenticationFilter;
import next... | Java | 안녕하세요 재연님 !
제가 이부분 코멘트를 정확하게 이해하지는 못한 것 같습니다.
기존 제가 구현한 부분은 AuthorityAuthorizationManager<T>에서 처리할 권한들을 가지고 있고, AuthoritiesAuthorizationManager는 전달받은 Role들로 검사만 하는 책임을 가지고 있는데요.
HasAuthorityAuthorizationManager라는 것은 delegate하지 않고, 스스로 처리할 역할을 알고 있고 처리하는 객체를 의미하시는 게 맞을까요!? |
@@ -1,13 +1,23 @@
package nextstep.app;
+import jakarta.servlet.http.HttpServletRequest;
import nextstep.app.domain.Member;
import nextstep.app.domain.MemberRepository;
import nextstep.security.authentication.AuthenticationException;
import nextstep.security.authentication.BasicAuthenticationFilter;
import next... | Java | 해당 코멘트는 해당 객체가 하나의 역할만 담당하면 가독성이 더 좋아질 것 같아 남긴건데요.
스프링 시큐리티도 찬호님이 구현하신 방식처럼 분리되어 있지 않은 코드라서 꼭 반영하실 필요는 없지만..
제가 봤을 땐 스프링 시큐리티도 역할을 구분하면 더 가독성이 좋아질 것 같아서 ㅋㅋ 한 번 고민해보시면 좋을 것 같아 코멘트를 남겼습니다~ |
@@ -0,0 +1,18 @@
+const categoryDao = require('../models/categoryDao');
+const error = require('../utils/error');
+
+const getCategory = async (type) => {
+ const categoryTypes = {
+ '지출' : [1, 2, 3],
+ '수입' : [4]
+ }
+
+ const categories = await categoryDao.getCategoriesByIds(categoryTypes[type]);
+ categori... | JavaScript | ```suggestion
const getCategory = async (type) => {
const categoryTypes = {
'지출' : [1, 2, 4],
'수입' : [3]
}
const categories = await categoryDao.getCategoriesByIds(categoryTypes[type]);
categories.map((category) => { category.type = type })
return categories
}
module.exports = { get... |
@@ -0,0 +1,20 @@
+const categoryService = require('../services/categoryService');
+const error = require('../utils/error');
+
+const getCategory = async (req, res) => {
+ try {
+ const { type } = req.query;
+ if (!type) {
+ error.throwErr(400, 'KEY_ERROR');
+ }
+ const categories = await categoryServi... | JavaScript | 에러 발생시켜 보셨나요? 모든 에러가 'internal_server_error'로 날텐데, 의도하신 바가 맞을까요? |
@@ -0,0 +1,18 @@
+const categoryDao = require('../models/categoryDao');
+const error = require('../utils/error');
+
+const getCategory = async (type) => {
+ const categoryTypes = {
+ '지출' : [1, 2, 3],
+ '수입' : [4]
+ }
+
+ const categories = await categoryDao.getCategoriesByIds(categoryTypes[type]);
+ categori... | JavaScript | 3. 근본적인 질문이 하나 있는데, category가 flow_type_id를 FK로 가지고 있으면, 하드코딩을 안해도 될 것 같은데 FK 생성하시는게 좋지 않을까요? 이부분은 백엔드 팀 같이 라운지에서 저 한 번 찾아와 주세요! |
@@ -0,0 +1,20 @@
+const categoryService = require('../services/categoryService');
+const error = require('../utils/error');
+
+const getCategory = async (req, res) => {
+ try {
+ const { type } = req.query;
+ if (!type) {
+ error.throwErr(400, 'KEY_ERROR');
+ }
+ const categories = await categoryServi... | JavaScript | 아 해당 **error message** 부분 수정하겠습니다.
`=> 'INTERNAL_SERVER_ERROR' || err.message}` |
@@ -0,0 +1,14 @@
+const {DataSource} = require('typeorm');
+const dotenv = require('dotenv');
+dotenv.config();
+
+const appDataSource = new DataSource({
+ type : process.env.TYPEORM_CONNECTION,
+ host: process.env.TYPEORM_HOST,
+ port: process.env.TYPEORM_PORT,
+ username: process.env.TYPEORM_USERNAME,
+ password... | JavaScript | 반영하겠습니다! |
@@ -1,4 +1,4 @@
-import { EstimationInputDTO, Estimation } from '#estimations/estimation.types.js';
+import { EstimationInputDTO, Estimation, IsActivate } from '#estimations/estimation.types.js';
import { IEstimationRepository } from '#estimations/interfaces/estimation.repository.interface.js';
import { PrismaService... | TypeScript | 아마도 javascript 레벨이 아니라 prisma에서 findMany 해오는 단계에서 이 작업을 해서 가져올 수 있을 것 같습니다. 나중에 한 번 찾아보면 좋을 것 같네요. |
@@ -1,4 +1,4 @@
-import { EstimationInputDTO, Estimation } from '#estimations/estimation.types.js';
+import { EstimationInputDTO, Estimation, IsActivate } from '#estimations/estimation.types.js';
import { IEstimationRepository } from '#estimations/interfaces/estimation.repository.interface.js';
import { PrismaService... | TypeScript | 네!! 찾아보겠습니다 !! 태영님 알려주셔서 감사합니다!!!! |
@@ -1,9 +1,14 @@
+import java.util.List;
import java.util.Scanner;
public class InputView {
private static final String INPUT_MONEY_MESSAGE = "구입금액을 입력해 주세요.";
private static final String INPUT_WINNING_LOTTO_MESSAGE = "지난 주 당첨 번호를 입력해 주세요.";
+ private static final String MANUAL_LOTTO_COUNT_MESSAGE = ... | Java | 애플리케이션 실행을 시켜보니 입력을 연달아 받기 때문에 한 줄 입력을 받은 후 입력을 한 번 더 기다리고 있습니다! 어떤 의도로 사용하신 걸까요? |
@@ -9,19 +9,24 @@ public LottoGame() {
statistics = new TreeMap<>();
}
- public int inputMoney(int money) {
+ public int calculateLottoCount(int money) {
return lottoCount = money / Lotto.LOTTO_PRICE;
}
- public LottoTicket generateAutoLottoTicket() {
+ public LottoTicket gen... | Java | 수동 로또와 자동 로또를 함께 생성하고 있는데 이를 분리시켜보면 어떨까요?
```
List<Lotto> lottos = InputView.manualLotto(lottoCount);
OutputView.printLottoTicket(game.generateLottoTicket(lottos));
```
코드 자체로 generateLottoTicket에서 자동로또까지 생성해주는 것인지 혹은 의도한대로 수동 로또와 자동 로또를 함께 생성하는 것인지 메서드명만 보고는 의미가 조금 모호하다고 생각됩니다. (개인적 생각으로)
그리고 나중에 요구사항이 변경되어 `수... |
@@ -0,0 +1,12 @@
+public class BonusNumber {
+ private LottoNumber bonusNumber;
+
+ public BonusNumber(LottoNumber bonusNumber) {
+ this.bonusNumber = bonusNumber;
+ }
+
+ public LottoNumber getBonusNumber() {
+ return bonusNumber;
+ }
+}
+ | Java | LottoNumber 자체도 원시값을 포장한 형태로 LottoNumber 타입으로 bonusNumber를 사용할 수 있는데 이를 한 번 더 포장하여 사용하신 이유가 있으실까요? BonusNumber에서는 어떠한 행위를 하지 않고 포장된 값을 한 번 더 Wrapping 하는 형태로만 사용되고 있는데 불필요해 보여서요~ |
@@ -43,6 +43,10 @@ public int match(WinningLotto winningLotto) {
return matchCount;
}
+ public boolean isBonusMatch(WinningLotto winningLotto) {
+ return lotto.contains(winningLotto.getBonusNumber());
+ }
+
public boolean contains(LottoNumber lottoNumber) {
return lotto.contai... | Java | lotto에 보너스 숫자가 포함되어있는지 판별하는 역할을 하는 메소드로 보이네요. 단순히 판별 여부라면 boolean 타입으로 변경해주면 어떨까요? 만약 보너스 숫자가 1개 이상이라는 요구사항 변경을 염두한 구현이라면 1, 0을 리턴하는 것보다 구체적으로 매칭된 갯수를 리턴해주는 식으로 변경해보면 확장에 유리한 구현이 될 것 같아요. 메소드명도 의미전달을 조금 더 명확하게 하면 완벽할 것 같습니다b |
@@ -6,6 +6,8 @@ public class OutputView {
private static final String RESULT_STATISTICS_MESSAGE = "당첨 통계";
private static final String BOUNDARY_LINE = "---------";
private static final String TOTAL_EARNING_RATIO_MESSAGE = "총 수익률은 %s 입니다.";
+ private static final int SECOND_RANK_COUNT = 5;
+ private... | Java | 제약사항 요구사항을 반영할 때 `rank.getMatch() == 5 && rank.getBonusMatchCount() == 1` 와 같은 코드를 메소드로 따로 분리해서 `validateMatchCount(rank)`와 같이 작성한다면 코드를 읽는 다른 개발자가 제약사항을 파악하는데 더 쉬울 것 같습니다. 메소드명만 보고 "이 지점에서 validate 체크를 하는 구나"라고 한눈에 파악이 되고, 구체적인 제약사항이 궁금할 땐 해당 메소드 내부 구현만 찾아보면 되게 될것 같습니다. 추가로 숫자들도 상수 처리해주면 더 좋을 것 같습니다. |
@@ -1,10 +1,33 @@
+import exception.*;
+import java.util.List;
+
public class Application {
public static void main(String[] args) {
LottoGame game = new LottoGame();
- OutputView.printLottoCount(game.inputMoney(new Money(InputView.inputMoney()).getMoney()));
- OutputView.printLottoTicket(g... | Java | 큰 요소는 아니겠지만 관련성에 따라서 개행을 추가해 구분 지어주는 것도 가독성을 높이는 요소라고 생각합니다! |
@@ -1,9 +1,14 @@
+import java.util.List;
import java.util.Scanner;
public class InputView {
private static final String INPUT_MONEY_MESSAGE = "구입금액을 입력해 주세요.";
private static final String INPUT_WINNING_LOTTO_MESSAGE = "지난 주 당첨 번호를 입력해 주세요.";
+ private static final String MANUAL_LOTTO_COUNT_MESSAGE = ... | Java | InputView에서 수동 로또에 대해 번호를 입력 받는 역할에 더해 직접 로또를 생성하는 역할까지 하고 있네요. 역할을 분리해볼 수 있을까요? 분리했을 때 어떤 이점이 생길까요? |
@@ -4,44 +4,36 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
public class LottoGameTest {
@Test
- @... | Java | `inputMoney()`라는 이름의 메소드의 결과값으로 로또 갯수가 나오는게 조금 어색한 것 같습니다. 입력받는 메소드와 갯수를 반환하는 메소드로 분리해보면 어떨까요? |
@@ -4,44 +4,36 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
public class LottoGameTest {
@Test
- @... | Java | 결과값과 비교하는 값을 lottoCount가 아닌 직접적인 숫자로 비교하면 어떨까요? 만약 실수로 lottoGame.inputMoney()에서 입력받은 돈을 반올림해서 장수를 출력하도록 해버렸다면 티켓의 사이즈가 4더라도 테스트가 통과하게 될 것 같습니다. 사실 지금 테스트 코드는 `lottoGame.inputMoney()`가 먼저 보장되어야하는만 정확한 테스트가 가능한 코드라고 볼 수 있을 것 같습니다. 테스트를 하다보면 어쩔 수 없는 부분일 수도 있고, 제 말이 정답은 아니지만 결과값은 가급적 더 정확한 것에 의존해야하지 않을까 생각이 들어 리뷰 남겨봤습니다. |
@@ -1,9 +1,14 @@
+import java.util.List;
import java.util.Scanner;
public class InputView {
private static final String INPUT_MONEY_MESSAGE = "구입금액을 입력해 주세요.";
private static final String INPUT_WINNING_LOTTO_MESSAGE = "지난 주 당첨 번호를 입력해 주세요.";
+ private static final String MANUAL_LOTTO_COUNT_MESSAGE = ... | Java | 자동이 아닌 수동으로 입력할 갯수만큼 입력을 받도록 요구사항이 기재되어 있기 때문에, 만약 `수동으로 구매할 로또 수를 입력해 주세요.` 에서 2개를 입력했다면, 2줄의 입력 값을 넣어주어야 합니다! |
@@ -1,9 +1,14 @@
+import java.util.List;
import java.util.Scanner;
public class InputView {
private static final String INPUT_MONEY_MESSAGE = "구입금액을 입력해 주세요.";
private static final String INPUT_WINNING_LOTTO_MESSAGE = "지난 주 당첨 번호를 입력해 주세요.";
+ private static final String MANUAL_LOTTO_COUNT_MESSAGE = ... | Java | <img width="370" alt="스크린샷 2022-07-04 오후 7 14 35" src="https://user-images.githubusercontent.com/62830487/177134400-0365bef0-a31c-4a57-9020-e294daa65100.png">
로직에 문제가 있어보이네요. 수동 로또 2장을 구매해서 로또 2장의 번호를 입력했는데 입력을 한 번 더 기다리고 있네요. 확인 부탁드려요. |
@@ -9,19 +9,24 @@ public LottoGame() {
statistics = new TreeMap<>();
}
- public int inputMoney(int money) {
+ public int calculateLottoCount(int money) {
return lottoCount = money / Lotto.LOTTO_PRICE;
}
- public LottoTicket generateAutoLottoTicket() {
+ public LottoTicket gen... | Java | 결국은 수동 로또와 자동 로또 모두 하나의 로또 티켓으로 합쳐지는 부분이 필요하기 때문에, 현재 `generateLottoTicket()` 내의 수동과 자동 로또 생성 각각의 반복문을 `generateManualLottoTicket()`과 `generateAutoLottoTicket()` 으로 메서드를 분리해보도록 하겠습니다 |
@@ -0,0 +1,12 @@
+public class BonusNumber {
+ private LottoNumber bonusNumber;
+
+ public BonusNumber(LottoNumber bonusNumber) {
+ this.bonusNumber = bonusNumber;
+ }
+
+ public LottoNumber getBonusNumber() {
+ return bonusNumber;
+ }
+}
+ | Java | @sunghyuki 기존에 Lotto 객체로만 구성된 WinningLotto에 BonusNumber를 추가하여, 로또 당첨 번호 중 5개가 일치하는 경우 BonusNumber 일치 여부 확인을 분명하게 하기 위해 LottoNumber 타입으로 구성된 BonusNumber를 생성했습니다~ |
@@ -4,44 +4,36 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
public class LottoGameTest {
@Test
- @... | Java | @Bellroute 저희는 입력 금액만큼 로또 리스트가 잘 추가되는지 테스트하려고 작성했는데, 적어주신 리뷰를 잘 이해하지 못한 것 같습니다. 부연 설명 부탁드려도 될까요?? |
@@ -1,9 +1,14 @@
+import java.util.List;
import java.util.Scanner;
public class InputView {
private static final String INPUT_MONEY_MESSAGE = "구입금액을 입력해 주세요.";
private static final String INPUT_WINNING_LOTTO_MESSAGE = "지난 주 당첨 번호를 입력해 주세요.";
+ private static final String MANUAL_LOTTO_COUNT_MESSAGE = ... | Java | @Bellroute 기존에 저희가 작성한 코드는 지적해주신 것처럼 Lottoame 책임을 InputView에서 부여하고 있습니다. 이 경우 변경사항이 생길 때, InputView와 Lotto를 생성하는 LottoGame을 모두 수정해야합니다.
확인해보니 LottoGame에 기존에 작성해둔 Lotto 생성 메서드를 활용해서 리펙토링하였습니다. |
@@ -3,8 +3,10 @@ import { ParsedUrlQuery } from "querystring";
import { GetServerSideProps } from "next";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
+import { getReviewStat, getReviews } from "@/lib/api/ReviewService";
import { getTrainerInfo } from "@/lib/api/trainerService... | Unknown | ```js
useQuery(["review-stat", trainerId],
() => getReviewStat(trainerId as string),
{ enabled: !!trainerId,
cacheTime: 5 * 60 * 1000,
staleTime: 5 * 60 * 1000 });
```
로 해주시는게 좋아보여요. |
@@ -3,8 +3,10 @@ import { ParsedUrlQuery } from "querystring";
import { GetServerSideProps } from "next";
import { useState } from "react";
import { useQuery } from "@tanstack/react-query";
+import { getReviewStat, getReviews } from "@/lib/api/ReviewService";
import { getTrainerInfo } from "@/lib/api/trainerService... | Unknown | 넵 수정하겠습니다! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.