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
์•„๋‹ˆ์—์—ฌ ์ œ๊ฐ€ ์ž˜๋ชฐ๋ž์–ด์š” ใ…‹ใ…‹ใ…‹ใ…‹ ์ž˜ํ•˜์…จ์–ด์š”!!
@@ -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)}%` : '-'} ```
@@ -0,0 +1,20 @@ +import { IsInt, IsNotEmpty, IsPositive, IsString, IsUUID } from 'class-validator'; + +export class CreateReviewDTO { + @IsUUID() + @IsNotEmpty() + makerId: string; + + @IsInt() + @IsPositive() + @IsNotEmpty() + rating: number; + + @IsString() + @IsNotEmpty() + content: string; + + @IsUUID()...
TypeScript
๋ณ„์ ์— 0.5์ ์€ ์—†๋‚˜์š”?
@@ -0,0 +1,20 @@ +import { IsInt, IsNotEmpty, IsPositive, IsString, IsUUID } from 'class-validator'; + +export class CreateReviewDTO { + @IsUUID() + @IsNotEmpty() + makerId: string; + + @IsInt() + @IsPositive() + @IsNotEmpty() + rating: number; + + @IsString() + @IsNotEmpty() + content: string; + + @IsUUID()...
TypeScript
๋„ค! ๊ฐ’์€ ์ •์ˆ˜(1,2,3,4,5)๋กœ ๋ฐ›๊ธฐ๋กœ ํ•˜๊ณ , ์‘๋‹ต์—๋Š” ์†Œ์ˆ˜์  1์ž๋ฆฌ๊นŒ์ง€ ๋ฐ˜ํ™˜ํ•˜๊ธฐ๋กœ ํ–ˆ์Šต๋‹ˆ๋‹ค
@@ -0,0 +1,48 @@ +import { PlanReference } from 'src/common/types/plan/plan.type'; +import { ReviewAllProperties, ReviewProperties } from 'src/common/types/review/review.types'; +import { UserReference } from 'src/common/types/user/user.types'; + +export default class Review { + private readonly id?: string; + privat...
TypeScript
get ๋ฉ”์†Œ๋“œ๋กœ DB๋ณด๋‚ด๊ธฐ ๋ณด๋‹ค๋Š” DB์—๋Š” createdAt๊ณผ updatedAt์„ ์“ธ ์ผ์ด ์—†์œผ๋‹ˆ๊นŒ ๋บด๊ณ  toDB ๋ฉ”์†Œ๋“œ ์ด๋ฆ„์ด ์ข‹์•„๋ณด์—ฌ์š”. ๋งŒ์•ฝ ๋ชจ๋“  ๋ฐ์ดํ„ฐ๊ฐ€ ํ•„์š”ํ•œ ๋ถ€๋ถ„์ด ์ƒ๊ธด๋‹ค๋ฉด ๊ทธ ๋•Œ get ๋ฉ”์†Œ๋“œ๋กœ ๋ชจ๋“ ๊ฑธ ๋‚ด๋ณด๋‚ด๋Š”๊ฑด ์–ด๋–จ๊นŒ์š”?
@@ -0,0 +1,45 @@ +import { Injectable } from '@nestjs/common'; +import ReviewRepository from './review.repository'; +import PlanService from '../plan/plan.service'; +import { StatusEnum } from 'src/common/constants/status.type'; +import BadRequestError from 'src/common/errors/badRequestError'; +import ErrorMessage from...
TypeScript
๊ฐ’์„ ๋„ฃ์–ด์ค„ ๋ฟ์ด๋”๋ผ๋„ ์œ ์ง€๋ณด์ˆ˜ ์ธก๋ฉด์—์„œ static create ๋ฉ”์†Œ๋“œ๋กœ ๋งŒ๋“œ์‹œ๋ ค๋Š”๊ฑฐ ์•„๋‹ˆ์˜€๋‚˜์š”?
@@ -0,0 +1,45 @@ +import { Injectable } from '@nestjs/common'; +import ReviewRepository from './review.repository'; +import PlanService from '../plan/plan.service'; +import { StatusEnum } from 'src/common/constants/status.type'; +import BadRequestError from 'src/common/errors/badRequestError'; +import ErrorMessage from...
TypeScript
์ €๋ฒˆ์— ๊ทธ๋ ‡๊ฒŒ ๋ง์”€๋“œ๋ ธ์—ˆ์ฃ ..ใ…Žใ…Žใ…Ž ๊ทธ๋Ÿฐ๋ฐ ์˜ค๋Š˜ review ๋„๋ฉ”์ธ์„ ์ƒˆ๋กœ ๋งŒ๋“ค๋‹ค๋ณด๋‹ˆ create ๋ฉ”์†Œ๋“œ์—์„œ return new Revier(data)๋งŒ ํ•˜๊ณ , ํŠน๋ณ„ํžˆ ๊ฒ€์ฆ์ด๋‚˜ ๋‹ค๋ฅธ ์ž‘์—…์ด ์—†์–ด์„œ ๊ตณ์ด ์จ์•ผ ํ• ๊นŒ ์˜๋ฌธ์ด ๋“ค์–ด๊ฐ€์ง€๊ณ ... ๋‹ค๋ฅธ ๋„๋ฉ”์ธ๋„ ๋„๋ฉ”์ธ์„ ๋งŒ๋“ค ๋•Œ ํŠน๋ณ„ํ•œ ์ด์Šˆ๊ฐ€ ์—†๋‹ค๋ฉด ๋ฐ”๊ฟ€๊นŒ ํ•˜๋Š”๋ฐ, ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ•˜์‹œ๋‚˜์š”?
@@ -0,0 +1,48 @@ +import { PlanReference } from 'src/common/types/plan/plan.type'; +import { ReviewAllProperties, ReviewProperties } from 'src/common/types/review/review.types'; +import { UserReference } from 'src/common/types/user/user.types'; + +export default class Review { + private readonly id?: string; + privat...
TypeScript
๋„ค! ์„œ๋น„์Šค์— get ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€ํ•˜๋ฉด์„œ toDB, toClient ์ด๋Ÿฐ ์‹์œผ๋กœ ์ˆ˜์ •ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค :)
@@ -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,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,7 +3,7 @@ import { VerticalLine } from "../Line"; interface LessonInfoProps { startDate: string; endDate: string; - locationType: string; + locationType?: string; address?: string; }
Unknown
์ด๊ฑด ์™œ ์˜ต์…”๋„๋กœ ๋ฐ”๊พธ์‹ ๊ฑด๊ฐ€์š”?
@@ -1,26 +1,30 @@ import { CHAT_SORT_OPTIONS } from '@/constants/chat'; +import { User } from './user'; -export type SortType = keyof typeof CHAT_SORT_OPTIONS; - -export interface RoomResponse { +export interface ChatRoom { chatId: string; chattingName: string; + description: string; host: string; + hostP...
TypeScript
๊ณต์šฉ ์œ ์ € ํƒ€์ž…๊ณผ ๊ฒน์น˜๋Š” ๋ถ€๋ถ„์ด ๋งŽ์€ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. User ์ธํ„ฐํŽ˜์ด์Šค ๊ฐ€์ ธ๋‹ค๊ฐ€ ์“ฐ์‹œ๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”. ์œ ํ‹ธ๋ฆฌํ‹ฐ ํƒ€์ž…๊ณผ ํ™•์žฅ ์ด์šฉํ•˜์‹œ๋ฉด ๋  ๊ฒƒ ๊ฐ™์•„์š”.
@@ -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,79 @@ +"use client"; + +import { useRef, useState } from "react"; +import CameraIcon from "@/assets/images/icons/camera.svg"; +import FilledDeleteIcon from "@/assets/images/icons/filled_delete.svg"; +import { useSimpleImageUpload } from "@/hooks/useSimpleImageUpload"; + +export default function ReviewImageIn...
Unknown
useUploadImage๋ฅผ ํ™œ์šฉํ•ด๋„ ๋˜์ง€ ์•Š๋‚˜์š”?.?
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
`createReviewMutation.isPending` ์‚ฌ์šฉํ•ด์„œ ์ค‘๋ณต ํ˜ธ์ถœ ๋ฐฉ์ง€ํ•˜๋ฉด ์ข‹์„๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค!
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
์ž‘์„ฑ๋œ ๋‚ด์šฉ๋“ค์„ ์ƒˆ๋กœ๊ณ ์นจ ํ–ˆ์„ ๋•Œ๋„ ์‚ฌ๋ผ์ง€์ง€ ์•Š๊ฒŒ, localStorage์— ์ €์žฅํ•˜๋ฉด ๋” ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
ํ•ด๋‹น ๋ผ์ธ์€ ๋ถˆํ•„์š”ํ•˜๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ํ† ํฐ์ด ์—†์œผ๋ฉด ์–ด์งœํ”ผ ์„œ๋ฒ„์—์„œ ๊ฒ€์ฆ ํ›„ ์—๋Ÿฌ๋ฅผ ๋˜์ ธ์ค๋‹ˆ๋‹ค. UX์ ์œผ๋กœ API ์š”์ฒญ ์ „ ๊ฒ€์‚ฌ ํ›„ ๋ฆฌ๋‹ค์ด๋ ‰ํŠธ๊ฐ€ ํ•„์š”ํ•˜๋ฉด `mutatonFn`์„ wrappingํ•˜๋Š” ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜์‹œ๊ฑฐ๋‚˜ ์ค‘์•™์ง‘์ค‘์‹์œผ๋กœ ๊ด€๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ•˜์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค.
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
์—ฌ๊ธฐ์„œ throw ๋œ ์—๋Ÿฌ๋Š” ์–ด๋””์„œ ์–ด๋–ป๊ฒŒ ํ•ธ๋“ค๋ง ๋ ๊นŒ์š”?
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
`Blob` ์ธ์Šคํ„ด์Šค๋กœ ๋งŒ๋“œ๋Š” ์ด์œ ๊ฐ€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.
@@ -0,0 +1,79 @@ +"use client"; + +import { useRef, useState } from "react"; +import CameraIcon from "@/assets/images/icons/camera.svg"; +import FilledDeleteIcon from "@/assets/images/icons/filled_delete.svg"; +import { useSimpleImageUpload } from "@/hooks/useSimpleImageUpload"; + +export default function ReviewImageIn...
Unknown
`useSimpleImageUpload`๋Š” ์ด์ „์— IndexedDB ์ด์Šˆ๊ฐ€ ์žˆ์—ˆ์„ ๋•Œ ๊ธ‰ํ•˜๊ฒŒ ๋Œ€์ฒด ๊ตฌํ˜„์ด ํ•„์š”ํ•ด์„œ ๋งŒ๋“ค์–ด๋‘” ํ›…์ž…๋‹ˆ๋‹ค. ์ดํ›„ IndexedDB ์ด์Šˆ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์ง€๋งŒ ์œ ์ €ํŽ˜์ด์ง€๋ฅผ ๋น„๋กฏํ•œ ๊ธฐํƒ€ ์ž‘์—…์— ์•„์ง ์‹ค์ œ ์ ์šฉ์€ ํ•ด๋ณด์ง€ ์•Š์€ ์ƒํƒœ๋ผ ์ผ๋‹จ `useSimpleImageUpload`๋กœ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค! ์ถ”ํ›„ ๋ฆฌํŒฉํ† ๋ง ๋‹จ๊ณ„์—์„œ IndexedDB๋ฅผ ์ ์šฉํ•˜๋ฉด์„œ ์ด ๋ถ€๋ถ„๋„ `useUploadImage`๋กœ ๊ต์ฒดํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹น
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
๋„ต ๋ฆฌํŒฉํ† ๋ง ๋•Œ ๋ฐ˜์˜ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
๊ทธ๊ฒŒ ๋” ์ข‹์€ ๋ฐฉ์‹ ๊ฐ™๋„ค์š”! ๊ทธ๋ ‡๊ฒŒ ์ˆ˜์ •ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค!
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
๋„ต ํ”ผ๋“œ๋ฐฑ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค! ๋ง์”€ํ•˜์‹  ๋Œ€๋กœ api ๋ ˆ๋ฒจ์˜ ํ† ํฐ ์ฒดํฌ๋Š” ์ œ๊ฑฐํ•˜๊ณ , ์ปดํฌ๋„ŒํŠธ ์ง„์ž… ์‹œ์ ์— ์ฒ˜๋ฆฌํ•˜๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค!
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
`multipart/form-data`๋กœ ํŒŒ์ผ๊ณผ JSON ๊ฐ์ฒด๋ฅผ ํ•จ๊ป˜ ์ „์†กํ•  ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ํŒŒ์‹ฑ ์ด์Šˆ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค. ์ผ์ „์˜ ํ”„๋กœํ•„์ˆ˜์ • ์ž‘์—… ๋•Œ ๊ฐ™์€ ์ด์Šˆ๊ฐ€ ์žˆ์—ˆ๋Š”๋ฐ, ์ด ๋ฐฉ์‹์ด ์ž˜ ์ž‘๋™ํ•˜์—ฌ ๋™์ผํ•œ ํŒจํ„ด์„ ์ ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
์•—, throw๋œ ์—๋Ÿฌ๊ฐ€ ์ œ๋Œ€๋กœ ํ•ธ๋“ค๋ง๋˜์ง€ ์•Š๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค๐Ÿฅน `useReviewMutation`์˜ `onError`์—์„œ ๋ชจ๋‹ฌ ์•Œ๋ฆผ์ฐฝ์„ ๋„์šฐ๋„๋ก ์ˆ˜์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
JSON ๊ฐ์ฒด๋ฅผ ํ•จ๊ป˜ ์ „์†ก์‹œ ์–ด๋–ค ํŒŒ์‹ฑ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ•˜๋‚˜์š”?
@@ -0,0 +1,104 @@ +"use client"; + +import { FormProvider, useForm } from "react-hook-form"; +import SolidButton from "@/components/common/buttons/SolidButton"; +import CommonTextArea from "@/components/common/inputs/TextArea"; +import RatingInput from "@/components/create-reaview/RatingInput"; +import ReviewImageInput...
Unknown
์ฒ˜์Œ์— FormData์— request ๊ฐ์ฒด๋ฅผ JSON.stringify๋กœ appendํ–ˆ์„ ๋•Œ๋Š” ์š”์ฒญ์ด ์‹คํŒจํ–ˆ๋Š”๋ฐ, ์ฐพ์•„๋ณด๋‹ˆ ์ด๋ฏธ์ง€ ํŒŒ์ผ๊ณผ ํ•จ๊ป˜ ๋ณด๋‚ด๋Š” ๋ฉ€ํ‹ฐํŒŒํŠธ ํผ๋ฐ์ดํ„ฐ์—์„œ๋Š” ๋ชจ๋“  ๋ฐ์ดํ„ฐ๊ฐ€ ๋ฐ”์ด๋„ˆ๋ฆฌ ํ˜•ํƒœ์—ฌ์•ผ ์„œ๋ฒ„์—์„œ ์ œ๋Œ€๋กœ ํŒŒ์‹ฑํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ํ•ด์„œ Blob ๊ฐ์ฒด๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ์ „์†กํ–ˆ๋”๋‹ˆ ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค.
@@ -8,7 +8,7 @@ export default class PlanMapper { toDomain(): IPlan { if (!this.plan) return null; - return new Plan({ + const returnPlan = new Plan({ id: this.plan.id, createdAt: this.plan.createdAt, updatedAt: this.plan.updatedAt, @@ -19,11 +19,19 @@ export default class PlanMappe...
TypeScript
์ด๊ฑฐ ์ด์ „์— ์ฒดํฌ ์•ˆ ํ•œ ๊ฒƒ ๊ฐ™์€๋ฐ, status๋Š” ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ default ๊ฐ’์ด PENDING์œผ๋กœ ์ฃผ์–ด์ง€๋‹ˆ๊นŒ mapper์—๋Š” ํ•„์š”์—†์„ ๊ฒƒ ๊ฐ™์•„์š”. ์ด์ œ mapper๋Š” repo์—์„œ๋งŒ ์“ฐ๋Š” ๊ฑธ๋กœ ์ˆ˜์ •ํ•˜์…จ๋‹ค๋ฉด ์ง€์›Œ๋„ ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค~!
@@ -8,7 +8,7 @@ export default class PlanMapper { toDomain(): IPlan { if (!this.plan) return null; - return new Plan({ + const returnPlan = new Plan({ id: this.plan.id, createdAt: this.plan.createdAt, updatedAt: this.plan.updatedAt, @@ -19,11 +19,19 @@ export default class PlanMappe...
TypeScript
PlanMapperProperties๋ฅผ ๋ณด๋‹ˆ makerProfile ์•ˆ์— image๊ฐ€ ๋“ค์–ด๊ฐ€๋Š” ๊ฒƒ ๊ฐ™์€๋ฐ, image ํ•„๋“œ๋Š” ๋ณ„๊ฐœ์ธ๊ฐ€์š”? makerProfile์„ undefined๋กœ ์ถ”๊ฐ€ํ•˜๋Š” ์ด์œ ๋„ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค. ``` maker?: { id: string; nickName: string; makerProfile: { image: ProfileImage }; }; ```
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
isHasReview๋ผ๋Š” ์ด๋ฆ„์ด ๋„ˆ๋ฌด ์–ด์ƒ‰ํ•ฉ๋‹ˆ๋‹ค ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ใ…‹ ํ˜น์‹œ ๋ฐ”๊ฟ”์ฃผ์‹ค ์ˆ˜ ์žˆ๋‚˜์š”..?
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
hasReview๋ฅผ reviewed๋กœ ์ „์ฒด ๋ฐ”๊ฟ”๋„ ๊ดœ์ฐฎ์„ ๊ฒƒ ๊ฐ™์•„์š”. ์–ด์ฐจํ”ผ ๋ฆฌ๋ทฐ๋Š” ํ•œ ๋ฒˆ๋ฐ–์— ๋ชป ์“ฐ๋‹ˆ๊นŒ
@@ -9,17 +9,15 @@ import ErrorMessage from 'src/common/constants/errorMessage.enum'; import { CreateOptionalQuoteData, QuoteQueryOptions } from 'src/common/types/quote/quote.type'; import { QuoteToClientProperties } from 'src/common/types/quote/quoteProperties'; import { CreatePlanData } from 'src/common/types/plan/...
TypeScript
hasReview๊ฐ€ boolean ๊ฐ’์ธ๋ฐ, isHasReview๋กœ ๋‹ค์‹œ ํ•œ ๋ฒˆ boolean ์œผ๋กœ ์น˜ํ™˜ํ•˜๋Š” ์ด์œ ๊ฐ€ ์žˆ๋‚˜์š”?
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
์ด๊ฑด ๋‚˜์ค‘์— ์‚ฌ์šฉํ•  ์˜ˆ์ •์ด์‹ ๊ฐ€์š”?
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
review: { is: null } | { isNot: null } ์ด๊ฑด ์–ด๋””์— ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉ๋˜๋Š”์ง€ ์ฝ”๋“œ๋งŒ ๋ด์„œ ์ž˜ ๋ชจ๋ฅด๊ฒ ์–ด์š”. ์„ค๋ช…ํ•ด ์ฃผ์‹ค ์ˆ˜ ์žˆ๋‚˜์š”?
@@ -9,17 +9,15 @@ import ErrorMessage from 'src/common/constants/errorMessage.enum'; import { CreateOptionalQuoteData, QuoteQueryOptions } from 'src/common/types/quote/quote.type'; import { QuoteToClientProperties } from 'src/common/types/quote/quoteProperties'; import { CreatePlanData } from 'src/common/types/plan/...
TypeScript
false๋Š” if๋ฌธ์—์„œ ํ•„ํ„ฐ๊ฐ€ ๋˜์ง€ ์•Š์•„์„œ ์กฐ๊ฑด๋ฌธ์œผ๋กœ true๊ฑฐ๋‚˜ false๊ฑฐ๋‚˜ ํ•„ํ„ฐ๋ฅผ ํ•˜๊ฒŒ ํ–ˆ์–ด์š”
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
ํ•„์š”ํ• ๊นŒ ์‹ถ์–ด์„œ ๋งŒ๋“ ๊ฑด๋ฐ ์•ˆ์ป๋‚˜๋ณด๋„ค์š” ์ง€์šฐ๊ฒ ์Šต๋‹ˆ๋‹ค
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
ํ”„๋ฆฌ์ฆˆ๋งˆ์—์„œ 1:1 ๊ด€๊ณ„์„ฑ ํ•„๋“œ์ผ ๋•Œ id๋กœ ์ฒดํฌํ•˜๋Š”๊ฒŒ ๊ฐ€์žฅ ์ข‹์ง€๋งŒ plan๊ณผ review๋Š” ๋ฆฌ๋ทฐ๋งŒ ํ”Œ๋žœ id๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์ฃ  ๊ทธ๋ ‡๊ธฐ์— ๋ฆฌ๋ทฐ๊ฐ€ ์žˆ๋Š”์ง€ ์—†๋Š”์ง€๋ฅผ ์ฒดํฌํ•˜๊ธฐ ์œ„ํ•œ ๋ฌธ๋ฒ•์ž…๋‹ˆ๋‹ค. ํ˜น์‹œ ๋‹ค๋ฅธ ๋ฌธ๋ฒ•์„ ์•„์‹œ๋Š”๊ฒŒ ์žˆ์œผ์‹ ๊ฐ€์š”?
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
์ข‹์Šต๋‹ˆ๋‹ค ๋ณ€๊ฒฝํ• ๊ฒŒ์š” ใ…‹ใ…‹ใ…‹
@@ -8,7 +8,7 @@ export default class PlanMapper { toDomain(): IPlan { if (!this.plan) return null; - return new Plan({ + const returnPlan = new Plan({ id: this.plan.id, createdAt: this.plan.createdAt, updatedAt: this.plan.updatedAt, @@ -19,11 +19,19 @@ export default class PlanMappe...
TypeScript
๋ฐ›์•„์˜ฌ ๋•Œ๋Š” makerProfile์— ๋‹ด๊ฒจ์˜ค์ง€๋งŒ ๋งตํผ์—์„œ makerProfile ์•ˆ์— ์žˆ๋Š” image๋ฅผ ๋ฐ–์œผ๋กœ ๋„์ง‘์–ด์˜ค๊ณ  makerProfile์ด๋ž€ ํ•„๋“œ๋ฅผ ์—†์• ์ฃผ๊ธฐ ์œ„ํ•ด undefined๋ฅผ ๋„ฃ์—ˆ์Šต๋‹ˆ๋‹ค
@@ -8,7 +8,7 @@ export default class PlanMapper { toDomain(): IPlan { if (!this.plan) return null; - return new Plan({ + const returnPlan = new Plan({ id: this.plan.id, createdAt: this.plan.createdAt, updatedAt: this.plan.updatedAt, @@ -19,11 +19,19 @@ export default class PlanMappe...
TypeScript
๋„ค ์ˆ˜์ •ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค
@@ -9,17 +9,15 @@ import ErrorMessage from 'src/common/constants/errorMessage.enum'; import { CreateOptionalQuoteData, QuoteQueryOptions } from 'src/common/types/quote/quote.type'; import { QuoteToClientProperties } from 'src/common/types/quote/quoteProperties'; import { CreatePlanData } from 'src/common/types/plan/...
TypeScript
service์—์„œ๋Š” if ์กฐ๊ฑด๋ฌธ์— hasReview=true์ธ ๊ฒฝ์šฐ๋งŒ ํ•„ํ„ฐ๋งํ•˜๋Š” ๊ฒƒ ๊ฐ™์€๋ฐ false๋„ ํ•„์š”ํ•œ ๊ฑด๊ฐ€์š”?
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
plan์—์„œ ๋ฆฌ๋ทฐ ์œ ๋ฌด๋ฅผ ํ™•์ธํ•˜๋Š” prisma ๋ฌธ๋ฒ•์ด๊ตฐ์š”! ์ด์ „์— ์œ ๋ฌด ์ฒดํฌํ•  ๋• ์–ด๋–ป๊ฒŒ ํ–ˆ๋Š”์ง€ ๊ธฐ์–ต์ด ์•ˆ๋‚˜๋„ค์š” ใ…‹ใ…‹ใ…‹ ์•Œ๋ ค์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค~!
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common'; import PlanOrder from 'src/common/constants/planOrder.enum'; import { RoleEnum } from 'src/common/constants/role.type'; import SortOrder from 'src/common/constants/sortOrder.enum'; +import { StatusEnum } from 'src/common/constants/status.type'; import { T...
TypeScript
reviewed์™€ isReqviewQuery๋กœ ๋ณ€๊ฒฝํ–ˆ์Šต๋‹ˆ๋‹ค
@@ -9,17 +9,15 @@ import ErrorMessage from 'src/common/constants/errorMessage.enum'; import { CreateOptionalQuoteData, QuoteQueryOptions } from 'src/common/types/quote/quote.type'; import { QuoteToClientProperties } from 'src/common/types/quote/quoteProperties'; import { CreatePlanData } from 'src/common/types/plan/...
TypeScript
hasReview=false์ธ ๊ฒฝ์šฐ๋งŒ ํ•„์š”ํ•˜์ง€๋งŒ ํ•˜๋Š”๊น€์— true๋„ ๊ฐ™์ด ๋งŒ๋“ค์–ด ๋’€์Šต๋‹ˆ๋‹ค
@@ -8,7 +8,7 @@ export default class PlanMapper { toDomain(): IPlan { if (!this.plan) return null; - return new Plan({ + const returnPlan = new Plan({ id: this.plan.id, createdAt: this.plan.createdAt, updatedAt: this.plan.updatedAt, @@ -19,11 +19,19 @@ export default class PlanMappe...
TypeScript
undefined ๋Œ€์‹  ๋งตํ•‘๋ฐฉ์‹์œผ๋กœ ๋ณ€๊ฒฝ
@@ -0,0 +1,25 @@ +package nextstep.security.authentication; + +import nextstep.app.util.Base64Convertor; +import nextstep.security.authentication.exception.AuthenticationException; +import nextstep.security.user.UsernamePasswordAuthenticationToken; +import org.springframework.util.StringUtils; + +public class Authentic...
Java
Convert์˜ ์ฑ…์ž„์„ ๋ถ„๋ฆฌํ•ด์ฃผ์…จ๊ตฐ์š” ๐Ÿ‘
@@ -0,0 +1,28 @@ +package nextstep.security.authentication; + +import jakarta.servlet.http.HttpServletResponse; +import nextstep.security.authentication.exception.AuthenticationException; +import nextstep.security.authentication.exception.MemberAccessDeniedException; + +import java.io.IOException; + +public class Authe...
Java
error handle์˜ ์ฑ…์ž„๋„ ๋ถ„๋ฆฌํ•ด์ฃผ์…จ๊ตฐ์š” ๐Ÿ‘