From ad74c82d3971f516aa689f68213c2fd33ddbf84f Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 25 Jul 2023 15:44:26 +0900 Subject: [PATCH 01/67] misson 1 commit --- .gitignore | 33 ++ .mvn/wrapper/maven-wrapper.jar | Bin 0 -> 59925 bytes .mvn/wrapper/maven-wrapper.properties | 18 + mvnw | 316 ++++++++++++++++++ mvnw.cmd | 188 +++++++++++ pom.xml | 63 ++++ .../com/jpaweekily/JpaWeekilyApplication.java | 13 + .../jpaweekily/domain/customer/Customer.java | 40 +++ .../domain/customer/CustomerMapper.java | 21 ++ .../domain/customer/dto/CustomerRequest.java | 7 + .../domain/customer/dto/CustomerResponse.java | 7 + .../domain/customer/dto/CustomerUpdate.java | 9 + .../repository/CustomerRepository.java | 11 + .../customer/service/CustomerService.java | 21 ++ .../customer/service/CustomerServiceImpl.java | 54 +++ src/main/resources/application.yml | 5 + .../JpaWeekilyApplicationTests.java | 13 + .../service/CustomerServiceImplTest.java | 90 +++++ 18 files changed, 909 insertions(+) create mode 100644 .gitignore create mode 100644 .mvn/wrapper/maven-wrapper.jar create mode 100644 .mvn/wrapper/maven-wrapper.properties create mode 100644 mvnw create mode 100644 mvnw.cmd create mode 100644 pom.xml create mode 100644 src/main/java/com/jpaweekily/JpaWeekilyApplication.java create mode 100644 src/main/java/com/jpaweekily/domain/customer/Customer.java create mode 100644 src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java create mode 100644 src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java create mode 100644 src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java create mode 100644 src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java create mode 100644 src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java create mode 100644 src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java create mode 100644 src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java create mode 100644 src/main/resources/application.yml create mode 100644 src/test/java/com/jpaweekily/JpaWeekilyApplicationTests.java create mode 100644 src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..549e00a2a --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..bf82ff01c6cdae4a1bb754a6e062954d77ac5c11 GIT binary patch literal 59925 zcmb5U1CS=sk~ZA7ZQHhc+Mc%Ywrx+_*0gQgw(Xv_ZBOg(y}RG;-uU;sUu;#Jh>EHw zGfrmZsXF;&D$0O@!2kh40RbILm8t;!w*&h7T24$wm|jX=oKf)`hV~7E`UmXw?e4Pt z`>_l#5YYGC|ANU0%S(xiDXTEZiATrw!Spl1gyQYxsqjrZO`%3Yq?k$Dr=tVr?HIeHlsmnE9=ZU6I2QoCjlLn85rrn7M!RO}+ z%|6^Q>sv`K3j6Ux>as6NoB}L8q#ghm_b)r{V+Pf3xj>b^+M8ZFY`k|FHgl zM!^0D!qDCjU~cj+fXM$0v@vuwvHcft?EeYw=4fbdZ{qkb#PI)>7{J=%Ux*@pi~i^9 z{(nu6>i-Y^_7lUudx7B}(hUFa*>e0ZwEROS{eRc_U*VV`F$C=Jtqb-$9MS)~&L3im zV)8%4)^9W3c4IT94|h)3k zdAT_~?$Z0{&MK=M0K)Y#_0R;gEjTs0uy4JHvr6q{RKur)D^%t>W+U;a*TZ;VL{kcnJJT z3mD=m7($$%?Y#>-Edcet`uW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XhY3a?=stT8Y=e zON`*J*XWAt)HGrxwZ*q+Vqa@ZR!L$}q20V!284MwiP%v31Gsxj)?B>8!)?>u^OApn zubibAoVP(51dG%rOn3B)1%o>rsY(~gcHxBV%zHNcGJAG5LXzusqp zf6xIB1mL$bi4w3Gd_OZ<=ql@JspAZdBy`p3fx$rYJ<-5uph=7HP0s?jFr8%~{M}+| zNTO>9R$pfs>diHr8rccBgeCIxUk5pYDmyHW0xgInO29$zSUV$u*HXpl8RB4To$Jl) z{=g^)d?NLZLQw)fbI!8X+h+vqVdLNM)J_c802p356&!dPP6 zCE7UwrwB-(Cm67|{rYWDP!Y8AfYQ_I;43A7XB{1Ynw2%tgXFFTJT;NX#G{D6V^}|d zVDJD7^jm?x;T-)4a6Qv{?DzgRb=^((gMaJ8lLIg#^ggES;cg28O4wNB&wi4wpM0>1vR)_@;4cOr@Ob#+|3e&Q7EJv(^^|?+hTO*&u!_h2Ss`y zx5A)}f$&VC1c<8AQN@#OY^LLn!S!0&Q*9~*T1_5YgpxCYw2a=t(UH`pO*9TnO)F@Z z{`~n3`;;u525tv@p!e>cBQ9@1N1Q-(w^ep?vvNE_t6@CZl1Ngs1HH`dhzAnP1TKgR z&x+=ipcT78VZ`UK6Yo4@10Zu1dFQ^1lLKX#%I7Y+9FjbP)?{2X?wBENh6hH0t!iov~!_g0%`C9z|%z*OpA9f0PuiVfdgO zf~Mpy6+QnL1HT-G5DZEdApC1jdVT`D&y5iJDway1HzLD3f(U2xlZ7~o-yeiq2;Q4Q zs9aAMpu!K)v!10Ec)Wr4NDwHhZq{nR)NJ^N3n_D#JihOkz~zHi5)l;c*?&PH>xu*& VCNKd3JGtOvEm(5t0lFyE{{i--k}m)N literal 0 HcmV?d00001 diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 000000000..ca5ab4bab --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar diff --git a/mvnw b/mvnw new file mode 100644 index 000000000..8a8fb2282 --- /dev/null +++ b/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 000000000..1d8ab018e --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml new file mode 100644 index 000000000..36a9ebab8 --- /dev/null +++ b/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.0.9 + + + com + jpa-weekily + 0.0.1-SNAPSHOT + jpa-weekily + jpa-weekily + + 17 + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-web + + + + com.h2database + h2 + runtime + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/src/main/java/com/jpaweekily/JpaWeekilyApplication.java b/src/main/java/com/jpaweekily/JpaWeekilyApplication.java new file mode 100644 index 000000000..0fdb287dd --- /dev/null +++ b/src/main/java/com/jpaweekily/JpaWeekilyApplication.java @@ -0,0 +1,13 @@ +package com.jpaweekily; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class JpaWeekilyApplication { + + public static void main(String[] args) { + SpringApplication.run(JpaWeekilyApplication.class, args); + } + +} diff --git a/src/main/java/com/jpaweekily/domain/customer/Customer.java b/src/main/java/com/jpaweekily/domain/customer/Customer.java new file mode 100644 index 000000000..51cec37a3 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/Customer.java @@ -0,0 +1,40 @@ +package com.jpaweekily.domain.customer; + +import com.jpaweekily.domain.customer.dto.CustomerResponse; +import jakarta.persistence.*; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@Entity +@NoArgsConstructor +public class Customer { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(name = "first_Name", nullable = false) + private String firstName; + + private String lastName; + + @Builder + public Customer(String firstName, String lastName) { + this.firstName = firstName; + this.lastName = lastName; + } + + public static CustomerResponse from(Customer customer) { + return new CustomerResponse(customer.getFirstName(), customer.getLastName()); + } + + public void changeFirstName(String firstName) { + this.firstName = firstName; + } + + public void changeLastName(String lastName) { + this.lastName = lastName; + } +} diff --git a/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java b/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java new file mode 100644 index 000000000..7a54c3524 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java @@ -0,0 +1,21 @@ +package com.jpaweekily.domain.customer; + +import com.jpaweekily.domain.customer.dto.CustomerRequest; +import com.jpaweekily.domain.customer.dto.CustomerResponse; + +public class CustomerMapper { + + private CustomerMapper() { + } + + public static CustomerResponse convertEntityToResponse(Customer customer) { + return new CustomerResponse(customer.getFirstName(), customer.getLastName()); + } + + public static Customer convertRequestToEntity(CustomerRequest request) { + return Customer.builder() + .firstName(request.firstName()) + .lastName(request.lastName()) + .build(); + } +} diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java new file mode 100644 index 000000000..b2f838a57 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java @@ -0,0 +1,7 @@ +package com.jpaweekily.domain.customer.dto; + +public record CustomerRequest ( + String firstName, + String lastName +){ +} diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java new file mode 100644 index 000000000..847572ceb --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java @@ -0,0 +1,7 @@ +package com.jpaweekily.domain.customer.dto; + +public record CustomerResponse ( + String firstName, + String lastName +){ +} diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java new file mode 100644 index 000000000..65e8308dc --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java @@ -0,0 +1,9 @@ +package com.jpaweekily.domain.customer.dto; + +public record CustomerUpdate ( + Long id, + String firstName, + String lastName +) { + +} diff --git a/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java b/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java new file mode 100644 index 000000000..44322e7bd --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java @@ -0,0 +1,11 @@ +package com.jpaweekily.domain.customer.repository; + +import com.jpaweekily.domain.customer.Customer; +import org.springframework.data.jpa.repository.JpaRepository; + + +public interface CustomerRepository extends JpaRepository { + + String findByFirstName(String firstname); + +} diff --git a/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java b/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java new file mode 100644 index 000000000..e09ff90e9 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java @@ -0,0 +1,21 @@ +package com.jpaweekily.domain.customer.service; + +import com.jpaweekily.domain.customer.dto.CustomerRequest; +import com.jpaweekily.domain.customer.dto.CustomerResponse; +import com.jpaweekily.domain.customer.dto.CustomerUpdate; + +import java.util.List; + +public interface CustomerService { + + Long create(CustomerRequest request); + + CustomerResponse findCustomerById(Long id); + + List findCustomers(); + + CustomerResponse update(CustomerUpdate request); + + void delete(Long id); + +} diff --git a/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java b/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java new file mode 100644 index 000000000..ad67d12bd --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java @@ -0,0 +1,54 @@ +package com.jpaweekily.domain.customer.service; + +import com.jpaweekily.domain.customer.Customer; +import com.jpaweekily.domain.customer.CustomerMapper; +import com.jpaweekily.domain.customer.dto.CustomerRequest; +import com.jpaweekily.domain.customer.dto.CustomerResponse; +import com.jpaweekily.domain.customer.dto.CustomerUpdate; +import com.jpaweekily.domain.customer.repository.CustomerRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Transactional(readOnly = true) +@Service +public class CustomerServiceImpl implements CustomerService { + + private final CustomerRepository customerRepository; + + public CustomerServiceImpl(CustomerRepository customerRepository) { + this.customerRepository = customerRepository; + } + + @Transactional + public Long create(CustomerRequest request) { + Customer customer = CustomerMapper.convertRequestToEntity(request); + customerRepository.save(customer); + return customer.getId(); + } + + public CustomerResponse findCustomerById(Long id) { + Customer customer = customerRepository.findById(id).orElseThrow(IllegalArgumentException::new); + return CustomerMapper.convertEntityToResponse(customer); + } + + public List findCustomers() { + return customerRepository.findAll().stream() + .map(CustomerMapper::convertEntityToResponse) + .toList(); + } + + @Transactional + public CustomerResponse update(CustomerUpdate request) { + Customer customer = customerRepository.findById(request.id()).orElseThrow(IllegalArgumentException::new); + customer.changeFirstName(request.firstName()); + customer.changeLastName(request.lastName()); + return CustomerMapper.convertEntityToResponse(customer); + } + + @Transactional + public void delete(Long id) { + customerRepository.deleteById(id); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 000000000..a208fabbb --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,5 @@ +spring: + datasource: + url: jdbc:h2:mem:test;MODE=MySQL + username: sa + password: \ No newline at end of file diff --git a/src/test/java/com/jpaweekily/JpaWeekilyApplicationTests.java b/src/test/java/com/jpaweekily/JpaWeekilyApplicationTests.java new file mode 100644 index 000000000..266c71e09 --- /dev/null +++ b/src/test/java/com/jpaweekily/JpaWeekilyApplicationTests.java @@ -0,0 +1,13 @@ +package com.jpaweekily; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class JpaWeekilyApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java b/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java new file mode 100644 index 000000000..873591949 --- /dev/null +++ b/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java @@ -0,0 +1,90 @@ +package com.jpaweekily.domain.customer.service; + +import com.jpaweekily.domain.customer.dto.CustomerRequest; +import com.jpaweekily.domain.customer.dto.CustomerResponse; +import com.jpaweekily.domain.customer.dto.CustomerUpdate; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import static org.assertj.core.api.Assertions.*; + +@Transactional +@SpringBootTest +class CustomerServiceImplTest { + + @Autowired + private CustomerService customerService; + + + @Test + void createTest() { + //given + CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); + + //when + Long id = customerService.create(customerRequest); + + //then + assertThat(id).isNotNull(); + } + + @Test + void findByIdTest() { + //given + CustomerRequest customerRequest = new CustomerRequest("weon2", "geonhee"); + Long id = customerService.create(customerRequest); + + //when + CustomerResponse customerById = customerService.findCustomerById(id); + + //then + assertThat(customerById.firstName()).isEqualTo("weon2"); + } + + @Test + void findAllTest() { + //given + CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); + CustomerRequest customerRequest2 = new CustomerRequest("god", "geonhee"); + customerService.create(customerRequest); + customerService.create(customerRequest2); + + //when + List customers = customerService.findCustomers(); + + //then + assertThat(customers.size()).isEqualTo(2); + } + + @Test + void updateTest() { + //given + CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); + Long id = customerService.create(customerRequest); + CustomerUpdate customerUpdate = new CustomerUpdate(id, "god", "sin"); + + //when + CustomerResponse updated = customerService.update(customerUpdate); + + //then + assertThat(customerUpdate.firstName()).isEqualTo(updated.firstName()); + } + + @Test + void deleteTest() { + CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); + Long id = customerService.create(customerRequest); + + //when + customerService.delete(id); + + //then + assertThatThrownBy(() -> customerService.findCustomerById(id)) + .isInstanceOf(IllegalArgumentException.class); + } +} \ No newline at end of file From 3bc666f3914023a67d7926a9abeffc9b57b70b03 Mon Sep 17 00:00:00 2001 From: weonest Date: Wed, 26 Jul 2023 15:59:36 +0900 Subject: [PATCH 02/67] =?UTF-8?q?=EB=AF=B8=EC=85=982?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jpaweekily/domain/customer/Customer.java | 4 -- .../domain/customer/CustomerMapper.java | 2 +- .../controller/CustomerApiController.java | 57 +++++++++++++++++++ .../domain/customer/dto/CustomerResponse.java | 6 ++ .../domain/customer/dto/CustomerUpdate.java | 1 - .../repository/CustomerRepository.java | 3 + .../customer/service/CustomerService.java | 4 ++ .../customer/service/CustomerServiceImpl.java | 7 +++ .../customer/service/LifeCycleTest.java | 22 +++++++ 9 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java create mode 100644 src/test/java/com/jpaweekily/domain/customer/service/LifeCycleTest.java diff --git a/src/main/java/com/jpaweekily/domain/customer/Customer.java b/src/main/java/com/jpaweekily/domain/customer/Customer.java index 51cec37a3..79fbdc05f 100644 --- a/src/main/java/com/jpaweekily/domain/customer/Customer.java +++ b/src/main/java/com/jpaweekily/domain/customer/Customer.java @@ -26,10 +26,6 @@ public Customer(String firstName, String lastName) { this.lastName = lastName; } - public static CustomerResponse from(Customer customer) { - return new CustomerResponse(customer.getFirstName(), customer.getLastName()); - } - public void changeFirstName(String firstName) { this.firstName = firstName; } diff --git a/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java b/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java index 7a54c3524..3d4b02c56 100644 --- a/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java +++ b/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java @@ -9,7 +9,7 @@ private CustomerMapper() { } public static CustomerResponse convertEntityToResponse(Customer customer) { - return new CustomerResponse(customer.getFirstName(), customer.getLastName()); + return new CustomerResponse(customer.getId(), customer.getFirstName(), customer.getLastName()); } public static Customer convertRequestToEntity(CustomerRequest request) { diff --git a/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java b/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java new file mode 100644 index 000000000..ba7985301 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java @@ -0,0 +1,57 @@ +package com.jpaweekily.domain.customer.controller; + +import com.jpaweekily.domain.customer.dto.CustomerRequest; +import com.jpaweekily.domain.customer.dto.CustomerResponse; +import com.jpaweekily.domain.customer.dto.CustomerUpdate; +import com.jpaweekily.domain.customer.service.CustomerService; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.web.PageableDefault; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@RestController +@RequestMapping("/api/v1/customers") +public class CustomerApiController { + + private final CustomerService customerService; + + public CustomerApiController(CustomerService customerService) { + this.customerService = customerService; + } + + @GetMapping + public ResponseEntity> customerList() { + List customers = customerService.findCustomers(); + return ResponseEntity.ok(customers); + } + + @GetMapping("/page") + public ResponseEntity> customerPage(@PageableDefault() Pageable pageable) { + Page customers = customerService.findCustomersWithPaging(pageable); + return ResponseEntity.ok(customers); + } + + @PostMapping("/new") + public ResponseEntity customerCreate(@RequestBody CustomerRequest request) { + Long id = customerService.create(request); + return new ResponseEntity<>(id, HttpStatus.CREATED); + } + + @PatchMapping("/update") + public ResponseEntity customerUpdate(@RequestBody CustomerUpdate request) { + CustomerResponse updated = customerService.update(request); + return ResponseEntity.ok(updated); + } + + public String pupsf(Model model) { + CustomerResponse customerById = customerService.findCustomerById(1L); + model.addAttribute("user", customerById); + + return "/users-page"; + } +} diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java index 847572ceb..69857a8e4 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java @@ -1,7 +1,13 @@ package com.jpaweekily.domain.customer.dto; +import com.jpaweekily.domain.customer.Customer; + public record CustomerResponse ( + Long id, String firstName, String lastName ){ + public static CustomerResponse from(Customer customer) { + return new CustomerResponse(customer.getId(), customer.getFirstName(), customer.getLastName()); + } } diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java index 65e8308dc..c50a5f71d 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java @@ -5,5 +5,4 @@ public record CustomerUpdate ( String firstName, String lastName ) { - } diff --git a/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java b/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java index 44322e7bd..2b1f10dcd 100644 --- a/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java +++ b/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java @@ -1,6 +1,8 @@ package com.jpaweekily.domain.customer.repository; import com.jpaweekily.domain.customer.Customer; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; @@ -8,4 +10,5 @@ public interface CustomerRepository extends JpaRepository { String findByFirstName(String firstname); + Page findAll(Pageable pageable); } diff --git a/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java b/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java index e09ff90e9..5957731cc 100644 --- a/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java +++ b/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java @@ -3,6 +3,8 @@ import com.jpaweekily.domain.customer.dto.CustomerRequest; import com.jpaweekily.domain.customer.dto.CustomerResponse; import com.jpaweekily.domain.customer.dto.CustomerUpdate; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import java.util.List; @@ -14,6 +16,8 @@ public interface CustomerService { List findCustomers(); + Page findCustomersWithPaging(Pageable pageable); + CustomerResponse update(CustomerUpdate request); void delete(Long id); diff --git a/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java b/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java index ad67d12bd..38f4abffa 100644 --- a/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java @@ -6,6 +6,8 @@ import com.jpaweekily.domain.customer.dto.CustomerResponse; import com.jpaweekily.domain.customer.dto.CustomerUpdate; import com.jpaweekily.domain.customer.repository.CustomerRepository; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -39,6 +41,11 @@ public List findCustomers() { .toList(); } + public Page findCustomersWithPaging(Pageable pageable) { + return customerRepository.findAll(pageable) + .map(CustomerMapper::convertEntityToResponse); + } + @Transactional public CustomerResponse update(CustomerUpdate request) { Customer customer = customerRepository.findById(request.id()).orElseThrow(IllegalArgumentException::new); diff --git a/src/test/java/com/jpaweekily/domain/customer/service/LifeCycleTest.java b/src/test/java/com/jpaweekily/domain/customer/service/LifeCycleTest.java new file mode 100644 index 000000000..999fd3002 --- /dev/null +++ b/src/test/java/com/jpaweekily/domain/customer/service/LifeCycleTest.java @@ -0,0 +1,22 @@ +package com.jpaweekily.domain.customer.service; + +import com.jpaweekily.domain.customer.Customer; +import jakarta.persistence.EntityManager; +import jakarta.persistence.EntityManagerFactory; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class LifeCycleTest { + + @Autowired + EntityManagerFactory emf; + + @Test + void test() { + EntityManager entityManager = emf.createEntityManager(); + + } + +} From 0ef908d274c3bcad5ded790caba2bda4f50e9116 Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 27 Jul 2023 22:11:46 +0900 Subject: [PATCH 03/67] =?UTF-8?q?feat:=20=EB=AF=B8=EC=85=983?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jpaweekily/domain/customer/Customer.java | 1 - .../controller/CustomerApiController.java | 7 +--- .../repository/CustomerRepository.java | 4 +- .../com/jpaweekily/domain/order/Order.java | 40 +++++++++++++++++++ .../jpaweekily/domain/order/OrderProduct.java | 36 +++++++++++++++++ .../jpaweekily/domain/order/OrderStatus.java | 7 ++++ .../domain/order/dto/OrderCreateRequest.java | 7 ++++ .../order/repository/OrderRepository.java | 8 ++++ .../domain/order/service/OrderService.java | 4 ++ .../order/service/OrderServiceImpl.java | 38 ++++++++++++++++++ .../jpaweekily/domain/product/Product.java | 32 +++++++++++++++ .../product/dto/ProductCreateRequest.java | 7 ++++ .../product/repository/ProductRepository.java | 8 ++++ .../product/service/ProductService.java | 4 ++ .../product/service/ProductServiceImpl.java | 28 +++++++++++++ .../java/com/jpaweekily/domain/user/User.java | 37 +++++++++++++++++ .../domain/user/dto/UserCreateRequest.java | 8 ++++ .../user/repository/UserRepository.java | 11 +++++ .../domain/user/service/UserService.java | 4 ++ .../domain/user/service/UserServiceImpl.java | 32 +++++++++++++++ src/main/resources/application.yml | 21 +++++++++- .../service/CustomerServiceImplTest.java | 3 +- 22 files changed, 335 insertions(+), 12 deletions(-) create mode 100644 src/main/java/com/jpaweekily/domain/order/Order.java create mode 100644 src/main/java/com/jpaweekily/domain/order/OrderProduct.java create mode 100644 src/main/java/com/jpaweekily/domain/order/OrderStatus.java create mode 100644 src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java create mode 100644 src/main/java/com/jpaweekily/domain/order/repository/OrderRepository.java create mode 100644 src/main/java/com/jpaweekily/domain/order/service/OrderService.java create mode 100644 src/main/java/com/jpaweekily/domain/order/service/OrderServiceImpl.java create mode 100644 src/main/java/com/jpaweekily/domain/product/Product.java create mode 100644 src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java create mode 100644 src/main/java/com/jpaweekily/domain/product/repository/ProductRepository.java create mode 100644 src/main/java/com/jpaweekily/domain/product/service/ProductService.java create mode 100644 src/main/java/com/jpaweekily/domain/product/service/ProductServiceImpl.java create mode 100644 src/main/java/com/jpaweekily/domain/user/User.java create mode 100644 src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java create mode 100644 src/main/java/com/jpaweekily/domain/user/repository/UserRepository.java create mode 100644 src/main/java/com/jpaweekily/domain/user/service/UserService.java create mode 100644 src/main/java/com/jpaweekily/domain/user/service/UserServiceImpl.java diff --git a/src/main/java/com/jpaweekily/domain/customer/Customer.java b/src/main/java/com/jpaweekily/domain/customer/Customer.java index 79fbdc05f..33326b7ca 100644 --- a/src/main/java/com/jpaweekily/domain/customer/Customer.java +++ b/src/main/java/com/jpaweekily/domain/customer/Customer.java @@ -1,6 +1,5 @@ package com.jpaweekily.domain.customer; -import com.jpaweekily.domain.customer.dto.CustomerResponse; import jakarta.persistence.*; import lombok.Builder; import lombok.Getter; diff --git a/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java b/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java index ba7985301..074a8ec2b 100644 --- a/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java +++ b/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java @@ -9,7 +9,6 @@ import org.springframework.data.web.PageableDefault; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.List; @@ -48,10 +47,6 @@ public ResponseEntity customerUpdate(@RequestBody CustomerUpda return ResponseEntity.ok(updated); } - public String pupsf(Model model) { - CustomerResponse customerById = customerService.findCustomerById(1L); - model.addAttribute("user", customerById); - return "/users-page"; - } + } diff --git a/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java b/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java index 2b1f10dcd..edc28823e 100644 --- a/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java +++ b/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java @@ -5,10 +5,12 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.Optional; + public interface CustomerRepository extends JpaRepository { - String findByFirstName(String firstname); + Optional findByFirstName(String firstname); Page findAll(Pageable pageable); } diff --git a/src/main/java/com/jpaweekily/domain/order/Order.java b/src/main/java/com/jpaweekily/domain/order/Order.java new file mode 100644 index 000000000..1117fd66b --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/Order.java @@ -0,0 +1,40 @@ +package com.jpaweekily.domain.order; + +import com.jpaweekily.domain.user.User; +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "orders") +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Order { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String address; + + @Enumerated(EnumType.STRING) + private OrderStatus orderStatus; + + private LocalDateTime createAt; + + @ManyToOne + @JoinColumn(name = "user_id") + private User user; + + @Builder + public Order(String address, OrderStatus orderStatus, LocalDateTime createAt, User user) { + this.address = address; + this.orderStatus = orderStatus; + this.createAt = createAt; + this.user = user; + } +} diff --git a/src/main/java/com/jpaweekily/domain/order/OrderProduct.java b/src/main/java/com/jpaweekily/domain/order/OrderProduct.java new file mode 100644 index 000000000..0f910bc2b --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/OrderProduct.java @@ -0,0 +1,36 @@ +package com.jpaweekily.domain.order; + +import com.jpaweekily.domain.product.Product; +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Table(name = "order_product") +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class OrderProduct { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @ManyToOne + @JoinColumn(name = "order_id") + private Order order; + + @ManyToOne + @JoinColumn(name = "product_id") + private Product product; + + private int quantity; + + @Builder + public OrderProduct(Order order, Product product, int quantity) { + this.order = order; + this.product = product; + this.quantity = quantity; + } +} diff --git a/src/main/java/com/jpaweekily/domain/order/OrderStatus.java b/src/main/java/com/jpaweekily/domain/order/OrderStatus.java new file mode 100644 index 000000000..fcf6d03a2 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/OrderStatus.java @@ -0,0 +1,7 @@ +package com.jpaweekily.domain.order; + +public enum OrderStatus { + READY_FOR_DELIVERY, + COMPLETED, + CANCELLED +} diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java b/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java new file mode 100644 index 000000000..50bf7f095 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java @@ -0,0 +1,7 @@ +package com.jpaweekily.domain.order.dto; + +public record OrderCreateRequest ( + String nickName, + String address +){ +} diff --git a/src/main/java/com/jpaweekily/domain/order/repository/OrderRepository.java b/src/main/java/com/jpaweekily/domain/order/repository/OrderRepository.java new file mode 100644 index 000000000..a5bc03f52 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/repository/OrderRepository.java @@ -0,0 +1,8 @@ +package com.jpaweekily.domain.order.repository; + +import com.jpaweekily.domain.order.Order; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface OrderRepository extends JpaRepository { + +} diff --git a/src/main/java/com/jpaweekily/domain/order/service/OrderService.java b/src/main/java/com/jpaweekily/domain/order/service/OrderService.java new file mode 100644 index 000000000..99158d4c9 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/service/OrderService.java @@ -0,0 +1,4 @@ +package com.jpaweekily.domain.order.service; + +public interface OrderService { +} diff --git a/src/main/java/com/jpaweekily/domain/order/service/OrderServiceImpl.java b/src/main/java/com/jpaweekily/domain/order/service/OrderServiceImpl.java new file mode 100644 index 000000000..baaefb4ad --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/service/OrderServiceImpl.java @@ -0,0 +1,38 @@ +package com.jpaweekily.domain.order.service; + +import com.jpaweekily.domain.order.Order; +import com.jpaweekily.domain.order.OrderStatus; +import com.jpaweekily.domain.order.dto.OrderCreateRequest; +import com.jpaweekily.domain.order.repository.OrderRepository; +import com.jpaweekily.domain.user.User; +import com.jpaweekily.domain.user.repository.UserRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; + +@Transactional(readOnly = true) +@Service +public class OrderServiceImpl implements OrderService { + + private final OrderRepository orderRepository; + private final UserRepository userRepository; + + public OrderServiceImpl(OrderRepository orderRepository, UserRepository userRepository) { + this.orderRepository = orderRepository; + this.userRepository = userRepository; + } + + public void createOrder(OrderCreateRequest request) { + User user = userRepository.findByNickName(request.nickName()).orElseThrow(IllegalArgumentException::new); + + Order order = Order.builder() + .address(request.address()) + .orderStatus(OrderStatus.READY_FOR_DELIVERY) + .createAt(LocalDateTime.now()) + .user(user) + .build(); + + orderRepository.save(order); + } +} diff --git a/src/main/java/com/jpaweekily/domain/product/Product.java b/src/main/java/com/jpaweekily/domain/product/Product.java new file mode 100644 index 000000000..11c8c9540 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/product/Product.java @@ -0,0 +1,32 @@ +package com.jpaweekily.domain.product; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class Product { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String productName; + + private int price; + + + + @Builder + public Product(String productName, int price) { + this.productName = productName; + this.price = price; + } +} diff --git a/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java b/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java new file mode 100644 index 000000000..20e67d60b --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java @@ -0,0 +1,7 @@ +package com.jpaweekily.domain.product.dto; + +public record ProductCreateRequest( + String productName, + int price +) { +} diff --git a/src/main/java/com/jpaweekily/domain/product/repository/ProductRepository.java b/src/main/java/com/jpaweekily/domain/product/repository/ProductRepository.java new file mode 100644 index 000000000..b9a6e496b --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/product/repository/ProductRepository.java @@ -0,0 +1,8 @@ +package com.jpaweekily.domain.product.repository; + +import com.jpaweekily.domain.product.Product; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ProductRepository extends JpaRepository { + +} diff --git a/src/main/java/com/jpaweekily/domain/product/service/ProductService.java b/src/main/java/com/jpaweekily/domain/product/service/ProductService.java new file mode 100644 index 000000000..8be4a8c4c --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/product/service/ProductService.java @@ -0,0 +1,4 @@ +package com.jpaweekily.domain.product.service; + +public interface ProductService { +} diff --git a/src/main/java/com/jpaweekily/domain/product/service/ProductServiceImpl.java b/src/main/java/com/jpaweekily/domain/product/service/ProductServiceImpl.java new file mode 100644 index 000000000..9016cd9d1 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/product/service/ProductServiceImpl.java @@ -0,0 +1,28 @@ +package com.jpaweekily.domain.product.service; + + +import com.jpaweekily.domain.product.Product; +import com.jpaweekily.domain.product.dto.ProductCreateRequest; +import com.jpaweekily.domain.product.repository.ProductRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Transactional(readOnly = true) +@Service +public class ProductServiceImpl implements ProductService { + + private final ProductRepository productRepository; + + public ProductServiceImpl(ProductRepository productRepository) { + this.productRepository = productRepository; + } + + public void createProduct(ProductCreateRequest request) { + Product product = Product.builder() + .productName(request.productName()) + .price(request.price()) + .build(); + + productRepository.save(product); + } +} diff --git a/src/main/java/com/jpaweekily/domain/user/User.java b/src/main/java/com/jpaweekily/domain/user/User.java new file mode 100644 index 000000000..a21dee267 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/user/User.java @@ -0,0 +1,37 @@ +package com.jpaweekily.domain.user; + +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Builder; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +@Entity +@Table(name = "users") +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + @Column(unique = true, nullable = false) + private String loginId; + + @Column(nullable = false) + private String password; + + @Column(unique = true, nullable = false) + private String nickName; + + private LocalDateTime createdAt; + + @Builder + public User(String loginId, String nickName, String password, LocalDateTime createdAt) { + this.loginId = loginId; + this.nickName = nickName; + this.password = password; + this.createdAt = createdAt; + } +} diff --git a/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java b/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java new file mode 100644 index 000000000..7641482c0 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java @@ -0,0 +1,8 @@ +package com.jpaweekily.domain.user.dto; + +public record UserCreateRequest ( + String loginId, + String password, + String nickName +){ +} diff --git a/src/main/java/com/jpaweekily/domain/user/repository/UserRepository.java b/src/main/java/com/jpaweekily/domain/user/repository/UserRepository.java new file mode 100644 index 000000000..6fa55949f --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/user/repository/UserRepository.java @@ -0,0 +1,11 @@ +package com.jpaweekily.domain.user.repository; + +import com.jpaweekily.domain.user.User; +import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; + +public interface UserRepository extends JpaRepository { + + Optional findByNickName(String nickName); +} diff --git a/src/main/java/com/jpaweekily/domain/user/service/UserService.java b/src/main/java/com/jpaweekily/domain/user/service/UserService.java new file mode 100644 index 000000000..091e3b2e2 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/user/service/UserService.java @@ -0,0 +1,4 @@ +package com.jpaweekily.domain.user.service; + +public interface UserService { +} diff --git a/src/main/java/com/jpaweekily/domain/user/service/UserServiceImpl.java b/src/main/java/com/jpaweekily/domain/user/service/UserServiceImpl.java new file mode 100644 index 000000000..7e206566c --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/user/service/UserServiceImpl.java @@ -0,0 +1,32 @@ +package com.jpaweekily.domain.user.service; + +import com.jpaweekily.domain.user.User; +import com.jpaweekily.domain.user.dto.UserCreateRequest; +import com.jpaweekily.domain.user.repository.UserRepository; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.time.LocalDateTime; + + +@Transactional(readOnly = true) +@Service +public class UserServiceImpl implements UserService { + + private final UserRepository userRepository; + + public UserServiceImpl(UserRepository userRepository) { + this.userRepository = userRepository; + } + + public void createUser(UserCreateRequest request) { + User user = User.builder() + .loginId(request.loginId()) + .password(request.password()) + .nickName(request.nickName()) + .createdAt(LocalDateTime.now()) + .build(); + + userRepository.save(user); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a208fabbb..89cfab3e4 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,5 +1,22 @@ spring: datasource: - url: jdbc:h2:mem:test;MODE=MySQL +# url: jdbc:h2:mem:test;MODE=MySQL + url: jdbc:h2:~/weekly username: sa - password: \ No newline at end of file + password: + + + h2: + console: + enabled: true + path: /h2-console + + jpa: + open-in-view: false + hibernate: + ddl-auto: create + properties: + hibernate: + format_sql: true + show_sql: true + diff --git a/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java b/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java index 873591949..322479299 100644 --- a/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java @@ -3,7 +3,6 @@ import com.jpaweekily.domain.customer.dto.CustomerRequest; import com.jpaweekily.domain.customer.dto.CustomerResponse; import com.jpaweekily.domain.customer.dto.CustomerUpdate; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -20,7 +19,6 @@ class CustomerServiceImplTest { @Autowired private CustomerService customerService; - @Test void createTest() { //given @@ -87,4 +85,5 @@ void deleteTest() { assertThatThrownBy(() -> customerService.findCustomerById(id)) .isInstanceOf(IllegalArgumentException.class); } + } \ No newline at end of file From efdb159ff56701fb3c2b082cf116b3125e9ecdc3 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 18:38:20 +0900 Subject: [PATCH 04/67] =?UTF-8?q?refactor:=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customer/{service => application}/CustomerService.java | 2 +- .../{service => application}/CustomerServiceImpl.java | 4 ++-- .../{repository => infrastructrue}/CustomerRepository.java | 2 +- .../{controller => presentation}/CustomerApiController.java | 6 ++---- .../jpaweekily/domain/order/application/OrderService.java | 4 ++++ .../order/{service => application}/OrderServiceImpl.java | 6 +++--- .../{repository => infrastructrue}/OrderRepository.java | 2 +- .../com/jpaweekily/domain/order/service/OrderService.java | 4 ---- .../domain/product/application/ProductService.java | 4 ++++ .../{service => application}/ProductServiceImpl.java | 4 ++-- .../{repository => infrastructrue}/ProductRepository.java | 2 +- .../jpaweekily/domain/product/service/ProductService.java | 4 ---- .../com/jpaweekily/domain/user/application/UserService.java | 4 ++++ .../user/{service => application}/UserServiceImpl.java | 4 ++-- .../user/{repository => infrastructrue}/UserRepository.java | 2 +- .../com/jpaweekily/domain/user/service/UserService.java | 4 ---- .../{service => application}/CustomerServiceImplTest.java | 2 +- .../customer/{service => application}/LifeCycleTest.java | 3 +-- 18 files changed, 30 insertions(+), 33 deletions(-) rename src/main/java/com/jpaweekily/domain/customer/{service => application}/CustomerService.java (92%) rename src/main/java/com/jpaweekily/domain/customer/{service => application}/CustomerServiceImpl.java (94%) rename src/main/java/com/jpaweekily/domain/customer/{repository => infrastructrue}/CustomerRepository.java (88%) rename src/main/java/com/jpaweekily/domain/customer/{controller => presentation}/CustomerApiController.java (93%) create mode 100644 src/main/java/com/jpaweekily/domain/order/application/OrderService.java rename src/main/java/com/jpaweekily/domain/order/{service => application}/OrderServiceImpl.java (86%) rename src/main/java/com/jpaweekily/domain/order/{repository => infrastructrue}/OrderRepository.java (77%) delete mode 100644 src/main/java/com/jpaweekily/domain/order/service/OrderService.java create mode 100644 src/main/java/com/jpaweekily/domain/product/application/ProductService.java rename src/main/java/com/jpaweekily/domain/product/{service => application}/ProductServiceImpl.java (86%) rename src/main/java/com/jpaweekily/domain/product/{repository => infrastructrue}/ProductRepository.java (77%) delete mode 100644 src/main/java/com/jpaweekily/domain/product/service/ProductService.java create mode 100644 src/main/java/com/jpaweekily/domain/user/application/UserService.java rename src/main/java/com/jpaweekily/domain/user/{service => application}/UserServiceImpl.java (88%) rename src/main/java/com/jpaweekily/domain/user/{repository => infrastructrue}/UserRepository.java (83%) delete mode 100644 src/main/java/com/jpaweekily/domain/user/service/UserService.java rename src/test/java/com/jpaweekily/domain/customer/{service => application}/CustomerServiceImplTest.java (98%) rename src/test/java/com/jpaweekily/domain/customer/{service => application}/LifeCycleTest.java (82%) diff --git a/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java b/src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java similarity index 92% rename from src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java rename to src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java index 5957731cc..62d56468a 100644 --- a/src/main/java/com/jpaweekily/domain/customer/service/CustomerService.java +++ b/src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.customer.service; +package com.jpaweekily.domain.customer.application; import com.jpaweekily.domain.customer.dto.CustomerRequest; import com.jpaweekily.domain.customer.dto.CustomerResponse; diff --git a/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java b/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java similarity index 94% rename from src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java rename to src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java index 38f4abffa..c82a3964c 100644 --- a/src/main/java/com/jpaweekily/domain/customer/service/CustomerServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java @@ -1,11 +1,11 @@ -package com.jpaweekily.domain.customer.service; +package com.jpaweekily.domain.customer.application; import com.jpaweekily.domain.customer.Customer; import com.jpaweekily.domain.customer.CustomerMapper; import com.jpaweekily.domain.customer.dto.CustomerRequest; import com.jpaweekily.domain.customer.dto.CustomerResponse; import com.jpaweekily.domain.customer.dto.CustomerUpdate; -import com.jpaweekily.domain.customer.repository.CustomerRepository; +import com.jpaweekily.domain.customer.infrastructrue.CustomerRepository; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java b/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java similarity index 88% rename from src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java rename to src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java index edc28823e..6729733c2 100644 --- a/src/main/java/com/jpaweekily/domain/customer/repository/CustomerRepository.java +++ b/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.customer.repository; +package com.jpaweekily.domain.customer.infrastructrue; import com.jpaweekily.domain.customer.Customer; import org.springframework.data.domain.Page; diff --git a/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java similarity index 93% rename from src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java rename to src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java index 074a8ec2b..fe0d8689c 100644 --- a/src/main/java/com/jpaweekily/domain/customer/controller/CustomerApiController.java +++ b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java @@ -1,9 +1,9 @@ -package com.jpaweekily.domain.customer.controller; +package com.jpaweekily.domain.customer.presentation; import com.jpaweekily.domain.customer.dto.CustomerRequest; import com.jpaweekily.domain.customer.dto.CustomerResponse; import com.jpaweekily.domain.customer.dto.CustomerUpdate; -import com.jpaweekily.domain.customer.service.CustomerService; +import com.jpaweekily.domain.customer.application.CustomerService; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; @@ -47,6 +47,4 @@ public ResponseEntity customerUpdate(@RequestBody CustomerUpda return ResponseEntity.ok(updated); } - - } diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderService.java b/src/main/java/com/jpaweekily/domain/order/application/OrderService.java new file mode 100644 index 000000000..8f6d3050b --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/application/OrderService.java @@ -0,0 +1,4 @@ +package com.jpaweekily.domain.order.application; + +public interface OrderService { +} diff --git a/src/main/java/com/jpaweekily/domain/order/service/OrderServiceImpl.java b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java similarity index 86% rename from src/main/java/com/jpaweekily/domain/order/service/OrderServiceImpl.java rename to src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java index baaefb4ad..27593260d 100644 --- a/src/main/java/com/jpaweekily/domain/order/service/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java @@ -1,11 +1,11 @@ -package com.jpaweekily.domain.order.service; +package com.jpaweekily.domain.order.application; import com.jpaweekily.domain.order.Order; import com.jpaweekily.domain.order.OrderStatus; import com.jpaweekily.domain.order.dto.OrderCreateRequest; -import com.jpaweekily.domain.order.repository.OrderRepository; +import com.jpaweekily.domain.order.infrastructrue.OrderRepository; import com.jpaweekily.domain.user.User; -import com.jpaweekily.domain.user.repository.UserRepository; +import com.jpaweekily.domain.user.infrastructrue.UserRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/jpaweekily/domain/order/repository/OrderRepository.java b/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderRepository.java similarity index 77% rename from src/main/java/com/jpaweekily/domain/order/repository/OrderRepository.java rename to src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderRepository.java index a5bc03f52..9aa18d998 100644 --- a/src/main/java/com/jpaweekily/domain/order/repository/OrderRepository.java +++ b/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderRepository.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.order.repository; +package com.jpaweekily.domain.order.infrastructrue; import com.jpaweekily.domain.order.Order; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/com/jpaweekily/domain/order/service/OrderService.java b/src/main/java/com/jpaweekily/domain/order/service/OrderService.java deleted file mode 100644 index 99158d4c9..000000000 --- a/src/main/java/com/jpaweekily/domain/order/service/OrderService.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.jpaweekily.domain.order.service; - -public interface OrderService { -} diff --git a/src/main/java/com/jpaweekily/domain/product/application/ProductService.java b/src/main/java/com/jpaweekily/domain/product/application/ProductService.java new file mode 100644 index 000000000..6548968bd --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/product/application/ProductService.java @@ -0,0 +1,4 @@ +package com.jpaweekily.domain.product.application; + +public interface ProductService { +} diff --git a/src/main/java/com/jpaweekily/domain/product/service/ProductServiceImpl.java b/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java similarity index 86% rename from src/main/java/com/jpaweekily/domain/product/service/ProductServiceImpl.java rename to src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java index 9016cd9d1..8ef517170 100644 --- a/src/main/java/com/jpaweekily/domain/product/service/ProductServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java @@ -1,9 +1,9 @@ -package com.jpaweekily.domain.product.service; +package com.jpaweekily.domain.product.application; import com.jpaweekily.domain.product.Product; import com.jpaweekily.domain.product.dto.ProductCreateRequest; -import com.jpaweekily.domain.product.repository.ProductRepository; +import com.jpaweekily.domain.product.infrastructrue.ProductRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/jpaweekily/domain/product/repository/ProductRepository.java b/src/main/java/com/jpaweekily/domain/product/infrastructrue/ProductRepository.java similarity index 77% rename from src/main/java/com/jpaweekily/domain/product/repository/ProductRepository.java rename to src/main/java/com/jpaweekily/domain/product/infrastructrue/ProductRepository.java index b9a6e496b..e5a81bb31 100644 --- a/src/main/java/com/jpaweekily/domain/product/repository/ProductRepository.java +++ b/src/main/java/com/jpaweekily/domain/product/infrastructrue/ProductRepository.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.product.repository; +package com.jpaweekily.domain.product.infrastructrue; import com.jpaweekily.domain.product.Product; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/com/jpaweekily/domain/product/service/ProductService.java b/src/main/java/com/jpaweekily/domain/product/service/ProductService.java deleted file mode 100644 index 8be4a8c4c..000000000 --- a/src/main/java/com/jpaweekily/domain/product/service/ProductService.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.jpaweekily.domain.product.service; - -public interface ProductService { -} diff --git a/src/main/java/com/jpaweekily/domain/user/application/UserService.java b/src/main/java/com/jpaweekily/domain/user/application/UserService.java new file mode 100644 index 000000000..fd5fa547a --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/user/application/UserService.java @@ -0,0 +1,4 @@ +package com.jpaweekily.domain.user.application; + +public interface UserService { +} diff --git a/src/main/java/com/jpaweekily/domain/user/service/UserServiceImpl.java b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java similarity index 88% rename from src/main/java/com/jpaweekily/domain/user/service/UserServiceImpl.java rename to src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java index 7e206566c..944a15f85 100644 --- a/src/main/java/com/jpaweekily/domain/user/service/UserServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java @@ -1,8 +1,8 @@ -package com.jpaweekily.domain.user.service; +package com.jpaweekily.domain.user.application; import com.jpaweekily.domain.user.User; import com.jpaweekily.domain.user.dto.UserCreateRequest; -import com.jpaweekily.domain.user.repository.UserRepository; +import com.jpaweekily.domain.user.infrastructrue.UserRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/jpaweekily/domain/user/repository/UserRepository.java b/src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java similarity index 83% rename from src/main/java/com/jpaweekily/domain/user/repository/UserRepository.java rename to src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java index 6fa55949f..4fe6932c3 100644 --- a/src/main/java/com/jpaweekily/domain/user/repository/UserRepository.java +++ b/src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.user.repository; +package com.jpaweekily.domain.user.infrastructrue; import com.jpaweekily.domain.user.User; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/com/jpaweekily/domain/user/service/UserService.java b/src/main/java/com/jpaweekily/domain/user/service/UserService.java deleted file mode 100644 index 091e3b2e2..000000000 --- a/src/main/java/com/jpaweekily/domain/user/service/UserService.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.jpaweekily.domain.user.service; - -public interface UserService { -} diff --git a/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java b/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java similarity index 98% rename from src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java rename to src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java index 322479299..270283370 100644 --- a/src/test/java/com/jpaweekily/domain/customer/service/CustomerServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.customer.service; +package com.jpaweekily.domain.customer.application; import com.jpaweekily.domain.customer.dto.CustomerRequest; import com.jpaweekily.domain.customer.dto.CustomerResponse; diff --git a/src/test/java/com/jpaweekily/domain/customer/service/LifeCycleTest.java b/src/test/java/com/jpaweekily/domain/customer/application/LifeCycleTest.java similarity index 82% rename from src/test/java/com/jpaweekily/domain/customer/service/LifeCycleTest.java rename to src/test/java/com/jpaweekily/domain/customer/application/LifeCycleTest.java index 999fd3002..a18205899 100644 --- a/src/test/java/com/jpaweekily/domain/customer/service/LifeCycleTest.java +++ b/src/test/java/com/jpaweekily/domain/customer/application/LifeCycleTest.java @@ -1,6 +1,5 @@ -package com.jpaweekily.domain.customer.service; +package com.jpaweekily.domain.customer.application; -import com.jpaweekily.domain.customer.Customer; import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; import org.junit.jupiter.api.Test; From d2a857393b7cf5727299bde368d11a10c3c18c1c Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:19:21 +0900 Subject: [PATCH 05/67] =?UTF-8?q?feat:=20OrderProductRepository=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/infrastructrue/OrderProductRepository.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java b/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java new file mode 100644 index 000000000..62d7b91b7 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java @@ -0,0 +1,7 @@ +package com.jpaweekily.domain.order.infrastructrue; + +import com.jpaweekily.domain.order.OrderProduct; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface OrderProductRepository extends JpaRepository { +} From 2c18ba80bb1bea9172a0605c9d8942b11dde44a4 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:19:39 +0900 Subject: [PATCH 06/67] =?UTF-8?q?feat:=20OrderProductCreate=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jpaweekily/domain/order/dto/OrderProductCreate.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java b/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java new file mode 100644 index 000000000..c78c0ffc3 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java @@ -0,0 +1,7 @@ +package com.jpaweekily.domain.order.dto; + +public record OrderProductCreate( + Long productId, + int quantity +) { +} From f8cb85dc4053f3f05d5f8ac370fa5721bd3ae117 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:20:13 +0900 Subject: [PATCH 07/67] =?UTF-8?q?refactor:=20Users=20getter=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jpaweekily/domain/user/User.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jpaweekily/domain/user/User.java b/src/main/java/com/jpaweekily/domain/user/User.java index a21dee267..888e3bf28 100644 --- a/src/main/java/com/jpaweekily/domain/user/User.java +++ b/src/main/java/com/jpaweekily/domain/user/User.java @@ -3,12 +3,14 @@ import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; +import lombok.Getter; import lombok.NoArgsConstructor; import java.time.LocalDateTime; -@Entity @Table(name = "users") +@Entity +@Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) public class User { From cfbbb88407574c42c113f4af68327bedf9235205 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:20:58 +0900 Subject: [PATCH 08/67] =?UTF-8?q?refactor:=20OrderCreateRequest=EC=97=90?= =?UTF-8?q?=20orderProduct=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekily/domain/order/dto/OrderCreateRequest.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java b/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java index 50bf7f095..9903084f8 100644 --- a/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java +++ b/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java @@ -1,7 +1,10 @@ package com.jpaweekily.domain.order.dto; +import java.util.List; + public record OrderCreateRequest ( String nickName, - String address + String address, + List orderProductCreateList ){ } From 9f7b91e2e49c94e39ae9ac1228dadf10c7fc0b72 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:22:21 +0900 Subject: [PATCH 09/67] =?UTF-8?q?refactor:=20fetch=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?Lazy=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jpaweekily/domain/order/Order.java | 3 ++- src/main/java/com/jpaweekily/domain/order/OrderProduct.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/order/Order.java b/src/main/java/com/jpaweekily/domain/order/Order.java index 1117fd66b..83f89fcb4 100644 --- a/src/main/java/com/jpaweekily/domain/order/Order.java +++ b/src/main/java/com/jpaweekily/domain/order/Order.java @@ -26,7 +26,7 @@ public class Order { private LocalDateTime createAt; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") private User user; @@ -37,4 +37,5 @@ public Order(String address, OrderStatus orderStatus, LocalDateTime createAt, Us this.createAt = createAt; this.user = user; } + } diff --git a/src/main/java/com/jpaweekily/domain/order/OrderProduct.java b/src/main/java/com/jpaweekily/domain/order/OrderProduct.java index 0f910bc2b..6caa75e2a 100644 --- a/src/main/java/com/jpaweekily/domain/order/OrderProduct.java +++ b/src/main/java/com/jpaweekily/domain/order/OrderProduct.java @@ -17,11 +17,11 @@ public class OrderProduct { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "order_id") private Order order; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "product_id") private Product product; From 28a436ac3405b48781a407ccd18d6ce349e4e5c1 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:32:44 +0900 Subject: [PATCH 10/67] =?UTF-8?q?refactor:=20userService=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=B0=98=ED=99=98=20Long=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekily/domain/user/application/UserService.java | 3 +++ .../jpaweekily/domain/user/application/UserServiceImpl.java | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jpaweekily/domain/user/application/UserService.java b/src/main/java/com/jpaweekily/domain/user/application/UserService.java index fd5fa547a..ef90ba913 100644 --- a/src/main/java/com/jpaweekily/domain/user/application/UserService.java +++ b/src/main/java/com/jpaweekily/domain/user/application/UserService.java @@ -1,4 +1,7 @@ package com.jpaweekily.domain.user.application; +import com.jpaweekily.domain.user.dto.UserCreateRequest; + public interface UserService { + Long createUser(UserCreateRequest request); } diff --git a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java index 944a15f85..57e42002b 100644 --- a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java @@ -19,7 +19,7 @@ public UserServiceImpl(UserRepository userRepository) { this.userRepository = userRepository; } - public void createUser(UserCreateRequest request) { + public Long createUser(UserCreateRequest request) { User user = User.builder() .loginId(request.loginId()) .password(request.password()) @@ -28,5 +28,7 @@ public void createUser(UserCreateRequest request) { .build(); userRepository.save(user); + + return user.getId(); } } From 2fabaaab9fd559a6cc74ef3cf0622868c46b9fcd Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:35:24 +0900 Subject: [PATCH 11/67] =?UTF-8?q?test:=20user=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/application/UserServiceImplTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java diff --git a/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java b/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java new file mode 100644 index 000000000..6362759e6 --- /dev/null +++ b/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java @@ -0,0 +1,26 @@ +package com.jpaweekily.domain.user.application; + +import com.jpaweekily.domain.user.dto.UserCreateRequest; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import static org.assertj.core.api.Assertions.*; + +@SpringBootTest +class UserServiceImplTest { + + @Autowired + private UserService userService; + + + @Test + void create_user_test() { + UserCreateRequest userCreateRequest = new UserCreateRequest("test", "123", "tester"); + + Long userId = userService.createUser(userCreateRequest); + + assertThat(userId).isNotNull(); + } + +} \ No newline at end of file From b4d98a8babc20820b3361ec61267be7bb25520f8 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:36:03 +0900 Subject: [PATCH 12/67] =?UTF-8?q?refactor:=20=EC=83=81=ED=92=88=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1=20=EB=B0=98=ED=99=98=ED=83=80=EC=9E=85=20Lon?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jpaweekily/domain/product/application/ProductService.java | 3 +++ .../domain/product/application/ProductServiceImpl.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/product/application/ProductService.java b/src/main/java/com/jpaweekily/domain/product/application/ProductService.java index 6548968bd..1134a0392 100644 --- a/src/main/java/com/jpaweekily/domain/product/application/ProductService.java +++ b/src/main/java/com/jpaweekily/domain/product/application/ProductService.java @@ -1,4 +1,7 @@ package com.jpaweekily.domain.product.application; +import com.jpaweekily.domain.product.dto.ProductCreateRequest; + public interface ProductService { + Long createProduct(ProductCreateRequest request); } diff --git a/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java b/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java index 8ef517170..9c2ddc623 100644 --- a/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java @@ -17,12 +17,12 @@ public ProductServiceImpl(ProductRepository productRepository) { this.productRepository = productRepository; } - public void createProduct(ProductCreateRequest request) { + public Long createProduct(ProductCreateRequest request) { Product product = Product.builder() .productName(request.productName()) .price(request.price()) .build(); - productRepository.save(product); + return product.getId(); } } From 890732e79f24e7910ca4147d4008e423b38af179 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:37:54 +0900 Subject: [PATCH 13/67] =?UTF-8?q?test:=20=EC=83=81=ED=92=88=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/ProductServiceImplTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java diff --git a/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java b/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java new file mode 100644 index 000000000..f6aa9c459 --- /dev/null +++ b/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java @@ -0,0 +1,25 @@ +package com.jpaweekily.domain.product.application; + +import com.jpaweekily.domain.product.dto.ProductCreateRequest; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import static org.assertj.core.api.Assertions.*; + +@SpringBootTest +class ProductServiceImplTest { + + @Autowired + private ProductService productService; + + @Test + void create_product_test() { + ProductCreateRequest request = new ProductCreateRequest("주먹밥", 100); + + Long productId = productService.createProduct(request); + + assertThat(productId).isNotNull(); + } + +} \ No newline at end of file From 01c622e0f0f8eeb5b3560c4b17b3c6ae238ab824 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:45:16 +0900 Subject: [PATCH 14/67] =?UTF-8?q?test:=20=EC=A3=BC=EB=AC=B8=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/application/OrderService.java | 3 ++ .../order/application/OrderServiceImpl.java | 24 +++++++++-- .../application/OrderServiceImplTest.java | 41 +++++++++++++++++++ 3 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderService.java b/src/main/java/com/jpaweekily/domain/order/application/OrderService.java index 8f6d3050b..d430e638f 100644 --- a/src/main/java/com/jpaweekily/domain/order/application/OrderService.java +++ b/src/main/java/com/jpaweekily/domain/order/application/OrderService.java @@ -1,4 +1,7 @@ package com.jpaweekily.domain.order.application; +import com.jpaweekily.domain.order.dto.OrderCreateRequest; + public interface OrderService { + Long createOrder(OrderCreateRequest request); } diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java index 27593260d..baa170a5e 100644 --- a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java @@ -1,9 +1,13 @@ package com.jpaweekily.domain.order.application; import com.jpaweekily.domain.order.Order; +import com.jpaweekily.domain.order.OrderProduct; import com.jpaweekily.domain.order.OrderStatus; import com.jpaweekily.domain.order.dto.OrderCreateRequest; +import com.jpaweekily.domain.order.infrastructrue.OrderProductRepository; import com.jpaweekily.domain.order.infrastructrue.OrderRepository; +import com.jpaweekily.domain.product.Product; +import com.jpaweekily.domain.product.infrastructrue.ProductRepository; import com.jpaweekily.domain.user.User; import com.jpaweekily.domain.user.infrastructrue.UserRepository; import org.springframework.stereotype.Service; @@ -17,13 +21,17 @@ public class OrderServiceImpl implements OrderService { private final OrderRepository orderRepository; private final UserRepository userRepository; + private final ProductRepository productRepository; + private final OrderProductRepository orderProductRepository; - public OrderServiceImpl(OrderRepository orderRepository, UserRepository userRepository) { + public OrderServiceImpl(OrderRepository orderRepository, UserRepository userRepository, ProductRepository productRepository, OrderProductRepository orderProductRepository) { this.orderRepository = orderRepository; this.userRepository = userRepository; + this.productRepository = productRepository; + this.orderProductRepository = orderProductRepository; } - public void createOrder(OrderCreateRequest request) { + public Long createOrder(OrderCreateRequest request) { User user = userRepository.findByNickName(request.nickName()).orElseThrow(IllegalArgumentException::new); Order order = Order.builder() @@ -32,7 +40,17 @@ public void createOrder(OrderCreateRequest request) { .createAt(LocalDateTime.now()) .user(user) .build(); - orderRepository.save(order); + + request.orderProductCreateList().forEach(item -> { + Product product = productRepository.findById(item.productId()).orElseThrow(IllegalArgumentException::new); + OrderProduct orderProduct = OrderProduct.builder() + .order(order) + .product(product) + .quantity(item.quantity()) + .build(); + orderProductRepository.save(orderProduct); + }); + return order.getId(); } } diff --git a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java b/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java new file mode 100644 index 000000000..f3bd8366a --- /dev/null +++ b/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java @@ -0,0 +1,41 @@ +package com.jpaweekily.domain.order.application; + +import com.jpaweekily.domain.order.dto.OrderCreateRequest; +import com.jpaweekily.domain.order.dto.OrderProductCreate; +import com.jpaweekily.domain.product.application.ProductService; +import com.jpaweekily.domain.product.dto.ProductCreateRequest; +import com.jpaweekily.domain.user.application.UserService; +import com.jpaweekily.domain.user.dto.UserCreateRequest; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import static org.assertj.core.api.Assertions.*; + +import java.util.List; + +@SpringBootTest +class OrderServiceImplTest { + + @Autowired + private OrderService orderService; + + @Autowired + private ProductService productService; + + @Autowired + private UserService userService; + + @Test + void order_create_test() { + userService.createUser(new UserCreateRequest("test", "123", "tester")); + Long productId = productService.createProduct(new ProductCreateRequest("주먹밥", 100)); + OrderProductCreate orderProductCreate = new OrderProductCreate(productId, 3); + OrderCreateRequest orderCreateRequest = new OrderCreateRequest("tester", "수원시", List.of(orderProductCreate)); + + Long orderId = orderService.createOrder(orderCreateRequest); + + assertThat(orderId).isNotNull(); + } + +} \ No newline at end of file From da3dc5f44f538ab8aefa16b48555037cea8b22f9 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:46:36 +0900 Subject: [PATCH 15/67] =?UTF-8?q?style:=20=EC=BD=94=EB=93=9C=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=EB=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jpaweekily/domain/product/Product.java | 2 -- .../application/CustomerServiceImplTest.java | 2 +- .../customer/application/LifeCycleTest.java | 21 ------------------- .../application/OrderServiceImplTest.java | 2 +- .../application/ProductServiceImplTest.java | 2 +- .../user/application/UserServiceImplTest.java | 2 +- 6 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 src/test/java/com/jpaweekily/domain/customer/application/LifeCycleTest.java diff --git a/src/main/java/com/jpaweekily/domain/product/Product.java b/src/main/java/com/jpaweekily/domain/product/Product.java index 11c8c9540..01d4a20fa 100644 --- a/src/main/java/com/jpaweekily/domain/product/Product.java +++ b/src/main/java/com/jpaweekily/domain/product/Product.java @@ -22,8 +22,6 @@ public class Product { private int price; - - @Builder public Product(String productName, int price) { this.productName = productName; diff --git a/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java b/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java index 270283370..f4682e218 100644 --- a/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java @@ -86,4 +86,4 @@ void deleteTest() { .isInstanceOf(IllegalArgumentException.class); } -} \ No newline at end of file +} diff --git a/src/test/java/com/jpaweekily/domain/customer/application/LifeCycleTest.java b/src/test/java/com/jpaweekily/domain/customer/application/LifeCycleTest.java deleted file mode 100644 index a18205899..000000000 --- a/src/test/java/com/jpaweekily/domain/customer/application/LifeCycleTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.jpaweekily.domain.customer.application; - -import jakarta.persistence.EntityManager; -import jakarta.persistence.EntityManagerFactory; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -public class LifeCycleTest { - - @Autowired - EntityManagerFactory emf; - - @Test - void test() { - EntityManager entityManager = emf.createEntityManager(); - - } - -} diff --git a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java b/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java index f3bd8366a..e3f69a327 100644 --- a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java @@ -38,4 +38,4 @@ void order_create_test() { assertThat(orderId).isNotNull(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java b/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java index f6aa9c459..bff20c557 100644 --- a/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java @@ -22,4 +22,4 @@ void create_product_test() { assertThat(productId).isNotNull(); } -} \ No newline at end of file +} diff --git a/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java b/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java index 6362759e6..25167ad51 100644 --- a/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java @@ -23,4 +23,4 @@ void create_user_test() { assertThat(userId).isNotNull(); } -} \ No newline at end of file +} From 51b1d783e41351b915c3759bd60ae9ad75bc1e0a Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 20:50:19 +0900 Subject: [PATCH 16/67] =?UTF-8?q?style:=20=EC=BD=94=EB=93=9C=20=EC=8A=A4?= =?UTF-8?q?=ED=83=80=EC=9D=BC=EB=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekily/domain/user/application/UserServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java index 57e42002b..2565697a2 100644 --- a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java @@ -26,9 +26,7 @@ public Long createUser(UserCreateRequest request) { .nickName(request.nickName()) .createdAt(LocalDateTime.now()) .build(); - userRepository.save(user); - return user.getId(); } } From 11077453a81b19498739c4265ee31a3cb485d179 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 21:00:11 +0900 Subject: [PATCH 17/67] =?UTF-8?q?feat:=20Response=20=EA=B0=9D=EC=B2=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/order/dto/OrderResponse.java | 22 +++++++++++++++++++ .../domain/product/dto/ProductResponse.java | 15 +++++++++++++ .../java/com/jpaweekily/domain/user/User.java | 6 ++--- .../domain/user/dto/UserResponse.java | 21 ++++++++++++++++++ 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/jpaweekily/domain/order/dto/OrderResponse.java create mode 100644 src/main/java/com/jpaweekily/domain/product/dto/ProductResponse.java create mode 100644 src/main/java/com/jpaweekily/domain/user/dto/UserResponse.java diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderResponse.java b/src/main/java/com/jpaweekily/domain/order/dto/OrderResponse.java new file mode 100644 index 000000000..dcdd6fb15 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/dto/OrderResponse.java @@ -0,0 +1,22 @@ +package com.jpaweekily.domain.order.dto; + +import com.jpaweekily.domain.order.Order; +import com.jpaweekily.domain.order.OrderStatus; + +import java.time.LocalDateTime; + +public record OrderResponse( + Long id, + String nickname, + String address, + OrderStatus orderStatus, + LocalDateTime createdAt +) { + public static OrderResponse from(Order order) { + return new OrderResponse(order.getId(), + order.getUser().getNickname(), + order.getAddress(), + order.getOrderStatus(), + order.getCreateAt()); + } +} diff --git a/src/main/java/com/jpaweekily/domain/product/dto/ProductResponse.java b/src/main/java/com/jpaweekily/domain/product/dto/ProductResponse.java new file mode 100644 index 000000000..f47c659b0 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/product/dto/ProductResponse.java @@ -0,0 +1,15 @@ +package com.jpaweekily.domain.product.dto; + +import com.jpaweekily.domain.product.Product; + +public record ProductResponse( + Long id, + String ProductName, + int price +) { + public static ProductResponse from(Product product) { + return new ProductResponse(product.getId(), + product.getProductName(), + product.getPrice()); + } +} diff --git a/src/main/java/com/jpaweekily/domain/user/User.java b/src/main/java/com/jpaweekily/domain/user/User.java index 888e3bf28..860f898aa 100644 --- a/src/main/java/com/jpaweekily/domain/user/User.java +++ b/src/main/java/com/jpaweekily/domain/user/User.java @@ -25,14 +25,14 @@ public class User { private String password; @Column(unique = true, nullable = false) - private String nickName; + private String nickname; private LocalDateTime createdAt; @Builder - public User(String loginId, String nickName, String password, LocalDateTime createdAt) { + public User(String loginId, String nickname, String password, LocalDateTime createdAt) { this.loginId = loginId; - this.nickName = nickName; + this.nickname = nickname; this.password = password; this.createdAt = createdAt; } diff --git a/src/main/java/com/jpaweekily/domain/user/dto/UserResponse.java b/src/main/java/com/jpaweekily/domain/user/dto/UserResponse.java new file mode 100644 index 000000000..e0484386d --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/user/dto/UserResponse.java @@ -0,0 +1,21 @@ +package com.jpaweekily.domain.user.dto; + +import com.jpaweekily.domain.user.User; + +import java.time.LocalDateTime; + +public record UserResponse( + Long id, + String loginId, + String password, + String nickname, + LocalDateTime createdAt +) { + public static UserResponse from(User user) { + return new UserResponse(user.getId(), + user.getLoginId(), + user.getPassword(), + user.getNickname(), + user.getCreatedAt()); + } +} From 15280c5050a47b855bd71e5c10b1cdd89e10ecf9 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 21:01:12 +0900 Subject: [PATCH 18/67] =?UTF-8?q?refactor:=20nickName=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20->=20nickname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekily/domain/user/application/UserServiceImpl.java | 2 +- .../java/com/jpaweekily/domain/user/dto/UserCreateRequest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java index 2565697a2..c2dcae812 100644 --- a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java @@ -23,7 +23,7 @@ public Long createUser(UserCreateRequest request) { User user = User.builder() .loginId(request.loginId()) .password(request.password()) - .nickName(request.nickName()) + .nickname(request.nickname()) .createdAt(LocalDateTime.now()) .build(); userRepository.save(user); diff --git a/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java b/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java index 7641482c0..4e83bd0f1 100644 --- a/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java +++ b/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java @@ -3,6 +3,6 @@ public record UserCreateRequest ( String loginId, String password, - String nickName + String nickname ){ } From e9ca8856187cfd3b82bd3957ecb76ca352d995d4 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 22:07:32 +0900 Subject: [PATCH 19/67] =?UTF-8?q?refactor:=20nickName=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=AA=85=20->=20nickname?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/order/application/OrderServiceImpl.java | 8 +++++++- .../domain/user/infrastructrue/UserRepository.java | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java index baa170a5e..ffd262995 100644 --- a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java @@ -4,6 +4,7 @@ import com.jpaweekily.domain.order.OrderProduct; import com.jpaweekily.domain.order.OrderStatus; import com.jpaweekily.domain.order.dto.OrderCreateRequest; +import com.jpaweekily.domain.order.dto.OrderResponse; import com.jpaweekily.domain.order.infrastructrue.OrderProductRepository; import com.jpaweekily.domain.order.infrastructrue.OrderRepository; import com.jpaweekily.domain.product.Product; @@ -32,7 +33,7 @@ public OrderServiceImpl(OrderRepository orderRepository, UserRepository userRepo } public Long createOrder(OrderCreateRequest request) { - User user = userRepository.findByNickName(request.nickName()).orElseThrow(IllegalArgumentException::new); + User user = userRepository.findByNickname(request.nickName()).orElseThrow(IllegalArgumentException::new); Order order = Order.builder() .address(request.address()) @@ -53,4 +54,9 @@ public Long createOrder(OrderCreateRequest request) { }); return order.getId(); } + + public OrderResponse findOrderById(Long id) { + Order order = orderRepository.findById(id).orElseThrow(IllegalArgumentException::new); + return OrderResponse.from(order); + } } diff --git a/src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java b/src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java index 4fe6932c3..0b9069c14 100644 --- a/src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java +++ b/src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java @@ -7,5 +7,5 @@ public interface UserRepository extends JpaRepository { - Optional findByNickName(String nickName); + Optional findByNickname(String nickname); } From 1dcfec1b48c84e8b8111640730f7f84c15406d7e Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 30 Jul 2023 22:18:09 +0900 Subject: [PATCH 20/67] =?UTF-8?q?feat:=20application=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 2 +- src/test/resources/application.yml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/application.yml diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 89cfab3e4..10c25b49c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -14,7 +14,7 @@ spring: jpa: open-in-view: false hibernate: - ddl-auto: create + ddl-auto: none properties: hibernate: format_sql: true diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml new file mode 100644 index 000000000..3e86de1b3 --- /dev/null +++ b/src/test/resources/application.yml @@ -0,0 +1,5 @@ +spring: + datasource: + url: jdbc:h2:mem:board + username: sa + password: From 591e0e32c9de806e3d66833923695dc645e4cb68 Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 31 Jul 2023 22:23:59 +0900 Subject: [PATCH 21/67] =?UTF-8?q?feedback:=20@Column=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jpaweekily/domain/customer/Customer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/Customer.java b/src/main/java/com/jpaweekily/domain/customer/Customer.java index 33326b7ca..86071ce12 100644 --- a/src/main/java/com/jpaweekily/domain/customer/Customer.java +++ b/src/main/java/com/jpaweekily/domain/customer/Customer.java @@ -14,7 +14,6 @@ public class Customer { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; - @Column(name = "first_Name", nullable = false) private String firstName; private String lastName; From 2acc0c9045af1089f75ad29cc27b1c1684af34aa Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 18:31:33 +0900 Subject: [PATCH 22/67] =?UTF-8?q?feedback:=20Customer=20=EA=B0=9D=EC=B2=B4?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekily/domain/customer/Customer.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/Customer.java b/src/main/java/com/jpaweekily/domain/customer/Customer.java index 86071ce12..9c51ca26e 100644 --- a/src/main/java/com/jpaweekily/domain/customer/Customer.java +++ b/src/main/java/com/jpaweekily/domain/customer/Customer.java @@ -1,34 +1,35 @@ package com.jpaweekily.domain.customer; import jakarta.persistence.*; +import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +@Table(name = "customers") @Getter @Entity -@NoArgsConstructor +@NoArgsConstructor(access = AccessLevel.PROTECTED) public class Customer { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; + @Column(name = "first_name", nullable = false) private String firstName; + @Column(name = "first_name", nullable = false) private String lastName; @Builder - public Customer(String firstName, String lastName) { + private Customer(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } - public void changeFirstName(String firstName) { + public void update(String firstName, String lastName) { this.firstName = firstName; - } - - public void changeLastName(String lastName) { this.lastName = lastName; } } From b2c77d461a3000e0690d121cbaf96b45f83eb451 Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 18:34:23 +0900 Subject: [PATCH 23/67] =?UTF-8?q?feedback:=20CustomerMapper=20=EB=A1=AC?= =?UTF-8?q?=EB=B3=B5=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/jpaweekily/domain/customer/CustomerMapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java b/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java index 3d4b02c56..92bab1f5c 100644 --- a/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java +++ b/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java @@ -2,12 +2,12 @@ import com.jpaweekily.domain.customer.dto.CustomerRequest; import com.jpaweekily.domain.customer.dto.CustomerResponse; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +@NoArgsConstructor(access = AccessLevel.PRIVATE) public class CustomerMapper { - private CustomerMapper() { - } - public static CustomerResponse convertEntityToResponse(Customer customer) { return new CustomerResponse(customer.getId(), customer.getFirstName(), customer.getLastName()); } From 6f7e559b4416b714af9bed193c3c8dc0a3827ce4 Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 18:41:16 +0900 Subject: [PATCH 24/67] =?UTF-8?q?feedback:=20CustomerService=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=20=ED=83=80=EC=9E=85=20=EB=B0=8F=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customer/application/CustomerService.java | 4 +--- .../application/CustomerServiceImpl.java | 19 ++++--------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java b/src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java index 62d56468a..187688835 100644 --- a/src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java +++ b/src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java @@ -14,11 +14,9 @@ public interface CustomerService { CustomerResponse findCustomerById(Long id); - List findCustomers(); - Page findCustomersWithPaging(Pageable pageable); - CustomerResponse update(CustomerUpdate request); + void update(Long id, CustomerUpdate request); void delete(Long id); diff --git a/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java b/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java index c82a3964c..b17590e4f 100644 --- a/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java @@ -11,8 +11,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - @Transactional(readOnly = true) @Service public class CustomerServiceImpl implements CustomerService { @@ -26,8 +24,7 @@ public CustomerServiceImpl(CustomerRepository customerRepository) { @Transactional public Long create(CustomerRequest request) { Customer customer = CustomerMapper.convertRequestToEntity(request); - customerRepository.save(customer); - return customer.getId(); + return customerRepository.save(customer).getId(); } public CustomerResponse findCustomerById(Long id) { @@ -35,23 +32,15 @@ public CustomerResponse findCustomerById(Long id) { return CustomerMapper.convertEntityToResponse(customer); } - public List findCustomers() { - return customerRepository.findAll().stream() - .map(CustomerMapper::convertEntityToResponse) - .toList(); - } - public Page findCustomersWithPaging(Pageable pageable) { return customerRepository.findAll(pageable) .map(CustomerMapper::convertEntityToResponse); } @Transactional - public CustomerResponse update(CustomerUpdate request) { - Customer customer = customerRepository.findById(request.id()).orElseThrow(IllegalArgumentException::new); - customer.changeFirstName(request.firstName()); - customer.changeLastName(request.lastName()); - return CustomerMapper.convertEntityToResponse(customer); + public void update(Long id, CustomerUpdate request) { + Customer customer = customerRepository.findById(id).orElseThrow(IllegalArgumentException::new); + customer.update(request.firstName(), request.lastName()); } @Transactional From c4b15ec8155d407e7120792c534e067966c34d1d Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 22:16:33 +0900 Subject: [PATCH 25/67] =?UTF-8?q?feedback:=20CustomerResponse=20=EB=B3=80?= =?UTF-8?q?=ED=99=98=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekily/domain/customer/dto/CustomerResponse.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java index 69857a8e4..c65178a1e 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java @@ -1,13 +1,8 @@ package com.jpaweekily.domain.customer.dto; -import com.jpaweekily.domain.customer.Customer; - public record CustomerResponse ( Long id, String firstName, String lastName ){ - public static CustomerResponse from(Customer customer) { - return new CustomerResponse(customer.getId(), customer.getFirstName(), customer.getLastName()); - } } From 19fabb1f44b9f4494526157735a3bce78f701b17 Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 22:18:41 +0900 Subject: [PATCH 26/67] =?UTF-8?q?feedback:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/customer/infrastructrue/CustomerRepository.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java b/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java index 6729733c2..e61176862 100644 --- a/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java +++ b/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java @@ -5,12 +5,8 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; -import java.util.Optional; - public interface CustomerRepository extends JpaRepository { - Optional findByFirstName(String firstname); - Page findAll(Pageable pageable); } From 34399eaf215384bd57fb5b20035698254d4e17d9 Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 22:21:15 +0900 Subject: [PATCH 27/67] =?UTF-8?q?feedback:=20CustomerApiController=20?= =?UTF-8?q?=ED=94=BC=EB=93=9C=EB=B0=B1=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/CustomerApiController.java | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java index fe0d8689c..1d097f2f2 100644 --- a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java +++ b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java @@ -4,6 +4,7 @@ import com.jpaweekily.domain.customer.dto.CustomerResponse; import com.jpaweekily.domain.customer.dto.CustomerUpdate; import com.jpaweekily.domain.customer.application.CustomerService; +import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; @@ -11,23 +12,13 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import java.util.List; - @RestController @RequestMapping("/api/v1/customers") +@RequiredArgsConstructor public class CustomerApiController { private final CustomerService customerService; - public CustomerApiController(CustomerService customerService) { - this.customerService = customerService; - } - - @GetMapping - public ResponseEntity> customerList() { - List customers = customerService.findCustomers(); - return ResponseEntity.ok(customers); - } @GetMapping("/page") public ResponseEntity> customerPage(@PageableDefault() Pageable pageable) { @@ -41,10 +32,10 @@ public ResponseEntity customerCreate(@RequestBody CustomerRequest request) return new ResponseEntity<>(id, HttpStatus.CREATED); } - @PatchMapping("/update") - public ResponseEntity customerUpdate(@RequestBody CustomerUpdate request) { - CustomerResponse updated = customerService.update(request); - return ResponseEntity.ok(updated); + @PatchMapping("/{id}") + public ResponseEntity customerUpdate(@PathVariable Long id, @RequestBody CustomerUpdate request) { + customerService.update(id, request); + return ResponseEntity.ok().build(); } } From 93077d64947da52d7b6d5958333ea498149698a0 Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 22:21:29 +0900 Subject: [PATCH 28/67] =?UTF-8?q?feedback:=20CustomerApiController=20?= =?UTF-8?q?=ED=94=BC=EB=93=9C=EB=B0=B1=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jpaweekily/domain/customer/Customer.java | 2 +- .../java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/Customer.java b/src/main/java/com/jpaweekily/domain/customer/Customer.java index 9c51ca26e..8eba91ae5 100644 --- a/src/main/java/com/jpaweekily/domain/customer/Customer.java +++ b/src/main/java/com/jpaweekily/domain/customer/Customer.java @@ -19,7 +19,7 @@ public class Customer { @Column(name = "first_name", nullable = false) private String firstName; - @Column(name = "first_name", nullable = false) + @Column(name = "last_name", nullable = false) private String lastName; @Builder diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java index c50a5f71d..a74769dda 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java @@ -1,7 +1,6 @@ package com.jpaweekily.domain.customer.dto; public record CustomerUpdate ( - Long id, String firstName, String lastName ) { From efc5e30256538c200545a9d1e3cb8330e4ebe59d Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 22:21:49 +0900 Subject: [PATCH 29/67] =?UTF-8?q?test:=20CustomerServiceImplTest=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/CustomerServiceImplTest.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java b/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java index f4682e218..128b8ebf6 100644 --- a/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java @@ -6,10 +6,11 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; import org.springframework.transaction.annotation.Transactional; -import java.util.List; - import static org.assertj.core.api.Assertions.*; @Transactional @@ -53,10 +54,11 @@ void findAllTest() { customerService.create(customerRequest2); //when - List customers = customerService.findCustomers(); + Pageable pageable = PageRequest.of(0, 10); + Page customers = customerService.findCustomersWithPaging(pageable); //then - assertThat(customers.size()).isEqualTo(2); + assertThat(customers.getTotalElements()).isEqualTo(2); } @Test @@ -64,10 +66,11 @@ void updateTest() { //given CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); Long id = customerService.create(customerRequest); - CustomerUpdate customerUpdate = new CustomerUpdate(id, "god", "sin"); + CustomerUpdate customerUpdate = new CustomerUpdate("god", "sin"); //when - CustomerResponse updated = customerService.update(customerUpdate); + customerService.update(id, customerUpdate); + CustomerResponse updated = customerService.findCustomerById(id); //then assertThat(customerUpdate.firstName()).isEqualTo(updated.firstName()); From e9b2d89f754cf1bcd9628e0fd2f8d18a3ea4522e Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 22:44:34 +0900 Subject: [PATCH 30/67] =?UTF-8?q?feedback:=20create=20=EC=9A=94=EC=B2=AD?= =?UTF-8?q?=20path=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/customer/presentation/CustomerApiController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java index 1d097f2f2..4adba3401 100644 --- a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java +++ b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java @@ -19,7 +19,6 @@ public class CustomerApiController { private final CustomerService customerService; - @GetMapping("/page") public ResponseEntity> customerPage(@PageableDefault() Pageable pageable) { Page customers = customerService.findCustomersWithPaging(pageable); From 7c610f5525b632055adcc46f64ffa825f3643f3b Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 22:48:03 +0900 Subject: [PATCH 31/67] =?UTF-8?q?feedback:=20OrderStatus=20=EB=B0=B0?= =?UTF-8?q?=EC=86=A1=EC=A4=91=20=EC=83=81=ED=83=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jpaweekily/domain/order/OrderStatus.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/jpaweekily/domain/order/OrderStatus.java b/src/main/java/com/jpaweekily/domain/order/OrderStatus.java index fcf6d03a2..4cb9e1abb 100644 --- a/src/main/java/com/jpaweekily/domain/order/OrderStatus.java +++ b/src/main/java/com/jpaweekily/domain/order/OrderStatus.java @@ -2,6 +2,7 @@ public enum OrderStatus { READY_FOR_DELIVERY, + DELIVERING, COMPLETED, CANCELLED } From 531b0ae3797a6322b9c297223df9741c75ac1827 Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 1 Aug 2023 23:49:14 +0900 Subject: [PATCH 32/67] =?UTF-8?q?feedback:=20OrderService=20=ED=94=BC?= =?UTF-8?q?=EB=93=9C=EB=B0=B1=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/application/OrderService.java | 2 +- .../order/application/OrderServiceImpl.java | 23 ++++++------ .../OrderProductBulkRepository.java | 36 +++++++++++++++++++ .../application/OrderServiceImplTest.java | 26 ++++++++++---- src/test/resources/application.yml | 3 ++ 5 files changed, 71 insertions(+), 19 deletions(-) create mode 100644 src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductBulkRepository.java diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderService.java b/src/main/java/com/jpaweekily/domain/order/application/OrderService.java index d430e638f..37d6ab5e2 100644 --- a/src/main/java/com/jpaweekily/domain/order/application/OrderService.java +++ b/src/main/java/com/jpaweekily/domain/order/application/OrderService.java @@ -3,5 +3,5 @@ import com.jpaweekily.domain.order.dto.OrderCreateRequest; public interface OrderService { - Long createOrder(OrderCreateRequest request); + Long createOrder(Long id, OrderCreateRequest request); } diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java index ffd262995..310725ea2 100644 --- a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java @@ -5,35 +5,34 @@ import com.jpaweekily.domain.order.OrderStatus; import com.jpaweekily.domain.order.dto.OrderCreateRequest; import com.jpaweekily.domain.order.dto.OrderResponse; +import com.jpaweekily.domain.order.infrastructrue.OrderProductBulkRepository; import com.jpaweekily.domain.order.infrastructrue.OrderProductRepository; import com.jpaweekily.domain.order.infrastructrue.OrderRepository; import com.jpaweekily.domain.product.Product; import com.jpaweekily.domain.product.infrastructrue.ProductRepository; import com.jpaweekily.domain.user.User; import com.jpaweekily.domain.user.infrastructrue.UserRepository; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; @Transactional(readOnly = true) @Service +@RequiredArgsConstructor public class OrderServiceImpl implements OrderService { private final OrderRepository orderRepository; private final UserRepository userRepository; private final ProductRepository productRepository; - private final OrderProductRepository orderProductRepository; + private final OrderProductBulkRepository orderProductBulkRepository; - public OrderServiceImpl(OrderRepository orderRepository, UserRepository userRepository, ProductRepository productRepository, OrderProductRepository orderProductRepository) { - this.orderRepository = orderRepository; - this.userRepository = userRepository; - this.productRepository = productRepository; - this.orderProductRepository = orderProductRepository; - } - - public Long createOrder(OrderCreateRequest request) { - User user = userRepository.findByNickname(request.nickName()).orElseThrow(IllegalArgumentException::new); + @Transactional + public Long createOrder(Long id, OrderCreateRequest request) { + User user = userRepository.findById(id).orElseThrow(IllegalArgumentException::new); Order order = Order.builder() .address(request.address()) @@ -43,6 +42,7 @@ public Long createOrder(OrderCreateRequest request) { .build(); orderRepository.save(order); + List orderProducts = new ArrayList<>(); request.orderProductCreateList().forEach(item -> { Product product = productRepository.findById(item.productId()).orElseThrow(IllegalArgumentException::new); OrderProduct orderProduct = OrderProduct.builder() @@ -50,8 +50,9 @@ public Long createOrder(OrderCreateRequest request) { .product(product) .quantity(item.quantity()) .build(); - orderProductRepository.save(orderProduct); + orderProducts.add(orderProduct); }); + orderProductBulkRepository.saveAll(orderProducts); return order.getId(); } diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductBulkRepository.java b/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductBulkRepository.java new file mode 100644 index 000000000..ceb817b82 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductBulkRepository.java @@ -0,0 +1,36 @@ +package com.jpaweekily.domain.order.infrastructrue; + +import com.jpaweekily.domain.order.OrderProduct; +import lombok.RequiredArgsConstructor; +import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.jdbc.core.namedparam.SqlParameterSource; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +@Repository +@RequiredArgsConstructor +public class OrderProductBulkRepository { + + private final NamedParameterJdbcTemplate jdbcTemplate; + + @Transactional + public void saveAll(List orderProducts) { + SqlParameterSource[] sqlParameterSources = new SqlParameterSource[orderProducts.size()]; + int idx = 0; + for (OrderProduct orderProduct : orderProducts) { + SqlParameterSource source = new MapSqlParameterSource() + .addValue("order_id", orderProduct.getOrder().getId()) + .addValue("product_id", orderProduct.getProduct().getId()) + .addValue("quantity", orderProduct.getQuantity()); + sqlParameterSources[idx++] = source; + } + String sql = """ + insert into order_product (order_id, product_id, quantity) + values(:order_id, :product_id, :quantity)"""; + jdbcTemplate.batchUpdate(sql, sqlParameterSources); + } + +} diff --git a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java b/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java index e3f69a327..3f6e08f95 100644 --- a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java @@ -6,14 +6,15 @@ import com.jpaweekily.domain.product.dto.ProductCreateRequest; import com.jpaweekily.domain.user.application.UserService; import com.jpaweekily.domain.user.dto.UserCreateRequest; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import static org.assertj.core.api.Assertions.*; - import java.util.List; +import static org.assertj.core.api.Assertions.assertThat; + @SpringBootTest class OrderServiceImplTest { @@ -26,14 +27,25 @@ class OrderServiceImplTest { @Autowired private UserService userService; - @Test - void order_create_test() { - userService.createUser(new UserCreateRequest("test", "123", "tester")); + List orderProducts; + + @BeforeEach + void setUp() { Long productId = productService.createProduct(new ProductCreateRequest("주먹밥", 100)); + Long productId2 = productService.createProduct(new ProductCreateRequest("고봉밥", 100)); + Long productId3 = productService.createProduct(new ProductCreateRequest("김밥", 100)); OrderProductCreate orderProductCreate = new OrderProductCreate(productId, 3); - OrderCreateRequest orderCreateRequest = new OrderCreateRequest("tester", "수원시", List.of(orderProductCreate)); + OrderProductCreate orderProductCreate2 = new OrderProductCreate(productId2, 3); + OrderProductCreate orderProductCreate3 = new OrderProductCreate(productId3, 3); + orderProducts = List.of(orderProductCreate, orderProductCreate2, orderProductCreate3); + } + + @Test + void order_create_test() { + Long userId = userService.createUser(new UserCreateRequest("test", "123", "tester")); + OrderCreateRequest orderCreateRequest = new OrderCreateRequest("tester", "수원시", orderProducts); - Long orderId = orderService.createOrder(orderCreateRequest); + Long orderId = orderService.createOrder(userId, orderCreateRequest); assertThat(orderId).isNotNull(); } diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 3e86de1b3..bf7227f32 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -3,3 +3,6 @@ spring: url: jdbc:h2:mem:board username: sa password: + + jpa: + show-sql: true From 3ba450678fde88aea43f3b9c8ba638b7d0db3011 Mon Sep 17 00:00:00 2001 From: weonest Date: Wed, 2 Aug 2023 00:01:11 +0900 Subject: [PATCH 33/67] =?UTF-8?q?feedback:=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=ED=8C=A8=EC=8A=A4=EC=9B=8C=EB=93=9C=20=EC=95=94=ED=98=B8?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 ++++++- src/main/java/com/jpaweekily/config/Config.java | 15 +++++++++++++++ .../domain/user/application/UserServiceImpl.java | 12 +++++++----- 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/jpaweekily/config/Config.java diff --git a/pom.xml b/pom.xml index 36a9ebab8..e5aa0e86f 100644 --- a/pom.xml +++ b/pom.xml @@ -25,12 +25,16 @@ org.springframework.boot spring-boot-starter-web - + + org.springframework.security + spring-security-crypto + com.h2database h2 runtime + org.projectlombok lombok @@ -41,6 +45,7 @@ spring-boot-starter-test test + diff --git a/src/main/java/com/jpaweekily/config/Config.java b/src/main/java/com/jpaweekily/config/Config.java new file mode 100644 index 000000000..e196bbf1f --- /dev/null +++ b/src/main/java/com/jpaweekily/config/Config.java @@ -0,0 +1,15 @@ +package com.jpaweekily.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +@Configuration +public class Config { + + @Bean + public PasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } +} diff --git a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java index c2dcae812..0f6af9064 100644 --- a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java @@ -3,6 +3,8 @@ import com.jpaweekily.domain.user.User; import com.jpaweekily.domain.user.dto.UserCreateRequest; import com.jpaweekily.domain.user.infrastructrue.UserRepository; +import lombok.RequiredArgsConstructor; +import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -11,18 +13,18 @@ @Transactional(readOnly = true) @Service +@RequiredArgsConstructor public class UserServiceImpl implements UserService { private final UserRepository userRepository; + private final PasswordEncoder passwordEncoder; - public UserServiceImpl(UserRepository userRepository) { - this.userRepository = userRepository; - } - + @Transactional public Long createUser(UserCreateRequest request) { + String encodedPassword = passwordEncoder.encode(request.password()); User user = User.builder() .loginId(request.loginId()) - .password(request.password()) + .password(encodedPassword) .nickname(request.nickname()) .createdAt(LocalDateTime.now()) .build(); From 380f6a62ba3b10faa84b7b6bfee6ebf1493adcf7 Mon Sep 17 00:00:00 2001 From: weonest Date: Wed, 2 Aug 2023 00:04:05 +0900 Subject: [PATCH 34/67] =?UTF-8?q?feedback:=20CustomerServiceImplTest=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/CustomerServiceImplTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java b/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java index 128b8ebf6..7b5a77655 100644 --- a/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java @@ -5,16 +5,16 @@ import com.jpaweekily.domain.customer.dto.CustomerUpdate; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.context.annotation.Import; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; -import org.springframework.transaction.annotation.Transactional; import static org.assertj.core.api.Assertions.*; -@Transactional -@SpringBootTest +@DataJpaTest +@Import(CustomerServiceImpl.class) class CustomerServiceImplTest { @Autowired @@ -35,14 +35,15 @@ void createTest() { @Test void findByIdTest() { //given - CustomerRequest customerRequest = new CustomerRequest("weon2", "geonhee"); + String firstName = "weon"; + CustomerRequest customerRequest = new CustomerRequest(firstName, "geonhee"); Long id = customerService.create(customerRequest); //when CustomerResponse customerById = customerService.findCustomerById(id); //then - assertThat(customerById.firstName()).isEqualTo("weon2"); + assertThat(customerById.firstName()).isEqualTo(firstName); } @Test From c00a0f1eb597b3221295e8598a65eafa7c16f371 Mon Sep 17 00:00:00 2001 From: weonest Date: Wed, 2 Aug 2023 00:08:36 +0900 Subject: [PATCH 35/67] =?UTF-8?q?feedback:=20=EB=A9=94=EC=84=9C=EB=93=9C?= =?UTF-8?q?=20=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EC=88=98=EC=A0=95!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/order/application/OrderServiceImplTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java b/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java index 3f6e08f95..6660d2eb7 100644 --- a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java +++ b/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java @@ -41,7 +41,7 @@ void setUp() { } @Test - void order_create_test() { + void orderCreateTest() { Long userId = userService.createUser(new UserCreateRequest("test", "123", "tester")); OrderCreateRequest orderCreateRequest = new OrderCreateRequest("tester", "수원시", orderProducts); From 3db114aaea20f2de4617e13d7a3450a379da1e4d Mon Sep 17 00:00:00 2001 From: weonest Date: Wed, 2 Aug 2023 00:08:56 +0900 Subject: [PATCH 36/67] =?UTF-8?q?feedback:=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekily/JpaWeekilyApplicationTests.java | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 src/test/java/com/jpaweekily/JpaWeekilyApplicationTests.java diff --git a/src/test/java/com/jpaweekily/JpaWeekilyApplicationTests.java b/src/test/java/com/jpaweekily/JpaWeekilyApplicationTests.java deleted file mode 100644 index 266c71e09..000000000 --- a/src/test/java/com/jpaweekily/JpaWeekilyApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.jpaweekily; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class JpaWeekilyApplicationTests { - - @Test - void contextLoads() { - } - -} From fd9a100673424fcb51858a66e52438dceee9181f Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 20:28:56 +0900 Subject: [PATCH 37/67] =?UTF-8?q?feedback:=20path=20=EC=97=90=EC=84=9C=20p?= =?UTF-8?q?age=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/customer/presentation/CustomerApiController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java index 4adba3401..f78ed04e4 100644 --- a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java +++ b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java @@ -19,7 +19,7 @@ public class CustomerApiController { private final CustomerService customerService; - @GetMapping("/page") + @GetMapping public ResponseEntity> customerPage(@PageableDefault() Pageable pageable) { Page customers = customerService.findCustomersWithPaging(pageable); return ResponseEntity.ok(customers); From c9094c2b8bb637844299750ae8a23997a6d68417 Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 20:31:05 +0900 Subject: [PATCH 38/67] =?UTF-8?q?feedback:=20Product=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jpaweekily/domain/product/Product.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/product/Product.java b/src/main/java/com/jpaweekily/domain/product/Product.java index 01d4a20fa..35715384d 100644 --- a/src/main/java/com/jpaweekily/domain/product/Product.java +++ b/src/main/java/com/jpaweekily/domain/product/Product.java @@ -1,9 +1,6 @@ package com.jpaweekily.domain.product; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; @@ -18,12 +15,14 @@ public class Product { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; + @Column(name = "product_name", nullable = false) private String productName; + @Column(name = "price", nullable = false) private int price; @Builder - public Product(String productName, int price) { + private Product(String productName, int price) { this.productName = productName; this.price = price; } From c2c201c00bd733ba55743745440a9bbfc1eab803 Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 20:41:34 +0900 Subject: [PATCH 39/67] =?UTF-8?q?feedback:=20OrderProductRepository=20?= =?UTF-8?q?=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=A0=20=EC=88=98=20=EC=9E=88?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=83=81=EC=86=8D=EA=B4=80=EA=B3=84=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/order/application/OrderServiceImpl.java | 5 ++--- .../infrastructrue/CustomOrderProductRepository.java | 9 +++++++++ ...sitory.java => CustomOrderProductRepositoryImpl.java} | 2 +- .../order/infrastructrue/OrderProductRepository.java | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepository.java rename src/main/java/com/jpaweekily/domain/order/infrastructrue/{OrderProductBulkRepository.java => CustomOrderProductRepositoryImpl.java} (94%) diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java index 310725ea2..0f4e1df33 100644 --- a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java @@ -5,7 +5,6 @@ import com.jpaweekily.domain.order.OrderStatus; import com.jpaweekily.domain.order.dto.OrderCreateRequest; import com.jpaweekily.domain.order.dto.OrderResponse; -import com.jpaweekily.domain.order.infrastructrue.OrderProductBulkRepository; import com.jpaweekily.domain.order.infrastructrue.OrderProductRepository; import com.jpaweekily.domain.order.infrastructrue.OrderRepository; import com.jpaweekily.domain.product.Product; @@ -28,7 +27,7 @@ public class OrderServiceImpl implements OrderService { private final OrderRepository orderRepository; private final UserRepository userRepository; private final ProductRepository productRepository; - private final OrderProductBulkRepository orderProductBulkRepository; + private final OrderProductRepository orderProductRepository; @Transactional public Long createOrder(Long id, OrderCreateRequest request) { @@ -52,7 +51,7 @@ public Long createOrder(Long id, OrderCreateRequest request) { .build(); orderProducts.add(orderProduct); }); - orderProductBulkRepository.saveAll(orderProducts); + orderProductRepository.saveAll(orderProducts); return order.getId(); } diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepository.java b/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepository.java new file mode 100644 index 000000000..f56fdcd82 --- /dev/null +++ b/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepository.java @@ -0,0 +1,9 @@ +package com.jpaweekily.domain.order.infrastructrue; + +import com.jpaweekily.domain.order.OrderProduct; + +import java.util.List; + +public interface CustomOrderProductRepository { + void saveAll(List orderProducts); +} diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductBulkRepository.java b/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java similarity index 94% rename from src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductBulkRepository.java rename to src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java index ceb817b82..83ad05781 100644 --- a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductBulkRepository.java +++ b/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java @@ -12,7 +12,7 @@ @Repository @RequiredArgsConstructor -public class OrderProductBulkRepository { +public class CustomOrderProductRepositoryImpl implements CustomOrderProductRepository{ private final NamedParameterJdbcTemplate jdbcTemplate; diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java b/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java index 62d7b91b7..1179a6152 100644 --- a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java +++ b/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java @@ -3,5 +3,5 @@ import com.jpaweekily.domain.order.OrderProduct; import org.springframework.data.jpa.repository.JpaRepository; -public interface OrderProductRepository extends JpaRepository { +public interface OrderProductRepository extends JpaRepository, CustomOrderProductRepository { } From 6288249c5020c923c7fb9798893ed1b84a9ebdd3 Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 20:47:04 +0900 Subject: [PATCH 40/67] =?UTF-8?q?feedback:=20Validation=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++++ .../domain/customer/dto/CustomerRequest.java | 4 ++++ .../domain/customer/dto/CustomerUpdate.java | 4 ++++ .../presentation/CustomerApiController.java | 3 ++- .../domain/order/dto/OrderCreateRequest.java | 16 +++++++++++----- .../domain/order/dto/OrderProductCreate.java | 9 +++++++-- .../domain/product/dto/ProductCreateRequest.java | 5 +++++ .../domain/user/dto/UserCreateRequest.java | 5 +++++ 8 files changed, 42 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index e5aa0e86f..4c02350ad 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,10 @@ org.springframework.security spring-security-crypto + + org.springframework.boot + spring-boot-starter-validation + com.h2database h2 diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java index b2f838a57..823e38fe7 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java @@ -1,7 +1,11 @@ package com.jpaweekily.domain.customer.dto; +import jakarta.validation.constraints.NotBlank; + public record CustomerRequest ( + @NotBlank String firstName, + @NotBlank String lastName ){ } diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java index a74769dda..535d0f81d 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java +++ b/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java @@ -1,7 +1,11 @@ package com.jpaweekily.domain.customer.dto; +import jakarta.validation.constraints.NotBlank; + public record CustomerUpdate ( + @NotBlank String firstName, + @NotBlank String lastName ) { } diff --git a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java index f78ed04e4..0379d65ab 100644 --- a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java +++ b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java @@ -4,6 +4,7 @@ import com.jpaweekily.domain.customer.dto.CustomerResponse; import com.jpaweekily.domain.customer.dto.CustomerUpdate; import com.jpaweekily.domain.customer.application.CustomerService; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -26,7 +27,7 @@ public ResponseEntity> customerPage(@PageableDefault() Pa } @PostMapping("/new") - public ResponseEntity customerCreate(@RequestBody CustomerRequest request) { + public ResponseEntity customerCreate(@RequestBody @Valid CustomerRequest request) { Long id = customerService.create(request); return new ResponseEntity<>(id, HttpStatus.CREATED); } diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java b/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java index 9903084f8..acbb3595c 100644 --- a/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java +++ b/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java @@ -1,10 +1,16 @@ package com.jpaweekily.domain.order.dto; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; + import java.util.List; -public record OrderCreateRequest ( - String nickName, - String address, - List orderProductCreateList -){ +public record OrderCreateRequest( + @NotBlank + String nickName, + @NotBlank + String address, + @NotNull + List orderProductCreateList +) { } diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java b/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java index c78c0ffc3..9debba302 100644 --- a/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java +++ b/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java @@ -1,7 +1,12 @@ package com.jpaweekily.domain.order.dto; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; + public record OrderProductCreate( - Long productId, - int quantity + @NotNull + Long productId, + @NotBlank + int quantity ) { } diff --git a/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java b/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java index 20e67d60b..94f6fa5bd 100644 --- a/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java +++ b/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java @@ -1,7 +1,12 @@ package com.jpaweekily.domain.product.dto; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; + public record ProductCreateRequest( + @NotBlank String productName, + @Min(0) int price ) { } diff --git a/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java b/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java index 4e83bd0f1..d25b7bc05 100644 --- a/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java +++ b/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java @@ -1,8 +1,13 @@ package com.jpaweekily.domain.user.dto; +import jakarta.validation.constraints.NotBlank; + public record UserCreateRequest ( + @NotBlank String loginId, + @NotBlank String password, + @NotBlank String nickname ){ } From 4e86c619c85d1719c353d09e8b26b194442cf23b Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 20:58:11 +0900 Subject: [PATCH 41/67] =?UTF-8?q?feedback:=20@RequiredArgsConstructor=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/customer/application/CustomerServiceImpl.java | 6 ++---- .../domain/product/application/ProductServiceImpl.java | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java b/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java index b17590e4f..c428bea01 100644 --- a/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java @@ -6,6 +6,7 @@ import com.jpaweekily.domain.customer.dto.CustomerResponse; import com.jpaweekily.domain.customer.dto.CustomerUpdate; import com.jpaweekily.domain.customer.infrastructrue.CustomerRepository; +import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -13,14 +14,11 @@ @Transactional(readOnly = true) @Service +@RequiredArgsConstructor public class CustomerServiceImpl implements CustomerService { private final CustomerRepository customerRepository; - public CustomerServiceImpl(CustomerRepository customerRepository) { - this.customerRepository = customerRepository; - } - @Transactional public Long create(CustomerRequest request) { Customer customer = CustomerMapper.convertRequestToEntity(request); diff --git a/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java b/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java index 9c2ddc623..cc20231e2 100644 --- a/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java @@ -4,19 +4,17 @@ import com.jpaweekily.domain.product.Product; import com.jpaweekily.domain.product.dto.ProductCreateRequest; import com.jpaweekily.domain.product.infrastructrue.ProductRepository; +import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Transactional(readOnly = true) @Service +@RequiredArgsConstructor public class ProductServiceImpl implements ProductService { private final ProductRepository productRepository; - public ProductServiceImpl(ProductRepository productRepository) { - this.productRepository = productRepository; - } - public Long createProduct(ProductCreateRequest request) { Product product = Product.builder() .productName(request.productName()) From 94aa363183bc3417356505752f1f132ab50b5dd3 Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 20:59:34 +0900 Subject: [PATCH 42/67] =?UTF-8?q?feedback:=20findAll=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=82=AD=EC=A0=9C=20->=20=EC=9D=B4=EB=AF=B8=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EB=90=98=EC=96=B4=20=EC=9E=88=EB=8A=94=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=EC=9E=84=20(PagingAndSortingReposit?= =?UTF-8?q?ory)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/customer/infrastructrue/CustomerRepository.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java b/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java index e61176862..8515d9e5f 100644 --- a/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java +++ b/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java @@ -1,12 +1,8 @@ package com.jpaweekily.domain.customer.infrastructrue; import com.jpaweekily.domain.customer.Customer; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; public interface CustomerRepository extends JpaRepository { - - Page findAll(Pageable pageable); } From bf9505569139d094acdc49a2d7bd4ead93ca514b Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 21:04:13 +0900 Subject: [PATCH 43/67] =?UTF-8?q?feedback:=20=ED=8A=B8=EB=9E=9C=EC=9E=AD?= =?UTF-8?q?=EC=85=94=EB=84=90=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/customer/presentation/CustomerApiController.java | 2 +- .../domain/product/application/ProductServiceImpl.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java index 0379d65ab..9835f3b61 100644 --- a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java +++ b/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java @@ -26,7 +26,7 @@ public ResponseEntity> customerPage(@PageableDefault() Pa return ResponseEntity.ok(customers); } - @PostMapping("/new") + @PostMapping public ResponseEntity customerCreate(@RequestBody @Valid CustomerRequest request) { Long id = customerService.create(request); return new ResponseEntity<>(id, HttpStatus.CREATED); diff --git a/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java b/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java index cc20231e2..0d406f154 100644 --- a/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java +++ b/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java @@ -15,6 +15,7 @@ public class ProductServiceImpl implements ProductService { private final ProductRepository productRepository; + @Transactional public Long createProduct(ProductCreateRequest request) { Product product = Product.builder() .productName(request.productName()) From 0615bcc8162ed755626757aaf9e71b47e78818a1 Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 21:14:48 +0900 Subject: [PATCH 44/67] =?UTF-8?q?style:=20=ED=94=84=EB=A1=9C=EC=A0=9D?= =?UTF-8?q?=ED=8A=B8=EB=AA=85=20=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 ++--- .../order/application/OrderService.java | 7 ----- .../product/application/ProductService.java | 7 ----- .../domain/user/application/UserService.java | 7 ----- .../JpaWeekilyApplication.java | 2 +- .../config/Config.java | 2 +- .../domain/customer/Customer.java | 2 +- .../domain/customer/CustomerMapper.java | 6 ++--- .../customer/application/CustomerService.java | 10 +++---- .../application/CustomerServiceImpl.java | 16 ++++++------ .../domain/customer/dto/CustomerRequest.java | 2 +- .../domain/customer/dto/CustomerResponse.java | 2 +- .../domain/customer/dto/CustomerUpdate.java | 2 +- .../infrastructrue/CustomerRepository.java | 4 +-- .../presentation/CustomerApiController.java | 10 +++---- .../domain/order/Order.java | 4 +-- .../domain/order/OrderProduct.java | 4 +-- .../domain/order/OrderStatus.java | 2 +- .../order/application/OrderService.java | 7 +++++ .../order/application/OrderServiceImpl.java | 26 +++++++++---------- .../domain/order/dto/OrderCreateRequest.java | 2 +- .../domain/order/dto/OrderProductCreate.java | 2 +- .../domain/order/dto/OrderResponse.java | 6 ++--- .../CustomOrderProductRepository.java | 4 +-- .../CustomOrderProductRepositoryImpl.java | 4 +-- .../OrderProductRepository.java | 4 +-- .../order/infrastructrue/OrderRepository.java | 4 +-- .../domain/product/Product.java | 2 +- .../product/application/ProductService.java | 7 +++++ .../application/ProductServiceImpl.java | 8 +++--- .../product/dto/ProductCreateRequest.java | 2 +- .../domain/product/dto/ProductResponse.java | 4 +-- .../infrastructrue/ProductRepository.java | 4 +-- .../domain/user/User.java | 2 +- .../domain/user/application/UserService.java | 7 +++++ .../user/application/UserServiceImpl.java | 8 +++--- .../domain/user/dto/UserCreateRequest.java | 2 +- .../domain/user/dto/UserResponse.java | 4 +-- .../user/infrastructrue/UserRepository.java | 4 +-- .../application/CustomerServiceImplTest.java | 8 +++--- .../application/ProductServiceImplTest.java | 4 +-- .../user/application/UserServiceImplTest.java | 4 +-- 42 files changed, 111 insertions(+), 113 deletions(-) delete mode 100644 src/main/java/com/jpaweekily/domain/order/application/OrderService.java delete mode 100644 src/main/java/com/jpaweekily/domain/product/application/ProductService.java delete mode 100644 src/main/java/com/jpaweekily/domain/user/application/UserService.java rename src/main/java/com/{jpaweekily => jpaweekly}/JpaWeekilyApplication.java (92%) rename src/main/java/com/{jpaweekily => jpaweekly}/config/Config.java (92%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/Customer.java (95%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/CustomerMapper.java (78%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/application/CustomerService.java (59%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/application/CustomerServiceImpl.java (78%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/dto/CustomerRequest.java (79%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/dto/CustomerResponse.java (70%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/dto/CustomerUpdate.java (79%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/infrastructrue/CustomerRepository.java (58%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/customer/presentation/CustomerApiController.java (81%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/Order.java (91%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/OrderProduct.java (90%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/OrderStatus.java (72%) create mode 100644 src/main/java/com/jpaweekly/domain/order/application/OrderService.java rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/application/OrderServiceImpl.java (73%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/dto/OrderCreateRequest.java (88%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/dto/OrderProductCreate.java (84%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/dto/OrderResponse.java (78%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/infrastructrue/CustomOrderProductRepository.java (55%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java (93%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/infrastructrue/OrderProductRepository.java (64%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/order/infrastructrue/OrderRepository.java (59%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/product/Product.java (94%) create mode 100644 src/main/java/com/jpaweekly/domain/product/application/ProductService.java rename src/main/java/com/{jpaweekily => jpaweekly}/domain/product/application/ProductServiceImpl.java (74%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/product/dto/ProductCreateRequest.java (83%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/product/dto/ProductResponse.java (76%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/product/infrastructrue/ProductRepository.java (58%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/user/User.java (96%) create mode 100644 src/main/java/com/jpaweekly/domain/user/application/UserService.java rename src/main/java/com/{jpaweekily => jpaweekly}/domain/user/application/UserServiceImpl.java (81%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/user/dto/UserCreateRequest.java (84%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/user/dto/UserResponse.java (84%) rename src/main/java/com/{jpaweekily => jpaweekly}/domain/user/infrastructrue/UserRepository.java (70%) rename src/test/java/com/{jpaweekily => jpaweekly}/domain/customer/application/CustomerServiceImplTest.java (92%) rename src/test/java/com/{jpaweekily => jpaweekly}/domain/product/application/ProductServiceImplTest.java (83%) rename src/test/java/com/{jpaweekily => jpaweekly}/domain/user/application/UserServiceImplTest.java (84%) diff --git a/pom.xml b/pom.xml index 4c02350ad..c69a6e654 100644 --- a/pom.xml +++ b/pom.xml @@ -9,10 +9,10 @@ com - jpa-weekily + jpa-weekly 0.0.1-SNAPSHOT - jpa-weekily - jpa-weekily + jpa-weekly + jpa-weekly 17 diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderService.java b/src/main/java/com/jpaweekily/domain/order/application/OrderService.java deleted file mode 100644 index 37d6ab5e2..000000000 --- a/src/main/java/com/jpaweekily/domain/order/application/OrderService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.jpaweekily.domain.order.application; - -import com.jpaweekily.domain.order.dto.OrderCreateRequest; - -public interface OrderService { - Long createOrder(Long id, OrderCreateRequest request); -} diff --git a/src/main/java/com/jpaweekily/domain/product/application/ProductService.java b/src/main/java/com/jpaweekily/domain/product/application/ProductService.java deleted file mode 100644 index 1134a0392..000000000 --- a/src/main/java/com/jpaweekily/domain/product/application/ProductService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.jpaweekily.domain.product.application; - -import com.jpaweekily.domain.product.dto.ProductCreateRequest; - -public interface ProductService { - Long createProduct(ProductCreateRequest request); -} diff --git a/src/main/java/com/jpaweekily/domain/user/application/UserService.java b/src/main/java/com/jpaweekily/domain/user/application/UserService.java deleted file mode 100644 index ef90ba913..000000000 --- a/src/main/java/com/jpaweekily/domain/user/application/UserService.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.jpaweekily.domain.user.application; - -import com.jpaweekily.domain.user.dto.UserCreateRequest; - -public interface UserService { - Long createUser(UserCreateRequest request); -} diff --git a/src/main/java/com/jpaweekily/JpaWeekilyApplication.java b/src/main/java/com/jpaweekly/JpaWeekilyApplication.java similarity index 92% rename from src/main/java/com/jpaweekily/JpaWeekilyApplication.java rename to src/main/java/com/jpaweekly/JpaWeekilyApplication.java index 0fdb287dd..a3b16dd7a 100644 --- a/src/main/java/com/jpaweekily/JpaWeekilyApplication.java +++ b/src/main/java/com/jpaweekly/JpaWeekilyApplication.java @@ -1,4 +1,4 @@ -package com.jpaweekily; +package com.jpaweekly; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/src/main/java/com/jpaweekily/config/Config.java b/src/main/java/com/jpaweekly/config/Config.java similarity index 92% rename from src/main/java/com/jpaweekily/config/Config.java rename to src/main/java/com/jpaweekly/config/Config.java index e196bbf1f..36589ac6d 100644 --- a/src/main/java/com/jpaweekily/config/Config.java +++ b/src/main/java/com/jpaweekly/config/Config.java @@ -1,4 +1,4 @@ -package com.jpaweekily.config; +package com.jpaweekly.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/com/jpaweekily/domain/customer/Customer.java b/src/main/java/com/jpaweekly/domain/customer/Customer.java similarity index 95% rename from src/main/java/com/jpaweekily/domain/customer/Customer.java rename to src/main/java/com/jpaweekly/domain/customer/Customer.java index 8eba91ae5..40a1211e6 100644 --- a/src/main/java/com/jpaweekily/domain/customer/Customer.java +++ b/src/main/java/com/jpaweekly/domain/customer/Customer.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.customer; +package com.jpaweekly.domain.customer; import jakarta.persistence.*; import lombok.AccessLevel; diff --git a/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java b/src/main/java/com/jpaweekly/domain/customer/CustomerMapper.java similarity index 78% rename from src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java rename to src/main/java/com/jpaweekly/domain/customer/CustomerMapper.java index 92bab1f5c..39fb261ae 100644 --- a/src/main/java/com/jpaweekily/domain/customer/CustomerMapper.java +++ b/src/main/java/com/jpaweekly/domain/customer/CustomerMapper.java @@ -1,7 +1,7 @@ -package com.jpaweekily.domain.customer; +package com.jpaweekly.domain.customer; -import com.jpaweekily.domain.customer.dto.CustomerRequest; -import com.jpaweekily.domain.customer.dto.CustomerResponse; +import com.jpaweekly.domain.customer.dto.CustomerRequest; +import com.jpaweekly.domain.customer.dto.CustomerResponse; import lombok.AccessLevel; import lombok.NoArgsConstructor; diff --git a/src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java b/src/main/java/com/jpaweekly/domain/customer/application/CustomerService.java similarity index 59% rename from src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java rename to src/main/java/com/jpaweekly/domain/customer/application/CustomerService.java index 187688835..08ef77527 100644 --- a/src/main/java/com/jpaweekily/domain/customer/application/CustomerService.java +++ b/src/main/java/com/jpaweekly/domain/customer/application/CustomerService.java @@ -1,13 +1,11 @@ -package com.jpaweekily.domain.customer.application; +package com.jpaweekly.domain.customer.application; -import com.jpaweekily.domain.customer.dto.CustomerRequest; -import com.jpaweekily.domain.customer.dto.CustomerResponse; -import com.jpaweekily.domain.customer.dto.CustomerUpdate; +import com.jpaweekly.domain.customer.dto.CustomerRequest; +import com.jpaweekly.domain.customer.dto.CustomerResponse; +import com.jpaweekly.domain.customer.dto.CustomerUpdate; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import java.util.List; - public interface CustomerService { Long create(CustomerRequest request); diff --git a/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java b/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java similarity index 78% rename from src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java rename to src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java index c428bea01..7a65f9942 100644 --- a/src/main/java/com/jpaweekily/domain/customer/application/CustomerServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java @@ -1,11 +1,11 @@ -package com.jpaweekily.domain.customer.application; - -import com.jpaweekily.domain.customer.Customer; -import com.jpaweekily.domain.customer.CustomerMapper; -import com.jpaweekily.domain.customer.dto.CustomerRequest; -import com.jpaweekily.domain.customer.dto.CustomerResponse; -import com.jpaweekily.domain.customer.dto.CustomerUpdate; -import com.jpaweekily.domain.customer.infrastructrue.CustomerRepository; +package com.jpaweekly.domain.customer.application; + +import com.jpaweekly.domain.customer.Customer; +import com.jpaweekly.domain.customer.CustomerMapper; +import com.jpaweekly.domain.customer.dto.CustomerRequest; +import com.jpaweekly.domain.customer.dto.CustomerResponse; +import com.jpaweekly.domain.customer.dto.CustomerUpdate; +import com.jpaweekly.domain.customer.infrastructrue.CustomerRepository; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java b/src/main/java/com/jpaweekly/domain/customer/dto/CustomerRequest.java similarity index 79% rename from src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java rename to src/main/java/com/jpaweekly/domain/customer/dto/CustomerRequest.java index 823e38fe7..e07c0042c 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerRequest.java +++ b/src/main/java/com/jpaweekly/domain/customer/dto/CustomerRequest.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.customer.dto; +package com.jpaweekly.domain.customer.dto; import jakarta.validation.constraints.NotBlank; diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java b/src/main/java/com/jpaweekly/domain/customer/dto/CustomerResponse.java similarity index 70% rename from src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java rename to src/main/java/com/jpaweekly/domain/customer/dto/CustomerResponse.java index c65178a1e..9fb161cd0 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerResponse.java +++ b/src/main/java/com/jpaweekly/domain/customer/dto/CustomerResponse.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.customer.dto; +package com.jpaweekly.domain.customer.dto; public record CustomerResponse ( Long id, diff --git a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java b/src/main/java/com/jpaweekly/domain/customer/dto/CustomerUpdate.java similarity index 79% rename from src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java rename to src/main/java/com/jpaweekly/domain/customer/dto/CustomerUpdate.java index 535d0f81d..e105b85b1 100644 --- a/src/main/java/com/jpaweekily/domain/customer/dto/CustomerUpdate.java +++ b/src/main/java/com/jpaweekly/domain/customer/dto/CustomerUpdate.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.customer.dto; +package com.jpaweekly.domain.customer.dto; import jakarta.validation.constraints.NotBlank; diff --git a/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java b/src/main/java/com/jpaweekly/domain/customer/infrastructrue/CustomerRepository.java similarity index 58% rename from src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java rename to src/main/java/com/jpaweekly/domain/customer/infrastructrue/CustomerRepository.java index 8515d9e5f..d5c536ff0 100644 --- a/src/main/java/com/jpaweekily/domain/customer/infrastructrue/CustomerRepository.java +++ b/src/main/java/com/jpaweekly/domain/customer/infrastructrue/CustomerRepository.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.customer.infrastructrue; +package com.jpaweekly.domain.customer.infrastructrue; -import com.jpaweekily.domain.customer.Customer; +import com.jpaweekly.domain.customer.Customer; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java b/src/main/java/com/jpaweekly/domain/customer/presentation/CustomerApiController.java similarity index 81% rename from src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java rename to src/main/java/com/jpaweekly/domain/customer/presentation/CustomerApiController.java index 9835f3b61..e53ad5b5b 100644 --- a/src/main/java/com/jpaweekily/domain/customer/presentation/CustomerApiController.java +++ b/src/main/java/com/jpaweekly/domain/customer/presentation/CustomerApiController.java @@ -1,9 +1,9 @@ -package com.jpaweekily.domain.customer.presentation; +package com.jpaweekly.domain.customer.presentation; -import com.jpaweekily.domain.customer.dto.CustomerRequest; -import com.jpaweekily.domain.customer.dto.CustomerResponse; -import com.jpaweekily.domain.customer.dto.CustomerUpdate; -import com.jpaweekily.domain.customer.application.CustomerService; +import com.jpaweekly.domain.customer.dto.CustomerRequest; +import com.jpaweekly.domain.customer.dto.CustomerResponse; +import com.jpaweekly.domain.customer.dto.CustomerUpdate; +import com.jpaweekly.domain.customer.application.CustomerService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; diff --git a/src/main/java/com/jpaweekily/domain/order/Order.java b/src/main/java/com/jpaweekly/domain/order/Order.java similarity index 91% rename from src/main/java/com/jpaweekily/domain/order/Order.java rename to src/main/java/com/jpaweekly/domain/order/Order.java index 83f89fcb4..744974ebd 100644 --- a/src/main/java/com/jpaweekily/domain/order/Order.java +++ b/src/main/java/com/jpaweekly/domain/order/Order.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.order; +package com.jpaweekly.domain.order; -import com.jpaweekily.domain.user.User; +import com.jpaweekly.domain.user.User; import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; diff --git a/src/main/java/com/jpaweekily/domain/order/OrderProduct.java b/src/main/java/com/jpaweekly/domain/order/OrderProduct.java similarity index 90% rename from src/main/java/com/jpaweekily/domain/order/OrderProduct.java rename to src/main/java/com/jpaweekly/domain/order/OrderProduct.java index 6caa75e2a..65b7fa2a3 100644 --- a/src/main/java/com/jpaweekily/domain/order/OrderProduct.java +++ b/src/main/java/com/jpaweekly/domain/order/OrderProduct.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.order; +package com.jpaweekly.domain.order; -import com.jpaweekily.domain.product.Product; +import com.jpaweekly.domain.product.Product; import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; diff --git a/src/main/java/com/jpaweekily/domain/order/OrderStatus.java b/src/main/java/com/jpaweekly/domain/order/OrderStatus.java similarity index 72% rename from src/main/java/com/jpaweekily/domain/order/OrderStatus.java rename to src/main/java/com/jpaweekly/domain/order/OrderStatus.java index 4cb9e1abb..420658775 100644 --- a/src/main/java/com/jpaweekily/domain/order/OrderStatus.java +++ b/src/main/java/com/jpaweekly/domain/order/OrderStatus.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.order; +package com.jpaweekly.domain.order; public enum OrderStatus { READY_FOR_DELIVERY, diff --git a/src/main/java/com/jpaweekly/domain/order/application/OrderService.java b/src/main/java/com/jpaweekly/domain/order/application/OrderService.java new file mode 100644 index 000000000..1fbc1b9e0 --- /dev/null +++ b/src/main/java/com/jpaweekly/domain/order/application/OrderService.java @@ -0,0 +1,7 @@ +package com.jpaweekly.domain.order.application; + +import com.jpaweekly.domain.order.dto.OrderCreateRequest; + +public interface OrderService { + Long createOrder(Long id, OrderCreateRequest request); +} diff --git a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java b/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java similarity index 73% rename from src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java rename to src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java index 0f4e1df33..2c8ecbff6 100644 --- a/src/main/java/com/jpaweekily/domain/order/application/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java @@ -1,16 +1,16 @@ -package com.jpaweekily.domain.order.application; - -import com.jpaweekily.domain.order.Order; -import com.jpaweekily.domain.order.OrderProduct; -import com.jpaweekily.domain.order.OrderStatus; -import com.jpaweekily.domain.order.dto.OrderCreateRequest; -import com.jpaweekily.domain.order.dto.OrderResponse; -import com.jpaweekily.domain.order.infrastructrue.OrderProductRepository; -import com.jpaweekily.domain.order.infrastructrue.OrderRepository; -import com.jpaweekily.domain.product.Product; -import com.jpaweekily.domain.product.infrastructrue.ProductRepository; -import com.jpaweekily.domain.user.User; -import com.jpaweekily.domain.user.infrastructrue.UserRepository; +package com.jpaweekly.domain.order.application; + +import com.jpaweekly.domain.order.Order; +import com.jpaweekly.domain.order.OrderProduct; +import com.jpaweekly.domain.order.OrderStatus; +import com.jpaweekly.domain.order.dto.OrderCreateRequest; +import com.jpaweekly.domain.order.dto.OrderResponse; +import com.jpaweekly.domain.order.infrastructrue.OrderProductRepository; +import com.jpaweekly.domain.order.infrastructrue.OrderRepository; +import com.jpaweekly.domain.product.Product; +import com.jpaweekly.domain.product.infrastructrue.ProductRepository; +import com.jpaweekly.domain.user.User; +import com.jpaweekly.domain.user.infrastructrue.UserRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java b/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java similarity index 88% rename from src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java rename to src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java index acbb3595c..f314d4ef0 100644 --- a/src/main/java/com/jpaweekily/domain/order/dto/OrderCreateRequest.java +++ b/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.order.dto; +package com.jpaweekly.domain.order.dto; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java b/src/main/java/com/jpaweekly/domain/order/dto/OrderProductCreate.java similarity index 84% rename from src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java rename to src/main/java/com/jpaweekly/domain/order/dto/OrderProductCreate.java index 9debba302..0d4704934 100644 --- a/src/main/java/com/jpaweekily/domain/order/dto/OrderProductCreate.java +++ b/src/main/java/com/jpaweekly/domain/order/dto/OrderProductCreate.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.order.dto; +package com.jpaweekly.domain.order.dto; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; diff --git a/src/main/java/com/jpaweekily/domain/order/dto/OrderResponse.java b/src/main/java/com/jpaweekly/domain/order/dto/OrderResponse.java similarity index 78% rename from src/main/java/com/jpaweekily/domain/order/dto/OrderResponse.java rename to src/main/java/com/jpaweekly/domain/order/dto/OrderResponse.java index dcdd6fb15..16229fe88 100644 --- a/src/main/java/com/jpaweekily/domain/order/dto/OrderResponse.java +++ b/src/main/java/com/jpaweekly/domain/order/dto/OrderResponse.java @@ -1,7 +1,7 @@ -package com.jpaweekily.domain.order.dto; +package com.jpaweekly.domain.order.dto; -import com.jpaweekily.domain.order.Order; -import com.jpaweekily.domain.order.OrderStatus; +import com.jpaweekly.domain.order.Order; +import com.jpaweekly.domain.order.OrderStatus; import java.time.LocalDateTime; diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepository.java b/src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepository.java similarity index 55% rename from src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepository.java rename to src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepository.java index f56fdcd82..36f4685a2 100644 --- a/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepository.java +++ b/src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepository.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.order.infrastructrue; +package com.jpaweekly.domain.order.infrastructrue; -import com.jpaweekily.domain.order.OrderProduct; +import com.jpaweekly.domain.order.OrderProduct; import java.util.List; diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java b/src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java similarity index 93% rename from src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java rename to src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java index 83ad05781..23dbbe59a 100644 --- a/src/main/java/com/jpaweekily/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java +++ b/src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.order.infrastructrue; +package com.jpaweekly.domain.order.infrastructrue; -import com.jpaweekily.domain.order.OrderProduct; +import com.jpaweekly.domain.order.OrderProduct; import lombok.RequiredArgsConstructor; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java b/src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderProductRepository.java similarity index 64% rename from src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java rename to src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderProductRepository.java index 1179a6152..92ecba0db 100644 --- a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderProductRepository.java +++ b/src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderProductRepository.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.order.infrastructrue; +package com.jpaweekly.domain.order.infrastructrue; -import com.jpaweekily.domain.order.OrderProduct; +import com.jpaweekly.domain.order.OrderProduct; import org.springframework.data.jpa.repository.JpaRepository; public interface OrderProductRepository extends JpaRepository, CustomOrderProductRepository { diff --git a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderRepository.java b/src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderRepository.java similarity index 59% rename from src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderRepository.java rename to src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderRepository.java index 9aa18d998..0727b0ab0 100644 --- a/src/main/java/com/jpaweekily/domain/order/infrastructrue/OrderRepository.java +++ b/src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderRepository.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.order.infrastructrue; +package com.jpaweekly.domain.order.infrastructrue; -import com.jpaweekily.domain.order.Order; +import com.jpaweekly.domain.order.Order; import org.springframework.data.jpa.repository.JpaRepository; public interface OrderRepository extends JpaRepository { diff --git a/src/main/java/com/jpaweekily/domain/product/Product.java b/src/main/java/com/jpaweekly/domain/product/Product.java similarity index 94% rename from src/main/java/com/jpaweekily/domain/product/Product.java rename to src/main/java/com/jpaweekly/domain/product/Product.java index 35715384d..a10fab46e 100644 --- a/src/main/java/com/jpaweekily/domain/product/Product.java +++ b/src/main/java/com/jpaweekly/domain/product/Product.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.product; +package com.jpaweekly.domain.product; import jakarta.persistence.*; import lombok.AccessLevel; diff --git a/src/main/java/com/jpaweekly/domain/product/application/ProductService.java b/src/main/java/com/jpaweekly/domain/product/application/ProductService.java new file mode 100644 index 000000000..33aec7378 --- /dev/null +++ b/src/main/java/com/jpaweekly/domain/product/application/ProductService.java @@ -0,0 +1,7 @@ +package com.jpaweekly.domain.product.application; + +import com.jpaweekly.domain.product.dto.ProductCreateRequest; + +public interface ProductService { + Long createProduct(ProductCreateRequest request); +} diff --git a/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java b/src/main/java/com/jpaweekly/domain/product/application/ProductServiceImpl.java similarity index 74% rename from src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java rename to src/main/java/com/jpaweekly/domain/product/application/ProductServiceImpl.java index 0d406f154..0be5fd9af 100644 --- a/src/main/java/com/jpaweekily/domain/product/application/ProductServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/product/application/ProductServiceImpl.java @@ -1,9 +1,9 @@ -package com.jpaweekily.domain.product.application; +package com.jpaweekly.domain.product.application; -import com.jpaweekily.domain.product.Product; -import com.jpaweekily.domain.product.dto.ProductCreateRequest; -import com.jpaweekily.domain.product.infrastructrue.ProductRepository; +import com.jpaweekly.domain.product.Product; +import com.jpaweekly.domain.product.dto.ProductCreateRequest; +import com.jpaweekly.domain.product.infrastructrue.ProductRepository; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java b/src/main/java/com/jpaweekly/domain/product/dto/ProductCreateRequest.java similarity index 83% rename from src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java rename to src/main/java/com/jpaweekly/domain/product/dto/ProductCreateRequest.java index 94f6fa5bd..edcbeaf90 100644 --- a/src/main/java/com/jpaweekily/domain/product/dto/ProductCreateRequest.java +++ b/src/main/java/com/jpaweekly/domain/product/dto/ProductCreateRequest.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.product.dto; +package com.jpaweekly.domain.product.dto; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; diff --git a/src/main/java/com/jpaweekily/domain/product/dto/ProductResponse.java b/src/main/java/com/jpaweekly/domain/product/dto/ProductResponse.java similarity index 76% rename from src/main/java/com/jpaweekily/domain/product/dto/ProductResponse.java rename to src/main/java/com/jpaweekly/domain/product/dto/ProductResponse.java index f47c659b0..a57637199 100644 --- a/src/main/java/com/jpaweekily/domain/product/dto/ProductResponse.java +++ b/src/main/java/com/jpaweekly/domain/product/dto/ProductResponse.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.product.dto; +package com.jpaweekly.domain.product.dto; -import com.jpaweekily.domain.product.Product; +import com.jpaweekly.domain.product.Product; public record ProductResponse( Long id, diff --git a/src/main/java/com/jpaweekily/domain/product/infrastructrue/ProductRepository.java b/src/main/java/com/jpaweekly/domain/product/infrastructrue/ProductRepository.java similarity index 58% rename from src/main/java/com/jpaweekily/domain/product/infrastructrue/ProductRepository.java rename to src/main/java/com/jpaweekly/domain/product/infrastructrue/ProductRepository.java index e5a81bb31..71c0b76a5 100644 --- a/src/main/java/com/jpaweekily/domain/product/infrastructrue/ProductRepository.java +++ b/src/main/java/com/jpaweekly/domain/product/infrastructrue/ProductRepository.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.product.infrastructrue; +package com.jpaweekly.domain.product.infrastructrue; -import com.jpaweekily.domain.product.Product; +import com.jpaweekly.domain.product.Product; import org.springframework.data.jpa.repository.JpaRepository; public interface ProductRepository extends JpaRepository { diff --git a/src/main/java/com/jpaweekily/domain/user/User.java b/src/main/java/com/jpaweekly/domain/user/User.java similarity index 96% rename from src/main/java/com/jpaweekily/domain/user/User.java rename to src/main/java/com/jpaweekly/domain/user/User.java index 860f898aa..5502d242f 100644 --- a/src/main/java/com/jpaweekily/domain/user/User.java +++ b/src/main/java/com/jpaweekly/domain/user/User.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.user; +package com.jpaweekly.domain.user; import jakarta.persistence.*; import lombok.AccessLevel; diff --git a/src/main/java/com/jpaweekly/domain/user/application/UserService.java b/src/main/java/com/jpaweekly/domain/user/application/UserService.java new file mode 100644 index 000000000..ab4559600 --- /dev/null +++ b/src/main/java/com/jpaweekly/domain/user/application/UserService.java @@ -0,0 +1,7 @@ +package com.jpaweekly.domain.user.application; + +import com.jpaweekly.domain.user.dto.UserCreateRequest; + +public interface UserService { + Long createUser(UserCreateRequest request); +} diff --git a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java b/src/main/java/com/jpaweekly/domain/user/application/UserServiceImpl.java similarity index 81% rename from src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java rename to src/main/java/com/jpaweekly/domain/user/application/UserServiceImpl.java index 0f6af9064..c1f698cb0 100644 --- a/src/main/java/com/jpaweekily/domain/user/application/UserServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/user/application/UserServiceImpl.java @@ -1,8 +1,8 @@ -package com.jpaweekily.domain.user.application; +package com.jpaweekly.domain.user.application; -import com.jpaweekily.domain.user.User; -import com.jpaweekily.domain.user.dto.UserCreateRequest; -import com.jpaweekily.domain.user.infrastructrue.UserRepository; +import com.jpaweekly.domain.user.User; +import com.jpaweekly.domain.user.dto.UserCreateRequest; +import com.jpaweekly.domain.user.infrastructrue.UserRepository; import lombok.RequiredArgsConstructor; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; diff --git a/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java b/src/main/java/com/jpaweekly/domain/user/dto/UserCreateRequest.java similarity index 84% rename from src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java rename to src/main/java/com/jpaweekly/domain/user/dto/UserCreateRequest.java index d25b7bc05..ae90bfd67 100644 --- a/src/main/java/com/jpaweekily/domain/user/dto/UserCreateRequest.java +++ b/src/main/java/com/jpaweekly/domain/user/dto/UserCreateRequest.java @@ -1,4 +1,4 @@ -package com.jpaweekily.domain.user.dto; +package com.jpaweekly.domain.user.dto; import jakarta.validation.constraints.NotBlank; diff --git a/src/main/java/com/jpaweekily/domain/user/dto/UserResponse.java b/src/main/java/com/jpaweekly/domain/user/dto/UserResponse.java similarity index 84% rename from src/main/java/com/jpaweekily/domain/user/dto/UserResponse.java rename to src/main/java/com/jpaweekly/domain/user/dto/UserResponse.java index e0484386d..67cf2fa7f 100644 --- a/src/main/java/com/jpaweekily/domain/user/dto/UserResponse.java +++ b/src/main/java/com/jpaweekly/domain/user/dto/UserResponse.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.user.dto; +package com.jpaweekly.domain.user.dto; -import com.jpaweekily.domain.user.User; +import com.jpaweekly.domain.user.User; import java.time.LocalDateTime; diff --git a/src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java b/src/main/java/com/jpaweekly/domain/user/infrastructrue/UserRepository.java similarity index 70% rename from src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java rename to src/main/java/com/jpaweekly/domain/user/infrastructrue/UserRepository.java index 0b9069c14..27f3ec7ee 100644 --- a/src/main/java/com/jpaweekily/domain/user/infrastructrue/UserRepository.java +++ b/src/main/java/com/jpaweekly/domain/user/infrastructrue/UserRepository.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.user.infrastructrue; +package com.jpaweekly.domain.user.infrastructrue; -import com.jpaweekily.domain.user.User; +import com.jpaweekly.domain.user.User; import org.springframework.data.jpa.repository.JpaRepository; import java.util.Optional; diff --git a/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java b/src/test/java/com/jpaweekly/domain/customer/application/CustomerServiceImplTest.java similarity index 92% rename from src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java rename to src/test/java/com/jpaweekly/domain/customer/application/CustomerServiceImplTest.java index 7b5a77655..4964e4cdb 100644 --- a/src/test/java/com/jpaweekily/domain/customer/application/CustomerServiceImplTest.java +++ b/src/test/java/com/jpaweekly/domain/customer/application/CustomerServiceImplTest.java @@ -1,8 +1,8 @@ -package com.jpaweekily.domain.customer.application; +package com.jpaweekly.domain.customer.application; -import com.jpaweekily.domain.customer.dto.CustomerRequest; -import com.jpaweekily.domain.customer.dto.CustomerResponse; -import com.jpaweekily.domain.customer.dto.CustomerUpdate; +import com.jpaweekly.domain.customer.dto.CustomerRequest; +import com.jpaweekly.domain.customer.dto.CustomerResponse; +import com.jpaweekly.domain.customer.dto.CustomerUpdate; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; diff --git a/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java b/src/test/java/com/jpaweekly/domain/product/application/ProductServiceImplTest.java similarity index 83% rename from src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java rename to src/test/java/com/jpaweekly/domain/product/application/ProductServiceImplTest.java index bff20c557..56cd29b40 100644 --- a/src/test/java/com/jpaweekily/domain/product/application/ProductServiceImplTest.java +++ b/src/test/java/com/jpaweekly/domain/product/application/ProductServiceImplTest.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.product.application; +package com.jpaweekly.domain.product.application; -import com.jpaweekily.domain.product.dto.ProductCreateRequest; +import com.jpaweekly.domain.product.dto.ProductCreateRequest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; diff --git a/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java b/src/test/java/com/jpaweekly/domain/user/application/UserServiceImplTest.java similarity index 84% rename from src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java rename to src/test/java/com/jpaweekly/domain/user/application/UserServiceImplTest.java index 25167ad51..ba838d3ca 100644 --- a/src/test/java/com/jpaweekily/domain/user/application/UserServiceImplTest.java +++ b/src/test/java/com/jpaweekly/domain/user/application/UserServiceImplTest.java @@ -1,6 +1,6 @@ -package com.jpaweekily.domain.user.application; +package com.jpaweekly.domain.user.application; -import com.jpaweekily.domain.user.dto.UserCreateRequest; +import com.jpaweekly.domain.user.dto.UserCreateRequest; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; From f5c2ff447a10e8688de86d9e9bc9282fae9e8b70 Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 21:19:00 +0900 Subject: [PATCH 45/67] =?UTF-8?q?feedBack:=20DataJpaTest=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/OrderServiceImplTest.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) rename src/test/java/com/{jpaweekily => jpaweekly}/domain/order/application/OrderServiceImplTest.java (67%) diff --git a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java b/src/test/java/com/jpaweekly/domain/order/application/OrderServiceImplTest.java similarity index 67% rename from src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java rename to src/test/java/com/jpaweekly/domain/order/application/OrderServiceImplTest.java index 6660d2eb7..f747fed68 100644 --- a/src/test/java/com/jpaweekily/domain/order/application/OrderServiceImplTest.java +++ b/src/test/java/com/jpaweekly/domain/order/application/OrderServiceImplTest.java @@ -1,23 +1,29 @@ -package com.jpaweekily.domain.order.application; - -import com.jpaweekily.domain.order.dto.OrderCreateRequest; -import com.jpaweekily.domain.order.dto.OrderProductCreate; -import com.jpaweekily.domain.product.application.ProductService; -import com.jpaweekily.domain.product.dto.ProductCreateRequest; -import com.jpaweekily.domain.user.application.UserService; -import com.jpaweekily.domain.user.dto.UserCreateRequest; +package com.jpaweekly.domain.order.application; + +import com.jpaweekly.domain.order.dto.OrderCreateRequest; +import com.jpaweekly.domain.order.dto.OrderProductCreate; +import com.jpaweekly.domain.product.application.ProductService; +import com.jpaweekly.domain.product.dto.ProductCreateRequest; +import com.jpaweekly.domain.user.application.UserService; +import com.jpaweekly.domain.user.dto.UserCreateRequest; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.boot.test.context.TestConfiguration; +import org.springframework.context.annotation.ComponentScan; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -@SpringBootTest +@DataJpaTest class OrderServiceImplTest { + @TestConfiguration + @ComponentScan(basePackages = {"com.jpaweekly.domain", "com.jpaweekly.config"}) + static class Config{} + @Autowired private OrderService orderService; From 0b93f9975c24e915d4e9aebec283059aed8baf0a Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 21:19:42 +0900 Subject: [PATCH 46/67] =?UTF-8?q?refactor:=20=EB=B9=8C=EB=8D=94=20?= =?UTF-8?q?=EC=A0=91=EA=B7=BC=EC=A0=9C=EC=96=B4=EC=9E=90=20private?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jpaweekly/domain/order/Order.java | 2 +- src/main/java/com/jpaweekly/domain/order/OrderProduct.java | 2 +- src/main/java/com/jpaweekly/domain/user/User.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/order/Order.java b/src/main/java/com/jpaweekly/domain/order/Order.java index 744974ebd..2c8da2545 100644 --- a/src/main/java/com/jpaweekly/domain/order/Order.java +++ b/src/main/java/com/jpaweekly/domain/order/Order.java @@ -31,7 +31,7 @@ public class Order { private User user; @Builder - public Order(String address, OrderStatus orderStatus, LocalDateTime createAt, User user) { + private Order(String address, OrderStatus orderStatus, LocalDateTime createAt, User user) { this.address = address; this.orderStatus = orderStatus; this.createAt = createAt; diff --git a/src/main/java/com/jpaweekly/domain/order/OrderProduct.java b/src/main/java/com/jpaweekly/domain/order/OrderProduct.java index 65b7fa2a3..077137fd7 100644 --- a/src/main/java/com/jpaweekly/domain/order/OrderProduct.java +++ b/src/main/java/com/jpaweekly/domain/order/OrderProduct.java @@ -28,7 +28,7 @@ public class OrderProduct { private int quantity; @Builder - public OrderProduct(Order order, Product product, int quantity) { + private OrderProduct(Order order, Product product, int quantity) { this.order = order; this.product = product; this.quantity = quantity; diff --git a/src/main/java/com/jpaweekly/domain/user/User.java b/src/main/java/com/jpaweekly/domain/user/User.java index 5502d242f..c772a224f 100644 --- a/src/main/java/com/jpaweekly/domain/user/User.java +++ b/src/main/java/com/jpaweekly/domain/user/User.java @@ -30,7 +30,7 @@ public class User { private LocalDateTime createdAt; @Builder - public User(String loginId, String nickname, String password, LocalDateTime createdAt) { + private User(String loginId, String nickname, String password, LocalDateTime createdAt) { this.loginId = loginId; this.nickname = nickname; this.password = password; From d5ab8656d0fe8eeed21084599a7f0af6571697d7 Mon Sep 17 00:00:00 2001 From: weonest Date: Thu, 3 Aug 2023 22:17:40 +0900 Subject: [PATCH 47/67] refactor: CustomerMapper -> CustomerConverter --- .../{CustomerMapper.java => CustomerConverter.java} | 2 +- .../domain/customer/application/CustomerServiceImpl.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename src/main/java/com/jpaweekly/domain/customer/{CustomerMapper.java => CustomerConverter.java} (94%) diff --git a/src/main/java/com/jpaweekly/domain/customer/CustomerMapper.java b/src/main/java/com/jpaweekly/domain/customer/CustomerConverter.java similarity index 94% rename from src/main/java/com/jpaweekly/domain/customer/CustomerMapper.java rename to src/main/java/com/jpaweekly/domain/customer/CustomerConverter.java index 39fb261ae..1063bbc40 100644 --- a/src/main/java/com/jpaweekly/domain/customer/CustomerMapper.java +++ b/src/main/java/com/jpaweekly/domain/customer/CustomerConverter.java @@ -6,7 +6,7 @@ import lombok.NoArgsConstructor; @NoArgsConstructor(access = AccessLevel.PRIVATE) -public class CustomerMapper { +public final class CustomerConverter { public static CustomerResponse convertEntityToResponse(Customer customer) { return new CustomerResponse(customer.getId(), customer.getFirstName(), customer.getLastName()); diff --git a/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java b/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java index 7a65f9942..a8ccf785b 100644 --- a/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java @@ -1,7 +1,7 @@ package com.jpaweekly.domain.customer.application; import com.jpaweekly.domain.customer.Customer; -import com.jpaweekly.domain.customer.CustomerMapper; +import com.jpaweekly.domain.customer.CustomerConverter; import com.jpaweekly.domain.customer.dto.CustomerRequest; import com.jpaweekly.domain.customer.dto.CustomerResponse; import com.jpaweekly.domain.customer.dto.CustomerUpdate; @@ -21,18 +21,18 @@ public class CustomerServiceImpl implements CustomerService { @Transactional public Long create(CustomerRequest request) { - Customer customer = CustomerMapper.convertRequestToEntity(request); + Customer customer = CustomerConverter.convertRequestToEntity(request); return customerRepository.save(customer).getId(); } public CustomerResponse findCustomerById(Long id) { Customer customer = customerRepository.findById(id).orElseThrow(IllegalArgumentException::new); - return CustomerMapper.convertEntityToResponse(customer); + return CustomerConverter.convertEntityToResponse(customer); } public Page findCustomersWithPaging(Pageable pageable) { return customerRepository.findAll(pageable) - .map(CustomerMapper::convertEntityToResponse); + .map(CustomerConverter::convertEntityToResponse); } @Transactional From a603097b039ce3f012b786a73b43f3cd00fde6cb Mon Sep 17 00:00:00 2001 From: weonest Date: Sat, 5 Aug 2023 18:56:52 +0900 Subject: [PATCH 48/67] =?UTF-8?q?feedback:=20application.yml=20=ED=94=BC?= =?UTF-8?q?=EB=93=9C=EB=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/resources/application.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index bf7227f32..091449ba8 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -3,6 +3,8 @@ spring: url: jdbc:h2:mem:board username: sa password: - jpa: show-sql: true + logging: + level: + sql: info \ No newline at end of file From 163da1ce854669db341df12a8e16e2671a494e59 Mon Sep 17 00:00:00 2001 From: weonest Date: Sat, 5 Aug 2023 19:00:49 +0900 Subject: [PATCH 49/67] =?UTF-8?q?refactor:=20=EC=97=94=ED=8B=B0=ED=8B=B0?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/customer/application/CustomerServiceImpl.java | 5 +++-- .../domain/order/application/OrderServiceImpl.java | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java b/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java index a8ccf785b..41f3bc142 100644 --- a/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/customer/application/CustomerServiceImpl.java @@ -6,6 +6,7 @@ import com.jpaweekly.domain.customer.dto.CustomerResponse; import com.jpaweekly.domain.customer.dto.CustomerUpdate; import com.jpaweekly.domain.customer.infrastructrue.CustomerRepository; +import jakarta.persistence.EntityNotFoundException; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -26,7 +27,7 @@ public Long create(CustomerRequest request) { } public CustomerResponse findCustomerById(Long id) { - Customer customer = customerRepository.findById(id).orElseThrow(IllegalArgumentException::new); + Customer customer = customerRepository.findById(id).orElseThrow(EntityNotFoundException::new); return CustomerConverter.convertEntityToResponse(customer); } @@ -37,7 +38,7 @@ public Page findCustomersWithPaging(Pageable pageable) { @Transactional public void update(Long id, CustomerUpdate request) { - Customer customer = customerRepository.findById(id).orElseThrow(IllegalArgumentException::new); + Customer customer = customerRepository.findById(id).orElseThrow(EntityNotFoundException::new); customer.update(request.firstName(), request.lastName()); } diff --git a/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java b/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java index 2c8ecbff6..391008316 100644 --- a/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java @@ -11,6 +11,7 @@ import com.jpaweekly.domain.product.infrastructrue.ProductRepository; import com.jpaweekly.domain.user.User; import com.jpaweekly.domain.user.infrastructrue.UserRepository; +import jakarta.persistence.EntityNotFoundException; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -31,7 +32,7 @@ public class OrderServiceImpl implements OrderService { @Transactional public Long createOrder(Long id, OrderCreateRequest request) { - User user = userRepository.findById(id).orElseThrow(IllegalArgumentException::new); + User user = userRepository.findById(id).orElseThrow(EntityNotFoundException::new); Order order = Order.builder() .address(request.address()) @@ -43,7 +44,7 @@ public Long createOrder(Long id, OrderCreateRequest request) { List orderProducts = new ArrayList<>(); request.orderProductCreateList().forEach(item -> { - Product product = productRepository.findById(item.productId()).orElseThrow(IllegalArgumentException::new); + Product product = productRepository.findById(item.productId()).orElseThrow(EntityNotFoundException::new); OrderProduct orderProduct = OrderProduct.builder() .order(order) .product(product) @@ -56,7 +57,7 @@ public Long createOrder(Long id, OrderCreateRequest request) { } public OrderResponse findOrderById(Long id) { - Order order = orderRepository.findById(id).orElseThrow(IllegalArgumentException::new); + Order order = orderRepository.findById(id).orElseThrow(EntityNotFoundException::new); return OrderResponse.from(order); } } From 542377232fbc89a8e49b9ddd45457529b6d310c5 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 6 Aug 2023 00:18:08 +0900 Subject: [PATCH 50/67] =?UTF-8?q?feat:=20static=20method=20Mocking?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pom.xml b/pom.xml index c69a6e654..4f94d7b49 100644 --- a/pom.xml +++ b/pom.xml @@ -38,6 +38,12 @@ h2 runtime + + org.mockito + mockito-inline + 5.1.1 + test + org.projectlombok @@ -49,6 +55,11 @@ spring-boot-starter-test test + + junit + junit + test + From 0180272efd7d855f36d7d5a51e668a62a3a07380 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 6 Aug 2023 21:10:52 +0900 Subject: [PATCH 51/67] =?UTF-8?q?feat:=20=EB=8D=94=EB=AF=B8=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=83=9D=EC=84=B1=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20instancio=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4f94d7b49..501800a2d 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,12 @@ 5.1.1 test - + + org.instancio + instancio-junit + 3.0.0 + test + org.projectlombok lombok From fc13d3424a1bfa979021ba9dd42217f41a08b811 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 6 Aug 2023 21:11:16 +0900 Subject: [PATCH 52/67] =?UTF-8?q?refactor:=20mock=EA=B3=BC=20instancio?= =?UTF-8?q?=EB=A5=BC=20=ED=99=9C=EC=9A=A9=ED=95=9C=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=20=EB=A0=88=EC=9D=B4=EC=96=B4=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/CustomerServiceImplTest.java | 114 ++++++++++++------ 1 file changed, 78 insertions(+), 36 deletions(-) diff --git a/src/test/java/com/jpaweekly/domain/customer/application/CustomerServiceImplTest.java b/src/test/java/com/jpaweekly/domain/customer/application/CustomerServiceImplTest.java index 4964e4cdb..d9c1b0af0 100644 --- a/src/test/java/com/jpaweekly/domain/customer/application/CustomerServiceImplTest.java +++ b/src/test/java/com/jpaweekly/domain/customer/application/CustomerServiceImplTest.java @@ -1,93 +1,135 @@ package com.jpaweekly.domain.customer.application; +import com.jpaweekly.domain.customer.Customer; +import com.jpaweekly.domain.customer.CustomerConverter; import com.jpaweekly.domain.customer.dto.CustomerRequest; import com.jpaweekly.domain.customer.dto.CustomerResponse; import com.jpaweekly.domain.customer.dto.CustomerUpdate; +import com.jpaweekly.domain.customer.infrastructrue.CustomerRepository; +import org.instancio.Instancio; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.context.annotation.Import; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.MockedStatic; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; -import static org.assertj.core.api.Assertions.*; +import java.util.Optional; -@DataJpaTest -@Import(CustomerServiceImpl.class) +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatNoException; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.mockStatic; + +@ExtendWith(MockitoExtension.class) class CustomerServiceImplTest { - @Autowired - private CustomerService customerService; + private static MockedStatic customerConverter; + + @InjectMocks + private CustomerServiceImpl customerService; + + @Mock + private CustomerRepository customerRepository; + + @BeforeAll + public static void setUp() { + customerConverter = mockStatic(CustomerConverter.class); + } + + @AfterAll + public static void tearDown() { + customerConverter.close(); + } @Test - void createTest() { + void createCustomerTest() { //given - CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); + Customer customer = Instancio.create(Customer.class); + Long customerId = customer.getId(); + CustomerRequest request = Instancio.create(CustomerRequest.class); + + given(CustomerConverter.convertRequestToEntity(request)).willReturn(customer); + given(customerRepository.save(customer)).willReturn(customer); //when - Long id = customerService.create(customerRequest); + Long id = customerService.create(request); //then - assertThat(id).isNotNull(); + assertThat(customerId).isEqualTo(id); } @Test void findByIdTest() { - //given - String firstName = "weon"; - CustomerRequest customerRequest = new CustomerRequest(firstName, "geonhee"); - Long id = customerService.create(customerRequest); + Customer customer = Instancio.create(Customer.class); + Long customerId = customer.getId(); + CustomerResponse response = Instancio.create(CustomerResponse.class); + + given(customerRepository.findById(customerId)).willReturn(Optional.of(customer)); + given(CustomerConverter.convertEntityToResponse(customer)).willReturn(response); //when - CustomerResponse customerById = customerService.findCustomerById(id); + CustomerResponse storedCustomer = customerService.findCustomerById(customerId); //then - assertThat(customerById.firstName()).isEqualTo(firstName); + assertThat(response).isEqualTo(storedCustomer); } @Test void findAllTest() { //given - CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); - CustomerRequest customerRequest2 = new CustomerRequest("god", "geonhee"); - customerService.create(customerRequest); - customerService.create(customerRequest2); + int testSize = 55; + int page = 0; + int pageSize = 10; + + Page customers = new PageImpl<>(Instancio.ofList(Customer.class).size(testSize).create()); + Pageable pageable = PageRequest.of(page, pageSize); + + given(customerRepository.findAll(pageable)).willReturn(customers); //when - Pageable pageable = PageRequest.of(0, 10); - Page customers = customerService.findCustomersWithPaging(pageable); + Page storedCustomers = customerService.findCustomersWithPaging(pageable); //then - assertThat(customers.getTotalElements()).isEqualTo(2); + assertThat(storedCustomers.getTotalElements()).isEqualTo(testSize); } @Test void updateTest() { //given - CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); - Long id = customerService.create(customerRequest); - CustomerUpdate customerUpdate = new CustomerUpdate("god", "sin"); + Customer customer = Instancio.create(Customer.class); + Long customerId = customer.getId(); + CustomerUpdate request = Instancio.create(CustomerUpdate.class); + CustomerResponse response = new CustomerResponse(customerId, request.firstName(), request.lastName()); + + given(customerRepository.findById(customerId)).willReturn(Optional.of(customer)); + given(CustomerConverter.convertEntityToResponse(customer)).willReturn(response); //when - customerService.update(id, customerUpdate); - CustomerResponse updated = customerService.findCustomerById(id); + customerService.update(customerId, request); //then - assertThat(customerUpdate.firstName()).isEqualTo(updated.firstName()); + assertThat(request.firstName()).isEqualTo(response.firstName()); } @Test void deleteTest() { - CustomerRequest customerRequest = new CustomerRequest("weon", "geonhee"); - Long id = customerService.create(customerRequest); + //given + Customer customer = Instancio.create(Customer.class); + Long customerId = customer.getId(); //when - customerService.delete(id); + doNothing().when(customerRepository).deleteById(customerId); //then - assertThatThrownBy(() -> customerService.findCustomerById(id)) - .isInstanceOf(IllegalArgumentException.class); + assertThatNoException().isThrownBy(() -> customerService.delete(customerId)); } } From 098dc349f641b191dc727e5997eda7cd5fa043a6 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 6 Aug 2023 21:17:07 +0900 Subject: [PATCH 53/67] =?UTF-8?q?refactor:=20@DataJpaTest=20=EB=A5=BC=20?= =?UTF-8?q?=ED=99=9C=EC=9A=A9=ED=95=9C=20Repository=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerRepositoryTest.java | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/test/java/com/jpaweekly/domain/customer/infrastructure/CustomerRepositoryTest.java diff --git a/src/test/java/com/jpaweekly/domain/customer/infrastructure/CustomerRepositoryTest.java b/src/test/java/com/jpaweekly/domain/customer/infrastructure/CustomerRepositoryTest.java new file mode 100644 index 000000000..a02e23fe4 --- /dev/null +++ b/src/test/java/com/jpaweekly/domain/customer/infrastructure/CustomerRepositoryTest.java @@ -0,0 +1,98 @@ +package com.jpaweekly.domain.customer.infrastructure; + +import com.jpaweekly.domain.customer.application.CustomerService; +import com.jpaweekly.domain.customer.application.CustomerServiceImpl; +import com.jpaweekly.domain.customer.dto.CustomerRequest; +import com.jpaweekly.domain.customer.dto.CustomerResponse; +import com.jpaweekly.domain.customer.dto.CustomerUpdate; +import jakarta.persistence.EntityNotFoundException; +import org.instancio.Instancio; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.context.annotation.Import; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +@DataJpaTest +@Import(CustomerServiceImpl.class) +class CustomerRepositoryTest { + + @Autowired + private CustomerService customerService; + + @Test + void createTest() { + //given + CustomerRequest request = Instancio.create(CustomerRequest.class); + + //when + Long id = customerService.create(request); + + //then + assertThat(id).isNotNull(); + } + + @Test + void findByIdTest() { + //given + CustomerRequest request = Instancio.create(CustomerRequest.class); + Long id = customerService.create(request); + + //when + CustomerResponse storedCustomer = customerService.findCustomerById(id); + + //then + assertThat(id).isEqualTo(storedCustomer.id()); + } + + @Test + void findAllTest() { + //given + int testSize = 33; + List requests = Instancio.ofList(CustomerRequest.class).size(testSize).create(); + requests.forEach(customerService::create); + + //when + Pageable pageable = PageRequest.of(0, 10); + Page response = customerService.findCustomersWithPaging(pageable); + + //then + assertThat(response.getTotalElements()).isEqualTo(testSize); + } + + @Test + void updateTest() { + //given + CustomerRequest request = Instancio.create(CustomerRequest.class); + Long id = customerService.create(request); + CustomerUpdate customerUpdate = Instancio.create(CustomerUpdate.class); + + //when + customerService.update(id, customerUpdate); + CustomerResponse updated = customerService.findCustomerById(id); + + //then + assertThat(customerUpdate.firstName()).isEqualTo(updated.firstName()); + } + + @Test + void deleteTest() { + CustomerRequest request = Instancio.create(CustomerRequest.class); + Long id = customerService.create(request); + + //when + customerService.delete(id); + + //then + assertThatThrownBy(() -> customerService.findCustomerById(id)) + .isInstanceOf(EntityNotFoundException.class); + } + +} From 67355cdbecda342a4d8410aac7506f4406bbff4d Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 6 Aug 2023 21:49:44 +0900 Subject: [PATCH 54/67] =?UTF-8?q?refactor:=20OrderCreateRequest=20nickname?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java b/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java index f314d4ef0..c359aa913 100644 --- a/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java +++ b/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java @@ -6,8 +6,6 @@ import java.util.List; public record OrderCreateRequest( - @NotBlank - String nickName, @NotBlank String address, @NotNull From 5f0947c6f65a62f6c9f84ad55589a278f702296d Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 6 Aug 2023 21:51:02 +0900 Subject: [PATCH 55/67] =?UTF-8?q?feat:=20BaseEntity=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekly/JpaWeekilyApplication.java | 2 ++ .../java/com/jpaweekly/common/BaseEntity.java | 24 +++++++++++++++++++ .../com/jpaweekly/domain/order/Order.java | 3 ++- .../com/jpaweekly/domain/product/Product.java | 3 ++- .../java/com/jpaweekly/domain/user/User.java | 3 ++- 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/jpaweekly/common/BaseEntity.java diff --git a/src/main/java/com/jpaweekly/JpaWeekilyApplication.java b/src/main/java/com/jpaweekly/JpaWeekilyApplication.java index a3b16dd7a..bf413c9f2 100644 --- a/src/main/java/com/jpaweekly/JpaWeekilyApplication.java +++ b/src/main/java/com/jpaweekly/JpaWeekilyApplication.java @@ -2,8 +2,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; @SpringBootApplication +@EnableJpaAuditing public class JpaWeekilyApplication { public static void main(String[] args) { diff --git a/src/main/java/com/jpaweekly/common/BaseEntity.java b/src/main/java/com/jpaweekly/common/BaseEntity.java new file mode 100644 index 000000000..5f3e6614b --- /dev/null +++ b/src/main/java/com/jpaweekly/common/BaseEntity.java @@ -0,0 +1,24 @@ +package com.jpaweekly.common; + +import jakarta.persistence.Column; +import jakarta.persistence.EntityListeners; +import jakarta.persistence.MappedSuperclass; +import lombok.Getter; +import org.springframework.data.annotation.CreatedDate; +import org.springframework.data.annotation.LastModifiedDate; +import org.springframework.data.jpa.domain.support.AuditingEntityListener; + +import java.time.LocalDateTime; + +@MappedSuperclass +@Getter +@EntityListeners(AuditingEntityListener.class) +public abstract class BaseEntity { + @Column(name = "created_at", nullable = false, updatable = false) + @CreatedDate + LocalDateTime createdAt; + + @Column(name = "updated_at", nullable = false) + @LastModifiedDate + LocalDateTime updatedAt; +} diff --git a/src/main/java/com/jpaweekly/domain/order/Order.java b/src/main/java/com/jpaweekly/domain/order/Order.java index 2c8da2545..7f9ad4482 100644 --- a/src/main/java/com/jpaweekly/domain/order/Order.java +++ b/src/main/java/com/jpaweekly/domain/order/Order.java @@ -1,5 +1,6 @@ package com.jpaweekly.domain.order; +import com.jpaweekly.common.BaseEntity; import com.jpaweekly.domain.user.User; import jakarta.persistence.*; import lombok.AccessLevel; @@ -13,7 +14,7 @@ @Table(name = "orders") @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class Order { +public class Order extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/src/main/java/com/jpaweekly/domain/product/Product.java b/src/main/java/com/jpaweekly/domain/product/Product.java index a10fab46e..bbf9eeb4c 100644 --- a/src/main/java/com/jpaweekly/domain/product/Product.java +++ b/src/main/java/com/jpaweekly/domain/product/Product.java @@ -1,5 +1,6 @@ package com.jpaweekly.domain.product; +import com.jpaweekly.common.BaseEntity; import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; @@ -9,7 +10,7 @@ @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class Product { +public class Product extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/src/main/java/com/jpaweekly/domain/user/User.java b/src/main/java/com/jpaweekly/domain/user/User.java index c772a224f..401323a2b 100644 --- a/src/main/java/com/jpaweekly/domain/user/User.java +++ b/src/main/java/com/jpaweekly/domain/user/User.java @@ -1,5 +1,6 @@ package com.jpaweekly.domain.user; +import com.jpaweekly.common.BaseEntity; import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; @@ -12,7 +13,7 @@ @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -public class User { +public class User extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) From 4505c97bb6574b476f3a04ffd46bbfce02119575 Mon Sep 17 00:00:00 2001 From: weonest Date: Sun, 6 Aug 2023 21:51:56 +0900 Subject: [PATCH 56/67] =?UTF-8?q?refactor:=20BaseEntity=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=EC=97=90=20=EB=94=B0=EB=A5=B8=20User=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/jpaweekly/domain/user/User.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/user/User.java b/src/main/java/com/jpaweekly/domain/user/User.java index 401323a2b..c1841bc75 100644 --- a/src/main/java/com/jpaweekly/domain/user/User.java +++ b/src/main/java/com/jpaweekly/domain/user/User.java @@ -28,13 +28,10 @@ public class User extends BaseEntity { @Column(unique = true, nullable = false) private String nickname; - private LocalDateTime createdAt; - @Builder - private User(String loginId, String nickname, String password, LocalDateTime createdAt) { + private User(String loginId, String nickname, String password) { this.loginId = loginId; this.nickname = nickname; this.password = password; - this.createdAt = createdAt; } } From 1875e577c636fefda00c775278153519dc80a9f5 Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 13:44:18 +0900 Subject: [PATCH 57/67] refactor: --- src/main/java/com/jpaweekly/domain/order/Order.java | 7 +------ .../domain/order/dto/OrderCreateRequest.java | 11 +++++++++++ .../com/jpaweekly/domain/order/dto/OrderResponse.java | 2 +- src/main/java/com/jpaweekly/domain/user/User.java | 2 -- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/order/Order.java b/src/main/java/com/jpaweekly/domain/order/Order.java index 7f9ad4482..6108ac0ad 100644 --- a/src/main/java/com/jpaweekly/domain/order/Order.java +++ b/src/main/java/com/jpaweekly/domain/order/Order.java @@ -8,8 +8,6 @@ import lombok.Getter; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; - @Entity @Table(name = "orders") @Getter @@ -25,17 +23,14 @@ public class Order extends BaseEntity { @Enumerated(EnumType.STRING) private OrderStatus orderStatus; - private LocalDateTime createAt; - @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "user_id") private User user; @Builder - private Order(String address, OrderStatus orderStatus, LocalDateTime createAt, User user) { + private Order(String address, OrderStatus orderStatus, User user) { this.address = address; this.orderStatus = orderStatus; - this.createAt = createAt; this.user = user; } diff --git a/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java b/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java index c359aa913..50a6a2d9f 100644 --- a/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java +++ b/src/main/java/com/jpaweekly/domain/order/dto/OrderCreateRequest.java @@ -1,14 +1,25 @@ package com.jpaweekly.domain.order.dto; +import com.jpaweekly.domain.order.Order; +import com.jpaweekly.domain.order.OrderStatus; +import com.jpaweekly.domain.user.User; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import java.util.List; + public record OrderCreateRequest( @NotBlank String address, @NotNull List orderProductCreateList ) { + public Order toEntity(User user) { + return Order.builder() + .address(this.address) + .orderStatus(OrderStatus.READY_FOR_DELIVERY) + .user(user) + .build(); + } } diff --git a/src/main/java/com/jpaweekly/domain/order/dto/OrderResponse.java b/src/main/java/com/jpaweekly/domain/order/dto/OrderResponse.java index 16229fe88..042761974 100644 --- a/src/main/java/com/jpaweekly/domain/order/dto/OrderResponse.java +++ b/src/main/java/com/jpaweekly/domain/order/dto/OrderResponse.java @@ -17,6 +17,6 @@ public static OrderResponse from(Order order) { order.getUser().getNickname(), order.getAddress(), order.getOrderStatus(), - order.getCreateAt()); + order.getCreatedAt()); } } diff --git a/src/main/java/com/jpaweekly/domain/user/User.java b/src/main/java/com/jpaweekly/domain/user/User.java index c1841bc75..cb52c1f80 100644 --- a/src/main/java/com/jpaweekly/domain/user/User.java +++ b/src/main/java/com/jpaweekly/domain/user/User.java @@ -7,8 +7,6 @@ import lombok.Getter; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; - @Table(name = "users") @Entity @Getter From 7d1b1589b7e1f73d27e87105144d33a927ce8390 Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 13:44:46 +0900 Subject: [PATCH 58/67] =?UTF-8?q?style:=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekly/domain/user/application/UserServiceImpl.java | 3 --- .../jpaweekly/domain/user/application/UserServiceImplTest.java | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/user/application/UserServiceImpl.java b/src/main/java/com/jpaweekly/domain/user/application/UserServiceImpl.java index c1f698cb0..784a70c6f 100644 --- a/src/main/java/com/jpaweekly/domain/user/application/UserServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/user/application/UserServiceImpl.java @@ -8,8 +8,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; - @Transactional(readOnly = true) @Service @@ -26,7 +24,6 @@ public Long createUser(UserCreateRequest request) { .loginId(request.loginId()) .password(encodedPassword) .nickname(request.nickname()) - .createdAt(LocalDateTime.now()) .build(); userRepository.save(user); return user.getId(); diff --git a/src/test/java/com/jpaweekly/domain/user/application/UserServiceImplTest.java b/src/test/java/com/jpaweekly/domain/user/application/UserServiceImplTest.java index ba838d3ca..9ccaae150 100644 --- a/src/test/java/com/jpaweekly/domain/user/application/UserServiceImplTest.java +++ b/src/test/java/com/jpaweekly/domain/user/application/UserServiceImplTest.java @@ -5,7 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest class UserServiceImplTest { From 341818b0bec93fa1fb3d72085a9a6353bcf16cff Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 13:45:13 +0900 Subject: [PATCH 59/67] =?UTF-8?q?refactor:=20OrderServiceImpl=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/application/OrderServiceImpl.java | 15 +- .../application/OrderServiceImplTest.java | 133 +++++++++++++----- 2 files changed, 103 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java b/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java index 391008316..5bdf140ee 100644 --- a/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java @@ -2,7 +2,6 @@ import com.jpaweekly.domain.order.Order; import com.jpaweekly.domain.order.OrderProduct; -import com.jpaweekly.domain.order.OrderStatus; import com.jpaweekly.domain.order.dto.OrderCreateRequest; import com.jpaweekly.domain.order.dto.OrderResponse; import com.jpaweekly.domain.order.infrastructrue.OrderProductRepository; @@ -16,7 +15,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -34,26 +32,21 @@ public class OrderServiceImpl implements OrderService { public Long createOrder(Long id, OrderCreateRequest request) { User user = userRepository.findById(id).orElseThrow(EntityNotFoundException::new); - Order order = Order.builder() - .address(request.address()) - .orderStatus(OrderStatus.READY_FOR_DELIVERY) - .createAt(LocalDateTime.now()) - .user(user) - .build(); - orderRepository.save(order); + Order order = request.toEntity(user); + Order savedOrder = orderRepository.save(order); List orderProducts = new ArrayList<>(); request.orderProductCreateList().forEach(item -> { Product product = productRepository.findById(item.productId()).orElseThrow(EntityNotFoundException::new); OrderProduct orderProduct = OrderProduct.builder() - .order(order) + .order(savedOrder) .product(product) .quantity(item.quantity()) .build(); orderProducts.add(orderProduct); }); orderProductRepository.saveAll(orderProducts); - return order.getId(); + return savedOrder.getId(); } public OrderResponse findOrderById(Long id) { diff --git a/src/test/java/com/jpaweekly/domain/order/application/OrderServiceImplTest.java b/src/test/java/com/jpaweekly/domain/order/application/OrderServiceImplTest.java index f747fed68..0a55f98b7 100644 --- a/src/test/java/com/jpaweekly/domain/order/application/OrderServiceImplTest.java +++ b/src/test/java/com/jpaweekly/domain/order/application/OrderServiceImplTest.java @@ -1,59 +1,124 @@ package com.jpaweekly.domain.order.application; +import com.jpaweekly.domain.order.Order; +import com.jpaweekly.domain.order.OrderProduct; import com.jpaweekly.domain.order.dto.OrderCreateRequest; import com.jpaweekly.domain.order.dto.OrderProductCreate; -import com.jpaweekly.domain.product.application.ProductService; -import com.jpaweekly.domain.product.dto.ProductCreateRequest; -import com.jpaweekly.domain.user.application.UserService; -import com.jpaweekly.domain.user.dto.UserCreateRequest; -import org.junit.jupiter.api.BeforeEach; +import com.jpaweekly.domain.order.infrastructrue.OrderProductRepository; +import com.jpaweekly.domain.order.infrastructrue.OrderRepository; +import com.jpaweekly.domain.product.Product; +import com.jpaweekly.domain.product.infrastructrue.ProductRepository; +import com.jpaweekly.domain.user.User; +import com.jpaweekly.domain.user.infrastructrue.UserRepository; +import org.instancio.Instancio; import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.boot.test.context.TestConfiguration; -import org.springframework.context.annotation.ComponentScan; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.test.util.ReflectionTestUtils; +import java.util.ArrayList; import java.util.List; +import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; +import static org.instancio.Assign.valueOf; +import static org.instancio.Select.field; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; +import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.doNothing; -@DataJpaTest +@ExtendWith(MockitoExtension.class) class OrderServiceImplTest { - @TestConfiguration - @ComponentScan(basePackages = {"com.jpaweekly.domain", "com.jpaweekly.config"}) - static class Config{} + @InjectMocks + private OrderServiceImpl orderService; - @Autowired - private OrderService orderService; + @Mock + private OrderRepository orderRepository; - @Autowired - private ProductService productService; + @Mock + private UserRepository userRepository; - @Autowired - private UserService userService; + @Mock + private ProductRepository productRepository; - List orderProducts; + @Mock + private OrderProductRepository orderProductRepository; - @BeforeEach - void setUp() { - Long productId = productService.createProduct(new ProductCreateRequest("주먹밥", 100)); - Long productId2 = productService.createProduct(new ProductCreateRequest("고봉밥", 100)); - Long productId3 = productService.createProduct(new ProductCreateRequest("김밥", 100)); - OrderProductCreate orderProductCreate = new OrderProductCreate(productId, 3); - OrderProductCreate orderProductCreate2 = new OrderProductCreate(productId2, 3); - OrderProductCreate orderProductCreate3 = new OrderProductCreate(productId3, 3); - orderProducts = List.of(orderProductCreate, orderProductCreate2, orderProductCreate3); - } + Long initialId = 1L; @Test void orderCreateTest() { - Long userId = userService.createUser(new UserCreateRequest("test", "123", "tester")); - OrderCreateRequest orderCreateRequest = new OrderCreateRequest("tester", "수원시", orderProducts); + //given + int productSize = 100; + int orderProductCreateSize = 10; + + List productList = getProductList(productSize); + List orderProductCreateList = getOrderProductList(orderProductCreateSize, productSize); + OrderCreateRequest request = getOrderCreateRequest(orderProductCreateList); + + User user = Instancio.create(User.class); + Long userId = user.getId(); + + Order order = request.toEntity(user); + ReflectionTestUtils.setField(order, "id", initialId); + + given(userRepository.findById(userId)).willReturn(Optional.of(user)); + given(orderRepository.save(any(Order.class))).willReturn(order); + for (int i = 0; i < orderProductCreateList.size(); i++) { + long productId = orderProductCreateList.get(i).productId(); + int productIdx = (int) productId - 1; + given(productRepository.findById(productId)).willReturn(Optional.ofNullable(productList.get(productIdx))); + } + doNothing().when(orderProductRepository).saveAll(anyList()); + + //when + Long orderId = orderService.createOrder(userId, request); + + //then + assertThat(order.getId()).isEqualTo(orderId); + } + + + private List getProductList(int size) { + return Instancio.ofList(Product.class) + .size(size) + .assign(valueOf(Product::getId).generate(gen -> gen.longSeq().start(initialId))) + .create(); + } - Long orderId = orderService.createOrder(userId, orderCreateRequest); + private List getOrderProductList(int size, long productSize) { + return Instancio.ofList(OrderProductCreate.class) + .size(size) + .supply(field(OrderProductCreate::productId), random -> random.longRange(initialId, productSize)) + .create(); + } + + private OrderCreateRequest getOrderCreateRequest(List orderProductCreateList) { + return Instancio.of(OrderCreateRequest.class) + .set(field(OrderCreateRequest::orderProductCreateList), orderProductCreateList) + .create(); + } - assertThat(orderId).isNotNull(); + private List getOrderProductList( + List orderProductCreateList, + List productList, + Order order + ) { + List orderProductList = new ArrayList<>(); + for (int i = 0; i < orderProductCreateList.size(); i++) { + int productIdx = (int) (orderProductCreateList.get(i).productId() - 1); + OrderProduct orderProduct = Instancio.of(OrderProduct.class) + .set(field(OrderProduct::getOrder), order) + .set(field(OrderProduct::getProduct), productList.get(productIdx)) + .set(field(OrderProduct::getQuantity), orderProductCreateList.get(i).quantity()) + .create(); + orderProductList.add(orderProduct); + } + return orderProductList; } } From f63e9325fde32dc2b01bde922fdafb52a33fa8f9 Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 13:45:33 +0900 Subject: [PATCH 60/67] =?UTF-8?q?style:=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/customer/presentation/CustomerApiController.java | 2 +- .../domain/product/application/ProductServiceImplTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/customer/presentation/CustomerApiController.java b/src/main/java/com/jpaweekly/domain/customer/presentation/CustomerApiController.java index e53ad5b5b..128842306 100644 --- a/src/main/java/com/jpaweekly/domain/customer/presentation/CustomerApiController.java +++ b/src/main/java/com/jpaweekly/domain/customer/presentation/CustomerApiController.java @@ -1,9 +1,9 @@ package com.jpaweekly.domain.customer.presentation; +import com.jpaweekly.domain.customer.application.CustomerService; import com.jpaweekly.domain.customer.dto.CustomerRequest; import com.jpaweekly.domain.customer.dto.CustomerResponse; import com.jpaweekly.domain.customer.dto.CustomerUpdate; -import com.jpaweekly.domain.customer.application.CustomerService; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; diff --git a/src/test/java/com/jpaweekly/domain/product/application/ProductServiceImplTest.java b/src/test/java/com/jpaweekly/domain/product/application/ProductServiceImplTest.java index 56cd29b40..b11fd73c7 100644 --- a/src/test/java/com/jpaweekly/domain/product/application/ProductServiceImplTest.java +++ b/src/test/java/com/jpaweekly/domain/product/application/ProductServiceImplTest.java @@ -5,7 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; @SpringBootTest class ProductServiceImplTest { From 86c59850f42058d84124f5a7a19fe302582a56ce Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 14:10:48 +0900 Subject: [PATCH 61/67] =?UTF-8?q?feat:=20=EB=8F=84=EB=A9=94=EC=9D=B8=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekly/domain/order/Order.java | 21 +++++++++++++++++++ .../jpaweekly/domain/order/OrderProduct.java | 3 +++ 2 files changed, 24 insertions(+) diff --git a/src/main/java/com/jpaweekly/domain/order/Order.java b/src/main/java/com/jpaweekly/domain/order/Order.java index 6108ac0ad..972f5ba5f 100644 --- a/src/main/java/com/jpaweekly/domain/order/Order.java +++ b/src/main/java/com/jpaweekly/domain/order/Order.java @@ -7,6 +7,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import org.springframework.util.Assert; @Entity @Table(name = "orders") @@ -29,9 +30,29 @@ public class Order extends BaseEntity { @Builder private Order(String address, OrderStatus orderStatus, User user) { + Assert.notNull(user, "User must be provided"); + Assert.notNull(address, "Address must be provided"); this.address = address; this.orderStatus = orderStatus; this.user = user; } + public void changeOrderStatusToDelivering() { + if (this.orderStatus == OrderStatus.READY_FOR_DELIVERY) { + this.orderStatus = OrderStatus.DELIVERING; + } else throw new RuntimeException("message"); + } + + public void changeOrderStatusToComplete() { + if (this.orderStatus == OrderStatus.DELIVERING) { + this.orderStatus = OrderStatus.COMPLETED; + } else throw new RuntimeException("message"); + } + + public void cancelOrder() { + if (this.orderStatus != OrderStatus.COMPLETED) { + this.orderStatus = OrderStatus.CANCELLED; + } else throw new RuntimeException("message"); + } + } diff --git a/src/main/java/com/jpaweekly/domain/order/OrderProduct.java b/src/main/java/com/jpaweekly/domain/order/OrderProduct.java index 077137fd7..31892de8d 100644 --- a/src/main/java/com/jpaweekly/domain/order/OrderProduct.java +++ b/src/main/java/com/jpaweekly/domain/order/OrderProduct.java @@ -27,10 +27,13 @@ public class OrderProduct { private int quantity; + private int totalPrice; + @Builder private OrderProduct(Order order, Product product, int quantity) { this.order = order; this.product = product; this.quantity = quantity; + this.totalPrice = product.getPrice() * quantity; } } From 3d7e185c3bf5317e9ab07475475a6a82c669de8e Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 14:11:02 +0900 Subject: [PATCH 62/67] =?UTF-8?q?feat:=20OrderProductResponse=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/order/dto/OrderProductResponse.java | 17 +++++++++++++++++ .../infrastructrue/OrderProductRepository.java | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 src/main/java/com/jpaweekly/domain/order/dto/OrderProductResponse.java diff --git a/src/main/java/com/jpaweekly/domain/order/dto/OrderProductResponse.java b/src/main/java/com/jpaweekly/domain/order/dto/OrderProductResponse.java new file mode 100644 index 000000000..5dda5ce05 --- /dev/null +++ b/src/main/java/com/jpaweekly/domain/order/dto/OrderProductResponse.java @@ -0,0 +1,17 @@ +package com.jpaweekly.domain.order.dto; + +import com.jpaweekly.domain.order.OrderProduct; + +public record OrderProductResponse ( + String productName, + int quantity, + int totalPrice +){ + public static OrderProductResponse from(OrderProduct orderProduct) { + return new OrderProductResponse( + orderProduct.getProduct().getProductName(), + orderProduct.getQuantity(), + orderProduct.getTotalPrice() + ); + } +} diff --git a/src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderProductRepository.java b/src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderProductRepository.java index 92ecba0db..915c9459b 100644 --- a/src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderProductRepository.java +++ b/src/main/java/com/jpaweekly/domain/order/infrastructrue/OrderProductRepository.java @@ -1,7 +1,11 @@ package com.jpaweekly.domain.order.infrastructrue; import com.jpaweekly.domain.order.OrderProduct; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; public interface OrderProductRepository extends JpaRepository, CustomOrderProductRepository { + + Page findByOrderId(Long orderId, Pageable pageable); } From db09543f968ac0dad10cd9263da926a23811183f Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 14:11:17 +0900 Subject: [PATCH 63/67] =?UTF-8?q?feat:=20OrderServiceImpl=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../order/application/OrderService.java | 20 +++++++++ .../order/application/OrderServiceImpl.java | 41 +++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/main/java/com/jpaweekly/domain/order/application/OrderService.java b/src/main/java/com/jpaweekly/domain/order/application/OrderService.java index 1fbc1b9e0..daf56b9ef 100644 --- a/src/main/java/com/jpaweekly/domain/order/application/OrderService.java +++ b/src/main/java/com/jpaweekly/domain/order/application/OrderService.java @@ -1,7 +1,27 @@ package com.jpaweekly.domain.order.application; import com.jpaweekly.domain.order.dto.OrderCreateRequest; +import com.jpaweekly.domain.order.dto.OrderProductResponse; +import com.jpaweekly.domain.order.dto.OrderResponse; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; public interface OrderService { Long createOrder(Long id, OrderCreateRequest request); + + OrderResponse findOrderById(Long id); + + Page findOrders(Pageable pageable); + + Page findOrderProducts(Pageable pageable); + + Page findOrderProductsByOderId(Long orderId, Pageable pageable); + + void deliverOrder(Long id); + + void completeOrder(Long id); + + void deleteOrder(Long id); + + void cancelOrder(Long id); } diff --git a/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java b/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java index 5bdf140ee..56cb7ea1d 100644 --- a/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/order/application/OrderServiceImpl.java @@ -3,6 +3,7 @@ import com.jpaweekly.domain.order.Order; import com.jpaweekly.domain.order.OrderProduct; import com.jpaweekly.domain.order.dto.OrderCreateRequest; +import com.jpaweekly.domain.order.dto.OrderProductResponse; import com.jpaweekly.domain.order.dto.OrderResponse; import com.jpaweekly.domain.order.infrastructrue.OrderProductRepository; import com.jpaweekly.domain.order.infrastructrue.OrderRepository; @@ -12,6 +13,8 @@ import com.jpaweekly.domain.user.infrastructrue.UserRepository; import jakarta.persistence.EntityNotFoundException; import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -53,4 +56,42 @@ public OrderResponse findOrderById(Long id) { Order order = orderRepository.findById(id).orElseThrow(EntityNotFoundException::new); return OrderResponse.from(order); } + + public Page findOrders(Pageable pageable) { + return orderRepository.findAll(pageable) + .map(OrderResponse::from); + } + + public Page findOrderProducts(Pageable pageable) { + return orderProductRepository.findAll(pageable) + .map(OrderProductResponse::from); + } + + public Page findOrderProductsByOderId(Long orderId, Pageable pageable) { + return orderProductRepository.findByOrderId(orderId, pageable) + .map(OrderProductResponse::from); + } + + @Transactional + public void deliverOrder(Long id) { + Order order = orderRepository.findById(id).orElseThrow(EntityNotFoundException::new); + order.changeOrderStatusToDelivering(); + } + + @Transactional + public void completeOrder(Long id) { + Order order = orderRepository.findById(id).orElseThrow(EntityNotFoundException::new); + order.changeOrderStatusToComplete(); + } + + @Transactional + public void cancelOrder(Long id) { + Order order = orderRepository.findById(id).orElseThrow(EntityNotFoundException::new); + order.cancelOrder(); + } + + @Transactional + public void deleteOrder(Long id) { + orderRepository.deleteById(id); + } } From 41af75bea69f00f02bc99214acbfe32e92abfb99 Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 14:59:00 +0900 Subject: [PATCH 64/67] =?UTF-8?q?feat:=20Product=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/jpaweekly/domain/product/Product.java | 6 ++++++ .../product/dto/ProductCreateRequest.java | 7 +++++++ .../product/dto/ProductUpdateRequest.java | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/main/java/com/jpaweekly/domain/product/dto/ProductUpdateRequest.java diff --git a/src/main/java/com/jpaweekly/domain/product/Product.java b/src/main/java/com/jpaweekly/domain/product/Product.java index bbf9eeb4c..9a64f7624 100644 --- a/src/main/java/com/jpaweekly/domain/product/Product.java +++ b/src/main/java/com/jpaweekly/domain/product/Product.java @@ -6,6 +6,7 @@ import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; +import org.springframework.util.StringUtils; @Entity @Getter @@ -27,4 +28,9 @@ private Product(String productName, int price) { this.productName = productName; this.price = price; } + + public void update(String ProductName, int price) { + this.productName = productName; + this.price = price; + } } diff --git a/src/main/java/com/jpaweekly/domain/product/dto/ProductCreateRequest.java b/src/main/java/com/jpaweekly/domain/product/dto/ProductCreateRequest.java index edcbeaf90..d518c9f62 100644 --- a/src/main/java/com/jpaweekly/domain/product/dto/ProductCreateRequest.java +++ b/src/main/java/com/jpaweekly/domain/product/dto/ProductCreateRequest.java @@ -1,5 +1,6 @@ package com.jpaweekly.domain.product.dto; +import com.jpaweekly.domain.product.Product; import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotBlank; @@ -9,4 +10,10 @@ public record ProductCreateRequest( @Min(0) int price ) { + public Product toEntity() { + return Product.builder() + .productName(this.productName) + .price(this.price) + .build(); + } } diff --git a/src/main/java/com/jpaweekly/domain/product/dto/ProductUpdateRequest.java b/src/main/java/com/jpaweekly/domain/product/dto/ProductUpdateRequest.java new file mode 100644 index 000000000..d03d52b0d --- /dev/null +++ b/src/main/java/com/jpaweekly/domain/product/dto/ProductUpdateRequest.java @@ -0,0 +1,19 @@ +package com.jpaweekly.domain.product.dto; + +import com.jpaweekly.domain.product.Product; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotBlank; + +public record ProductUpdateRequest( + @NotBlank + String productName, + @Min(0) + int price +){ + public Product toEntity() { + return Product.builder() + .productName(this.productName) + .price(this.price) + .build(); + } +} From 5f5d625cd1711202d6b0dfc2ab746c1ab1b779d7 Mon Sep 17 00:00:00 2001 From: weonest Date: Mon, 7 Aug 2023 14:59:20 +0900 Subject: [PATCH 65/67] =?UTF-8?q?feat:=20Product=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=20=EB=A0=88=ED=8F=AC=EC=A7=80=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/application/ProductService.java | 14 +++++++ .../application/ProductServiceImpl.java | 40 ++++++++++++++++--- .../infrastructrue/ProductRepository.java | 3 ++ 3 files changed, 51 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/product/application/ProductService.java b/src/main/java/com/jpaweekly/domain/product/application/ProductService.java index 33aec7378..394f6489d 100644 --- a/src/main/java/com/jpaweekly/domain/product/application/ProductService.java +++ b/src/main/java/com/jpaweekly/domain/product/application/ProductService.java @@ -1,7 +1,21 @@ package com.jpaweekly.domain.product.application; import com.jpaweekly.domain.product.dto.ProductCreateRequest; +import com.jpaweekly.domain.product.dto.ProductResponse; +import com.jpaweekly.domain.product.dto.ProductUpdateRequest; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; public interface ProductService { Long createProduct(ProductCreateRequest request); + + ProductResponse findProductById(Long id); + + ProductResponse findProductByProductName(String productName); + + Page findProducts(Pageable pageable); + + void updateProduct(Long id, ProductUpdateRequest request); + + void deleteProduct(Long id); } diff --git a/src/main/java/com/jpaweekly/domain/product/application/ProductServiceImpl.java b/src/main/java/com/jpaweekly/domain/product/application/ProductServiceImpl.java index 0be5fd9af..cad874ca3 100644 --- a/src/main/java/com/jpaweekly/domain/product/application/ProductServiceImpl.java +++ b/src/main/java/com/jpaweekly/domain/product/application/ProductServiceImpl.java @@ -3,8 +3,13 @@ import com.jpaweekly.domain.product.Product; import com.jpaweekly.domain.product.dto.ProductCreateRequest; +import com.jpaweekly.domain.product.dto.ProductResponse; +import com.jpaweekly.domain.product.dto.ProductUpdateRequest; import com.jpaweekly.domain.product.infrastructrue.ProductRepository; +import jakarta.persistence.EntityNotFoundException; import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -17,11 +22,34 @@ public class ProductServiceImpl implements ProductService { @Transactional public Long createProduct(ProductCreateRequest request) { - Product product = Product.builder() - .productName(request.productName()) - .price(request.price()) - .build(); - productRepository.save(product); - return product.getId(); + Product product = request.toEntity(); + return productRepository.save(product).getId(); } + + public ProductResponse findProductById(Long id) { + Product product = productRepository.findById(id).orElseThrow(EntityNotFoundException::new); + return ProductResponse.from(product); + } + + public ProductResponse findProductByProductName(String productName) { + Product product = productRepository.findByProductName(productName).orElseThrow(EntityNotFoundException::new); + return ProductResponse.from(product); + } + + public Page findProducts(Pageable pageable) { + return productRepository.findAll(pageable) + .map(ProductResponse::from); + } + + @Transactional + public void updateProduct(Long id, ProductUpdateRequest request) { + Product product = productRepository.findById(id).orElseThrow(EntityNotFoundException::new); + product.update(request.productName(), request.price()); + } + + @Transactional + public void deleteProduct(Long id) { + productRepository.deleteById(id); + } + } diff --git a/src/main/java/com/jpaweekly/domain/product/infrastructrue/ProductRepository.java b/src/main/java/com/jpaweekly/domain/product/infrastructrue/ProductRepository.java index 71c0b76a5..e7751f559 100644 --- a/src/main/java/com/jpaweekly/domain/product/infrastructrue/ProductRepository.java +++ b/src/main/java/com/jpaweekly/domain/product/infrastructrue/ProductRepository.java @@ -3,6 +3,9 @@ import com.jpaweekly.domain.product.Product; import org.springframework.data.jpa.repository.JpaRepository; +import java.util.Optional; + public interface ProductRepository extends JpaRepository { + Optional findByProductName(String productName); } From 0b6fece4f2fde8d49340b23b2ca0ae27007a51cc Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 8 Aug 2023 00:01:21 +0900 Subject: [PATCH 66/67] =?UTF-8?q?refactor:=20batch=20insert=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infrastructrue/CustomOrderProductRepositoryImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java b/src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java index 23dbbe59a..ac7734aad 100644 --- a/src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java +++ b/src/main/java/com/jpaweekly/domain/order/infrastructrue/CustomOrderProductRepositoryImpl.java @@ -24,12 +24,13 @@ public void saveAll(List orderProducts) { SqlParameterSource source = new MapSqlParameterSource() .addValue("order_id", orderProduct.getOrder().getId()) .addValue("product_id", orderProduct.getProduct().getId()) - .addValue("quantity", orderProduct.getQuantity()); + .addValue("quantity", orderProduct.getQuantity()) + .addValue("totalPrice", orderProduct.getTotalPrice()); sqlParameterSources[idx++] = source; } String sql = """ - insert into order_product (order_id, product_id, quantity) - values(:order_id, :product_id, :quantity)"""; + insert into order_product (order_id, product_id, quantity, total_price) + values(:order_id, :product_id, :quantity, :totalPrice)"""; jdbcTemplate.batchUpdate(sql, sqlParameterSources); } From 01e48e97029a9fbf7f2741d44a64283f6e23e9ba Mon Sep 17 00:00:00 2001 From: weonest Date: Tue, 8 Aug 2023 00:08:41 +0900 Subject: [PATCH 67/67] =?UTF-8?q?refactor:=20application.yml=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 5 +---- src/test/resources/application.yml | 11 +++++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 10c25b49c..d076b40c5 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,11 +1,9 @@ spring: datasource: -# url: jdbc:h2:mem:test;MODE=MySQL url: jdbc:h2:~/weekly username: sa password: - h2: console: enabled: true @@ -15,8 +13,7 @@ spring: open-in-view: false hibernate: ddl-auto: none + show_sql: true properties: hibernate: format_sql: true - show_sql: true - diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 091449ba8..00167f398 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -3,8 +3,11 @@ spring: url: jdbc:h2:mem:board username: sa password: + jpa: - show-sql: true - logging: - level: - sql: info \ No newline at end of file + hibernate: + ddl-auto: create-drop + show_sql: true + properties: + hibernate: + format_sql: true