code stringlengths 41 34.3k | lang stringclasses 8
values | review stringlengths 1 4.74k |
|---|---|---|
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | 리액트로 파일 옮겨오기전 js파일로만 작업할 때 돔으로 접근하는 용도로 쓰고 지우는걸 깜빡했네요 …;;;ㅠㅠ지웠습니다! |
@@ -1,9 +1,23 @@
import React from 'react';
+import './Login.scss';
+import LoginForm from './LoginForm';
-class Login extends React.Component {
+class LoginYoonHee extends React.Component {
render() {
- return null;
+ return (
+ <article className="login-art">
+ <div className="log-in__main">
+... | JavaScript | 수정했습니당! 덕분에 라우터에 대해서 좀 더 알게됐네용 ㅎㅎ |
@@ -0,0 +1,10 @@
+import React from 'react';
+
+class Comment extends React.Component {
+ render() {
+ const { innerText } = this.props;
+ return <li>{innerText}</li>;
+ }
+}
+
+export default Comment; | JavaScript | 수정했습니다-! key값 넣는곳을 정확히 모르고있었는데 이제 정확하게 알거같아요! |
@@ -0,0 +1,32 @@
+import React from 'react';
+import Feed from './Feed';
+
+class Feeds extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ feeds: [],
+ };
+ }
+
+ componentDidMount() {
+ fetch('/data/feed.json')
+ .then(res => res.json())
+ .then(data => {
... | JavaScript | 수정했습니다-! 포트번호는 생략으루! 팁 감사합니당! |
@@ -0,0 +1,32 @@
+import React from 'react';
+import Feed from './Feed';
+
+class Feeds extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ feeds: [],
+ };
+ }
+
+ componentDidMount() {
+ fetch('/data/feed.json')
+ .then(res => res.json())
+ .then(data => {
... | JavaScript | feed로 수정완료 했습니당 😊 |
@@ -1,9 +1,22 @@
+// eslint-disable-next-line
import React from 'react';
+import Nav from './Nav';
+import Feeds from './Feeds';
+import MainR from './MainR';
+import './Main.scss';
-class Main extends React.Component {
+class MainYoonHee extends React.Component {
render() {
- return null;
+ return (
+ ... | JavaScript | scss파일 아래로 위치수정 했습니당 ! |
@@ -1,9 +1,22 @@
+// eslint-disable-next-line
import React from 'react';
+import Nav from './Nav';
+import Feeds from './Feeds';
+import MainR from './MainR';
+import './Main.scss';
-class Main extends React.Component {
+class MainYoonHee extends React.Component {
render() {
- return null;
+ return (
+ ... | JavaScript | 그 때 말씀해주셨던 부분이네용 ㅎㅎ.. <div>로 변경했습니당.. 콘솔창에 뜨던 알수없는 빨간색 글씨 오류가 이것떄문이였군용 ㅠㅠ index.html에있는 body부분과 충돌해서요; 기본적인 구조를 생각하면 당연한건데 제가 너무 안일했네요.. |
@@ -0,0 +1,25 @@
+import React from 'react';
+
+class Recommend extends React.Component {
+ render() {
+ const { nickname, img } = this.props;
+ return (
+ <li className="user main-right__user2">
+ <div className="user-and-botton">
+ <img
+ className="user__img user__img--brder-re... | JavaScript | 수정했숨미당~!😇 |
@@ -0,0 +1,22 @@
+import React from 'react';
+
+class Story extends React.Component {
+ render() {
+ const { nickname, img } = this.props;
+ return (
+ <li className="user main-right__user">
+ <img
+ className="user__img user__img--brder-red"
+ alt={nickname}
+ src={img}
+ ... | JavaScript | 여기두용~ |
@@ -0,0 +1,281 @@
+/*------공통-----*/
+/*------공통-----*/
+
+.main-body {
+ background-color: var(--color-boxgray);
+}
+
+main {
+ display: flex;
+ margin-left: 100px;
+}
+
+ul > li {
+ margin: 10px 0;
+}
+
+a {
+ text-decoration: none;
+ color: inherit;
+}
+
+.box {
+ background-color: white;
+ border: 1px solid... | Unknown | common.scss 파일에 이미 있어서 해당 부분 삭제했어용 ㅎ...😱 |
@@ -0,0 +1,51 @@
+import React from 'react';
+import { withRouter } from 'react-router-dom';
+
+class LoginForm extends React.Component {
+ constructor() {
+ super();
+ this.state = { id: '', ps: '' };
+ }
+
+ goToMain = e => {
+ this.props.history.push('/main-yoonhee');
+ };
+
+ handleInput = e => {
+ ... | JavaScript | 래영님 강의 덕분입니당 ㅋ.ㅋ |
@@ -0,0 +1,59 @@
+import React from 'react';
+import Comment from './Comment';
+
+class CommentBox extends React.Component {
+ constructor(props) {
+ super(props);
+ this.state = { feedComment: '', commentList: [] };
+ }
+
+ handleInput = e => {
+ this.setState({ [e.target.name]: e.target.value });
+ };
+
... | JavaScript | 데이터 내용의 뜻을 알 수 있게 comment로 변경했습니다! |
@@ -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 없어도 될 것 같습니다 :) |
@@ -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 | css 속성 순서에 따르면 z-index가 가장 아래에 와야 할 것 같아요 😀 |
@@ -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 css에 있어서 빼셔도 될 것 같아요! |
@@ -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,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 | 오홍 예슬님은 filter로 구현하셨네여! :) |
@@ -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 | id값으로 key props 할당 👍 💯 🥇 |
@@ -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),
});
``` |
@@ -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)}%` : '-'}
``` |
@@ -5,16 +5,18 @@ export default class ReviewMapper {
constructor(private readonly review: ReviewAllProperties) {}
toDomain() {
+ if (!this.review) return null;
+
return new Review({
id: this.review.id,
- writerId: this.review.writerId,
- writer: this.review.writer,
- ownerId: this... | TypeScript | 저도 이렇게 했는거 같긴 한데 if문 안에서 null 값과 undefined값을 체크해서 리턴문 이후로 옵셔널로 줄 필요는 없는거 같아요 |
@@ -1,4 +1,5 @@
import { IsInt, IsNotEmpty, IsPositive, IsString, IsUUID } from 'class-validator';
+import { Type } from 'class-transformer';
export class CreateReviewDTO {
@IsUUID()
@@ -18,3 +19,13 @@ export class CreateReviewDTO {
@IsNotEmpty()
planId: string;
}
+
+export class GetReviewsQueryDTO {
+ @... | TypeScript | 기본값을 주려면 isOptional이 있어야되지 않나요? 테스트해서 괜찮던가요? |
@@ -14,13 +14,13 @@ export interface ReviewProperties {
export interface ReviewAllProperties {
id?: string;
- writerId: string;
+ writerId?: string;
writer?: UserReference;
- ownerId: string;
+ ownerId?: string;
owner?: UserReference;
rating: number;
content: string;
- planId: string;
+ planId?:... | TypeScript | 플랜이 삭제되더라도 리뷰는 남아있는 프로세스인가요?
그렇다는 전제하에 저희는 논리삭제라서 planId는 옵셔널이 아니여도 될거같아요.
플랜은 옵셔널로 유지해야겠네요.
여기 createdAt과 updatedAt이 옵셔널이 아니여도 괜찮지 않나요? |
@@ -5,16 +5,18 @@ export default class ReviewMapper {
constructor(private readonly review: ReviewAllProperties) {}
toDomain() {
+ if (!this.review) return null;
+
return new Review({
id: this.review.id,
- writerId: this.review.writerId,
- writer: this.review.writer,
- ownerId: this... | TypeScript | 리턴문에 옵셔널을 안 넣으면, 예를 들면 지금 PR에 올린 리뷰 목록 조회 때는 writer 데이터는 include를 하지 않고 매핑하니까 값이 없는데 문제 없나요??? |
@@ -1,4 +1,5 @@
import { IsInt, IsNotEmpty, IsPositive, IsString, IsUUID } from 'class-validator';
+import { Type } from 'class-transformer';
export class CreateReviewDTO {
@IsUUID()
@@ -18,3 +19,13 @@ export class CreateReviewDTO {
@IsNotEmpty()
planId: string;
}
+
+export class GetReviewsQueryDTO {
+ @... | TypeScript | 네 다시 테스트해봤는데 문제 없어요! 저 참고로 PlanQueryOptionDTO 참고해서 작성했습니다 ㅎㅎㅎ |
@@ -14,13 +14,13 @@ export interface ReviewProperties {
export interface ReviewAllProperties {
id?: string;
- writerId: string;
+ writerId?: string;
writer?: UserReference;
- ownerId: string;
+ ownerId?: string;
owner?: UserReference;
rating: number;
content: string;
- planId: string;
+ planId?:... | TypeScript | 사실 이 인터페이스는 실제 프로세스에서 리뷰 객체를 이루는 데에 필요한 필드를 기준으로 만들어서 rating, content 말고는 다 옵셔널입니다.. 예를 들면 지금 만든 API의 경우 plan에 대한 내용이 필요없기 때문에 planId를 db에서 가져오지도 않거든요. 이제 만들게 될 dreamer의 내가 작성한 리뷰 목록에는 필요하고요. 옵셔널이 너무 많아서 타입 안정성이 좀 애매하다면 인터페이스를 아예 나누거나 해야할 것 같습니다. |
@@ -5,16 +5,18 @@ export default class ReviewMapper {
constructor(private readonly review: ReviewAllProperties) {}
toDomain() {
+ if (!this.review) return null;
+
return new Review({
id: this.review.id,
- writerId: this.review.writerId,
- writer: this.review.writer,
- ownerId: this... | TypeScript | 저 옵셔널은 review가 있는지 체크하는거지 않나요? |
@@ -1,4 +1,5 @@
import { IsInt, IsNotEmpty, IsPositive, IsString, IsUUID } from 'class-validator';
+import { Type } from 'class-transformer';
export class CreateReviewDTO {
@IsUUID()
@@ -18,3 +19,13 @@ export class CreateReviewDTO {
@IsNotEmpty()
planId: string;
}
+
+export class GetReviewsQueryDTO {
+ @... | TypeScript | 그렇군요,, |
@@ -14,13 +14,13 @@ export interface ReviewProperties {
export interface ReviewAllProperties {
id?: string;
- writerId: string;
+ writerId?: string;
writer?: UserReference;
- ownerId: string;
+ ownerId?: string;
owner?: UserReference;
rating: number;
content: string;
- planId: string;
+ planId?:... | TypeScript | 이해했습니다 |
@@ -14,13 +14,13 @@ export interface ReviewProperties {
export interface ReviewAllProperties {
id?: string;
- writerId: string;
+ writerId?: string;
writer?: UserReference;
- ownerId: string;
+ ownerId?: string;
owner?: UserReference;
rating: number;
content: string;
- planId: string;
+ planId?:... | TypeScript | 나누기보단 그냥 옵셔널로 타입개수를 줄이죠 |
@@ -5,16 +5,18 @@ export default class ReviewMapper {
constructor(private readonly review: ReviewAllProperties) {}
toDomain() {
+ if (!this.review) return null;
+
return new Review({
id: this.review.id,
- writerId: this.review.writerId,
- writer: this.review.writer,
- ownerId: this... | TypeScript | this.review에 해당 값이 없으면 undefined 값을 할당한다고 합니다 (혹시나 해서 다시 찾아봤습니다 ㅎㅎㅎ) |
@@ -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 | 반영하겠습니다! |
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".ArchiveReviewFragment" >
+
+ ... | Unknown | 여기의 컨텍스트는 .ArchiveReviewFragment로 추정됩니다. |
@@ -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 생성 메서드를 활용해서 리펙토링하였습니다. |
@@ -0,0 +1,24 @@
+import UIKit
+
+extension UIImageView {
+ func loadImage(of key: String) {
+ let cacheKey = NSString(string: key)
+ if let cachedImage = ImageCacheManager.shared.object(forKey: cacheKey) {
+ self.image = cachedImage
+ return
+ }
+
+ Dispatch... | Swift | `func loadImage(of key: String)` 만 보고 key가 무엇인지, key가 Image와 어떤 연관이 있는지 알기 어렵네요.
loadCachedImage(of key: String) 정도 제안드립니다. |
@@ -0,0 +1,22 @@
+import UIKit
+
+extension UIStackView {
+ func style(axis: NSLayoutConstraint.Axis,
+ alignment: UIStackView.Alignment,
+ distribution: UIStackView.Distribution,
+ spacing: CGFloat = .zero) {
+ self.translatesAutoresizingMaskIntoConstraints = false
+... | Swift | method를 통해 property를 set하는 이유를 추측하기 어렵네요. |
@@ -0,0 +1,18 @@
+import Foundation
+
+extension URLRequest {
+ init?(api: APIProtocol) {
+ guard let url = api.url else {
+ return nil
+ }
+
+ self.init(url: url)
+ self.httpMethod = "\(api.method)"
+
+ if let postableAPI = api as? Postable {
+ ... | Swift | 추상화했을 때, Specific한 Type으로 casting이 필요하다는 건 추상화가 잘못되었다는 반증이 됩니다.
Header set하는 코드와 httpBody set하는 부분을 APIProtocol Level로 올려서 구한다면 Postable로의 Casting이 필요없을 것 같습니다. 이 방향으로 고민해주세요. |
@@ -0,0 +1,120 @@
+import UIKit
+
+struct MultipartFormData {
+ private(set) var boundary: String
+ let contentType: String
+ private(set) var body: Data = Data()
+
+ init(uuid: String = UUID().uuidString) {
+ self.boundary = "Boundary-\(uuid)"
+ self.contentType = "multipart/form-data; bo... | Swift | Type 이름에 'XXFormData'가 포함되어있으므로, method 이름에 FormData가 포함되지 않는 것이 호출했을 때 자연스럽습니다.
multipartFormdata.create만 해도 맥락을 이해하는데 문제 없어요.
또한 item이라는 파라미터 이름이 모호해보입니다. 정확히 저게 무슨 item인지 더 자세하게 명세되었으면 합니다. |
@@ -0,0 +1,120 @@
+import UIKit
+
+struct MultipartFormData {
+ private(set) var boundary: String
+ let contentType: String
+ private(set) var body: Data = Data()
+
+ init(uuid: String = UUID().uuidString) {
+ self.boundary = "Boundary-\(uuid)"
+ self.contentType = "multipart/form-data; bo... | Swift | 'params: params' 와 같은 모양이 나온다면, 언더바로 파라미터명을 숨기는 것을 고려해볼 수 있습니다. |
@@ -0,0 +1,120 @@
+import UIKit
+
+struct MultipartFormData {
+ private(set) var boundary: String
+ let contentType: String
+ private(set) var body: Data = Data()
+
+ init(uuid: String = UUID().uuidString) {
+ self.boundary = "Boundary-\(uuid)"
+ self.contentType = "multipart/form-data; bo... | Swift | static method가 눈에 걸리네요.
저는 객체 생성 하는 것이 더 좋다고 생각합니다. 애플이 그렇게 하고 있고요. (JsonDecoder 등.)
BoundaryGenerator().data(forType: .startSymblol) 과 같은 스타일이 되면 좋겠습니다. |
@@ -0,0 +1,102 @@
+import Foundation
+import RxSwift
+
+enum NetworkError: Error, LocalizedError {
+ case statusCodeError
+ case unknownError
+ case urlIsNil
+
+ var errorDescription: String? {
+ switch self {
+ case .statusCodeError:
+ return "정상적인 StatusCode가 아닙니다."
+ c... | Swift | NetworkProvider().request(api: api) 의 모양이 나올 것 같은데요.
매 케이스마다 다른 NetworkProvider가 필요해 보이지도 않고요.
NetworkProvider 를 매번 얻어와야 하는게 번거로와보여요.
api.execute()는 어떨까요. excute 안에 NetworkProvider의 로직을 담는거죠.
서로 다른 provider가 필요하다면, APIProtocol 내부에 명시하는 식으로 해결하면 될 것 같고요. |
@@ -0,0 +1,102 @@
+import Foundation
+import RxSwift
+
+enum NetworkError: Error, LocalizedError {
+ case statusCodeError
+ case unknownError
+ case urlIsNil
+
+ var errorDescription: String? {
+ switch self {
+ case .statusCodeError:
+ return "정상적인 StatusCode가 아닙니다."
+ c... | Swift | Observable.create 가 필요하지 않아보입니다. |
@@ -0,0 +1,52 @@
+import Foundation
+
+struct OpenMarketBaseURL: BaseURLProtocol {
+ var baseURL = "https://market-training.yagom-academy.kr/"
+}
+
+struct HealthCheckerAPI: Gettable {
+ var url: URL?
+ var method: HttpMethod = .get
+
+ init(baseURL: BaseURLProtocol = OpenMarketBaseURL()) {
+ sel... | Swift | var / let 확인 바랍니다. |
@@ -0,0 +1,37 @@
+import UIKit
+
+struct FlowCoordinator {
+ // MARK: - Properties
+ weak private var navigationController: UINavigationController?
+ private var productListViewController: ProductListViewController!
+ private var productListViewModel: ProductListViewModel!
+ private var menuSegmentedCont... | Swift | class type을 property로 들고있으니, struct보다는 class가 어울려보입니다. |
@@ -0,0 +1,37 @@
+import UIKit
+
+struct FlowCoordinator {
+ // MARK: - Properties
+ weak private var navigationController: UINavigationController?
+ private var productListViewController: ProductListViewController!
+ private var productListViewModel: ProductListViewModel!
+ private var menuSegmentedCont... | Swift | !는 쓰지 않는걸로 해요. |
@@ -0,0 +1,37 @@
+import UIKit
+
+struct FlowCoordinator {
+ // MARK: - Properties
+ weak private var navigationController: UINavigationController?
+ private var productListViewController: ProductListViewController!
+ private var productListViewModel: ProductListViewModel!
+ private var menuSegmentedCont... | Swift | FlowCoordinator 가 다르게 말하면 AppLevel의 Coordinator로 이해되는데요. ProductList의 로직과 의존성이 커서 ProductList 전용 Coordinator 처럼 보입니다. 저라면 ProductListCoordinator 정도를 만들어서 ProductList 로직을 모듈화하고요. FlowCoordinator의 rootCoordinator를 ProductListCoordinator 로 두어서 FlowCoordinator와 ProductListCoordinator의 관계를 분리할 것 같습니다. |
@@ -0,0 +1,46 @@
+import UIKit
+
+class ProductDetailImageCell: UICollectionViewCell {
+ // MARK: - Properties
+ private let productImageView: UIImageView = {
+ let imageView = UIImageView()
+ imageView.translatesAutoresizingMaskIntoConstraints = false
+ imageView.contentMode = .scaleAspectFi... | Swift | 이 경우 init에 param이 없으므로, init coder 살려도 될 것 같아요.
required init?(coder: NSCoder) {
super.init(coder: coder)
configureUI()
} |
@@ -0,0 +1,57 @@
+import Foundation
+import RxSwift
+import UIKit
+
+class ProductDetailViewModel {
+ // MARK: - Nested Types
+ struct Input {
+ let invokedViewDidLoad: Observable<Void>
+ let cellDidScroll: Observable<IndexPath>
+ }
+
+ struct Output {
+ let product: Observable<Deta... | Swift | inputObserver 와 fetchProduct 를 flatMap으로 엮어서 product observer를 만들 수 있을 것 같네요. 고민해봐주세요. subscribe는 꼭 필요한 위치에만 해주세요. |
@@ -0,0 +1,57 @@
+import Foundation
+import RxSwift
+import UIKit
+
+class ProductDetailViewModel {
+ // MARK: - Nested Types
+ struct Input {
+ let invokedViewDidLoad: Observable<Void>
+ let cellDidScroll: Observable<IndexPath>
+ }
+
+ struct Output {
+ let product: Observable<Deta... | Swift | output 파라미터가 많이 보이는데요. 마치 inout 키워드와 비슷한 기능을 하는 것으로 좋은 코드로 보이지 않습니다. output을 하고싶다면 return type을 쓰면 됩니다. |
@@ -0,0 +1,53 @@
+import UIKit
+
+final class BannerCell: UICollectionViewCell {
+ // MARK: - Properties
+ private let stackView: UIStackView = {
+ let stackView = UIStackView()
+ stackView.style(axis: .vertical, alignment: .fill, distribution: .fill)
+ return stackView
+ }()
+ private ... | Swift | reusable cell은 storable property를 들고있을 이유가 거의 없습니다.
cell은 UI 껍데기 일 뿐이지, 특정 데이터를 대표할 수 없습니다.
apply쪽에는 UI 세팅을 위한 ViewModel 만 전달 하면 되고요.
이 cell이 어떤 productID로 구성되었는지 궁금하다면, cell의 indexPath를 이용해서 직접 얻어내면 됩니다. |
@@ -0,0 +1,53 @@
+import UIKit
+import RxSwift
+import RxCocoa
+
+final class FooterView: UICollectionReusableView {
+ // MARK: - Properties
+ private let bannerPageControl: UIPageControl = {
+ let pageControl = UIPageControl()
+ pageControl.translatesAutoresizingMaskIntoConstraints = false
+ ... | Swift | bind가 N번 호출되었을 때 subscribe가 N번 될 가능성은 없을지 검토 바랍니다. |
@@ -0,0 +1,176 @@
+import UIKit
+
+final class GridListCell: UICollectionViewCell {
+ // MARK: - Nested Types
+ private enum Design {
+ static let nameLabelTextColor: UIColor = .black
+ static let stockLabelTextColor: UIColor = .systemOrange
+ static let priceLabelTextColor: UIColor = .system... | Swift | 저는 Design을 파일 최 하단으로 뺴고있습니다.
한 번 작성되면 볼 일이 거의 없는 코드라서요. |
@@ -0,0 +1,22 @@
+import UIKit
+
+extension UIStackView {
+ func style(axis: NSLayoutConstraint.Axis,
+ alignment: UIStackView.Alignment,
+ distribution: UIStackView.Distribution,
+ spacing: CGFloat = .zero) {
+ self.translatesAutoresizingMaskIntoConstraints = false
+... | Swift | 이부분은 프로퍼티를 클로저로 생성하는 부분에서 반복되는 부분이 많아 메서드를 통해 프로퍼티를 set할 수 있도록 했습니다!! |
@@ -0,0 +1,24 @@
+import UIKit
+
+extension UIImageView {
+ func loadImage(of key: String) {
+ let cacheKey = NSString(string: key)
+ if let cachedImage = ImageCacheManager.shared.object(forKey: cacheKey) {
+ self.image = cachedImage
+ return
+ }
+
+ Dispatch... | Swift | 말씀해주신대로 메서드이름만 봐서는 Cache 기능을 내포하는 것을 알 수 없어서 loadCachedImage(of key: String)로 수정했습니다! |
@@ -0,0 +1,120 @@
+import UIKit
+
+struct MultipartFormData {
+ private(set) var boundary: String
+ let contentType: String
+ private(set) var body: Data = Data()
+
+ init(uuid: String = UUID().uuidString) {
+ self.boundary = "Boundary-\(uuid)"
+ self.contentType = "multipart/form-data; bo... | Swift | createFormData와 createImageFormData 모두 create로 메서드 이름을 변경하고, 매개변수를 통해 구분할 수 있도록 했습니다. 현재 프로젝트에서 Post하는 타입이 product 밖에 없으므로 item은 product라는 이름으로 구체화시켰습니다. |
@@ -0,0 +1,52 @@
+import Foundation
+
+struct OpenMarketBaseURL: BaseURLProtocol {
+ var baseURL = "https://market-training.yagom-academy.kr/"
+}
+
+struct HealthCheckerAPI: Gettable {
+ var url: URL?
+ var method: HttpMethod = .get
+
+ init(baseURL: BaseURLProtocol = OpenMarketBaseURL()) {
+ sel... | Swift | 모두 initializer에서 지정하는 프로퍼티라서 let으로 변경했습니다. |
@@ -0,0 +1,72 @@
+package com.frame2.server.core.board.api;
+
+import com.frame2.server.core.board.application.ProductReviewService;
+import com.frame2.server.core.board.payload.request.ProductReviewModifyRequest;
+import com.frame2.server.core.board.payload.request.ProductReviewRequest;
+import com.frame2.server.core.... | Java | @PatchMapping에 엔드포인트가 정의되어 있는거 같지 않습니다 !
/reviews로 들어가서 어떤 리뷰를 수정하는 걸까요? |
@@ -0,0 +1,72 @@
+package com.frame2.server.core.board.api;
+
+import com.frame2.server.core.board.application.ProductReviewService;
+import com.frame2.server.core.board.payload.request.ProductReviewModifyRequest;
+import com.frame2.server.core.board.payload.request.ProductReviewRequest;
+import com.frame2.server.core.... | Java | `createProductReview()`, `getProductReview()`와 같이 `update()`와 `delete()`에도 `ProductReview`를 추가하면 좀 더 일관성 있는 메서드 이름이 될 것 같은데 어떠세요~?👀 |
@@ -0,0 +1,72 @@
+package com.frame2.server.core.board.api;
+
+import com.frame2.server.core.board.application.ProductReviewService;
+import com.frame2.server.core.board.payload.request.ProductReviewModifyRequest;
+import com.frame2.server.core.board.payload.request.ProductReviewRequest;
+import com.frame2.server.core.... | Java | 리뷰 단건 조회와 전체 조회에서만 ReponseEntity.ok()를 사용하셨는데,
리뷰 등록 성공의 경우 `ResponseEntity.create()`을 사용할 수도 있을 것 같아요!
ResponseEntity 사용과 Http 상태코드에 대해 간략하게 살펴보시면 좋을 것 같습니다 !!
(수정이 필요하다고 생각하진 않습니다❗) |
@@ -0,0 +1,45 @@
+package com.frame2.server.core.board.domain;
+
+import com.frame2.server.core.member.domain.Member;
+import com.frame2.server.core.order.domain.OrderDetail;
+import com.frame2.server.core.product.domain.SaleProduct;
+import com.frame2.server.core.support.entity.BaseEntity;
+import jakarta.persistence.... | Java | `ProductReview` 엔티티는 `BaseEntity`를 상속 받고 있습니다 !
`BaseEntity`를 보시면 `deletStatus` 라는 삭제여부를 관리하는 필드가 있어요.
해당 필드와 상품 리뷰 기능 구현 내에서 리뷰 삭제 로직이 충돌하지는 않는지 고민해보셨으면 좋겠습니다🍀 |
@@ -0,0 +1,70 @@
+package com.frame2.server.core.board.application;
+
+import com.frame2.server.core.board.domain.ProductReview;
+import com.frame2.server.core.board.infrastructure.ProductReviewRepository;
+import com.frame2.server.core.board.payload.request.ProductReviewModifyRequest;
+import com.frame2.server.core.bo... | Java | 만약 해당 `id`를 가진 리뷰가 없다면 어떡하죠 ..?!
리뷰가 있는지 없는지 먼저 확인해보는 작업이 필요하다고 생각합니다! |
@@ -0,0 +1,70 @@
+package com.frame2.server.core.board.application;
+
+import com.frame2.server.core.board.domain.ProductReview;
+import com.frame2.server.core.board.infrastructure.ProductReviewRepository;
+import com.frame2.server.core.board.payload.request.ProductReviewModifyRequest;
+import com.frame2.server.core.bo... | Java | `productReviewCreate()`는 `ProductReview` 엔티티를 반환하고 있습니다.
그런데 해당 메서드를 호출하는 곳에서 이 엔티티를 필요로 하고 있지 않아보입니다 ! |
@@ -0,0 +1,70 @@
+package com.frame2.server.core.board.application;
+
+import com.frame2.server.core.board.domain.ProductReview;
+import com.frame2.server.core.board.infrastructure.ProductReviewRepository;
+import com.frame2.server.core.board.payload.request.ProductReviewModifyRequest;
+import com.frame2.server.core.bo... | Java | productReviewModify()는 ProductReview 엔티티를 반환하고 있습니다.
그런데 해당 메서드를 호출하는 곳에서 이 엔티티를 필요로 하고 있지 않아보입니다 ! |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.