From 8a639a4078aa60c9837941b75ad948432e924b81 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:37:50 +0900 Subject: [PATCH 001/465] =?UTF-8?q?[DOCS]=20PR=20Template=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pull_request_template.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 0000000..001b269 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,21 @@ +## ๐Ÿ“ PR ํƒ€์ž… +- [ ] ๊ธฐ๋Šฅ ์ถ”๊ฐ€ +- [ ] ๊ธฐ๋Šฅ ์ˆ˜์ • +- [ ] ๊ธฐ๋Šฅ ์‚ญ์ œ +- [ ] ๋ฒ„๊ทธ ์ˆ˜์ • +- [ ] ์˜์กด์„ฑ, ํ™˜๊ฒฝ ๋ณ€์ˆ˜, ๋นŒ๋“œ ๊ด€๋ จ ์ฝ”๋“œ ์—…๋ฐ์ดํŠธ + +## ๐Ÿ“ ๋ฐ˜์˜ ๋ธŒ๋žœ์น˜ + + + + +## ๐Ÿ“ ๋ณ€๊ฒฝ ์‚ฌํ•ญ + + + +## ๐Ÿ“ ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ + + +## ๐Ÿ“ To Reviewer + From e67826366217387bd72196caa9e2a7825e67eeb1 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Tue, 2 Jan 2024 00:43:29 +0900 Subject: [PATCH 002/465] =?UTF-8?q?[DOCS]=20issue=20template=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/issue-template.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/issue-template.md diff --git a/.github/ISSUE_TEMPLATE/issue-template.md b/.github/ISSUE_TEMPLATE/issue-template.md new file mode 100644 index 0000000..9923cc9 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/issue-template.md @@ -0,0 +1,19 @@ +--- +name: Issue Template +about: nonsoolmate Issue Template +title: "[FEAT]" +labels: '' +assignees: '' + +--- + +## ๐Ÿ“ Desciption + + + +## ๐Ÿ“ To-do + + + +## ๐Ÿ“ ETC + From 639127fcfa133414cc0dd47e6789f709007d7c58 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 00:09:10 +0900 Subject: [PATCH 003/465] =?UTF-8?q?[INIT]=20Project=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/.gitignore | 41 +++ nonsoolmateServer/build.gradle | 25 ++ .../gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43462 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + nonsoolmateServer/gradlew | 249 ++++++++++++++++++ nonsoolmateServer/gradlew.bat | 92 +++++++ nonsoolmateServer/settings.gradle | 1 + .../NonsoolmateServerApplication.java | 13 + .../src/main/resources/application.properties | 1 + .../NonsoolmateServerApplicationTests.java | 13 + 10 files changed, 442 insertions(+) create mode 100644 nonsoolmateServer/.gitignore create mode 100644 nonsoolmateServer/build.gradle create mode 100644 nonsoolmateServer/gradle/wrapper/gradle-wrapper.jar create mode 100644 nonsoolmateServer/gradle/wrapper/gradle-wrapper.properties create mode 100755 nonsoolmateServer/gradlew create mode 100644 nonsoolmateServer/gradlew.bat create mode 100644 nonsoolmateServer/settings.gradle create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/NonsoolmateServerApplication.java create mode 100644 nonsoolmateServer/src/main/resources/application.properties create mode 100644 nonsoolmateServer/src/test/java/com/nonsoolmate/nonsoolmateServer/NonsoolmateServerApplicationTests.java diff --git a/nonsoolmateServer/.gitignore b/nonsoolmateServer/.gitignore new file mode 100644 index 0000000..d131927 --- /dev/null +++ b/nonsoolmateServer/.gitignore @@ -0,0 +1,41 @@ +HELP.md +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +## setting file +*.yml +*.yaml \ No newline at end of file diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle new file mode 100644 index 0000000..d5ac9e8 --- /dev/null +++ b/nonsoolmateServer/build.gradle @@ -0,0 +1,25 @@ +plugins { + id 'java' + id 'org.springframework.boot' version '3.2.1' + id 'io.spring.dependency-management' version '1.1.4' +} + +group = 'com.nonsoolmate' +version = '0.0.1-SNAPSHOT' + +java { + sourceCompatibility = '17' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-web' + testImplementation 'org.springframework.boot:spring-boot-starter-test' +} + +tasks.named('test') { + useJUnitPlatform() +} diff --git a/nonsoolmateServer/gradle/wrapper/gradle-wrapper.jar b/nonsoolmateServer/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..d64cd4917707c1f8861d8cb53dd15194d4248596 GIT binary patch literal 43462 zcma&NWl&^owk(X(xVyW%ySuwf;qI=D6|RlDJ2cR^yEKh!@I- zp9QeisK*rlxC>+~7Dk4IxIRsKBHqdR9b3+fyL=ynHmIDe&|>O*VlvO+%z5;9Z$|DJ zb4dO}-R=MKr^6EKJiOrJdLnCJn>np?~vU-1sSFgPu;pthGwf}bG z(1db%xwr#x)r+`4AGu$j7~u2MpVs3VpLp|mx&;>`0p0vH6kF+D2CY0fVdQOZ@h;A` z{infNyvmFUiu*XG}RNMNwXrbec_*a3N=2zJ|Wh5z* z5rAX$JJR{#zP>KY**>xHTuw?|-Rg|o24V)74HcfVT;WtQHXlE+_4iPE8QE#DUm%x0 zEKr75ur~W%w#-My3Tj`hH6EuEW+8K-^5P62$7Sc5OK+22qj&Pd1;)1#4tKihi=~8C zHiQSst0cpri6%OeaR`PY>HH_;CPaRNty%WTm4{wDK8V6gCZlG@U3$~JQZ;HPvDJcT1V{ z?>H@13MJcCNe#5z+MecYNi@VT5|&UiN1D4ATT+%M+h4c$t;C#UAs3O_q=GxK0}8%8 z8J(_M9bayxN}69ex4dzM_P3oh@ZGREjVvn%%r7=xjkqxJP4kj}5tlf;QosR=%4L5y zWhgejO=vao5oX%mOHbhJ8V+SG&K5dABn6!WiKl{|oPkq(9z8l&Mm%(=qGcFzI=eLu zWc_oCLyf;hVlB@dnwY98?75B20=n$>u3b|NB28H0u-6Rpl((%KWEBOfElVWJx+5yg z#SGqwza7f}$z;n~g%4HDU{;V{gXIhft*q2=4zSezGK~nBgu9-Q*rZ#2f=Q}i2|qOp z!!y4p)4o=LVUNhlkp#JL{tfkhXNbB=Ox>M=n6soptJw-IDI|_$is2w}(XY>a=H52d z3zE$tjPUhWWS+5h=KVH&uqQS=$v3nRs&p$%11b%5qtF}S2#Pc`IiyBIF4%A!;AVoI zXU8-Rpv!DQNcF~(qQnyyMy=-AN~U>#&X1j5BLDP{?K!%h!;hfJI>$mdLSvktEr*89 zdJHvby^$xEX0^l9g$xW-d?J;L0#(`UT~zpL&*cEh$L|HPAu=P8`OQZV!-}l`noSp_ zQ-1$q$R-gDL)?6YaM!=8H=QGW$NT2SeZlb8PKJdc=F-cT@j7Xags+Pr*jPtlHFnf- zh?q<6;)27IdPc^Wdy-mX%2s84C1xZq9Xms+==F4);O`VUASmu3(RlgE#0+#giLh-& zcxm3_e}n4{%|X zJp{G_j+%`j_q5}k{eW&TlP}J2wtZ2^<^E(O)4OQX8FDp6RJq!F{(6eHWSD3=f~(h} zJXCf7=r<16X{pHkm%yzYI_=VDP&9bmI1*)YXZeB}F? z(%QsB5fo*FUZxK$oX~X^69;x~j7ms8xlzpt-T15e9}$4T-pC z6PFg@;B-j|Ywajpe4~bk#S6(fO^|mm1hKOPfA%8-_iGCfICE|=P_~e;Wz6my&)h_~ zkv&_xSAw7AZ%ThYF(4jADW4vg=oEdJGVOs>FqamoL3Np8>?!W#!R-0%2Bg4h?kz5I zKV-rKN2n(vUL%D<4oj@|`eJ>0i#TmYBtYmfla;c!ATW%;xGQ0*TW@PTlGG><@dxUI zg>+3SiGdZ%?5N=8uoLA|$4isK$aJ%i{hECP$bK{J#0W2gQ3YEa zZQ50Stn6hqdfxJ*9#NuSLwKFCUGk@c=(igyVL;;2^wi4o30YXSIb2g_ud$ zgpCr@H0qWtk2hK8Q|&wx)}4+hTYlf;$a4#oUM=V@Cw#!$(nOFFpZ;0lc!qd=c$S}Z zGGI-0jg~S~cgVT=4Vo)b)|4phjStD49*EqC)IPwyeKBLcN;Wu@Aeph;emROAwJ-0< z_#>wVm$)ygH|qyxZaet&(Vf%pVdnvKWJn9`%DAxj3ot;v>S$I}jJ$FLBF*~iZ!ZXE zkvui&p}fI0Y=IDX)mm0@tAd|fEHl~J&K}ZX(Mm3cm1UAuwJ42+AO5@HwYfDH7ipIc zmI;1J;J@+aCNG1M`Btf>YT>~c&3j~Qi@Py5JT6;zjx$cvOQW@3oQ>|}GH?TW-E z1R;q^QFjm5W~7f}c3Ww|awg1BAJ^slEV~Pk`Kd`PS$7;SqJZNj->it4DW2l15}xP6 zoCl$kyEF%yJni0(L!Z&14m!1urXh6Btj_5JYt1{#+H8w?5QI%% zo-$KYWNMJVH?Hh@1n7OSu~QhSswL8x0=$<8QG_zepi_`y_79=nK=_ZP_`Em2UI*tyQoB+r{1QYZCpb?2OrgUw#oRH$?^Tj!Req>XiE#~B|~ z+%HB;=ic+R@px4Ld8mwpY;W^A%8%l8$@B@1m5n`TlKI6bz2mp*^^^1mK$COW$HOfp zUGTz-cN9?BGEp}5A!mDFjaiWa2_J2Iq8qj0mXzk; z66JBKRP{p%wN7XobR0YjhAuW9T1Gw3FDvR5dWJ8ElNYF94eF3ebu+QwKjtvVu4L zI9ip#mQ@4uqVdkl-TUQMb^XBJVLW(-$s;Nq;@5gr4`UfLgF$adIhd?rHOa%D);whv z=;krPp~@I+-Z|r#s3yCH+c1US?dnm+C*)r{m+86sTJusLdNu^sqLrfWed^ndHXH`m zd3#cOe3>w-ga(Dus_^ppG9AC>Iq{y%%CK+Cro_sqLCs{VLuK=dev>OL1dis4(PQ5R zcz)>DjEkfV+MO;~>VUlYF00SgfUo~@(&9$Iy2|G0T9BSP?&T22>K46D zL*~j#yJ?)^*%J3!16f)@Y2Z^kS*BzwfAQ7K96rFRIh>#$*$_Io;z>ux@}G98!fWR@ zGTFxv4r~v)Gsd|pF91*-eaZ3Qw1MH$K^7JhWIdX%o$2kCbvGDXy)a?@8T&1dY4`;L z4Kn+f%SSFWE_rpEpL9bnlmYq`D!6F%di<&Hh=+!VI~j)2mfil03T#jJ_s?}VV0_hp z7T9bWxc>Jm2Z0WMU?`Z$xE74Gu~%s{mW!d4uvKCx@WD+gPUQ zV0vQS(Ig++z=EHN)BR44*EDSWIyT~R4$FcF*VEY*8@l=218Q05D2$|fXKFhRgBIEE zdDFB}1dKkoO^7}{5crKX!p?dZWNz$m>1icsXG2N+((x0OIST9Zo^DW_tytvlwXGpn zs8?pJXjEG;T@qrZi%#h93?FP$!&P4JA(&H61tqQi=opRzNpm zkrG}$^t9&XduK*Qa1?355wd8G2CI6QEh@Ua>AsD;7oRUNLPb76m4HG3K?)wF~IyS3`fXuNM>${?wmB zpVz;?6_(Fiadfd{vUCBM*_kt$+F3J+IojI;9L(gc9n3{sEZyzR9o!_mOwFC#tQ{Q~ zP3-`#uK#tP3Q7~Q;4H|wjZHO8h7e4IuBxl&vz2w~D8)w=Wtg31zpZhz%+kzSzL*dV zwp@{WU4i;hJ7c2f1O;7Mz6qRKeASoIv0_bV=i@NMG*l<#+;INk-^`5w@}Dj~;k=|}qM1vq_P z|GpBGe_IKq|LNy9SJhKOQ$c=5L{Dv|Q_lZl=-ky*BFBJLW9&y_C|!vyM~rQx=!vun z?rZJQB5t}Dctmui5i31C_;_}CEn}_W%>oSXtt>@kE1=JW*4*v4tPp;O6 zmAk{)m!)}34pTWg8{i>($%NQ(Tl;QC@J@FfBoc%Gr&m560^kgSfodAFrIjF}aIw)X zoXZ`@IsMkc8_=w%-7`D6Y4e*CG8k%Ud=GXhsTR50jUnm+R*0A(O3UKFg0`K;qp1bl z7``HN=?39ic_kR|^R^~w-*pa?Vj#7|e9F1iRx{GN2?wK!xR1GW!qa=~pjJb-#u1K8 zeR?Y2i-pt}yJq;SCiVHODIvQJX|ZJaT8nO+(?HXbLefulKKgM^B(UIO1r+S=7;kLJ zcH}1J=Px2jsh3Tec&v8Jcbng8;V-`#*UHt?hB(pmOipKwf3Lz8rG$heEB30Sg*2rx zV<|KN86$soN(I!BwO`1n^^uF2*x&vJ$2d$>+`(romzHP|)K_KkO6Hc>_dwMW-M(#S zK(~SiXT1@fvc#U+?|?PniDRm01)f^#55;nhM|wi?oG>yBsa?~?^xTU|fX-R(sTA+5 zaq}-8Tx7zrOy#3*JLIIVsBmHYLdD}!0NP!+ITW+Thn0)8SS!$@)HXwB3tY!fMxc#1 zMp3H?q3eD?u&Njx4;KQ5G>32+GRp1Ee5qMO0lZjaRRu&{W<&~DoJNGkcYF<5(Ab+J zgO>VhBl{okDPn78<%&e2mR{jwVCz5Og;*Z;;3%VvoGo_;HaGLWYF7q#jDX=Z#Ml`H z858YVV$%J|e<1n`%6Vsvq7GmnAV0wW4$5qQ3uR@1i>tW{xrl|ExywIc?fNgYlA?C5 zh$ezAFb5{rQu6i7BSS5*J-|9DQ{6^BVQ{b*lq`xS@RyrsJN?-t=MTMPY;WYeKBCNg z^2|pN!Q^WPJuuO4!|P@jzt&tY1Y8d%FNK5xK(!@`jO2aEA*4 zkO6b|UVBipci?){-Ke=+1;mGlND8)6+P;8sq}UXw2hn;fc7nM>g}GSMWu&v&fqh

iViYT=fZ(|3Ox^$aWPp4a8h24tD<|8-!aK0lHgL$N7Efw}J zVIB!7=T$U`ao1?upi5V4Et*-lTG0XvExbf!ya{cua==$WJyVG(CmA6Of*8E@DSE%L z`V^$qz&RU$7G5mg;8;=#`@rRG`-uS18$0WPN@!v2d{H2sOqP|!(cQ@ zUHo!d>>yFArLPf1q`uBvY32miqShLT1B@gDL4XoVTK&@owOoD)OIHXrYK-a1d$B{v zF^}8D3Y^g%^cnvScOSJR5QNH+BI%d|;J;wWM3~l>${fb8DNPg)wrf|GBP8p%LNGN# z3EaIiItgwtGgT&iYCFy9-LG}bMI|4LdmmJt@V@% zb6B)1kc=T)(|L@0;wr<>=?r04N;E&ef+7C^`wPWtyQe(*pD1pI_&XHy|0gIGHMekd zF_*M4yi6J&Z4LQj65)S zXwdM{SwUo%3SbPwFsHgqF@V|6afT|R6?&S;lw=8% z3}@9B=#JI3@B*#4s!O))~z zc>2_4Q_#&+5V`GFd?88^;c1i7;Vv_I*qt!_Yx*n=;rj!82rrR2rQ8u5(Ejlo{15P% zs~!{%XJ>FmJ})H^I9bn^Re&38H{xA!0l3^89k(oU;bZWXM@kn$#aoS&Y4l^-WEn-fH39Jb9lA%s*WsKJQl?n9B7_~P z-XM&WL7Z!PcoF6_D>V@$CvUIEy=+Z&0kt{szMk=f1|M+r*a43^$$B^MidrT0J;RI` z(?f!O<8UZkm$_Ny$Hth1J#^4ni+im8M9mr&k|3cIgwvjAgjH z8`N&h25xV#v*d$qBX5jkI|xOhQn!>IYZK7l5#^P4M&twe9&Ey@@GxYMxBZq2e7?`q z$~Szs0!g{2fGcp9PZEt|rdQ6bhAgpcLHPz?f-vB?$dc*!9OL?Q8mn7->bFD2Si60* z!O%y)fCdMSV|lkF9w%x~J*A&srMyYY3{=&$}H zGQ4VG_?$2X(0|vT0{=;W$~icCI{b6W{B!Q8xdGhF|D{25G_5_+%s(46lhvNLkik~R z>nr(&C#5wwOzJZQo9m|U<;&Wk!_#q|V>fsmj1g<6%hB{jGoNUPjgJslld>xmODzGjYc?7JSuA?A_QzjDw5AsRgi@Y|Z0{F{!1=!NES-#*f^s4l0Hu zz468))2IY5dmD9pa*(yT5{EyP^G>@ZWumealS-*WeRcZ}B%gxq{MiJ|RyX-^C1V=0 z@iKdrGi1jTe8Ya^x7yyH$kBNvM4R~`fbPq$BzHum-3Zo8C6=KW@||>zsA8-Y9uV5V z#oq-f5L5}V<&wF4@X@<3^C%ptp6+Ce)~hGl`kwj)bsAjmo_GU^r940Z-|`<)oGnh7 zFF0Tde3>ui?8Yj{sF-Z@)yQd~CGZ*w-6p2U<8}JO-sRsVI5dBji`01W8A&3$?}lxBaC&vn0E$c5tW* zX>5(zzZ=qn&!J~KdsPl;P@bmA-Pr8T*)eh_+Dv5=Ma|XSle6t(k8qcgNyar{*ReQ8 zTXwi=8vr>!3Ywr+BhggHDw8ke==NTQVMCK`$69fhzEFB*4+H9LIvdt-#IbhZvpS}} zO3lz;P?zr0*0$%-Rq_y^k(?I{Mk}h@w}cZpMUp|ucs55bcloL2)($u%mXQw({Wzc~ z;6nu5MkjP)0C(@%6Q_I_vsWrfhl7Zpoxw#WoE~r&GOSCz;_ro6i(^hM>I$8y>`!wW z*U^@?B!MMmb89I}2(hcE4zN2G^kwyWCZp5JG>$Ez7zP~D=J^LMjSM)27_0B_X^C(M z`fFT+%DcKlu?^)FCK>QzSnV%IsXVcUFhFdBP!6~se&xxrIxsvySAWu++IrH;FbcY$ z2DWTvSBRfLwdhr0nMx+URA$j3i7_*6BWv#DXfym?ZRDcX9C?cY9sD3q)uBDR3uWg= z(lUIzB)G$Hr!){>E{s4Dew+tb9kvToZp-1&c?y2wn@Z~(VBhqz`cB;{E4(P3N2*nJ z_>~g@;UF2iG{Kt(<1PyePTKahF8<)pozZ*xH~U-kfoAayCwJViIrnqwqO}7{0pHw$ zs2Kx?s#vQr7XZ264>5RNKSL8|Ty^=PsIx^}QqOOcfpGUU4tRkUc|kc7-!Ae6!+B{o~7nFpm3|G5^=0#Bnm6`V}oSQlrX(u%OWnC zoLPy&Q;1Jui&7ST0~#+}I^&?vcE*t47~Xq#YwvA^6^} z`WkC)$AkNub|t@S!$8CBlwbV~?yp&@9h{D|3z-vJXgzRC5^nYm+PyPcgRzAnEi6Q^gslXYRv4nycsy-SJu?lMps-? zV`U*#WnFsdPLL)Q$AmD|0`UaC4ND07+&UmOu!eHruzV|OUox<+Jl|Mr@6~C`T@P%s zW7sgXLF2SSe9Fl^O(I*{9wsFSYb2l%-;&Pi^dpv!{)C3d0AlNY6!4fgmSgj_wQ*7Am7&$z;Jg&wgR-Ih;lUvWS|KTSg!&s_E9_bXBkZvGiC6bFKDWZxsD$*NZ#_8bl zG1P-#@?OQzED7@jlMJTH@V!6k;W>auvft)}g zhoV{7$q=*;=l{O>Q4a@ ziMjf_u*o^PsO)#BjC%0^h>Xp@;5$p{JSYDt)zbb}s{Kbt!T*I@Pk@X0zds6wsefuU zW$XY%yyRGC94=6mf?x+bbA5CDQ2AgW1T-jVAJbm7K(gp+;v6E0WI#kuACgV$r}6L? zd|Tj?^%^*N&b>Dd{Wr$FS2qI#Ucs1yd4N+RBUQiSZGujH`#I)mG&VKoDh=KKFl4=G z&MagXl6*<)$6P}*Tiebpz5L=oMaPrN+caUXRJ`D?=K9!e0f{@D&cZLKN?iNP@X0aF zE(^pl+;*T5qt?1jRC=5PMgV!XNITRLS_=9{CJExaQj;lt!&pdzpK?8p>%Mb+D z?yO*uSung=-`QQ@yX@Hyd4@CI^r{2oiu`%^bNkz+Nkk!IunjwNC|WcqvX~k=><-I3 zDQdbdb|!v+Iz01$w@aMl!R)koD77Xp;eZwzSl-AT zr@Vu{=xvgfq9akRrrM)}=!=xcs+U1JO}{t(avgz`6RqiiX<|hGG1pmop8k6Q+G_mv zJv|RfDheUp2L3=^C=4aCBMBn0aRCU(DQwX-W(RkRwmLeuJYF<0urcaf(=7)JPg<3P zQs!~G)9CT18o!J4{zX{_e}4eS)U-E)0FAt}wEI(c0%HkxgggW;(1E=>J17_hsH^sP z%lT0LGgbUXHx-K*CI-MCrP66UP0PvGqM$MkeLyqHdbgP|_Cm!7te~b8p+e6sQ_3k| zVcwTh6d83ltdnR>D^)BYQpDKlLk3g0Hdcgz2}%qUs9~~Rie)A-BV1mS&naYai#xcZ z(d{8=-LVpTp}2*y)|gR~;qc7fp26}lPcLZ#=JpYcn3AT9(UIdOyg+d(P5T7D&*P}# zQCYplZO5|7+r19%9e`v^vfSS1sbX1c%=w1;oyruXB%Kl$ACgKQ6=qNWLsc=28xJjg zwvsI5-%SGU|3p>&zXVl^vVtQT3o-#$UT9LI@Npz~6=4!>mc431VRNN8od&Ul^+G_kHC`G=6WVWM z%9eWNyy(FTO|A+@x}Ou3CH)oi;t#7rAxdIXfNFwOj_@Y&TGz6P_sqiB`Q6Lxy|Q{`|fgmRG(k+!#b*M+Z9zFce)f-7;?Km5O=LHV9f9_87; zF7%R2B+$?@sH&&-$@tzaPYkw0;=i|;vWdI|Wl3q_Zu>l;XdIw2FjV=;Mq5t1Q0|f< zs08j54Bp`3RzqE=2enlkZxmX6OF+@|2<)A^RNQpBd6o@OXl+i)zO%D4iGiQNuXd+zIR{_lb96{lc~bxsBveIw6umhShTX+3@ZJ=YHh@ zWY3(d0azg;7oHn>H<>?4@*RQbi>SmM=JrHvIG(~BrvI)#W(EAeO6fS+}mxxcc+X~W6&YVl86W9WFSS}Vz-f9vS?XUDBk)3TcF z8V?$4Q)`uKFq>xT=)Y9mMFVTUk*NIA!0$?RP6Ig0TBmUFrq*Q-Agq~DzxjStQyJ({ zBeZ;o5qUUKg=4Hypm|}>>L=XKsZ!F$yNTDO)jt4H0gdQ5$f|d&bnVCMMXhNh)~mN z@_UV6D7MVlsWz+zM+inZZp&P4fj=tm6fX)SG5H>OsQf_I8c~uGCig$GzuwViK54bcgL;VN|FnyQl>Ed7(@>=8$a_UKIz|V6CeVSd2(P z0Uu>A8A+muM%HLFJQ9UZ5c)BSAv_zH#1f02x?h9C}@pN@6{>UiAp>({Fn(T9Q8B z^`zB;kJ5b`>%dLm+Ol}ty!3;8f1XDSVX0AUe5P#@I+FQ-`$(a;zNgz)4x5hz$Hfbg z!Q(z26wHLXko(1`;(BAOg_wShpX0ixfWq3ponndY+u%1gyX)_h=v1zR#V}#q{au6; z!3K=7fQwnRfg6FXtNQmP>`<;!N137paFS%y?;lb1@BEdbvQHYC{976l`cLqn;b8lp zIDY>~m{gDj(wfnK!lpW6pli)HyLEiUrNc%eXTil|F2s(AY+LW5hkKb>TQ3|Q4S9rr zpDs4uK_co6XPsn_z$LeS{K4jFF`2>U`tbgKdyDne`xmR<@6AA+_hPNKCOR-Zqv;xk zu5!HsBUb^!4uJ7v0RuH-7?l?}b=w5lzzXJ~gZcxRKOovSk@|#V+MuX%Y+=;14i*%{)_gSW9(#4%)AV#3__kac1|qUy!uyP{>?U#5wYNq}y$S9pCc zFc~4mgSC*G~j0u#qqp9 z${>3HV~@->GqEhr_Xwoxq?Hjn#=s2;i~g^&Hn|aDKpA>Oc%HlW(KA1?BXqpxB;Ydx)w;2z^MpjJ(Qi(X!$5RC z*P{~%JGDQqojV>2JbEeCE*OEu!$XJ>bWA9Oa_Hd;y)F%MhBRi*LPcdqR8X`NQ&1L# z5#9L*@qxrx8n}LfeB^J{%-?SU{FCwiWyHp682F+|pa+CQa3ZLzBqN1{)h4d6+vBbV zC#NEbQLC;}me3eeYnOG*nXOJZEU$xLZ1<1Y=7r0(-U0P6-AqwMAM`a(Ed#7vJkn6plb4eI4?2y3yOTGmmDQ!z9`wzbf z_OY#0@5=bnep;MV0X_;;SJJWEf^E6Bd^tVJ9znWx&Ks8t*B>AM@?;D4oWUGc z!H*`6d7Cxo6VuyS4Eye&L1ZRhrRmN6Lr`{NL(wDbif|y&z)JN>Fl5#Wi&mMIr5i;x zBx}3YfF>>8EC(fYnmpu~)CYHuHCyr5*`ECap%t@y=jD>!_%3iiE|LN$mK9>- zHdtpy8fGZtkZF?%TW~29JIAfi2jZT8>OA7=h;8T{{k?c2`nCEx9$r zS+*&vt~2o^^J+}RDG@+9&M^K*z4p{5#IEVbz`1%`m5c2};aGt=V?~vIM}ZdPECDI)47|CWBCfDWUbxBCnmYivQ*0Nu_xb*C>~C9(VjHM zxe<*D<#dQ8TlpMX2c@M<9$w!RP$hpG4cs%AI){jp*Sj|*`m)5(Bw*A0$*i-(CA5#%>a)$+jI2C9r6|(>J8InryENI z$NohnxDUB;wAYDwrb*!N3noBTKPpPN}~09SEL18tkG zxgz(RYU_;DPT{l?Q$+eaZaxnsWCA^ds^0PVRkIM%bOd|G2IEBBiz{&^JtNsODs;5z zICt_Zj8wo^KT$7Bg4H+y!Df#3mbl%%?|EXe!&(Vmac1DJ*y~3+kRKAD=Ovde4^^%~ zw<9av18HLyrf*_>Slp;^i`Uy~`mvBjZ|?Ad63yQa#YK`4+c6;pW4?XIY9G1(Xh9WO8{F-Aju+nS9Vmv=$Ac0ienZ+p9*O%NG zMZKy5?%Z6TAJTE?o5vEr0r>f>hb#2w2U3DL64*au_@P!J!TL`oH2r*{>ffu6|A7tv zL4juf$DZ1MW5ZPsG!5)`k8d8c$J$o;%EIL0va9&GzWvkS%ZsGb#S(?{!UFOZ9<$a| zY|a+5kmD5N&{vRqkgY>aHsBT&`rg|&kezoD)gP0fsNYHsO#TRc_$n6Lf1Z{?+DLziXlHrq4sf(!>O{?Tj;Eh@%)+nRE_2VxbN&&%%caU#JDU%vL3}Cb zsb4AazPI{>8H&d=jUaZDS$-0^AxE@utGs;-Ez_F(qC9T=UZX=>ok2k2 ziTn{K?y~a5reD2A)P${NoI^>JXn>`IeArow(41c-Wm~)wiryEP(OS{YXWi7;%dG9v zI?mwu1MxD{yp_rrk!j^cKM)dc4@p4Ezyo%lRN|XyD}}>v=Xoib0gOcdXrQ^*61HNj z=NP|pd>@yfvr-=m{8$3A8TQGMTE7g=z!%yt`8`Bk-0MMwW~h^++;qyUP!J~ykh1GO z(FZ59xuFR$(WE;F@UUyE@Sp>`aVNjyj=Ty>_Vo}xf`e7`F;j-IgL5`1~-#70$9_=uBMq!2&1l zomRgpD58@)YYfvLtPW}{C5B35R;ZVvB<<#)x%srmc_S=A7F@DW8>QOEGwD6suhwCg z>Pa+YyULhmw%BA*4yjDp|2{!T98~<6Yfd(wo1mQ!KWwq0eg+6)o1>W~f~kL<-S+P@$wx*zeI|1t7z#Sxr5 zt6w+;YblPQNplq4Z#T$GLX#j6yldXAqj>4gAnnWtBICUnA&-dtnlh=t0Ho_vEKwV` z)DlJi#!@nkYV#$!)@>udAU*hF?V`2$Hf=V&6PP_|r#Iv*J$9)pF@X3`k;5})9^o4y z&)~?EjX5yX12O(BsFy-l6}nYeuKkiq`u9145&3Ssg^y{5G3Pse z9w(YVa0)N-fLaBq1`P!_#>SS(8fh_5!f{UrgZ~uEdeMJIz7DzI5!NHHqQtm~#CPij z?=N|J>nPR6_sL7!f4hD_|KH`vf8(Wpnj-(gPWH+ZvID}%?~68SwhPTC3u1_cB`otq z)U?6qo!ZLi5b>*KnYHWW=3F!p%h1;h{L&(Q&{qY6)_qxNfbP6E3yYpW!EO+IW3?@J z);4>g4gnl^8klu7uA>eGF6rIGSynacogr)KUwE_R4E5Xzi*Qir@b-jy55-JPC8c~( zo!W8y9OGZ&`xmc8;=4-U9=h{vCqfCNzYirONmGbRQlR`WWlgnY+1wCXbMz&NT~9*| z6@FrzP!LX&{no2!Ln_3|I==_4`@}V?4a;YZKTdw;vT<+K+z=uWbW(&bXEaWJ^W8Td z-3&1bY^Z*oM<=M}LVt>_j+p=2Iu7pZmbXrhQ_k)ysE9yXKygFNw$5hwDn(M>H+e1&9BM5!|81vd%r%vEm zqxY3?F@fb6O#5UunwgAHR9jp_W2zZ}NGp2%mTW@(hz7$^+a`A?mb8|_G*GNMJ) zjqegXQio=i@AINre&%ofexAr95aop5C+0MZ0m-l=MeO8m3epm7U%vZB8+I+C*iNFM z#T3l`gknX;D$-`2XT^Cg*vrv=RH+P;_dfF++cP?B_msQI4j+lt&rX2)3GaJx%W*Nn zkML%D{z5tpHH=dksQ*gzc|}gzW;lwAbxoR07VNgS*-c3d&8J|;@3t^ zVUz*J*&r7DFRuFVDCJDK8V9NN5hvpgGjwx+5n)qa;YCKe8TKtdnh{I7NU9BCN!0dq zczrBk8pE{{@vJa9ywR@mq*J=v+PG;?fwqlJVhijG!3VmIKs>9T6r7MJpC)m!Tc#>g zMtVsU>wbwFJEfwZ{vB|ZlttNe83)$iz`~#8UJ^r)lJ@HA&G#}W&ZH*;k{=TavpjWE z7hdyLZPf*X%Gm}i`Y{OGeeu^~nB8=`{r#TUrM-`;1cBvEd#d!kPqIgYySYhN-*1;L z^byj%Yi}Gx)Wnkosi337BKs}+5H5dth1JA{Ir-JKN$7zC)*}hqeoD(WfaUDPT>0`- z(6sa0AoIqASwF`>hP}^|)a_j2s^PQn*qVC{Q}htR z5-)duBFXT_V56-+UohKXlq~^6uf!6sA#ttk1o~*QEy_Y-S$gAvq47J9Vtk$5oA$Ct zYhYJ@8{hsC^98${!#Ho?4y5MCa7iGnfz}b9jE~h%EAAv~Qxu)_rAV;^cygV~5r_~?l=B`zObj7S=H=~$W zPtI_m%g$`kL_fVUk9J@>EiBH zOO&jtn~&`hIFMS5S`g8w94R4H40mdNUH4W@@XQk1sr17b{@y|JB*G9z1|CrQjd+GX z6+KyURG3;!*BQrentw{B2R&@2&`2}n(z-2&X7#r!{yg@Soy}cRD~j zj9@UBW+N|4HW4AWapy4wfUI- zZ`gSL6DUlgj*f1hSOGXG0IVH8HxK?o2|3HZ;KW{K+yPAlxtb)NV_2AwJm|E)FRs&& z=c^e7bvUsztY|+f^k7NXs$o1EUq>cR7C0$UKi6IooHWlK_#?IWDkvywnzg&ThWo^? z2O_N{5X39#?eV9l)xI(>@!vSB{DLt*oY!K1R8}_?%+0^C{d9a%N4 zoxHVT1&Lm|uDX%$QrBun5e-F`HJ^T$ zmzv)p@4ZHd_w9!%Hf9UYNvGCw2TTTbrj9pl+T9%-_-}L(tES>Or-}Z4F*{##n3~L~TuxjirGuIY#H7{%$E${?p{Q01 zi6T`n;rbK1yIB9jmQNycD~yZq&mbIsFWHo|ZAChSFPQa<(%d8mGw*V3fh|yFoxOOiWJd(qvVb!Z$b88cg->N=qO*4k~6;R==|9ihg&riu#P~s4Oap9O7f%crSr^rljeIfXDEg>wi)&v*a%7zpz<9w z*r!3q9J|390x`Zk;g$&OeN&ctp)VKRpDSV@kU2Q>jtok($Y-*x8_$2piTxun81@vt z!Vj?COa0fg2RPXMSIo26T=~0d`{oGP*eV+$!0I<(4azk&Vj3SiG=Q!6mX0p$z7I}; z9BJUFgT-K9MQQ-0@Z=^7R<{bn2Fm48endsSs`V7_@%8?Bxkqv>BDoVcj?K#dV#uUP zL1ND~?D-|VGKe3Rw_7-Idpht>H6XRLh*U7epS6byiGvJpr%d}XwfusjH9g;Z98H`x zyde%%5mhGOiL4wljCaWCk-&uE4_OOccb9c!ZaWt4B(wYl!?vyzl%7n~QepN&eFUrw zFIOl9c({``6~QD+43*_tzP{f2x41h(?b43^y6=iwyB)2os5hBE!@YUS5?N_tXd=h( z)WE286Fbd>R4M^P{!G)f;h<3Q>Fipuy+d2q-)!RyTgt;wr$(?9ox3;q+{E*ZQHhOn;lM`cjnu9 zXa48ks-v(~b*;MAI<>YZH(^NV8vjb34beE<_cwKlJoR;k6lJNSP6v}uiyRD?|0w+X@o1ONrH8a$fCxXpf? z?$DL0)7|X}Oc%h^zrMKWc-NS9I0Utu@>*j}b@tJ=ixQSJ={4@854wzW@E>VSL+Y{i z#0b=WpbCZS>kUCO_iQz)LoE>P5LIG-hv9E+oG}DtlIDF>$tJ1aw9^LuhLEHt?BCj& z(O4I8v1s#HUi5A>nIS-JK{v!7dJx)^Yg%XjNmlkWAq2*cv#tHgz`Y(bETc6CuO1VkN^L-L3j_x<4NqYb5rzrLC-7uOv z!5e`GZt%B782C5-fGnn*GhDF$%(qP<74Z}3xx+{$4cYKy2ikxI7B2N+2r07DN;|-T->nU&!=Cm#rZt%O_5c&1Z%nlWq3TKAW0w zQqemZw_ue--2uKQsx+niCUou?HjD`xhEjjQd3%rrBi82crq*~#uA4+>vR<_S{~5ce z-2EIl?~s z1=GVL{NxP1N3%=AOaC}j_Fv=ur&THz zyO!d9kHq|c73kpq`$+t+8Bw7MgeR5~`d7ChYyGCBWSteTB>8WAU(NPYt2Dk`@#+}= zI4SvLlyk#pBgVigEe`?NG*vl7V6m+<}%FwPV=~PvvA)=#ths==DRTDEYh4V5}Cf$z@#;< zyWfLY_5sP$gc3LLl2x+Ii)#b2nhNXJ{R~vk`s5U7Nyu^3yFg&D%Txwj6QezMX`V(x z=C`{76*mNb!qHHs)#GgGZ_7|vkt9izl_&PBrsu@}L`X{95-2jf99K)0=*N)VxBX2q z((vkpP2RneSIiIUEnGb?VqbMb=Zia+rF~+iqslydE34cSLJ&BJW^3knX@M;t*b=EA zNvGzv41Ld_T+WT#XjDB840vovUU^FtN_)G}7v)1lPetgpEK9YS^OWFkPoE{ovj^=@ zO9N$S=G$1ecndT_=5ehth2Lmd1II-PuT~C9`XVePw$y8J#dpZ?Tss<6wtVglm(Ok7 z3?^oi@pPio6l&!z8JY(pJvG=*pI?GIOu}e^EB6QYk$#FJQ%^AIK$I4epJ+9t?KjqA+bkj&PQ*|vLttme+`9G=L% ziadyMw_7-M)hS(3E$QGNCu|o23|%O+VN7;Qggp?PB3K-iSeBa2b}V4_wY`G1Jsfz4 z9|SdB^;|I8E8gWqHKx!vj_@SMY^hLEIbSMCuE?WKq=c2mJK z8LoG-pnY!uhqFv&L?yEuxo{dpMTsmCn)95xanqBrNPTgXP((H$9N${Ow~Is-FBg%h z53;|Y5$MUN)9W2HBe2TD`ct^LHI<(xWrw}$qSoei?}s)&w$;&!14w6B6>Yr6Y8b)S z0r71`WmAvJJ`1h&poLftLUS6Ir zC$bG9!Im_4Zjse)#K=oJM9mHW1{%l8sz$1o?ltdKlLTxWWPB>Vk22czVt|1%^wnN@*!l)}?EgtvhC>vlHm^t+ogpgHI1_$1ox9e;>0!+b(tBrmXRB`PY1vp-R**8N7 zGP|QqI$m(Rdu#=(?!(N}G9QhQ%o!aXE=aN{&wtGP8|_qh+7a_j_sU5|J^)vxq;# zjvzLn%_QPHZZIWu1&mRAj;Sa_97p_lLq_{~j!M9N^1yp3U_SxRqK&JnR%6VI#^E12 z>CdOVI^_9aPK2eZ4h&^{pQs}xsijXgFYRIxJ~N7&BB9jUR1fm!(xl)mvy|3e6-B3j zJn#ajL;bFTYJ2+Q)tDjx=3IklO@Q+FFM}6UJr6km7hj7th9n_&JR7fnqC!hTZoM~T zBeaVFp%)0cbPhejX<8pf5HyRUj2>aXnXBqDJe73~J%P(2C?-RT{c3NjE`)om! zl$uewSgWkE66$Kb34+QZZvRn`fob~Cl9=cRk@Es}KQm=?E~CE%spXaMO6YmrMl%9Q zlA3Q$3|L1QJ4?->UjT&CBd!~ru{Ih^in&JXO=|<6J!&qp zRe*OZ*cj5bHYlz!!~iEKcuE|;U4vN1rk$xq6>bUWD*u(V@8sG^7>kVuo(QL@Ki;yL zWC!FT(q{E8#on>%1iAS0HMZDJg{Z{^!De(vSIq&;1$+b)oRMwA3nc3mdTSG#3uYO_ z>+x;7p4I;uHz?ZB>dA-BKl+t-3IB!jBRgdvAbW!aJ(Q{aT>+iz?91`C-xbe)IBoND z9_Xth{6?(y3rddwY$GD65IT#f3<(0o#`di{sh2gm{dw*#-Vnc3r=4==&PU^hCv$qd zjw;>i&?L*Wq#TxG$mFIUf>eK+170KG;~+o&1;Tom9}}mKo23KwdEM6UonXgc z!6N(@k8q@HPw{O8O!lAyi{rZv|DpgfU{py+j(X_cwpKqcalcqKIr0kM^%Br3SdeD> zHSKV94Yxw;pjzDHo!Q?8^0bb%L|wC;4U^9I#pd5O&eexX+Im{ z?jKnCcsE|H?{uGMqVie_C~w7GX)kYGWAg%-?8|N_1#W-|4F)3YTDC+QSq1s!DnOML3@d`mG%o2YbYd#jww|jD$gotpa)kntakp#K;+yo-_ZF9qrNZw<%#C zuPE@#3RocLgPyiBZ+R_-FJ_$xP!RzWm|aN)S+{$LY9vvN+IW~Kf3TsEIvP+B9Mtm! zpfNNxObWQpLoaO&cJh5>%slZnHl_Q~(-Tfh!DMz(dTWld@LG1VRF`9`DYKhyNv z2pU|UZ$#_yUx_B_|MxUq^glT}O5Xt(Vm4Mr02><%C)@v;vPb@pT$*yzJ4aPc_FZ3z z3}PLoMBIM>q_9U2rl^sGhk1VUJ89=*?7|v`{!Z{6bqFMq(mYiA?%KbsI~JwuqVA9$H5vDE+VocjX+G^%bieqx->s;XWlKcuv(s%y%D5Xbc9+ zc(_2nYS1&^yL*ey664&4`IoOeDIig}y-E~_GS?m;D!xv5-xwz+G`5l6V+}CpeJDi^ z%4ed$qowm88=iYG+(`ld5Uh&>Dgs4uPHSJ^TngXP_V6fPyl~>2bhi20QB%lSd#yYn zO05?KT1z@?^-bqO8Cg`;ft>ilejsw@2%RR7;`$Vs;FmO(Yr3Fp`pHGr@P2hC%QcA|X&N2Dn zYf`MqXdHi%cGR@%y7Rg7?d3?an){s$zA{!H;Ie5exE#c~@NhQUFG8V=SQh%UxUeiV zd7#UcYqD=lk-}sEwlpu&H^T_V0{#G?lZMxL7ih_&{(g)MWBnCZxtXg znr#}>U^6!jA%e}@Gj49LWG@*&t0V>Cxc3?oO7LSG%~)Y5}f7vqUUnQ;STjdDU}P9IF9d9<$;=QaXc zL1^X7>fa^jHBu_}9}J~#-oz3Oq^JmGR#?GO7b9a(=R@fw@}Q{{@`Wy1vIQ#Bw?>@X z-_RGG@wt|%u`XUc%W{J z>iSeiz8C3H7@St3mOr_mU+&bL#Uif;+Xw-aZdNYUpdf>Rvu0i0t6k*}vwU`XNO2he z%miH|1tQ8~ZK!zmL&wa3E;l?!!XzgV#%PMVU!0xrDsNNZUWKlbiOjzH-1Uoxm8E#r`#2Sz;-o&qcqB zC-O_R{QGuynW14@)7&@yw1U}uP(1cov)twxeLus0s|7ayrtT8c#`&2~Fiu2=R;1_4bCaD=*E@cYI>7YSnt)nQc zohw5CsK%m?8Ack)qNx`W0_v$5S}nO|(V|RZKBD+btO?JXe|~^Qqur%@eO~<8-L^9d z=GA3-V14ng9L29~XJ>a5k~xT2152zLhM*@zlp2P5Eu}bywkcqR;ISbas&#T#;HZSf z2m69qTV(V@EkY(1Dk3`}j)JMo%ZVJ*5eB zYOjIisi+igK0#yW*gBGj?@I{~mUOvRFQR^pJbEbzFxTubnrw(Muk%}jI+vXmJ;{Q6 zrSobKD>T%}jV4Ub?L1+MGOD~0Ir%-`iTnWZN^~YPrcP5y3VMAzQ+&en^VzKEb$K!Q z<7Dbg&DNXuow*eD5yMr+#08nF!;%4vGrJI++5HdCFcGLfMW!KS*Oi@=7hFwDG!h2< zPunUEAF+HncQkbfFj&pbzp|MU*~60Z(|Ik%Tn{BXMN!hZOosNIseT?R;A`W?=d?5X zK(FB=9mZusYahp|K-wyb={rOpdn=@;4YI2W0EcbMKyo~-#^?h`BA9~o285%oY zfifCh5Lk$SY@|2A@a!T2V+{^!psQkx4?x0HSV`(w9{l75QxMk!)U52Lbhn{8ol?S) zCKo*7R(z!uk<6*qO=wh!Pul{(qq6g6xW;X68GI_CXp`XwO zxuSgPRAtM8K7}5E#-GM!*ydOOG_{A{)hkCII<|2=ma*71ci_-}VPARm3crFQjLYV! z9zbz82$|l01mv`$WahE2$=fAGWkd^X2kY(J7iz}WGS z@%MyBEO=A?HB9=^?nX`@nh;7;laAjs+fbo!|K^mE!tOB>$2a_O0y-*uaIn8k^6Y zSbuv;5~##*4Y~+y7Z5O*3w4qgI5V^17u*ZeupVGH^nM&$qmAk|anf*>r zWc5CV;-JY-Z@Uq1Irpb^O`L_7AGiqd*YpGUShb==os$uN3yYvb`wm6d=?T*it&pDk zo`vhw)RZX|91^^Wa_ti2zBFyWy4cJu#g)_S6~jT}CC{DJ_kKpT`$oAL%b^!2M;JgT zM3ZNbUB?}kP(*YYvXDIH8^7LUxz5oE%kMhF!rnPqv!GiY0o}NR$OD=ITDo9r%4E>E0Y^R(rS^~XjWyVI6 zMOR5rPXhTp*G*M&X#NTL`Hu*R+u*QNoiOKg4CtNPrjgH>c?Hi4MUG#I917fx**+pJfOo!zFM&*da&G_x)L(`k&TPI*t3e^{crd zX<4I$5nBQ8Ax_lmNRa~E*zS-R0sxkz`|>7q_?*e%7bxqNm3_eRG#1ae3gtV9!fQpY z+!^a38o4ZGy9!J5sylDxZTx$JmG!wg7;>&5H1)>f4dXj;B+@6tMlL=)cLl={jLMxY zbbf1ax3S4>bwB9-$;SN2?+GULu;UA-35;VY*^9Blx)Jwyb$=U!D>HhB&=jSsd^6yw zL)?a|>GxU!W}ocTC(?-%z3!IUhw^uzc`Vz_g>-tv)(XA#JK^)ZnC|l1`@CdX1@|!| z_9gQ)7uOf?cR@KDp97*>6X|;t@Y`k_N@)aH7gY27)COv^P3ya9I{4z~vUjLR9~z1Z z5=G{mVtKH*&$*t0@}-i_v|3B$AHHYale7>E+jP`ClqG%L{u;*ff_h@)al?RuL7tOO z->;I}>%WI{;vbLP3VIQ^iA$4wl6@0sDj|~112Y4OFjMs`13!$JGkp%b&E8QzJw_L5 zOnw9joc0^;O%OpF$Qp)W1HI!$4BaXX84`%@#^dk^hFp^pQ@rx4g(8Xjy#!X%+X5Jd@fs3amGT`}mhq#L97R>OwT5-m|h#yT_-v@(k$q7P*9X~T*3)LTdzP!*B} z+SldbVWrrwQo9wX*%FyK+sRXTa@O?WM^FGWOE?S`R(0P{<6p#f?0NJvnBia?k^fX2 zNQs7K-?EijgHJY}&zsr;qJ<*PCZUd*x|dD=IQPUK_nn)@X4KWtqoJNHkT?ZWL_hF? zS8lp2(q>;RXR|F;1O}EE#}gCrY~#n^O`_I&?&z5~7N;zL0)3Tup`%)oHMK-^r$NT% zbFg|o?b9w(q@)6w5V%si<$!U<#}s#x@0aX-hP>zwS#9*75VXA4K*%gUc>+yzupTDBOKH8WR4V0pM(HrfbQ&eJ79>HdCvE=F z|J>s;;iDLB^3(9}?biKbxf1$lI!*Z%*0&8UUq}wMyPs_hclyQQi4;NUY+x2qy|0J; zhn8;5)4ED1oHwg+VZF|80<4MrL97tGGXc5Sw$wAI#|2*cvQ=jB5+{AjMiDHmhUC*a zlmiZ`LAuAn_}hftXh;`Kq0zblDk8?O-`tnilIh|;3lZp@F_osJUV9`*R29M?7H{Fy z`nfVEIDIWXmU&YW;NjU8)EJpXhxe5t+scf|VXM!^bBlwNh)~7|3?fWwo_~ZFk(22% zTMesYw+LNx3J-_|DM~`v93yXe=jPD{q;li;5PD?Dyk+b? zo21|XpT@)$BM$%F=P9J19Vi&1#{jM3!^Y&fr&_`toi`XB1!n>sbL%U9I5<7!@?t)~ z;&H%z>bAaQ4f$wIzkjH70;<8tpUoxzKrPhn#IQfS%9l5=Iu))^XC<58D!-O z{B+o5R^Z21H0T9JQ5gNJnqh#qH^na|z92=hONIM~@_iuOi|F>jBh-?aA20}Qx~EpDGElELNn~|7WRXRFnw+Wdo`|# zBpU=Cz3z%cUJ0mx_1($X<40XEIYz(`noWeO+x#yb_pwj6)R(__%@_Cf>txOQ74wSJ z0#F3(zWWaR-jMEY$7C*3HJrohc79>MCUu26mfYN)f4M~4gD`}EX4e}A!U}QV8!S47 z6y-U-%+h`1n`*pQuKE%Av0@)+wBZr9mH}@vH@i{v(m-6QK7Ncf17x_D=)32`FOjjo zg|^VPf5c6-!FxN{25dvVh#fog=NNpXz zfB$o+0jbRkHH{!TKhE709f+jI^$3#v1Nmf80w`@7-5$1Iv_`)W^px8P-({xwb;D0y z7LKDAHgX<84?l!I*Dvi2#D@oAE^J|g$3!)x1Ua;_;<@#l1fD}lqU2_tS^6Ht$1Wl} zBESo7o^)9-Tjuz$8YQSGhfs{BQV6zW7dA?0b(Dbt=UnQs&4zHfe_sj{RJ4uS-vQpC zX;Bbsuju4%!o8?&m4UZU@~ZZjeFF6ex2ss5_60_JS_|iNc+R0GIjH1@Z z=rLT9%B|WWgOrR7IiIwr2=T;Ne?30M!@{%Qf8o`!>=s<2CBpCK_TWc(DX51>e^xh8 z&@$^b6CgOd7KXQV&Y4%}_#uN*mbanXq(2=Nj`L7H7*k(6F8s6{FOw@(DzU`4-*77{ zF+dxpv}%mFpYK?>N_2*#Y?oB*qEKB}VoQ@bzm>ptmVS_EC(#}Lxxx730trt0G)#$b zE=wVvtqOct1%*9}U{q<)2?{+0TzZzP0jgf9*)arV)*e!f`|jgT{7_9iS@e)recI#z zbzolURQ+TOzE!ymqvBY7+5NnAbWxvMLsLTwEbFqW=CPyCsmJ}P1^V30|D5E|p3BC5 z)3|qgw@ra7aXb-wsa|l^in~1_fm{7bS9jhVRkYVO#U{qMp z)Wce+|DJ}4<2gp8r0_xfZpMo#{Hl2MfjLcZdRB9(B(A(f;+4s*FxV{1F|4d`*sRNd zp4#@sEY|?^FIJ;tmH{@keZ$P(sLh5IdOk@k^0uB^BWr@pk6mHy$qf&~rI>P*a;h0C{%oA*i!VjWn&D~O#MxN&f@1Po# zKN+ zrGrkSjcr?^R#nGl<#Q722^wbYcgW@{+6CBS<1@%dPA8HC!~a`jTz<`g_l5N1M@9wn9GOAZ>nqNgq!yOCbZ@1z`U_N`Z>}+1HIZxk*5RDc&rd5{3qjRh8QmT$VyS;jK z;AF+r6XnnCp=wQYoG|rT2@8&IvKq*IB_WvS%nt%e{MCFm`&W*#LXc|HrD?nVBo=(8*=Aq?u$sDA_sC_RPDUiQ+wnIJET8vx$&fxkW~kP9qXKt zozR)@xGC!P)CTkjeWvXW5&@2?)qt)jiYWWBU?AUtzAN}{JE1I)dfz~7$;}~BmQF`k zpn11qmObXwRB8&rnEG*#4Xax3XBkKlw(;tb?Np^i+H8m(Wyz9k{~ogba@laiEk;2! zV*QV^6g6(QG%vX5Um#^sT&_e`B1pBW5yVth~xUs#0}nv?~C#l?W+9Lsb_5)!71rirGvY zTIJ$OPOY516Y|_014sNv+Z8cc5t_V=i>lWV=vNu#!58y9Zl&GsMEW#pPYPYGHQ|;vFvd*9eM==$_=vc7xnyz0~ zY}r??$<`wAO?JQk@?RGvkWVJlq2dk9vB(yV^vm{=NVI8dhsX<)O(#nr9YD?I?(VmQ z^r7VfUBn<~p3()8yOBjm$#KWx!5hRW)5Jl7wY@ky9lNM^jaT##8QGVsYeaVywmpv>X|Xj7gWE1Ezai&wVLt3p)k4w~yrskT-!PR!kiyQlaxl(( zXhF%Q9x}1TMt3~u@|#wWm-Vq?ZerK={8@~&@9r5JW}r#45#rWii};t`{5#&3$W)|@ zbAf2yDNe0q}NEUvq_Quq3cTjcw z@H_;$hu&xllCI9CFDLuScEMg|x{S7GdV8<&Mq=ezDnRZAyX-8gv97YTm0bg=d)(>N z+B2FcqvI9>jGtnK%eO%y zoBPkJTk%y`8TLf4)IXPBn`U|9>O~WL2C~C$z~9|0m*YH<-vg2CD^SX#&)B4ngOSG$ zV^wmy_iQk>dfN@Pv(ckfy&#ak@MLC7&Q6Ro#!ezM*VEh`+b3Jt%m(^T&p&WJ2Oqvj zs-4nq0TW6cv~(YI$n0UkfwN}kg3_fp?(ijSV#tR9L0}l2qjc7W?i*q01=St0eZ=4h zyGQbEw`9OEH>NMuIe)hVwYHsGERWOD;JxEiO7cQv%pFCeR+IyhwQ|y@&^24k+|8fD zLiOWFNJ2&vu2&`Jv96_z-Cd5RLgmeY3*4rDOQo?Jm`;I_(+ejsPM03!ly!*Cu}Cco zrQSrEDHNyzT(D5s1rZq!8#?f6@v6dB7a-aWs(Qk>N?UGAo{gytlh$%_IhyL7h?DLXDGx zgxGEBQoCAWo-$LRvM=F5MTle`M})t3vVv;2j0HZY&G z22^iGhV@uaJh(XyyY%} zd4iH_UfdV#T=3n}(Lj^|n;O4|$;xhu*8T3hR1mc_A}fK}jfZ7LX~*n5+`8N2q#rI$ z@<_2VANlYF$vIH$ zl<)+*tIWW78IIINA7Rr7i{<;#^yzxoLNkXL)eSs=%|P>$YQIh+ea_3k z_s7r4%j7%&*NHSl?R4k%1>Z=M9o#zxY!n8sL5>BO-ZP;T3Gut>iLS@U%IBrX6BA3k z)&@q}V8a{X<5B}K5s(c(LQ=%v1ocr`t$EqqY0EqVjr65usa=0bkf|O#ky{j3)WBR(((L^wmyHRzoWuL2~WTC=`yZ zn%VX`L=|Ok0v7?s>IHg?yArBcync5rG#^+u)>a%qjES%dRZoIyA8gQ;StH z1Ao7{<&}6U=5}4v<)1T7t!J_CL%U}CKNs-0xWoTTeqj{5{?Be$L0_tk>M9o8 zo371}S#30rKZFM{`H_(L`EM9DGp+Mifk&IP|C2Zu_)Ghr4Qtpmkm1osCf@%Z$%t+7 zYH$Cr)Ro@3-QDeQJ8m+x6%;?YYT;k6Z0E-?kr>x33`H%*ueBD7Zx~3&HtWn0?2Wt} zTG}*|v?{$ajzt}xPzV%lL1t-URi8*Zn)YljXNGDb>;!905Td|mpa@mHjIH%VIiGx- zd@MqhpYFu4_?y5N4xiHn3vX&|e6r~Xt> zZG`aGq|yTNjv;9E+Txuoa@A(9V7g?1_T5FzRI;!=NP1Kqou1z5?%X~Wwb{trRfd>i z8&y^H)8YnKyA_Fyx>}RNmQIczT?w2J4SNvI{5J&}Wto|8FR(W;Qw#b1G<1%#tmYzQ zQ2mZA-PAdi%RQOhkHy9Ea#TPSw?WxwL@H@cbkZwIq0B!@ns}niALidmn&W?!Vd4Gj zO7FiuV4*6Mr^2xlFSvM;Cp_#r8UaqIzHJQg_z^rEJw&OMm_8NGAY2)rKvki|o1bH~ z$2IbfVeY2L(^*rMRU1lM5Y_sgrDS`Z??nR2lX;zyR=c%UyGb*%TC-Dil?SihkjrQy~TMv6;BMs7P8il`H7DmpVm@rJ;b)hW)BL)GjS154b*xq-NXq2cwE z^;VP7ua2pxvCmxrnqUYQMH%a%nHmwmI33nJM(>4LznvY*k&C0{8f*%?zggpDgkuz&JBx{9mfb@wegEl2v!=}Sq2Gaty0<)UrOT0{MZtZ~j5y&w zXlYa_jY)I_+VA-^#mEox#+G>UgvM!Ac8zI<%JRXM_73Q!#i3O|)lOP*qBeJG#BST0 zqohi)O!|$|2SeJQo(w6w7%*92S})XfnhrH_Z8qe!G5>CglP=nI7JAOW?(Z29;pXJ9 zR9`KzQ=WEhy*)WH>$;7Cdz|>*i>=##0bB)oU0OR>>N<21e4rMCHDemNi2LD>Nc$;& zQRFthpWniC1J6@Zh~iJCoLOxN`oCKD5Q4r%ynwgUKPlIEd#?QViIqovY|czyK8>6B zSP%{2-<;%;1`#0mG^B(8KbtXF;Nf>K#Di72UWE4gQ%(_26Koiad)q$xRL~?pN71ZZ zujaaCx~jXjygw;rI!WB=xrOJO6HJ!!w}7eiivtCg5K|F6$EXa)=xUC za^JXSX98W`7g-tm@uo|BKj39Dl;sg5ta;4qjo^pCh~{-HdLl6qI9Ix6f$+qiZ$}s= zNguKrU;u+T@ko(Vr1>)Q%h$?UKXCY>3se%&;h2osl2D zE4A9bd7_|^njDd)6cI*FupHpE3){4NQ*$k*cOWZ_?CZ>Z4_fl@n(mMnYK62Q1d@+I zr&O))G4hMihgBqRIAJkLdk(p(D~X{-oBUA+If@B}j& zsHbeJ3RzTq96lB7d($h$xTeZ^gP0c{t!Y0c)aQE;$FY2!mACg!GDEMKXFOPI^)nHZ z`aSPJpvV0|bbrzhWWkuPURlDeN%VT8tndV8?d)eN*i4I@u zVKl^6{?}A?P)Fsy?3oi#clf}L18t;TjNI2>eI&(ezDK7RyqFxcv%>?oxUlonv(px) z$vnPzRH`y5A(x!yOIfL0bmgeMQB$H5wenx~!ujQK*nUBW;@Em&6Xv2%s(~H5WcU2R z;%Nw<$tI)a`Ve!>x+qegJnQsN2N7HaKzrFqM>`6R*gvh%O*-%THt zrB$Nk;lE;z{s{r^PPm5qz(&lM{sO*g+W{sK+m3M_z=4=&CC>T`{X}1Vg2PEfSj2x_ zmT*(x;ov%3F?qoEeeM>dUn$a*?SIGyO8m806J1W1o+4HRhc2`9$s6hM#qAm zChQ87b~GEw{ADfs+5}FJ8+|bIlIv(jT$Ap#hSHoXdd9#w<#cA<1Rkq^*EEkknUd4& zoIWIY)sAswy6fSERVm&!SO~#iN$OgOX*{9@_BWFyJTvC%S++ilSfCrO(?u=Dc?CXZ zzCG&0yVR{Z`|ZF0eEApWEo#s9osV>F{uK{QA@BES#&;#KsScf>y zvs?vIbI>VrT<*!;XmQS=bhq%46-aambZ(8KU-wOO2=en~D}MCToB_u;Yz{)1ySrPZ z@=$}EvjTdzTWU7c0ZI6L8=yP+YRD_eMMos}b5vY^S*~VZysrkq<`cK3>>v%uy7jgq z0ilW9KjVDHLv0b<1K_`1IkbTOINs0=m-22c%M~l=^S}%hbli-3?BnNq?b`hx^HX2J zIe6ECljRL0uBWb`%{EA=%!i^4sMcj+U_TaTZRb+~GOk z^ZW!nky0n*Wb*r+Q|9H@ml@Z5gU&W`(z4-j!OzC1wOke`TRAYGZVl$PmQ16{3196( zO*?`--I}Qf(2HIwb2&1FB^!faPA2=sLg(@6P4mN)>Dc3i(B0;@O-y2;lM4akD>@^v z=u>*|!s&9zem70g7zfw9FXl1bpJW(C#5w#uy5!V?Q(U35A~$dR%LDVnq@}kQm13{} zd53q3N(s$Eu{R}k2esbftfjfOITCL;jWa$}(mmm}d(&7JZ6d3%IABCapFFYjdEjdK z&4Edqf$G^MNAtL=uCDRs&Fu@FXRgX{*0<(@c3|PNHa>L%zvxWS={L8%qw`STm+=Rd zA}FLspESSIpE_^41~#5yI2bJ=9`oc;GIL!JuW&7YetZ?0H}$$%8rW@*J37L-~Rsx!)8($nI4 zZhcZ2^=Y+p4YPl%j!nFJA|*M^gc(0o$i3nlphe+~-_m}jVkRN{spFs(o0ajW@f3K{ zDV!#BwL322CET$}Y}^0ixYj2w>&Xh12|R8&yEw|wLDvF!lZ#dOTHM9pK6@Nm-@9Lnng4ZHBgBSrr7KI8YCC9DX5Kg|`HsiwJHg2(7#nS;A{b3tVO?Z% za{m5b3rFV6EpX;=;n#wltDv1LE*|g5pQ+OY&*6qCJZc5oDS6Z6JD#6F)bWxZSF@q% z+1WV;m!lRB!n^PC>RgQCI#D1br_o^#iPk>;K2hB~0^<~)?p}LG%kigm@moD#q3PE+ zA^Qca)(xnqw6x>XFhV6ku9r$E>bWNrVH9fum0?4s?Rn2LG{Vm_+QJHse6xa%nzQ?k zKug4PW~#Gtb;#5+9!QBgyB@q=sk9=$S{4T>wjFICStOM?__fr+Kei1 z3j~xPqW;W@YkiUM;HngG!;>@AITg}vAE`M2Pj9Irl4w1fo4w<|Bu!%rh%a(Ai^Zhi zs92>v5;@Y(Zi#RI*ua*h`d_7;byQSa*v9E{2x$<-_=5Z<7{%)}4XExANcz@rK69T0x3%H<@frW>RA8^swA+^a(FxK| zFl3LD*ImHN=XDUkrRhp6RY5$rQ{bRgSO*(vEHYV)3Mo6Jy3puiLmU&g82p{qr0F?ohmbz)f2r{X2|T2 z$4fdQ=>0BeKbiVM!e-lIIs8wVTuC_m7}y4A_%ikI;Wm5$9j(^Y z(cD%U%k)X>_>9~t8;pGzL6L-fmQO@K; zo&vQzMlgY95;1BSkngY)e{`n0!NfVgf}2mB3t}D9@*N;FQ{HZ3Pb%BK6;5#-O|WI( zb6h@qTLU~AbVW#_6?c!?Dj65Now7*pU{h!1+eCV^KCuPAGs28~3k@ueL5+u|Z-7}t z9|lskE`4B7W8wMs@xJa{#bsCGDFoRSNSnmNYB&U7 zVGKWe%+kFB6kb)e;TyHfqtU6~fRg)f|>=5(N36)0+C z`hv65J<$B}WUc!wFAb^QtY31yNleq4dzmG`1wHTj=c*=hay9iD071Hc?oYoUk|M*_ zU1GihAMBsM@5rUJ(qS?9ZYJ6@{bNqJ`2Mr+5#hKf?doa?F|+^IR!8lq9)wS3tF_9n zW_?hm)G(M+MYb?V9YoX^_mu5h-LP^TL^!Q9Z7|@sO(rg_4+@=PdI)WL(B7`!K^ND- z-uIuVDCVEdH_C@c71YGYT^_Scf_dhB8Z2Xy6vGtBSlYud9vggOqv^L~F{BraSE_t} zIkP+Hp2&nH^-MNEs}^`oMLy11`PQW$T|K(`Bu*(f@)mv1-qY(_YG&J2M2<7k;;RK~ zL{Fqj9yCz8(S{}@c)S!65aF<=&eLI{hAMErCx&>i7OeDN>okvegO87OaG{Jmi<|}D zaT@b|0X{d@OIJ7zvT>r+eTzgLq~|Dpu)Z&db-P4z*`M$UL51lf>FLlq6rfG)%doyp z)3kk_YIM!03eQ8Vu_2fg{+osaEJPtJ-s36R+5_AEG12`NG)IQ#TF9c@$99%0iye+ zUzZ57=m2)$D(5Nx!n)=5Au&O0BBgwxIBaeI(mro$#&UGCr<;C{UjJVAbVi%|+WP(a zL$U@TYCxJ=1{Z~}rnW;7UVb7+ZnzgmrogDxhjLGo>c~MiJAWs&&;AGg@%U?Y^0JhL ze(x6Z74JG6FlOFK(T}SXQfhr}RIFl@QXKnIcXYF)5|V~e-}suHILKT-k|<*~Ij|VF zC;t@=uj=hot~*!C68G8hTA%8SzOfETOXQ|3FSaIEjvBJp(A)7SWUi5!Eu#yWgY+;n zlm<$+UDou*V+246_o#V4kMdto8hF%%Lki#zPh}KYXmMf?hrN0;>Mv%`@{0Qn`Ujp) z=lZe+13>^Q!9zT);H<(#bIeRWz%#*}sgUX9P|9($kexOyKIOc`dLux}c$7It4u|Rl z6SSkY*V~g_B-hMPo_ak>>z@AVQ(_N)VY2kB3IZ0G(iDUYw+2d7W^~(Jq}KY=JnWS( z#rzEa&0uNhJ>QE8iiyz;n2H|SV#Og+wEZv=f2%1ELX!SX-(d3tEj$5$1}70Mp<&eI zCkfbByL7af=qQE@5vDVxx1}FSGt_a1DoE3SDI+G)mBAna)KBG4p8Epxl9QZ4BfdAN zFnF|Y(umr;gRgG6NLQ$?ZWgllEeeq~z^ZS7L?<(~O&$5|y)Al^iMKy}&W+eMm1W z7EMU)u^ke(A1#XCV>CZ71}P}0x)4wtHO8#JRG3MA-6g=`ZM!FcICCZ{IEw8Dm2&LQ z1|r)BUG^0GzI6f946RrBlfB1Vs)~8toZf~7)+G;pv&XiUO(%5bm)pl=p>nV^o*;&T z;}@oZSibzto$arQgfkp|z4Z($P>dTXE{4O=vY0!)kDO* zGF8a4wq#VaFpLfK!iELy@?-SeRrdz%F*}hjKcA*y@mj~VD3!it9lhRhX}5YOaR9$} z3mS%$2Be7{l(+MVx3 z(4?h;P!jnRmX9J9sYN#7i=iyj_5q7n#X(!cdqI2lnr8T$IfOW<_v`eB!d9xY1P=2q&WtOXY=D9QYteP)De?S4}FK6#6Ma z=E*V+#s8>L;8aVroK^6iKo=MH{4yEZ_>N-N z`(|;aOATba1^asjxlILk<4}f~`39dBFlxj>Dw(hMYKPO3EEt1@S`1lxFNM+J@uB7T zZ8WKjz7HF1-5&2=l=fqF-*@>n5J}jIxdDwpT?oKM3s8Nr`x8JnN-kCE?~aM1H!hAE z%%w(3kHfGwMnMmNj(SU(w42OrC-euI>Dsjk&jz3ts}WHqmMpzQ3vZrsXrZ|}+MHA7 z068obeXZTsO*6RS@o3x80E4ok``rV^Y3hr&C1;|ZZ0|*EKO`$lECUYG2gVFtUTw)R z4Um<0ZzlON`zTdvVdL#KFoMFQX*a5wM0Czp%wTtfK4Sjs)P**RW&?lP$(<}q%r68Z zS53Y!d@&~ne9O)A^tNrXHhXBkj~$8j%pT1%%mypa9AW5E&s9)rjF4@O3ytH{0z6riz|@< zB~UPh*wRFg2^7EbQrHf0y?E~dHlkOxof_a?M{LqQ^C!i2dawHTPYUE=X@2(3<=OOxs8qn_(y>pU>u^}3y&df{JarR0@VJn0f+U%UiF=$Wyq zQvnVHESil@d|8&R<%}uidGh7@u^(%?$#|&J$pvFC-n8&A>utA=n3#)yMkz+qnG3wd zP7xCnF|$9Dif@N~L)Vde3hW8W!UY0BgT2v(wzp;tlLmyk2%N|0jfG$%<;A&IVrOI< z!L)o>j>;dFaqA3pL}b-Je(bB@VJ4%!JeX@3x!i{yIeIso^=n?fDX`3bU=eG7sTc%g%ye8$v8P@yKE^XD=NYxTb zbf!Mk=h|otpqjFaA-vs5YOF-*GwWPc7VbaOW&stlANnCN8iftFMMrUdYNJ_Bnn5Vt zxfz@Ah|+4&P;reZxp;MmEI7C|FOv8NKUm8njF7Wb6Gi7DeODLl&G~}G4be&*Hi0Qw z5}77vL0P+7-B%UL@3n1&JPxW^d@vVwp?u#gVcJqY9#@-3X{ok#UfW3<1fb%FT`|)V~ggq z(3AUoUS-;7)^hCjdT0Kf{i}h)mBg4qhtHHBti=~h^n^OTH5U*XMgDLIR@sre`AaB$ zg)IGBET_4??m@cx&c~bA80O7B8CHR7(LX7%HThkeC*@vi{-pL%e)yXp!B2InafbDF zjPXf1mko3h59{lT6EEbxKO1Z5GF71)WwowO6kY|6tjSVSWdQ}NsK2x{>i|MKZK8%Q zfu&_0D;CO-Jg0#YmyfctyJ!mRJp)e#@O0mYdp|8x;G1%OZQ3Q847YWTyy|%^cpA;m zze0(5p{tMu^lDkpe?HynyO?a1$_LJl2L&mpeKu%8YvgRNr=%2z${%WThHG=vrWY@4 zsA`OP#O&)TetZ>s%h!=+CE15lOOls&nvC~$Qz0Ph7tHiP;O$i|eDwpT{cp>+)0-|; zY$|bB+Gbel>5aRN3>c0x)4U=|X+z+{ zn*_p*EQoquRL+=+p;=lm`d71&1NqBz&_ph)MXu(Nv6&XE7(RsS)^MGj5Q?Fwude-(sq zjJ>aOq!7!EN>@(fK7EE#;i_BGvli`5U;r!YA{JRodLBc6-`n8K+Fjgwb%sX;j=qHQ z7&Tr!)!{HXoO<2BQrV9Sw?JRaLXV8HrsNevvnf>Y-6|{T!pYLl7jp$-nEE z#X!4G4L#K0qG_4Z;Cj6=;b|Be$hi4JvMH!-voxqx^@8cXp`B??eFBz2lLD8RRaRGh zn7kUfy!YV~p(R|p7iC1Rdgt$_24i0cd-S8HpG|`@my70g^y`gu%#Tf_L21-k?sRRZHK&at(*ED0P8iw{7?R$9~OF$Ko;Iu5)ur5<->x!m93Eb zFYpIx60s=Wxxw=`$aS-O&dCO_9?b1yKiPCQmSQb>T)963`*U+Ydj5kI(B(B?HNP8r z*bfSBpSu)w(Z3j7HQoRjUG(+d=IaE~tv}y14zHHs|0UcN52fT8V_<@2ep_ee{QgZG zmgp8iv4V{k;~8@I%M3<#B;2R>Ef(Gg_cQM7%}0s*^)SK6!Ym+~P^58*wnwV1BW@eG z4sZLqsUvBbFsr#8u7S1r4teQ;t)Y@jnn_m5jS$CsW1um!p&PqAcc8!zyiXHVta9QC zY~wCwCF0U%xiQPD_INKtTb;A|Zf29(mu9NI;E zc-e>*1%(LSXB`g}kd`#}O;veb<(sk~RWL|f3ljxCnEZDdNSTDV6#Td({6l&y4IjKF z^}lIUq*ZUqgTPumD)RrCN{M^jhY>E~1pn|KOZ5((%F)G|*ZQ|r4zIbrEiV%42hJV8 z3xS)=!X1+=olbdGJ=yZil?oXLct8FM{(6ikLL3E%=q#O6(H$p~gQu6T8N!plf!96| z&Q3=`L~>U0zZh;z(pGR2^S^{#PrPxTRHD1RQOON&f)Siaf`GLj#UOk&(|@0?zm;Sx ztsGt8=29-MZs5CSf1l1jNFtNt5rFNZxJPvkNu~2}7*9468TWm>nN9TP&^!;J{-h)_ z7WsHH9|F%I`Pb!>KAS3jQWKfGivTVkMJLO-HUGM_a4UQ_%RgL6WZvrW+Z4ujZn;y@ zz9$=oO!7qVTaQAA^BhX&ZxS*|5dj803M=k&2%QrXda`-Q#IoZL6E(g+tN!6CA!CP* zCpWtCujIea)ENl0liwVfj)Nc<9mV%+e@=d`haoZ*`B7+PNjEbXBkv=B+Pi^~L#EO$D$ZqTiD8f<5$eyb54-(=3 zh)6i8i|jp(@OnRrY5B8t|LFXFQVQ895n*P16cEKTrT*~yLH6Z4e*bZ5otpRDri&+A zfNbK1D5@O=sm`fN=WzWyse!za5n%^+6dHPGX#8DyIK>?9qyX}2XvBWVqbP%%D)7$= z=#$WulZlZR<{m#gU7lwqK4WS1Ne$#_P{b17qe$~UOXCl>5b|6WVh;5vVnR<%d+Lnp z$uEmML38}U4vaW8>shm6CzB(Wei3s#NAWE3)a2)z@i{4jTn;;aQS)O@l{rUM`J@K& l00vQ5JBs~;vo!vr%%-k{2_Fq1Mn4QF81S)AQ99zk{{c4yR+0b! literal 0 HcmV?d00001 diff --git a/nonsoolmateServer/gradle/wrapper/gradle-wrapper.properties b/nonsoolmateServer/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..1af9e09 --- /dev/null +++ b/nonsoolmateServer/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/nonsoolmateServer/gradlew b/nonsoolmateServer/gradlew new file mode 100755 index 0000000..1aa94a4 --- /dev/null +++ b/nonsoolmateServer/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright ยฉ 2015-2021 the original authors. +# +# Licensed 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. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions ยซ$varยป, ยซ${var}ยป, ยซ${var:-default}ยป, ยซ${var+SET}ยป, +# ยซ${var#prefix}ยป, ยซ${var%suffix}ยป, and ยซ$( cmd )ยป; +# * compound commands having a testable exit status, especially ยซcaseยป; +# * various built-in commands including ยซcommandยป, ยซsetยป, and ยซulimitยป. +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +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 + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/nonsoolmateServer/gradlew.bat b/nonsoolmateServer/gradlew.bat new file mode 100644 index 0000000..6689b85 --- /dev/null +++ b/nonsoolmateServer/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem 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, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/nonsoolmateServer/settings.gradle b/nonsoolmateServer/settings.gradle new file mode 100644 index 0000000..20cf50f --- /dev/null +++ b/nonsoolmateServer/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'nonsoolmateServer' diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/NonsoolmateServerApplication.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/NonsoolmateServerApplication.java new file mode 100644 index 0000000..54089fb --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/NonsoolmateServerApplication.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class NonsoolmateServerApplication { + + public static void main(String[] args) { + SpringApplication.run(NonsoolmateServerApplication.class, args); + } + +} diff --git a/nonsoolmateServer/src/main/resources/application.properties b/nonsoolmateServer/src/main/resources/application.properties new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/nonsoolmateServer/src/main/resources/application.properties @@ -0,0 +1 @@ + diff --git a/nonsoolmateServer/src/test/java/com/nonsoolmate/nonsoolmateServer/NonsoolmateServerApplicationTests.java b/nonsoolmateServer/src/test/java/com/nonsoolmate/nonsoolmateServer/NonsoolmateServerApplicationTests.java new file mode 100644 index 0000000..af85e39 --- /dev/null +++ b/nonsoolmateServer/src/test/java/com/nonsoolmate/nonsoolmateServer/NonsoolmateServerApplicationTests.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class NonsoolmateServerApplicationTests { + + @Test + void contextLoads() { + } + +} From 828da8d6e4f15a7dd86731ace15d60d78ad4818b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 00:11:04 +0900 Subject: [PATCH 004/465] =?UTF-8?q?[CHORE]=20build.gradle=EC=97=90=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=ED=95=84=EC=9A=94=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 --- nonsoolmateServer/build.gradle | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index d5ac9e8..1267d77 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -16,7 +16,31 @@ repositories { } dependencies { + // spring boot + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + + // lombok + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + + // h2 + runtimeOnly 'com.h2database:h2' + + // mysql + runtimeOnly 'com.mysql:mysql-connector-j' + + // swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + + // mapper + implementation 'org.mapstruct:mapstruct:1.5.3.Final' + annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final' + + // validate + implementation 'org.hibernate.validator:hibernate-validator' + + // test testImplementation 'org.springframework.boot:spring-boot-starter-test' } From b9e209fe9dc890383a45018f345e392b6b6fc39b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 00:12:21 +0900 Subject: [PATCH 005/465] =?UTF-8?q?[DEL]=20application.properties=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 --- nonsoolmateServer/src/main/resources/application.properties | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/resources/application.properties diff --git a/nonsoolmateServer/src/main/resources/application.properties b/nonsoolmateServer/src/main/resources/application.properties deleted file mode 100644 index 8b13789..0000000 --- a/nonsoolmateServer/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ - From cf1041b888bcc918ae8cf266bff10a555ff24aa5 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 00:17:01 +0900 Subject: [PATCH 006/465] =?UTF-8?q?[ADD]=20SwaggerConfig.java=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 --- .../common/swagger/SwaggerConfig.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/swagger/SwaggerConfig.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/swagger/SwaggerConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/swagger/SwaggerConfig.java new file mode 100644 index 0000000..aaf9107 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/swagger/SwaggerConfig.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.common.swagger; + +import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.info.Info; +import org.springframework.context.annotation.Configuration; + +@OpenAPIDefinition( + info = @Info(title = "NONSOOLMATE", + description = "NONSOOLMATE SERVER API Documentation", + version = "v1")) +@Configuration +public class SwaggerConfig { +} From 2167f419c0bc0db7d501fd675f6ac9fa60ba30b1 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 00:23:35 +0900 Subject: [PATCH 007/465] =?UTF-8?q?[ADD]=20=ED=94=84=EB=A1=9C=EC=A0=9D?= =?UTF-8?q?=ED=8A=B8=20=EA=B5=AC=EC=A1=B0=20=EA=B3=B5=EC=9C=A0=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20dummy.txt=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/nonsoolmate/nonsoolmateServer/exam/controller/dummy.txt | 1 + .../java/com/nonsoolmate/nonsoolmateServer/exam/domain/dummy.txt | 1 + .../com/nonsoolmate/nonsoolmateServer/exam/exception/dummy.txt | 1 + .../com/nonsoolmate/nonsoolmateServer/exam/repository/dummy.txt | 1 + .../com/nonsoolmate/nonsoolmateServer/exam/service/dummy.txt | 1 + .../nonsoolmate/nonsoolmateServer/member/controller/dummy.txt | 1 + .../com/nonsoolmate/nonsoolmateServer/member/domain/dummy.txt | 1 + .../com/nonsoolmate/nonsoolmateServer/member/exception/dummy.txt | 1 + .../nonsoolmate/nonsoolmateServer/member/repository/dummy.txt | 1 + .../com/nonsoolmate/nonsoolmateServer/member/service/dummy.txt | 1 + .../nonsoolmateServer/university/controller/dummy.txt | 1 + .../nonsoolmate/nonsoolmateServer/university/domain/dummy.txt | 1 + .../nonsoolmate/nonsoolmateServer/university/exception/dummy.txt | 1 + .../nonsoolmateServer/university/repository/dummy.txt | 1 + .../nonsoolmate/nonsoolmateServer/university/service/dummy.txt | 1 + 15 files changed, 15 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/controller/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/domain/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/exception/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/repository/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/service/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/controller/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/domain/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/exception/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/repository/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/service/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/controller/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/domain/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/exception/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/repository/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/controller/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/controller/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/domain/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/domain/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/exception/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/exception/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/repository/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/repository/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/service/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/service/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/controller/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/controller/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/domain/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/domain/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/exception/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/exception/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/repository/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/repository/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/service/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/service/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/controller/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/controller/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/domain/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/domain/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/exception/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/exception/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/repository/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/repository/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/service/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/service/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From d294341e60efa01ba0f8c49b27f2eb79a7fe78e2 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:54:03 +0900 Subject: [PATCH 008/465] =?UTF-8?q?[DOCS]=20PR=20template=20.github=20?= =?UTF-8?q?=EB=94=94=EB=A0=89=ED=86=A0=EB=A6=AC=20=EC=95=84=EB=9E=98=20?= =?UTF-8?q?=EC=9E=AC=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pr template ์—ฌ๋Ÿฌ ๋ฒ„์ „์ด ์กด์žฌํ•˜๋Š”๊ฒŒ ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์— ์œ„์น˜๋ฅผ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค --- .github/pull_request_template.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..001b269 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,21 @@ +## ๐Ÿ“ PR ํƒ€์ž… +- [ ] ๊ธฐ๋Šฅ ์ถ”๊ฐ€ +- [ ] ๊ธฐ๋Šฅ ์ˆ˜์ • +- [ ] ๊ธฐ๋Šฅ ์‚ญ์ œ +- [ ] ๋ฒ„๊ทธ ์ˆ˜์ • +- [ ] ์˜์กด์„ฑ, ํ™˜๊ฒฝ ๋ณ€์ˆ˜, ๋นŒ๋“œ ๊ด€๋ จ ์ฝ”๋“œ ์—…๋ฐ์ดํŠธ + +## ๐Ÿ“ ๋ฐ˜์˜ ๋ธŒ๋žœ์น˜ + + + + +## ๐Ÿ“ ๋ณ€๊ฒฝ ์‚ฌํ•ญ + + + +## ๐Ÿ“ ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ + + +## ๐Ÿ“ To Reviewer + From 0fb59fe447ecf56e6046fdeebf1d5d6d57af3937 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Tue, 2 Jan 2024 20:55:49 +0900 Subject: [PATCH 009/465] =?UTF-8?q?[DEL]=20PULL=5FREQUEST=5FTEMPLATE=20?= =?UTF-8?q?=EB=94=94=EB=A0=89=ED=84=B0=EB=A6=AC=20=EC=95=84=EB=9E=98=20pr?= =?UTF-8?q?=20template=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ์ƒ์œ„ ํด๋”์— PR template์„ ์ƒ์„ฑํ•˜์˜€์œผ๋ฏ€๋กœ ํ•ด๋‹น ํŒŒ์ผ์„ ์ง€์›๋‹ˆ๋‹ค. --- .../pull_request_template.md | 21 ------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md deleted file mode 100644 index 001b269..0000000 --- a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +++ /dev/null @@ -1,21 +0,0 @@ -## ๐Ÿ“ PR ํƒ€์ž… -- [ ] ๊ธฐ๋Šฅ ์ถ”๊ฐ€ -- [ ] ๊ธฐ๋Šฅ ์ˆ˜์ • -- [ ] ๊ธฐ๋Šฅ ์‚ญ์ œ -- [ ] ๋ฒ„๊ทธ ์ˆ˜์ • -- [ ] ์˜์กด์„ฑ, ํ™˜๊ฒฝ ๋ณ€์ˆ˜, ๋นŒ๋“œ ๊ด€๋ จ ์ฝ”๋“œ ์—…๋ฐ์ดํŠธ - -## ๐Ÿ“ ๋ฐ˜์˜ ๋ธŒ๋žœ์น˜ - - - - -## ๐Ÿ“ ๋ณ€๊ฒฝ ์‚ฌํ•ญ - - - -## ๐Ÿ“ ํ…Œ์ŠคํŠธ ๊ฒฐ๊ณผ - - -## ๐Ÿ“ To Reviewer - From 80da59593fef0e1dc8094d7f4b2df32b9b19a609 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 18:37:21 +0900 Subject: [PATCH 010/465] =?UTF-8?q?[CHORE]=20health=20check=EB=A5=BC=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20=EC=9D=98=EC=A1=B4=EC=84=B1=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 --- nonsoolmateServer/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index 1267d77..074e4dd 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -40,6 +40,9 @@ dependencies { // validate implementation 'org.hibernate.validator:hibernate-validator' + // Health Check + implementation 'org.springframework.boot:spring-boot-starter-actuator' + // test testImplementation 'org.springframework.boot:spring-boot-starter-test' } From e133dc31cd4c04c87b71f47c26880acbc1060986 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 20:19:40 +0900 Subject: [PATCH 011/465] =?UTF-8?q?[FEAT]=20ServerProfileController=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../profile/ServerProfileController.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java new file mode 100644 index 0000000..fa42a4f --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java @@ -0,0 +1,22 @@ +package com.nonsoolmate.nonsoolmateServer.common.profile; + +import lombok.RequiredArgsConstructor; +import org.springframework.core.env.Environment; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; + +@RestController +@RequiredArgsConstructor +public class ServerProfileController { + + private final Environment env; + + @GetMapping("/profile") + public String getProfile() { + return Arrays.stream(env.getActiveProfiles()) + .findFirst() + .orElse(""); + } +} \ No newline at end of file From 03923cd915b385837551393c0b2895e3abab019f Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 20:41:03 +0900 Subject: [PATCH 012/465] =?UTF-8?q?[REFACTOR]=20getProfile=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EC=97=90=EC=84=9C=20env.getActiveProfiles()=EC=9D=98?= =?UTF-8?q?=200=EB=B2=88=EC=A7=B8=20=EC=9D=B8=EB=8D=B1=EC=8A=A4=EB=A5=BC?= =?UTF-8?q?=20=EB=B0=94=EB=A1=9C=20=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/profile/ServerProfileController.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java index fa42a4f..8eb21dc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java @@ -5,8 +5,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.Arrays; - @RestController @RequiredArgsConstructor public class ServerProfileController { @@ -15,8 +13,6 @@ public class ServerProfileController { @GetMapping("/profile") public String getProfile() { - return Arrays.stream(env.getActiveProfiles()) - .findFirst() - .orElse(""); + return env.getActiveProfiles()[0]; } } \ No newline at end of file From 15019ace87b67fc2508261389a5d520011687456 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 21:41:01 +0900 Subject: [PATCH 013/465] =?UTF-8?q?[ADD]=20dev-CI.yml=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CI.yml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/dev-CI.yml diff --git a/.github/workflows/dev-CI.yml b/.github/workflows/dev-CI.yml new file mode 100644 index 0000000..5d1ad21 --- /dev/null +++ b/.github/workflows/dev-CI.yml @@ -0,0 +1,38 @@ +name: NONSOOLMATE DEV CI + +on: + push: + branches: [ "dev" ] + pull_request: + branches: [ "dev" ] + +jobs: + build: + runs-on: ubuntu-22.04 + env: + working-directory: /nonsoolmateServer + + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: application.yaml ์ƒ์„ฑ + run: | + mkdir src/main/resources + cd src/main/resources + touch ./application.yaml + echo "${{ secrets.DEV_APPLICATION }}" > ./application.yaml + working-directory: ${{ env.working-directory }} + + - name: build + run: | + chmod +x gradlew + ./gradlew build -x test + working-directory: ${{ env.working-directory }} + shell: bash From f8734cd0331ad532077a18c24e8ed8ad1ffded65 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 22:31:24 +0900 Subject: [PATCH 014/465] =?UTF-8?q?[ADD]=20Dockerfile=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 nonsoolmateServer/Dockerfile diff --git a/nonsoolmateServer/Dockerfile b/nonsoolmateServer/Dockerfile new file mode 100644 index 0000000..8c216fd --- /dev/null +++ b/nonsoolmateServer/Dockerfile @@ -0,0 +1,7 @@ +FROM amd64/temurin:17 + +WORKDIR /app + +COPY ./build/libs/nonsoolmateServer-0.0.1-SNAPSHOT.jar /app/nonsoolmateServer.jar + +CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active={profile}", "nonsoolmateServer.jar"] From fe06b61389a85ff4262d35155aa3407dc3418ecc Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 22:33:40 +0900 Subject: [PATCH 015/465] =?UTF-8?q?[ADD]=20dev-CD.yml=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CD.yml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/dev-CD.yml diff --git a/.github/workflows/dev-CD.yml b/.github/workflows/dev-CD.yml new file mode 100644 index 0000000..daae79c --- /dev/null +++ b/.github/workflows/dev-CD.yml @@ -0,0 +1,67 @@ +name: NONSOOLMATE DEV CD + +on: + push: + branches: [ "dev" ] + +jobs: + deploy-ci: + runs-on: ubuntu-22.04 + env: + working-directory: /nonsoolmateServer + + steps: + - name: ์ฒดํฌ์•„์›ƒ + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: application.yaml ์ƒ์„ฑ + run: | + mkdir src/main/resources + cd src/main/resources + touch ./application.yaml + echo "${{ secrets.DEV_APPLICATION }}" > ./application-deploy.yaml + working-directory: ${{ env.working-directory }} + + - name: ๋นŒ๋“œ + run: | + chmod +x gradlew + ./gradlew build -x test + working-directory: ${{ env.working-directory }} + shell: bash + + + - name: docker build ๊ฐ€๋Šฅํ•˜๋„๋ก ํ™˜๊ฒฝ ์„ค์ • + uses: docker/setup-buildx-action@v2.9.1 + + - name: docker hub์—๋กœ๊ทธ์ธ + uses: docker/login-action@v2.2.0 + with: + username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} + password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }} + + - name: docker image ๋นŒ๋“œ ๋ฐ ํ‘ธ์‹œ + run: | + docker build --platform linux/amd64 -t nonsoolmate/nonsoolmateServer . + docker push nonsoolmate/nonsoolmateServer + working-directory: ${{ env.working-directory }} + + deploy-cd: + needs: deploy-ci + runs-on: ubuntu-20.04 + + steps: + - name: ๋„์ปค ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰ + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.DEV_SERVER_IP }} + username: ${{ secrets.DEV_SERVER_USER }} + key: ${{ secrets.DEV_SERVER_KEY }} + script: | + cd ~ + ./deploy.sh From f708cd7a7ab20436248ea24db072da040b3222f6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 2 Jan 2024 23:32:57 +0900 Subject: [PATCH 016/465] =?UTF-8?q?[CHORE]=20Dockerfile=20=EB=82=B4=20prof?= =?UTF-8?q?ile=20dev=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 --- nonsoolmateServer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/Dockerfile b/nonsoolmateServer/Dockerfile index 8c216fd..dce7147 100644 --- a/nonsoolmateServer/Dockerfile +++ b/nonsoolmateServer/Dockerfile @@ -4,4 +4,4 @@ WORKDIR /app COPY ./build/libs/nonsoolmateServer-0.0.1-SNAPSHOT.jar /app/nonsoolmateServer.jar -CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active={profile}", "nonsoolmateServer.jar"] +CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active=dev", "nonsoolmateServer.jar"] From 758b56cfa598c4a84205b720ab72e4ea822a1725 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 00:00:53 +0900 Subject: [PATCH 017/465] =?UTF-8?q?[CHORE]=20dev-CD=20=EB=93=A4=EC=97=AC?= =?UTF-8?q?=EC=93=B0=EA=B8=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CD.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-CD.yml b/.github/workflows/dev-CD.yml index daae79c..8de7202 100644 --- a/.github/workflows/dev-CD.yml +++ b/.github/workflows/dev-CD.yml @@ -1,4 +1,4 @@ -name: NONSOOLMATE DEV CD +name: CD on: push: @@ -23,7 +23,7 @@ jobs: - name: application.yaml ์ƒ์„ฑ run: | mkdir src/main/resources - cd src/main/resources + cd src/main/resources touch ./application.yaml echo "${{ secrets.DEV_APPLICATION }}" > ./application-deploy.yaml working-directory: ${{ env.working-directory }} @@ -63,5 +63,5 @@ jobs: username: ${{ secrets.DEV_SERVER_USER }} key: ${{ secrets.DEV_SERVER_KEY }} script: | - cd ~ + cd ~ ./deploy.sh From c5904a3a8186a2dfb8318ea4ec478181ce57f841 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 00:07:33 +0900 Subject: [PATCH 018/465] =?UTF-8?q?[CHORE]=20dev-CD=20=EC=97=90=EB=9F=AC?= =?UTF-8?q?=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CD.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dev-CD.yml b/.github/workflows/dev-CD.yml index 8de7202..1c741ee 100644 --- a/.github/workflows/dev-CD.yml +++ b/.github/workflows/dev-CD.yml @@ -1,4 +1,4 @@ -name: CD +name: NONSOOLMATE DEV CD on: push: @@ -15,32 +15,29 @@ jobs: uses: actions/checkout@v3 - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v2 with: distribution: 'temurin' java-version: '17' - name: application.yaml ์ƒ์„ฑ run: | - mkdir src/main/resources - cd src/main/resources - touch ./application.yaml - echo "${{ secrets.DEV_APPLICATION }}" > ./application-deploy.yaml + mkdir -p src/main/resources + echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application-deploy.yaml working-directory: ${{ env.working-directory }} - name: ๋นŒ๋“œ run: | - chmod +x gradlew - ./gradlew build -x test + chmod +x gradlew + ./gradlew build -x test working-directory: ${{ env.working-directory }} shell: bash - - name: docker build ๊ฐ€๋Šฅํ•˜๋„๋ก ํ™˜๊ฒฝ ์„ค์ • - uses: docker/setup-buildx-action@v2.9.1 - - - name: docker hub์—๋กœ๊ทธ์ธ - uses: docker/login-action@v2.2.0 + uses: docker/setup-buildx-action@v2 + + - name: docker hub์— ๋กœ๊ทธ์ธ + uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_LOGIN_USERNAME }} password: ${{ secrets.DOCKERHUB_LOGIN_ACCESSTOKEN }} @@ -63,5 +60,6 @@ jobs: username: ${{ secrets.DEV_SERVER_USER }} key: ${{ secrets.DEV_SERVER_KEY }} script: | - cd ~ + cd ~ ./deploy.sh + From 2697d411372837b2bb1aadefeed66914e2b360d9 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 00:10:25 +0900 Subject: [PATCH 019/465] =?UTF-8?q?[CHORE]=20dev-CI=20=EC=97=90=EB=9F=AC?= =?UTF-8?q?=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CI.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dev-CI.yml b/.github/workflows/dev-CI.yml index 5d1ad21..d1d8286 100644 --- a/.github/workflows/dev-CI.yml +++ b/.github/workflows/dev-CI.yml @@ -17,22 +17,21 @@ jobs: uses: actions/checkout@v3 - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: + uses: actions/setup-java@v2 + with: distribution: 'temurin' java-version: '17' - name: application.yaml ์ƒ์„ฑ run: | - mkdir src/main/resources - cd src/main/resources - touch ./application.yaml - echo "${{ secrets.DEV_APPLICATION }}" > ./application.yaml + mkdir -p src/main/resources + echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application.yaml working-directory: ${{ env.working-directory }} - name: build run: | - chmod +x gradlew - ./gradlew build -x test + chmod +x gradlew + ./gradlew build -x test working-directory: ${{ env.working-directory }} shell: bash + From 07909997a56542265de41f788c827d8d640d6f2d Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 00:18:50 +0900 Subject: [PATCH 020/465] =?UTF-8?q?[CHORE]=20dev-CI.yml=20workDir=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-CI.yml b/.github/workflows/dev-CI.yml index d1d8286..76c9862 100644 --- a/.github/workflows/dev-CI.yml +++ b/.github/workflows/dev-CI.yml @@ -10,7 +10,7 @@ jobs: build: runs-on: ubuntu-22.04 env: - working-directory: /nonsoolmateServer + working-directory: nonsoolmateServer steps: - name: checkout From 9398f2e86a0d75d2b482756df2169a85486ceb15 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 00:19:23 +0900 Subject: [PATCH 021/465] =?UTF-8?q?[CHORE]=20dev-CD.yml=20workDir=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-CD.yml b/.github/workflows/dev-CD.yml index 1c741ee..f6e0f76 100644 --- a/.github/workflows/dev-CD.yml +++ b/.github/workflows/dev-CD.yml @@ -8,7 +8,7 @@ jobs: deploy-ci: runs-on: ubuntu-22.04 env: - working-directory: /nonsoolmateServer + working-directory: nonsoolmateServer steps: - name: ์ฒดํฌ์•„์›ƒ From eb247c3cc5bc15f0153b54c84a8d1527142926a6 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Wed, 3 Jan 2024 01:05:05 +0900 Subject: [PATCH 022/465] =?UTF-8?q?[CHORE]=20dev-CD.yml=20server=5Fname=20?= =?UTF-8?q?=EB=8C=80=EB=AC=B8=EC=9E=90=20=ED=8F=AC=ED=95=A8=20=EC=95=88?= =?UTF-8?q?=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CD.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-CD.yml b/.github/workflows/dev-CD.yml index f6e0f76..93d237b 100644 --- a/.github/workflows/dev-CD.yml +++ b/.github/workflows/dev-CD.yml @@ -44,8 +44,8 @@ jobs: - name: docker image ๋นŒ๋“œ ๋ฐ ํ‘ธ์‹œ run: | - docker build --platform linux/amd64 -t nonsoolmate/nonsoolmateServer . - docker push nonsoolmate/nonsoolmateServer + docker build --platform linux/amd64 -t nonsoolmate/nonsoolmate-server . + docker push nonsoolmate/nonsoolmate-server working-directory: ${{ env.working-directory }} deploy-cd: From 10abf0a80591754aa8ce2162644687d1f65be05a Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Wed, 3 Jan 2024 01:13:26 +0900 Subject: [PATCH 023/465] =?UTF-8?q?[CHORE]=20Dockerfile=20image=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 --- nonsoolmateServer/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/Dockerfile b/nonsoolmateServer/Dockerfile index dce7147..6dd69d8 100644 --- a/nonsoolmateServer/Dockerfile +++ b/nonsoolmateServer/Dockerfile @@ -1,4 +1,4 @@ -FROM amd64/temurin:17 +FROM amd64/eclipse-temurin:17-jdk WORKDIR /app From 5d4c38b3f0d6911f6b51fedbd182cabcb87da35e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:17:28 +0900 Subject: [PATCH 024/465] =?UTF-8?q?[REFACTOR]=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=ED=98=95=EC=97=90=20=EB=A7=9E=EC=B6=94=EC=96=B4=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EA=B5=AC=EC=A1=B0=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 --- .../nonsoolmateServer/{ => domain}/exam/controller/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/exam/domain/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/exam/exception/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/exam/repository/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/exam/service/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/member/controller/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/member/domain/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/member/exception/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/member/repository/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/member/service/dummy.txt | 0 .../{ => domain}/university/controller/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/university/domain/dummy.txt | 0 .../{ => domain}/university/exception/dummy.txt | 0 .../{ => domain}/university/repository/dummy.txt | 0 .../nonsoolmateServer/{ => domain}/university/service/dummy.txt | 0 .../common/controller}/ServerProfileController.java | 2 +- .../{common/swagger => global/config}/SwaggerConfig.java | 2 +- 17 files changed, 2 insertions(+), 2 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/exam/controller/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/exam/domain/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/exam/exception/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/exam/repository/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/exam/service/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/member/controller/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/member/domain/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/member/exception/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/member/repository/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/member/service/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/university/controller/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/university/domain/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/university/exception/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/university/repository/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{ => domain}/university/service/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{common/profile => global/common/controller}/ServerProfileController.java (86%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{common/swagger => global/config}/SwaggerConfig.java (86%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/controller/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/controller/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/controller/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/domain/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/exception/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/exception/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/exception/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/repository/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/repository/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/repository/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/service/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/exam/service/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/controller/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/domain/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/exception/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/repository/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/member/service/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/controller/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/domain/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/exception/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/repository/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/university/service/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java similarity index 86% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java index 8eb21dc..36c4d85 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/profile/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.common.profile; +package com.nonsoolmate.nonsoolmateServer.global.common.controller; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/swagger/SwaggerConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SwaggerConfig.java similarity index 86% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/swagger/SwaggerConfig.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SwaggerConfig.java index aaf9107..64a711f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/common/swagger/SwaggerConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SwaggerConfig.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.common.swagger; +package com.nonsoolmate.nonsoolmateServer.global.config; import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.info.Info; From f04d6724c282137bcf2d881b3d48b790ef7b11ec Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:25:41 +0900 Subject: [PATCH 025/465] =?UTF-8?q?[ADD]=20Error=20Enum=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 --- .../nonsoolmateServer/global/error/Error.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/Error.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/Error.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/Error.java new file mode 100644 index 0000000..c30e9f2 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/Error.java @@ -0,0 +1,29 @@ +package com.nonsoolmate.nonsoolmateServer.global.error; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import org.springframework.http.HttpStatus; + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public enum Error { + + // 400 BAD REQUEST + REQUEST_VALIDATION_EXCEPTION(HttpStatus.BAD_REQUEST, "์ž˜๋ชป๋œ ์š”์ฒญ์ž…๋‹ˆ๋‹ค"), + + // 404 NOT FOUND + + // 500 INTERNAL SERVER ERROR + INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์•Œ ์ˆ˜ ์—†๋Š” ์„œ๋ฒ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"); + + private final HttpStatus httpStatus; + private final String message; + + public int getHttpStatus(){ + return httpStatus.value(); + } + + public String getMessage(){ + return message; + } + +} From 4c30133f70a1b69c1aa2b6a7d8c4ec467ffc2965 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:26:02 +0900 Subject: [PATCH 026/465] =?UTF-8?q?[ADD]=20Success=20Enum=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 --- .../global/success/Success.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/success/Success.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/success/Success.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/success/Success.java new file mode 100644 index 0000000..949bdee --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/success/Success.java @@ -0,0 +1,26 @@ +package com.nonsoolmate.nonsoolmateServer.global.success; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import org.springframework.http.HttpStatus; + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public enum Success { + + // 200 OK + GET_SERVER_PROFILE(HttpStatus.OK, "์„œ๋ฒ„ ํ”„๋กœํ•„ ํ™•์ธ ์™„๋ฃŒ"); + + // 201 created + + + private final HttpStatus httpStatus; + private final String message; + + public int getHttpStatus(){ + return httpStatus.value(); + } + + public String getMessage(){ + return message; + } +} \ No newline at end of file From 8ab813ab30b054a7063719d9dcaec40ffde1ec9c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:26:36 +0900 Subject: [PATCH 027/465] =?UTF-8?q?[FEAT]=20ApiResponse=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/common/response/ApiResponse.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java new file mode 100644 index 0000000..b9d2c1f --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java @@ -0,0 +1,33 @@ +package com.nonsoolmate.nonsoolmateServer.global.common.response; + +import com.nonsoolmate.nonsoolmateServer.global.success.Success; +import com.nonsoolmate.nonsoolmateServer.global.error.Error; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +@AllArgsConstructor +public class ApiResponse { + private final int code; + private final String message; + private T data; + + public static ApiResponse success(Success success) { + return new ApiResponse<>(success.getHttpStatus(), success.getMessage()); + } + + public static ApiResponse success(Success success, T data) { + return new ApiResponse(success.getHttpStatus(), success.getMessage(), data); + } + + public static ApiResponse error(Error error) { + return new ApiResponse<>(error.getHttpStatus(), error.getMessage()); + } + + public static ApiResponse error(Error error, T data) { + return new ApiResponse(error.getHttpStatus(), error.getMessage(), data); + } +} From d007568cb5bcd5353d79523c8256a919dc5fd865 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:29:34 +0900 Subject: [PATCH 028/465] =?UTF-8?q?[REFACTOR]=20getProfile=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=EA=B0=92=20ApiResponse=20=ED=98=95=EC=8B=9D=EC=9C=BC?= =?UTF-8?q?=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 --- .../global/common/controller/ServerProfileController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java index 36c4d85..f15fadd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java @@ -1,5 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.global.common.controller; +import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.success.Success; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.GetMapping; @@ -12,7 +14,7 @@ public class ServerProfileController { private final Environment env; @GetMapping("/profile") - public String getProfile() { - return env.getActiveProfiles()[0]; + public ApiResponse getProfile() { + return ApiResponse.success(Success.GET_SERVER_PROFILE ,env.getActiveProfiles()[0]); } } \ No newline at end of file From aebd5b3af1b7a8917f1517f75d60ff3e272111da Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:33:40 +0900 Subject: [PATCH 029/465] =?UTF-8?q?[FEAT]=20BusinessException=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/BusinessException.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/BusinessException.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/BusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/BusinessException.java new file mode 100644 index 0000000..71c4a2d --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/BusinessException.java @@ -0,0 +1,15 @@ +package com.nonsoolmate.nonsoolmateServer.global.error; + +import lombok.Getter; + +@Getter +public class BusinessException extends RuntimeException { + private final Error error; + public BusinessException(Error error,String message) { + super(message); + this.error = error; + } + public int getHttpStatus() { + return error.getHttpStatus(); + } +} \ No newline at end of file From b201ca84675f204e832e4b5483e897c1d6bf8fd2 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:35:59 +0900 Subject: [PATCH 030/465] =?UTF-8?q?[STYLE]=20exception=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/{ => exception}/BusinessException.java | 2 +- .../nonsoolmateServer/global/error/{ => exception}/Error.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/{ => exception}/BusinessException.java (82%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/{ => exception}/Error.java (91%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/BusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java similarity index 82% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/BusinessException.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java index 71c4a2d..c456e6e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/BusinessException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.error; +package com.nonsoolmate.nonsoolmateServer.global.error.exception; import lombok.Getter; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/Error.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java similarity index 91% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/Error.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java index c30e9f2..ae6e258 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/Error.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.error; +package com.nonsoolmate.nonsoolmateServer.global.error.exception; import lombok.AccessLevel; import lombok.AllArgsConstructor; From f2c6a9efff0d60fb1acd5a773e86c151582aa2f0 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:37:03 +0900 Subject: [PATCH 031/465] =?UTF-8?q?[REFACTOR]=20Error=20=EA=B2=BD=EB=A1=9C?= =?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 --- .../nonsoolmateServer/global/common/response/ApiResponse.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java index b9d2c1f..4ac13c3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java @@ -1,7 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.global.common.response; import com.nonsoolmate.nonsoolmateServer.global.success.Success; -import com.nonsoolmate.nonsoolmateServer.global.error.Error; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.Error; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; @@ -30,4 +30,4 @@ public static ApiResponse error(Error error) { public static ApiResponse error(Error error, T data) { return new ApiResponse(error.getHttpStatus(), error.getMessage(), data); } -} +} \ No newline at end of file From fd578bb8d55d89557a7fbd643cf46c314c65d4e2 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 13:42:04 +0900 Subject: [PATCH 032/465] =?UTF-8?q?[FEAT]=20GlobalExceptionHandler=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/GlobalExceptionHandler.java | 33 +++++++++++++++++++ .../global/error/exception/Error.java | 1 + 2 files changed, 34 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java new file mode 100644 index 0000000..9a1d0b8 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -0,0 +1,33 @@ +package com.nonsoolmate.nonsoolmateServer.global.error; + +import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.*; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.Error; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.servlet.NoHandlerFoundException; + +import java.util.HashMap; + +@RestControllerAdvice +@Slf4j +public class GlobalExceptionHandler { + @ExceptionHandler({ BusinessException.class }) + protected ApiResponse handleCustomException(BusinessException ex) { + return ApiResponse.error(ex.getError()); + } + + @ExceptionHandler({ Exception.class }) + protected ApiResponse handleServerException(Exception ex) { + log.error(ex.getMessage()); + return ApiResponse.error(Error.INTERNAL_SERVER_ERROR); + } + + @ExceptionHandler(NoHandlerFoundException.class) + protected ApiResponse handleNotFoundException(NoHandlerFoundException ex) { + HashMap pathMap = new HashMap<>(); + pathMap.put("path",ex.getRequestURL()); + return ApiResponse.error(Error.NOT_FOUND_PATH, pathMap); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java index ae6e258..6dfa64e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java @@ -11,6 +11,7 @@ public enum Error { REQUEST_VALIDATION_EXCEPTION(HttpStatus.BAD_REQUEST, "์ž˜๋ชป๋œ ์š”์ฒญ์ž…๋‹ˆ๋‹ค"), // 404 NOT FOUND + NOT_FOUND_PATH(HttpStatus.NOT_FOUND, "ํ•ด๋‹น ๊ฒฝ๋กœ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), // 500 INTERNAL SERVER ERROR INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์•Œ ์ˆ˜ ์—†๋Š” ์„œ๋ฒ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"); From 61b4d6f2c7f44da62b8063cf63164214650bc135 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 14:12:47 +0900 Subject: [PATCH 033/465] =?UTF-8?q?[CHORE]=20AWS=20sdk=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index 074e4dd..77c624c 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -30,6 +30,10 @@ dependencies { // mysql runtimeOnly 'com.mysql:mysql-connector-j' + // AWS sdk + implementation("software.amazon.awssdk:bom:2.21.0") + implementation("software.amazon.awssdk:s3:2.21.0") + // swagger implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' From 8e79aeba03d6b8f4254ec60781d888e738e3feac Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 15:26:17 +0900 Subject: [PATCH 034/465] =?UTF-8?q?[FEAT]=20AWSConfig=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/config/AWSConfig.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java new file mode 100644 index 0000000..4fbce58 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java @@ -0,0 +1,49 @@ +package com.nonsoolmate.nonsoolmateServer.global.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import software.amazon.awssdk.auth.credentials.SystemPropertyCredentialsProvider; +import software.amazon.awssdk.regions.Region; +import software.amazon.awssdk.services.s3.S3Client; + + +@Configuration +public class AWSConfig { + + private static final String AWS_ACCESS_KEY_ID = "aws.accessKeyId"; + private static final String AWS_SECRET_ACCESS_KEY = "aws.secretAccessKey"; + + private final String accessKey; + private final String secretKey; + private final String regionString; + + public AWSConfig(@Value("${aws-property.access-key}") final String accessKey, + @Value("${aws-property.secret-key}") final String secretKey, + @Value("${aws-property.aws-region}") final String regionString) { + this.accessKey = accessKey; + this.secretKey = secretKey; + this.regionString = regionString; + } + + + @Bean + public SystemPropertyCredentialsProvider systemPropertyCredentialsProvider() { + System.setProperty(AWS_ACCESS_KEY_ID, accessKey); + System.setProperty(AWS_SECRET_ACCESS_KEY, secretKey); + return SystemPropertyCredentialsProvider.create(); + } + + @Bean + public Region getRegion() { + return Region.of(regionString); + } + + @Bean + public S3Client getS3Client() { + return S3Client.builder() + .region(getRegion()) + .credentialsProvider(systemPropertyCredentialsProvider()) + .build(); + } +} \ No newline at end of file From f939ad23afbc3112c990b16b0229a4fc875e4a6e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 3 Jan 2024 16:08:55 +0900 Subject: [PATCH 035/465] =?UTF-8?q?[SYTLE]=20AWSConfig=20=EB=9D=84?= =?UTF-8?q?=EC=96=B4=EC=93=B0=EA=B8=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java | 1 - 1 file changed, 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java index 4fbce58..9ff98e1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java @@ -7,7 +7,6 @@ import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.s3.S3Client; - @Configuration public class AWSConfig { From f10011c826f2aa6c53730a2baf4e5ba6e386a109 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Thu, 4 Jan 2024 01:10:25 +0900 Subject: [PATCH 036/465] =?UTF-8?q?[CHORE]=20CD=20script=EC=97=90=EC=84=9C?= =?UTF-8?q?=20yml=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 --- .github/workflows/dev-CD.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-CD.yml b/.github/workflows/dev-CD.yml index 93d237b..e0b516d 100644 --- a/.github/workflows/dev-CD.yml +++ b/.github/workflows/dev-CD.yml @@ -23,7 +23,7 @@ jobs: - name: application.yaml ์ƒ์„ฑ run: | mkdir -p src/main/resources - echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application-deploy.yaml + echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application.yaml working-directory: ${{ env.working-directory }} - name: ๋นŒ๋“œ From 2768a3cf34173b2577c13d2b24e335d1197e7b5e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 02:41:59 +0900 Subject: [PATCH 037/465] =?UTF-8?q?[DEL]=20domain=20=EC=95=84=EB=9E=98=20d?= =?UTF-8?q?ummy.txt=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmate/nonsoolmateServer/domain/exam/domain/dummy.txt | 1 - .../nonsoolmate/nonsoolmateServer/domain/member/domain/dummy.txt | 1 - .../nonsoolmateServer/domain/university/domain/dummy.txt | 1 - 3 files changed, 3 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From b4fde5891e3667ecb51b1e16738a03ccf4289beb Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 02:42:24 +0900 Subject: [PATCH 038/465] =?UTF-8?q?[FEAT]=20Member=20Entity=EC=97=90=20?= =?UTF-8?q?=ED=95=84=EC=9A=94=ED=95=9C=20enum=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/global/common/enums/PlatformType.java | 5 +++++ .../nonsoolmateServer/global/common/enums/Role.java | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/PlatformType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/Role.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/PlatformType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/PlatformType.java new file mode 100644 index 0000000..bd948e8 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/PlatformType.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.global.common.enums; + +public enum PlatformType { + NAVER, NONE +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/Role.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/Role.java new file mode 100644 index 0000000..52e8ff6 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/Role.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.global.common.enums; + +public enum Role { + ADMIN, USER +} From b7da97e796e3c293b406b0c9aed16f8cda5408db Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 02:49:57 +0900 Subject: [PATCH 039/465] =?UTF-8?q?[FEAT]=20Member=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/domain/Member.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/Member.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/Member.java new file mode 100644 index 0000000..3618e21 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/Member.java @@ -0,0 +1,53 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.domain; + +import com.nonsoolmate.nonsoolmateServer.global.common.enums.PlatformType; +import com.nonsoolmate.nonsoolmateServer.global.common.enums.Role; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.validation.constraints.NotNull; +import java.time.LocalDateTime; +import java.time.Year; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.hibernate.annotations.ColumnDefault; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Member { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long memberId; + + @NotNull + private String email; + + @NotNull + private String memberName; + + @Enumerated(EnumType.STRING) + @NotNull + private PlatformType platformType; + + @Enumerated(EnumType.STRING) + @NotNull + private Role role; + + @NotNull + private Year memberBirthYear; + + @ColumnDefault("0") + private int ticketCount; + + private LocalDateTime ticketPreviousPublicationTime; + + @NotNull + private String phoneNumber; +} From 2fb7fe39a1b16838a16aed62bcc39c604b68a86b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 02:51:38 +0900 Subject: [PATCH 040/465] =?UTF-8?q?[FEAT]=20University=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/domain/University.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/University.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/University.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/University.java new file mode 100644 index 0000000..63d5548 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/University.java @@ -0,0 +1,27 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.domain; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.validation.constraints.NotNull; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class University { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long universityId; + + @NotNull + private String universityName; + + @NotNull + private String universityCollege; +} From 96a758115f0187824be06a28bdf8f25dee438300 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 02:57:15 +0900 Subject: [PATCH 041/465] =?UTF-8?q?[FEAT]=20Exam=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/exam/domain/Exam.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/Exam.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/Exam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/Exam.java new file mode 100644 index 0000000..a1708ab --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/Exam.java @@ -0,0 +1,43 @@ +package com.nonsoolmate.nonsoolmateServer.domain.exam.domain; + +import com.nonsoolmate.nonsoolmateServer.domain.university.domain.University; +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.validation.constraints.NotNull; +import java.sql.Time; +import java.time.Year; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Exam { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long examId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "university_id") + private University university; + + @NotNull + private String examName; + + @NotNull + private String examAnswerUrl; + + @NotNull + private Year examYear; + + @NotNull + private Time examTimeLimit; +} From b917a89fe6b9634502de228818a918ae39605432 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 22:06:27 +0900 Subject: [PATCH 042/465] =?UTF-8?q?[REFACTOR]=20domain=20->=20entity?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/exam/domain/Exam.java | 43 ------------------- .../domain/exam/entity/Exam.java | 0 .../member/{domain => entity}/Member.java | 6 +-- .../member/entity/enums/PlatformType.java | 5 +++ .../domain/member/entity/enums/Role.java | 5 +++ .../global/common/enums/PlatformType.java | 5 --- .../global/common/enums/Role.java | 5 --- 7 files changed, 13 insertions(+), 56 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/Exam.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/entity/Exam.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/{domain => entity}/Member.java (83%) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/PlatformType.java delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/Role.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/Exam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/Exam.java deleted file mode 100644 index a1708ab..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/domain/Exam.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.domain.exam.domain; - -import com.nonsoolmate.nonsoolmateServer.domain.university.domain.University; -import jakarta.persistence.Entity; -import jakarta.persistence.FetchType; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.validation.constraints.NotNull; -import java.sql.Time; -import java.time.Year; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@Entity -@Getter -@NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor -public class Exam { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long examId; - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "university_id") - private University university; - - @NotNull - private String examName; - - @NotNull - private String examAnswerUrl; - - @NotNull - private Year examYear; - - @NotNull - private Time examTimeLimit; -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/entity/Exam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/entity/Exam.java new file mode 100644 index 0000000..e69de29 diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java similarity index 83% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/Member.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java index 3618e21..b396e1e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/domain/Member.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java @@ -1,7 +1,7 @@ -package com.nonsoolmate.nonsoolmateServer.domain.member.domain; +package com.nonsoolmate.nonsoolmateServer.domain.member.entity; -import com.nonsoolmate.nonsoolmateServer.global.common.enums.PlatformType; -import com.nonsoolmate.nonsoolmateServer.global.common.enums.Role; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java new file mode 100644 index 0000000..1d30135 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums; + +public enum PlatformType { + NAVER, NONE +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java new file mode 100644 index 0000000..6ec2a47 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums; + +public enum Role { + ADMIN, USER +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/PlatformType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/PlatformType.java deleted file mode 100644 index bd948e8..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/PlatformType.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.common.enums; - -public enum PlatformType { - NAVER, NONE -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/Role.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/Role.java deleted file mode 100644 index 52e8ff6..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/enums/Role.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.common.enums; - -public enum Role { - ADMIN, USER -} From 249ea79bf92bd570b2c59125bc9a0981542f19fc Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 22:22:52 +0900 Subject: [PATCH 043/465] =?UTF-8?q?[FIX]=20Exam=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/exam/entity/Exam.java | 0 .../domain/university/entity/Exam.java | 43 +++++++++++++++++++ .../{domain => entity}/University.java | 0 3 files changed, 43 insertions(+) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/entity/Exam.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Exam.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/{domain => entity}/University.java (100%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/entity/Exam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/entity/Exam.java deleted file mode 100644 index e69de29..0000000 diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Exam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Exam.java new file mode 100644 index 0000000..5e2b6af --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Exam.java @@ -0,0 +1,43 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.validation.constraints.NotNull; +import java.sql.Time; +import java.time.Year; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Exam { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long examId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "university_id") + private University university; + + @NotNull + private String examName; + + @NotNull + private String examAnswerUrl; + + @NotNull + private Year examYear; + + @NotNull + private Time examTimeLimit; +} \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/University.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/domain/University.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java From 21544030b00791184e4909b21b2ac643b46b1834 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 22:24:06 +0900 Subject: [PATCH 044/465] =?UTF-8?q?[FIX]=20domain=20->=20entity=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/university/entity/University.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java index 63d5548..3e1e829 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.domain.university.domain; +package com.nonsoolmate.nonsoolmateServer.domain.university.entity; import jakarta.persistence.Entity; import jakarta.persistence.GeneratedValue; From 3e51f4e0c477211e5770e8b974db246ec006bb00 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 22:25:19 +0900 Subject: [PATCH 045/465] =?UTF-8?q?[DEL]=20exam=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/exam/controller/dummy.txt | 1 - .../nonsoolmateServer/domain/exam/exception/dummy.txt | 1 - .../nonsoolmateServer/domain/exam/repository/dummy.txt | 1 - .../nonsoolmate/nonsoolmateServer/domain/exam/service/dummy.txt | 1 - 4 files changed, 4 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/controller/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/exception/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/repository/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/controller/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/controller/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/exception/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/exception/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/repository/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/repository/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/service/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/exam/service/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 5c0fd7c2952f398e8a10af5c709c04cca17045ea Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 22:51:30 +0900 Subject: [PATCH 046/465] =?UTF-8?q?[FEAT]=20Question=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/entity/Question.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java new file mode 100644 index 0000000..4378662 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java @@ -0,0 +1,30 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.entity; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.validation.constraints.NotNull; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class Question { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long questionId; + + @ManyToOne + @JoinColumn(name = "exam_id") + private Exam exam; + + @NotNull + private String examQuestionImg; +} \ No newline at end of file From b04c49309702228e2fb4b7497768bc0e87fb4abf Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 22:57:28 +0900 Subject: [PATCH 047/465] =?UTF-8?q?[FEAT]=20ExamRecord=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/examRecord/entity/ExamRecord.java | 50 +++++++++++++++++++ .../entity/enums/ExamResultStatus.java | 5 ++ 2 files changed, 55 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/enums/ExamResultStatus.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java new file mode 100644 index 0000000..fda7862 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java @@ -0,0 +1,50 @@ +package com.nonsoolmate.nonsoolmateServer.domain.examRecord.entity; + +import com.nonsoolmate.nonsoolmateServer.domain.examRecord.entity.enums.ExamResultStatus; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.Exam; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.validation.constraints.NotNull; +import java.sql.Time; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class ExamRecord { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long examRecordId; + + @ManyToOne + @JoinColumn(name = "exam_id") + private Exam exam; + + @ManyToOne + @JoinColumn(name = "member_id") + private Member member; + + @Enumerated(EnumType.STRING) + @NotNull + private ExamResultStatus examResultStatus; + + @NotNull + private Time timeTakeExam; + + @NotNull + private String examRecordSheetUrl; + + @NotNull + private String examRecordResultUrl; +} \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/enums/ExamResultStatus.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/enums/ExamResultStatus.java new file mode 100644 index 0000000..757935e --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/enums/ExamResultStatus.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.domain.examRecord.entity.enums; + +public enum ExamResultStatus { + ONGOING, FINISH +} From 244215a009b8670d2644740579c2e50e74583465 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 4 Jan 2024 22:58:18 +0900 Subject: [PATCH 048/465] =?UTF-8?q?[ADD]=20examRecord=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EA=B5=AC=EC=A1=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/examRecord/controller/dummy.txt | 1 + .../nonsoolmateServer/domain/examRecord/exception/dummy.txt | 1 + .../nonsoolmateServer/domain/examRecord/repository/dummy.txt | 1 + .../nonsoolmateServer/domain/examRecord/service/dummy.txt | 1 + 4 files changed, 4 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/controller/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/exception/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/repository/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/controller/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/controller/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/exception/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/exception/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/repository/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/repository/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/service/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/service/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 34b3c78e1dc888c3f0d8fa790d3967814dbaf58b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 5 Jan 2024 01:14:30 +0900 Subject: [PATCH 049/465] =?UTF-8?q?[FEAT]=20selectUniversity=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/SelectUniversity.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java new file mode 100644 index 0000000..ce8eea4 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java @@ -0,0 +1,32 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.entity; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@AllArgsConstructor +public class SelectUniversity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long selectUniversityId; + + @ManyToOne + @JoinColumn(name = "member_id") + private Member member; + + @ManyToOne + @JoinColumn(name = "university_id") + private University university; +} From edacdb1f672d35e085c544f50ae576302f2ec4e9 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 5 Jan 2024 15:15:51 +0900 Subject: [PATCH 050/465] =?UTF-8?q?[FIX]=20=EA=B8=B0=ED=9A=8D=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=EC=82=AC=ED=95=AD=20=EB=B0=8F=20=EB=94=94=EC=9E=90?= =?UTF-8?q?=EC=9D=B8=20=EC=9A=94=EC=B2=AD=EC=82=AC=ED=95=AD=EC=97=90=20?= =?UTF-8?q?=EB=94=B0=EB=A5=B8=20=ED=94=84=EB=A1=9C=ED=95=84=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80,=20=EC=84=B1=EB=B3=84=20=ED=95=84=EB=93=9C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/entity/Member.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java index b396e1e..decbad9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java @@ -16,6 +16,7 @@ import lombok.Getter; import lombok.NoArgsConstructor; import org.hibernate.annotations.ColumnDefault; +import org.hibernate.validator.constraints.Length; @Entity @Getter @@ -30,7 +31,7 @@ public class Member { private String email; @NotNull - private String memberName; + private String name; @Enumerated(EnumType.STRING) @NotNull @@ -41,13 +42,22 @@ public class Member { private Role role; @NotNull - private Year memberBirthYear; + private Year birthYear; - @ColumnDefault("0") - private int ticketCount; + @NotNull + @Length(max = 1) + private String gender; - private LocalDateTime ticketPreviousPublicationTime; + @NotNull + @Length(max = 255) + private String profileImage; @NotNull + @Length(max = 13) private String phoneNumber; + + @ColumnDefault("0") + private int ticketCount; + + private LocalDateTime ticketPreviousPublicationTime; } From e6d4ccaf4cdd54adcd04bc324f3c85de70e211eb Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 5 Jan 2024 19:37:12 +0900 Subject: [PATCH 051/465] =?UTF-8?q?[FIX]=20=EB=84=A4=EC=9D=B4=EB=B2=84=20?= =?UTF-8?q?=EC=86=8C=EC=85=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=84=A0?= =?UTF-8?q?=ED=83=9D=EC=A0=81=20=EB=8F=99=EC=9D=98=20=ED=95=AD=EB=AA=A9?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=ED=95=84=EB=93=9C=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 --- .../nonsoolmateServer/domain/member/entity/Member.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java index decbad9..416ed7c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java @@ -41,17 +41,11 @@ public class Member { @NotNull private Role role; - @NotNull private Year birthYear; - @NotNull @Length(max = 1) private String gender; - @NotNull - @Length(max = 255) - private String profileImage; - @NotNull @Length(max = 13) private String phoneNumber; From fa94e27839d47bfb29251fece3c6a804b9f3250f Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 5 Jan 2024 19:44:24 +0900 Subject: [PATCH 052/465] =?UTF-8?q?[FIX]=20Exam=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EC=9D=B4=EB=A6=84=20->=20UniversityExam=20?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=AA=85=ED=99=95=ED=95=98=EA=B2=8C=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/examRecord/entity/ExamRecord.java | 4 ++-- .../nonsoolmateServer/domain/university/entity/Question.java | 4 ++-- .../university/entity/{Exam.java => UniversityExam.java} | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/{Exam.java => UniversityExam.java} (93%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java index fda7862..8f8adef 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java @@ -2,7 +2,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.examRecord.entity.enums.ExamResultStatus; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; -import com.nonsoolmate.nonsoolmateServer.domain.university.entity.Exam; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; @@ -29,7 +29,7 @@ public class ExamRecord { @ManyToOne @JoinColumn(name = "exam_id") - private Exam exam; + private UniversityExam universityExam; @ManyToOne @JoinColumn(name = "member_id") diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java index 4378662..af68e09 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java @@ -22,8 +22,8 @@ public class Question { private Long questionId; @ManyToOne - @JoinColumn(name = "exam_id") - private Exam exam; + @JoinColumn(name = "university_exam_id") + private UniversityExam universityExam; @NotNull private String examQuestionImg; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Exam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java similarity index 93% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Exam.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java index 5e2b6af..7412d79 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Exam.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java @@ -20,10 +20,10 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor -public class Exam { +public class UniversityExam { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long examId; + private Long universityExamId; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "university_id") From f757c0b890dd90881ca293a4f069fbb8d49dd979 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 5 Jan 2024 19:46:26 +0900 Subject: [PATCH 053/465] =?UTF-8?q?[FIX]=20Question=20->=20UniversityExamI?= =?UTF-8?q?mage=EB=A1=9C=20=EB=AA=85=ED=99=95=ED=95=98=EA=B2=8C=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/{Question.java => UniversityExamImage.java} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/{Question.java => UniversityExamImage.java} (86%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java similarity index 86% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java index af68e09..2160369 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/Question.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java @@ -16,15 +16,15 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor -public class Question { +public class UniversityExamImage { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long questionId; + private Long universityExamImageId; @ManyToOne @JoinColumn(name = "university_exam_id") private UniversityExam universityExam; @NotNull - private String examQuestionImg; + private String universityExamImageUrl; } \ No newline at end of file From b7f0fe892d47a1472d0f2db01ea7ff8f82dd738e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 5 Jan 2024 19:48:18 +0900 Subject: [PATCH 054/465] =?UTF-8?q?[FIX]=20ExamRecord=20->=20UniversityExa?= =?UTF-8?q?mRecord=EB=A1=9C=20=EB=8D=94=20=EB=AA=85=ED=99=95=ED=95=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=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 --- .../examRecord/entity/enums/ExamResultStatus.java | 5 ----- .../controller/dummy.txt | 0 .../entity/UniversityExamRecord.java} | 10 +++++----- .../entity/enums/ExamResultStatus.java | 5 +++++ .../exception/dummy.txt | 0 .../repository/dummy.txt | 0 .../service/dummy.txt | 0 7 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/enums/ExamResultStatus.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/{examRecord => universityExamRecord}/controller/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/{examRecord/entity/ExamRecord.java => universityExamRecord/entity/UniversityExamRecord.java} (79%) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/enums/ExamResultStatus.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/{examRecord => universityExamRecord}/exception/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/{examRecord => universityExamRecord}/repository/dummy.txt (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/{examRecord => universityExamRecord}/service/dummy.txt (100%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/enums/ExamResultStatus.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/enums/ExamResultStatus.java deleted file mode 100644 index 757935e..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/enums/ExamResultStatus.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.domain.examRecord.entity.enums; - -public enum ExamResultStatus { - ONGOING, FINISH -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/controller/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java similarity index 79% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java index 8f8adef..9d1a8a7 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/entity/ExamRecord.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java @@ -1,6 +1,6 @@ -package com.nonsoolmate.nonsoolmateServer.domain.examRecord.entity; +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity; -import com.nonsoolmate.nonsoolmateServer.domain.examRecord.entity.enums.ExamResultStatus; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.enums.ExamResultStatus; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; import jakarta.persistence.Entity; @@ -22,13 +22,13 @@ @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @AllArgsConstructor -public class ExamRecord { +public class UniversityExamRecord { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) - private Long examRecordId; + private Long universityExamRecordId; @ManyToOne - @JoinColumn(name = "exam_id") + @JoinColumn(name = "university_exam_id") private UniversityExam universityExam; @ManyToOne diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/enums/ExamResultStatus.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/enums/ExamResultStatus.java new file mode 100644 index 0000000..cfabd14 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/enums/ExamResultStatus.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.enums; + +public enum ExamResultStatus { + ONGOING, FINISH +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/exception/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/repository/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/dummy.txt similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/examRecord/service/dummy.txt rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/dummy.txt From ee7bd52629b2d1b1feda227adbc1459274cc51d0 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 5 Jan 2024 19:49:43 +0900 Subject: [PATCH 055/465] =?UTF-8?q?[ADD]=20selectUniversity=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=20=EA=B5=AC=EC=A1=B0=20=EA=B3=B5=EC=9C=A0?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20dummy=20file=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/selectUniversity/exception/dummy.txt | 1 + .../domain/selectUniversity/repository/dummy.txt | 1 + .../nonsoolmateServer/domain/selectUniversity/service/dummy.txt | 1 + 3 files changed, 3 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From b26848bc682caf39bffe1dd3b65fd87e3ae00f9b Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 6 Jan 2024 01:56:48 +0900 Subject: [PATCH 056/465] =?UTF-8?q?[ADD]=20jwt=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index 77c624c..7ab8cb6 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -20,6 +20,9 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-web' + // security + implementation 'com.auth0:java-jwt:4.2.1' + // lombok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' From 8fdaf4937087c13badc0b1b7bc6a8c70009339aa Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 6 Jan 2024 02:07:19 +0900 Subject: [PATCH 057/465] =?UTF-8?q?[DEL]=20=EB=8D=94=EB=AF=B8=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/repository/dummy.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 5d4065d4af2323c7606b55e3e4d21504dfea76d8 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 6 Jan 2024 02:10:13 +0900 Subject: [PATCH 058/465] =?UTF-8?q?[FEAT]=20MemberRepository=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/repository/MemberRepository.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java new file mode 100644 index 0000000..f760bb6 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java @@ -0,0 +1,9 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.repository; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface MemberRepository extends JpaRepository { + Optional findByEmail(String email); +} From 5540e0a5c1d3d404ed8bf6b7c749def078d72857 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 6 Jan 2024 02:10:42 +0900 Subject: [PATCH 059/465] =?UTF-8?q?[FEAT]=20JwtService=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/jwt/service/JwtService.java | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/security/jwt/service/JwtService.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/security/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/security/jwt/service/JwtService.java new file mode 100644 index 0000000..8e7cdb1 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/security/jwt/service/JwtService.java @@ -0,0 +1,180 @@ +package com.nonsoolmate.nonsoolmateServer.security.jwt.service; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.algorithms.Algorithm; +import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.util.Date; +import java.util.Optional; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +@Getter +@Slf4j +public class JwtService { + + @Value("${jwt.secretKey}") + private String secretKey; + + @Value("${jwt.access.expiration}") + private Long accessTokenExpirationPeriod; + + @Value("${jwt.refresh.expiration}") + private Long refreshTokenExpirationPeriod; + + @Value("${jwt.access.header}") + private String accessHeader; + + @Value("${jwt.refresh.header}") + private String refreshHeader; + + /** + * JWT์˜ Subject์™€ Claim์œผ๋กœ email ์‚ฌ์šฉ -> ํด๋ ˆ์ž„์˜ name์„ "email"์œผ๋กœ ์„ค์ • + * JWT์˜ ํ—ค๋”์— ๋“ค์–ด์˜ค๋Š” ๊ฐ’ : 'Authorization(Key) = Bearer {ํ† ํฐ} (Value)' ํ˜•์‹ + */ + private static final String ACCESS_TOKEN_SUBJECT = "AccessToken"; + private static final String REFRESH_TOKEN_SUBJECT = "RefreshToken"; + private static final String EMAIL_CLAIM = "email"; + private static final String BEARER = "Bearer "; + + private final MemberRepository memberRepository; + + /** + * AccessToken ์ƒ์„ฑ ๋ฉ”์†Œ๋“œ + */ + public String createAccessToken(String email) { + Date now = new Date(); + return JWT.create() // JWT ํ† ํฐ์„ ์ƒ์„ฑํ•˜๋Š” ๋นŒ๋” ๋ฐ˜ํ™˜ + .withSubject(ACCESS_TOKEN_SUBJECT) // JWT์˜ Subject ์ง€์ • -> AccessToken์ด๋ฏ€๋กœ AccessToken + .withExpiresAt(new Date(now.getTime() + accessTokenExpirationPeriod)) // ํ† ํฐ ๋งŒ๋ฃŒ ์‹œ๊ฐ„ ์„ค์ • + + //ํด๋ ˆ์ž„์œผ๋กœ๋Š” ์ €ํฌ๋Š” email ํ•˜๋‚˜๋งŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. + //์ถ”๊ฐ€์ ์œผ๋กœ ์‹๋ณ„์ž๋‚˜, ์ด๋ฆ„ ๋“ฑ์˜ ์ •๋ณด๋ฅผ ๋” ์ถ”๊ฐ€ํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค. + //์ถ”๊ฐ€ํ•˜์‹ค ๊ฒฝ์šฐ .withClaim(ํด๋ž˜์ž„ ์ด๋ฆ„, ํด๋ž˜์ž„ ๊ฐ’) ์œผ๋กœ ์„ค์ •ํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค + .withClaim(EMAIL_CLAIM, email) + .sign(Algorithm.HMAC512(secretKey)); // HMAC512 ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์‚ฌ์šฉ, application-jwt.yml์—์„œ ์ง€์ •ํ•œ secret ํ‚ค๋กœ ์•”ํ˜ธํ™” + } + + /** + * RefreshToken ์ƒ์„ฑ + * RefreshToken์€ Claim์— email๋„ ๋„ฃ์ง€ ์•Š์œผ๋ฏ€๋กœ withClaim() X + */ + public String createRefreshToken() { + Date now = new Date(); + return JWT.create() + .withSubject(REFRESH_TOKEN_SUBJECT) + .withExpiresAt(new Date(now.getTime() + refreshTokenExpirationPeriod)) + .sign(Algorithm.HMAC512(secretKey)); + } + + /** + * AccessToken ํ—ค๋”์— ์‹ค์–ด์„œ ๋ณด๋‚ด๊ธฐ + */ + public void sendAccessToken(HttpServletResponse response, String accessToken) { + response.setStatus(HttpServletResponse.SC_OK); + + response.setHeader(accessHeader, accessToken); + log.info("์žฌ๋ฐœ๊ธ‰๋œ Access Token : {}", accessToken); + } + + /** + * AccessToken + RefreshToken ํ—ค๋”์— ์‹ค์–ด์„œ ๋ณด๋‚ด๊ธฐ + */ + public void sendAccessAndRefreshToken(HttpServletResponse response, String accessToken, String refreshToken) { + response.setStatus(HttpServletResponse.SC_OK); + + setAccessTokenHeader(response, accessToken); + setRefreshTokenHeader(response, refreshToken); + log.info("{}", refreshToken); + log.info("Access Token, Refresh Token ํ—ค๋” ์„ค์ • ์™„๋ฃŒ"); + } + + /** + * ํ—ค๋”์—์„œ RefreshToken ์ถ”์ถœ + * ํ† ํฐ ํ˜•์‹ : Bearer XXX์—์„œ Bearer๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ˆœ์ˆ˜ ํ† ํฐ๋งŒ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด์„œ + * ํ—ค๋”๋ฅผ ๊ฐ€์ ธ์˜จ ํ›„ "Bearer"๋ฅผ ์‚ญ์ œ(""๋กœ replace) + */ + public Optional extractRefreshToken(HttpServletRequest request) { + return Optional.ofNullable(request.getHeader(refreshHeader)) + .filter(refreshToken -> refreshToken.startsWith(BEARER)) + .map(refreshToken -> refreshToken.replace(BEARER, "")); + } + + /** + * ํ—ค๋”์—์„œ AccessToken ์ถ”์ถœ + * ํ† ํฐ ํ˜•์‹ : Bearer XXX์—์„œ Bearer๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ˆœ์ˆ˜ ํ† ํฐ๋งŒ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด์„œ + * ํ—ค๋”๋ฅผ ๊ฐ€์ ธ์˜จ ํ›„ "Bearer"๋ฅผ ์‚ญ์ œ(""๋กœ replace) + */ + public Optional extractAccessToken(HttpServletRequest request) { + return Optional.ofNullable(request.getHeader(accessHeader)) + .filter(refreshToken -> refreshToken.startsWith(BEARER)) + .map(refreshToken -> refreshToken.replace(BEARER, "")); + } + + /** + * AccessToken์—์„œ Email ์ถ”์ถœ + * ์ถ”์ถœ ์ „์— JWT.require()๋กœ ๊ฒ€์ฆ๊ธฐ ์ƒ์„ฑ + * verify๋กœ AceessToken ๊ฒ€์ฆ ํ›„ + * ์œ ํšจํ•˜๋‹ค๋ฉด getClaim()์œผ๋กœ ์ด๋ฉ”์ผ ์ถ”์ถœ + * ์œ ํšจํ•˜์ง€ ์•Š๋‹ค๋ฉด ๋นˆ Optional ๊ฐ์ฒด ๋ฐ˜ํ™˜ + */ + public Optional extractEmail(String accessToken) { + try { + // ํ† ํฐ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌํ•˜๋Š” ๋ฐ์— ์‚ฌ์šฉํ•  ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ์žˆ๋Š” JWT verifier builder ๋ฐ˜ํ™˜ + return Optional.ofNullable(JWT.require(Algorithm.HMAC512(secretKey)) + .build() // ๋ฐ˜ํ™˜๋œ ๋นŒ๋”๋กœ JWT verifier ์ƒ์„ฑ + .verify(accessToken) // accessToken์„ ๊ฒ€์ฆํ•˜๊ณ  ์œ ํšจํ•˜์ง€ ์•Š๋‹ค๋ฉด ์˜ˆ์™ธ ๋ฐœ์ƒ + .getClaim(EMAIL_CLAIM) // claim(Emial) ๊ฐ€์ ธ์˜ค๊ธฐ + .asString()); + } catch (Exception e) { + log.error("์•ก์„ธ์Šค ํ† ํฐ์ด ์œ ํšจํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."); + return Optional.empty(); + } + } + + /** + * AccessToken ํ—ค๋” ์„ค์ • + */ + public void setAccessTokenHeader(HttpServletResponse response, String accessToken) { + response.setHeader(accessHeader, "Bearer " + accessToken); + } + + /** + * RefreshToken ํ—ค๋” ์„ค์ • + */ + public void setRefreshTokenHeader(HttpServletResponse response, String refreshToken) { + response.setHeader(refreshHeader, refreshToken); + } + + /** + * RefreshToken DB ์ €์žฅ(์—…๋ฐ์ดํŠธ) + * LoginSuccessHandler + */ + public void updateRefreshToken(String email, String refreshToken) { + log.info("updateRefreshToken, refresh = {} / email = {}", refreshToken, email); + memberRepository.findByEmail(email) + .ifPresentOrElse( + user -> { + // user.updateRefreshToken(refreshToken); + memberRepository.saveAndFlush(user); + }, + () -> new Exception("์ผ์น˜ํ•˜๋Š” ํšŒ์›์ด ์—†์Šต๋‹ˆ๋‹ค.") + ); + } + + public boolean isTokenValid(String token) { + try { + JWT.require(Algorithm.HMAC512(secretKey)).build().verify(token); + return true; + } catch (Exception e) { + log.error("์œ ํšจํ•˜์ง€ ์•Š์€ ํ† ํฐ์ž…๋‹ˆ๋‹ค. {}", e.getMessage()); + return false; + } + } +} From 3abfded588ce03c41c59950314a9fff5069ed371 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Sat, 6 Jan 2024 16:57:20 +0900 Subject: [PATCH 060/465] =?UTF-8?q?[DOCS]=201=EC=B0=A8=20=EA=B3=BC?= =?UTF-8?q?=EC=A0=9C=20=EC=A0=9C=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 205 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cab4a7b..dda3335 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,205 @@ -# nonsoolmate_server -๋„Œ ๋‚˜์˜ non alcohol mate~ +
+๋…ผ์ˆ ๋ฉ”์ดํŠธ_์„œ๋น„์Šค์„ค๋ช… + +
+ + +## ๐Ÿ““ Backend Developer +

+ + + + + + + + + + + + + +
๊น€์„ฑ์€ @sung-silver์†ก๋ฏผ๊ทœ @mikekks
์„ฑ์€ + ๋ฏผ๊ทœ +
์—ญํ•  ์—ญํ• 
+- ์†Œ์…œ ๋กœ๊ทธ์ธ
+- ๋งˆ์ดํŽ˜์ด์ง€: ๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ
+- ๋งˆ์ดํŽ˜์ด์ง€: ๋‹‰๋„ค์ž„
+- ์‹œํ—˜ ๋ณด๊ธฐ: ์ฒจ์‚ญ๊ถŒ ์‚ฌ์šฉ
+- ๋‚ด ์ •๋ณด ํ™•์ธ: ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜
+- ์‹œํ—˜ ๋ณด๊ธฐ: ๋ฌธ์ œ์ง€
+- ์‹œํ—˜ ๋ณด๊ธฐ: ์‹œํ—˜ ์ด๋ฆ„ & ์ œํ•œ ์‹œ๊ฐ„
+- ์‹œํ—˜ ๋ณด๊ธฐ: ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ๋ฐ ์‹œํ—˜ ์ œ์ถœ
+
+- ๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์กฐํšŒ
+- ๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์„ ํƒ
+- ํ•ด์ œ: ๋ฌธ์ œ์ด๋ฏธ์ง€ & ํ•ด์ œ PDF ์กฐํšŒ
+- ์ฒจ์‚ญ: ๋ฌธ์ œ์ด๋ฏธ์ง€_ํ•ด์ œPDF ์กฐํšŒ
+- ์ฒจ์‚ญ: ์ฒจ์‚ญPDF_ํ•ด์ œPDF ์กฐํšŒ
+- ์•ก์„ธ์Šค ํ† ํฐ ์žฌ๋ฐœ๊ธ‰
+- ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰
+
+
+ +
+
+ +## ๐Ÿ’ป Development Tech +![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge&logo=openjdk&logoColor=white) +
+ +
+ +
+ +
+ +
+ + +

+ +## ๐Ÿ› ๏ธ Architecture Structure +![nonsoolmate Server Architecture](https://github.com/nonsoolmate/NONSOOLMATE-SERVER/assets/81363864/5f1dd158-2f6f-485e-8ec8-ea39241418e2) + + +

+## ๐Ÿ“‚ Project Structure +~~~ +๐Ÿ“ฆ nonsoolmateServer +โ”œโ”€โ”€ ๐Ÿ“‚ domain +โ”‚ โ”œโ”€ ๐Ÿ“‚ member +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ controller +โ”‚ โ”œโ”€ ๐Ÿ“‚ member +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ”œโ”€ ๐Ÿ“‚ selectUniversity +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ”œโ”€ ๐Ÿ“‚ university +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ””โ”€ ๐Ÿ“‚ universityExamRecord +โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”œโ”€ ๐Ÿ“‚ entity +โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”œโ”€โ”€ ๐Ÿ“‚ global +โ”‚ โ”œโ”€ ๐Ÿ“‚ jwt +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ””โ”€ ๐Ÿ“‚ security +โ”‚ โ”œโ”€ ๐Ÿ“‚ handler +โ”‚ โ”œโ”€ ๐Ÿ“‚ filter +โ”‚ โ””โ”€ ๐Ÿ“‚ config +โ””โ”€ ๐Ÿ“‚ external + โ”œโ”€ ๐Ÿ“‚ s3 + โ”‚ โ”œโ”€ ๐Ÿ“‚ config + โ”‚ โ””โ”€ ๐Ÿ“‚ service + โ”œโ”€ ๐Ÿ“‚ redis + โ”‚ โ”œโ”€ ๐Ÿ“‚ config + โ”‚ โ””โ”€ ๐Ÿ“‚ service + โ””โ”€ ๐Ÿ“‚ oauth + โ””โ”€ ๐Ÿ“‚ service +~~~ +

+ +## ๐Ÿ” Nonsoolmate Server's Rule + +## 1. ๐Ÿ‘ปย Commit Convention + +- ex) [FEAT] ๋ชฉํ‘œ ๋Œ€ํ•™ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ API ๊ฐœ๋ฐœ +- ex) [FIX] ๋‚ด๊ฐ€ ์ž‘์„ฑํ•˜์ง€ ์•Š์€ ๋ฆฌ๋ทฐ ๋ณผ ์ˆ˜ ์žˆ๋Š” ๋ฒ„๊ทธ ํ•ด๊ฒฐ + +```jsx +- [CHORE]: ๋‚ด๋ถ€ ํŒŒ์ผ ์ˆ˜์ • +- [FEAT] : ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ๊ตฌํ˜„ +- [ADD] : FEAT ์ด์™ธ์˜ ๋ถ€์ˆ˜์ ์ธ ์ฝ”๋“œ ์ถ”๊ฐ€, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ถ”๊ฐ€, ์ƒˆ๋กœ์šด ํŒŒ์ผ ์ƒ์„ฑ ์‹œ +- [FIX] : ์ฝ”๋“œ ์ˆ˜์ •, ๋ฒ„๊ทธ, ์˜ค๋ฅ˜ ํ•ด๊ฒฐ +- [DEL] : ์“ธ๋ชจ์—†๋Š” ์ฝ”๋“œ ์‚ญ์ œ +- [DOCS] : README๋‚˜ WIKI ๋“ฑ์˜ ๋ฌธ์„œ ๊ฐœ์ • +- [MOVE] : ํ”„๋กœ์ ํŠธ ๋‚ด ํŒŒ์ผ์ด๋‚˜ ์ฝ”๋“œ์˜ ์ด๋™ +- [RENAME] : ํŒŒ์ผ ์ด๋ฆ„์˜ ๋ณ€๊ฒฝ +- [MERGE]: ๋‹ค๋ฅธ ๋ธŒ๋ Œ์น˜๋ฅผ mergeํ•˜๋Š” ๊ฒฝ์šฐ +- [STYLE] : ์ฝ”๋“œ๊ฐ€ ์•„๋‹Œ ์Šคํƒ€์ผ ๋ณ€๊ฒฝ์„ ํ•˜๋Š” ๊ฒฝ์šฐ +- [INIT] : Initial commit์„ ํ•˜๋Š” ๊ฒฝ์šฐ +- [REFACTOR] : ๋กœ์ง์€ ๋ณ€๊ฒฝ ์—†๋Š” ํด๋ฆฐ ์ฝ”๋“œ๋ฅผ ์œ„ํ•œ ์ฝ”๋“œ ์ˆ˜์ • +``` +
+ +## 2. ๐Ÿคย Branch Strategy + +- `prd branch`ย : ๋ฐฐํฌ ๋‹จ์œ„ branch (์šด์˜ ์„œ๋ฒ„ ์‚ฌ์šฉ ์šฉ๋„ โ†’ ์›น์žผ ์ดํ›„ ์‚ฌ์šฉ) +- `dev branch`ย : ์ฃผ์š” ๊ฐœ๋ฐœ branch, main merge ์ „ ๊ฑฐ์น˜๋Š” branch +- `feat branch` : ๊ฐ์ž ๊ฐœ๋ฐœ branch +- ํ•  ์ผ issue ๋“ฑ๋ก ํ›„, `issue number`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ branch ์ƒ์„ฑ ํ›„ ์ž‘์—… + - ex) feat/#issue_number +- branch naming + - ๊ธฐ๋Šฅ ๊ฐœ๋ฐœ - `feat` + - ๋ฆฌํŒฉํ† ๋ง - `refactor` + - ์ˆ˜์ • - `fix` + - ํ”„๋กœ์ ํŠธ ์…‹ํŒ… - `setting` +- ํ•ด๋‹น branch ์ž‘์—… ์™„๋ฃŒ ํ›„ PR ๋ณด๋‚ด๊ธฐ + - ํ•ญ์ƒ local์—์„œ ์ถฉ๋Œ ํ•ด๊ฒฐ ํ›„ โ†’ remote์— ์˜ฌ๋ฆฌ๊ธฐ + - reviewer์— ์„œ๋กœ tagํ›„ code-review + - comment(review) ์ „ merge ๋ถˆ๊ฐ€! + - review ๋ฐ˜์˜ ํ›„, ๋ณธ์ธ์ด merge +- branch ๊ตฌ์กฐ + +```bash +main + โ””โ”€โ”€ dev + โ”œโ”€โ”€ feat/#1 + โ””โ”€โ”€ feat/#2 +``` + +- merge ์ „๋žต โ†’ rebase and merge +- rebase๊ฐ€ ํ—ท๊ฐˆ๋ฆฐ๋‹ค๋ฉด? + - private โ†’ ์„ฑ์€ โ†’ Git Merge ๋ฐฉ๋ฒ• ๊ณต์œ  ์ฐธ๊ณ ํ•˜๊ธฐ! : [Git Merge ๋ฐฉ๋ฒ• ๊ณต์œ ](https://www.notion.so/Git-Merge-ec472be87bb84df8b81e8951bc7bf4e6?pvs=21) +
+ +## 3. ๐Ÿ‘€ย Code Convention + +- ์•„๋ž˜ 3๊ฐ€์ง€๋Š” ๊ธฐ์–ตํ•ด์ฃผ์„ธ์š” + - else ์ง€์–‘ํ•˜๊ธฐ + - ์šฐํ…Œ์ฝ” ์ฝ”๋“œ ์ปจ๋ฒค์…˜ ์ ์šฉํ•˜๊ธฐ + - `**cmd + option + L`** + +### 3.1 ์šฐํ…Œ์ฝ” ์ฝ”๋“œ ์ปจ๋ฒค์…˜ + +- **์•„๋ž˜ xml ํŒŒ์ผ ๋‹ค์šด๋ฐ›๊ณ  ์ ์šฉํ•˜๊ธฐ** +[woowacourse-docs/styleguide/java at main ยท woowacourse/woowacourse-docs](https://github.com/woowacourse/woowacourse-docs/tree/main/styleguide/java) + + +### 3.2 ๋ฉ”์†Œ๋“œ๋ช… +- ***CRUD Create Read Update Delete๋กœ ์‹œ์ž‘ํ•˜๊ธฐ!*** + - ์˜ˆ์‹œ: readUser createUser readBoard updateUser +- **์ปจํŠธ๋กค๋Ÿฌ & ์„œ๋น„์Šค ๋ฉ”์„œ๋“œ๋ช… ์ตœ๋Œ€ํ•œ ๋น„์Šทํ•˜๊ฒŒ ๋„ค์ด๋ฐ** + +### 3.3 DTO๋ช… + +- `Request` โ‡’ + - **์ƒ์„ฑ ์š”์ฒญ** โ‡’ entity๋ช… + RequestDTO + - ์˜ˆ์‹œ: *UserRequest*DTO + - **์ˆ˜์ • ์š”์ฒญ** โ‡’ entity๋ช… + Update + RequestDTO + - ์˜ˆ์‹œ: *UserUpdateRequest*DTO +- `Response` โ‡’ + - **์ƒ์„ฑ ์š”์ฒญ์— ๋Œ€ํ•œ ์‘๋‹ต** โ‡’ entity๋ช… + created + ResponseDTO + - ์˜ˆ์‹œ: *UserCreatedResponse*DTO + - **์กฐํšŒ ์š”์ฒญ์— ๋Œ€ํ•œ ์‘๋‹ต(๊ฐ€๊ณต ํ•„์š”)** โ‡’ entity๋ช…์„ ํฌํ•จํ•œ ์ ์ ˆํ•œ ์ด๋ฆ„ + ResponseDTO + - ์˜ˆ์‹œ: UserResponseDTO + - ๋ณต์ˆ˜๋ผ๋ฉด? entity๋ช… + -(e)s + ์ ์ ˆํ•œ ์„ค๋ช… + ResponseDTO + - ์˜ˆ์‹œ: *UsersOrderByNameResponse*DTO + - **entity ๊ทธ ์ž์ฒด๋ฅผ ๋ฆฌํ„ดํ•  ๋•Œ(๊ฐ€๊ณต X)** โ‡’ entity๋ช… + DTO + - ์˜ˆ์‹œ: *User*DTO + - ๋ณต์ˆ˜๋ผ๋ฉด? entity๋ช…+ -(e)s + DTO + ์˜ˆ์‹œ: *Users*DTO From 6160d7793333c12b56dc84b83a2f62667d1eb029 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 03:31:52 +0900 Subject: [PATCH 061/465] =?UTF-8?q?[STYLE]=20=ED=8C=A8=ED=82=A4=EC=A7=80?= =?UTF-8?q?=20=EA=B5=AC=EC=A1=B0=20auth=EB=A1=9C=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{security => global/auth}/jwt/service/JwtService.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{security => global/auth}/jwt/service/JwtService.java (100%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/security/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/security/jwt/service/JwtService.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java From c4a5674318ceb227a856d8035b8e9ae8f8e8324d Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 03:37:03 +0900 Subject: [PATCH 062/465] =?UTF-8?q?[ADD]=20MemberSignUpVo=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 --- .../global/auth/service/vo/MemberSignUpVO.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java new file mode 100644 index 0000000..a4a2a01 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo; + +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +public class MemberSignUpVO { + private final Long memberId; + private final String email; + private final String memberName; +} From 544099f2576be2e74582b35b420d6406637fb047 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 03:37:33 +0900 Subject: [PATCH 063/465] =?UTF-8?q?[ADD]=20MemberRequestDTO=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 --- .../global/auth/controller/dto/MemberRequestDTO.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java new file mode 100644 index 0000000..15435f0 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto; + +public record MemberRequestDTO(String email, String memberName, String platformType, String gender, int Year, + String phoneNumber) { +} \ No newline at end of file From b6be6707b2ef92e992531626a096f93a7f0ecbb0 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 04:15:24 +0900 Subject: [PATCH 064/465] =?UTF-8?q?[DEL]=20Error=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/exception/Error.java | 30 ------------------- 1 file changed, 30 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java deleted file mode 100644 index 6dfa64e..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/Error.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.error.exception; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import org.springframework.http.HttpStatus; - -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public enum Error { - - // 400 BAD REQUEST - REQUEST_VALIDATION_EXCEPTION(HttpStatus.BAD_REQUEST, "์ž˜๋ชป๋œ ์š”์ฒญ์ž…๋‹ˆ๋‹ค"), - - // 404 NOT FOUND - NOT_FOUND_PATH(HttpStatus.NOT_FOUND, "ํ•ด๋‹น ๊ฒฝ๋กœ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), - - // 500 INTERNAL SERVER ERROR - INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์•Œ ์ˆ˜ ์—†๋Š” ์„œ๋ฒ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"); - - private final HttpStatus httpStatus; - private final String message; - - public int getHttpStatus(){ - return httpStatus.value(); - } - - public String getMessage(){ - return message; - } - -} From 730487c10c906a81160f3e9253c62544e38547af Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 04:16:53 +0900 Subject: [PATCH 065/465] =?UTF-8?q?[FIX]=20ErrorType=20=EB=8F=84=EC=9E=85?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=BD=94=EB=93=9C=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 --- .../global/error/ErrorResponse.java | 20 +++++++++++++ .../error/exception/BusinessException.java | 13 +++++---- .../exception/BusinessExceptionType.java | 13 +++++++++ .../global/error/exception/ErrorType.java | 29 +++++++++++++++++++ 4 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessExceptionType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ErrorType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java new file mode 100644 index 0000000..780b7dc --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java @@ -0,0 +1,20 @@ +package com.nonsoolmate.nonsoolmateServer.global.error; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ErrorType; + +public record ErrorResponse(int code, String message) { + public static ErrorResponse of(ErrorType errorType) { + return new ErrorResponse( + errorType.getHttpStatusCode(), + errorType.getMessage() + ); + } + + public static ErrorResponse of(BusinessExceptionType exceptionType) { + return new ErrorResponse( + exceptionType.getHttpStatusCode(), + exceptionType.message() + ); + } +} \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java index c456e6e..c8f46ef 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java @@ -4,12 +4,15 @@ @Getter public class BusinessException extends RuntimeException { - private final Error error; - public BusinessException(Error error,String message) { - super(message); - this.error = error; + private final BusinessExceptionType exceptionType; + + public BusinessException(BusinessExceptionType exceptionType) { + super(exceptionType.message()); + this.exceptionType = exceptionType; } + public int getHttpStatus() { - return error.getHttpStatus(); + return exceptionType.status().value(); } + } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessExceptionType.java new file mode 100644 index 0000000..41fbc27 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessExceptionType.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.global.error.exception; + +import org.springframework.http.HttpStatus; + +public interface BusinessExceptionType { + HttpStatus status(); + + String message(); + + default int getHttpStatusCode() { + return status().value(); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ErrorType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ErrorType.java new file mode 100644 index 0000000..1923639 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ErrorType.java @@ -0,0 +1,29 @@ +package com.nonsoolmate.nonsoolmateServer.global.error.exception; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum ErrorType { + /** + * 404 Not Found + */ + NOT_FOUND_PATH(HttpStatus.NOT_FOUND, "์š”์ฒญํ•˜์‹  ๊ฒฝ๋กœ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), + + /** + * 500 Internal Server Error + */ + INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์•Œ ์ˆ˜ ์—†๋Š” ์„œ๋ฒ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"), + + ; + + private final HttpStatus httpStatus; + private final String message; + + public int getHttpStatusCode() { + return httpStatus.value(); + } +} From a3ca713493fa285d302c8e2256ff189c95320a0c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 04:18:14 +0900 Subject: [PATCH 066/465] =?UTF-8?q?[FIX]=20ErrorType=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20GlobalExceptionHandler,=20ApiR?= =?UTF-8?q?esponse=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/common/response/ApiResponse.java | 10 ++++----- .../global/error/GlobalExceptionHandler.java | 21 ++++++++++--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java index 4ac13c3..3dc5dc0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java @@ -1,7 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.global.common.response; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ErrorType; import com.nonsoolmate.nonsoolmateServer.global.success.Success; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.Error; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; @@ -23,11 +23,11 @@ public static ApiResponse success(Success success, T data) { return new ApiResponse(success.getHttpStatus(), success.getMessage(), data); } - public static ApiResponse error(Error error) { - return new ApiResponse<>(error.getHttpStatus(), error.getMessage()); + public static ApiResponse error(ErrorType error) { + return new ApiResponse<>(error.getHttpStatusCode(), error.getMessage()); } - public static ApiResponse error(Error error, T data) { - return new ApiResponse(error.getHttpStatus(), error.getMessage(), data); + public static ApiResponse error(ErrorType error, T data) { + return new ApiResponse(error.getHttpStatusCode(), error.getMessage(), data); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index 9a1d0b8..2b79a67 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -2,8 +2,8 @@ import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.error.exception.*; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.Error; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.servlet.NoHandlerFoundException; @@ -13,21 +13,22 @@ @RestControllerAdvice @Slf4j public class GlobalExceptionHandler { - @ExceptionHandler({ BusinessException.class }) - protected ApiResponse handleCustomException(BusinessException ex) { - return ApiResponse.error(ex.getError()); + @ExceptionHandler({BusinessException.class}) + protected ResponseEntity handleCustomException(BusinessException ex) { + log.error("๐Ÿšจ BusinessException occured: {} ๐Ÿšจ", ex.getMessage()); + return ResponseEntity.status(ex.getHttpStatus()).body(ErrorResponse.of(ex.getExceptionType())); } - @ExceptionHandler({ Exception.class }) + @ExceptionHandler({Exception.class}) protected ApiResponse handleServerException(Exception ex) { log.error(ex.getMessage()); - return ApiResponse.error(Error.INTERNAL_SERVER_ERROR); + return ApiResponse.error(ErrorType.INTERNAL_SERVER_ERROR); } @ExceptionHandler(NoHandlerFoundException.class) - protected ApiResponse handleNotFoundException(NoHandlerFoundException ex) { - HashMap pathMap = new HashMap<>(); - pathMap.put("path",ex.getRequestURL()); - return ApiResponse.error(Error.NOT_FOUND_PATH, pathMap); + protected ApiResponse handleNotFoundException(final NoHandlerFoundException ex) { + HashMap pathMap = new HashMap<>(); + pathMap.put("path", ex.getRequestURL()); + return ApiResponse.error(ErrorType.NOT_FOUND_PATH, pathMap); } } From 8f264a6fa46f5011160f1e4ac722d9e2d4f32d0c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 04:20:17 +0900 Subject: [PATCH 067/465] =?UTF-8?q?[DEL]=20dummy.txt=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/exception/dummy.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 9a439b1191691abdb031a9b98111f5fa8871fb67 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 04:27:20 +0900 Subject: [PATCH 068/465] =?UTF-8?q?[FEAT]=20member=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20exception=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/exception/MemberException.java | 10 +++++++ .../member/exception/MemberExceptionType.java | 28 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberException.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberException.java new file mode 100644 index 0000000..c295e81 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberException.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; + +public class MemberException extends BusinessException { + public MemberException(BusinessExceptionType exceptionType) { + super(exceptionType); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java new file mode 100644 index 0000000..3bddd94 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java @@ -0,0 +1,28 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum MemberExceptionType implements BusinessExceptionType { + + /** + * 404 Not Found + */ + NOT_FOUND_MEMBER(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์œ ์ €์ž…๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} From 92e06686db08a92df540e7da29b66d2668f649ab Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 04:33:37 +0900 Subject: [PATCH 069/465] =?UTF-8?q?[FEAT]=20Member=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=EC=97=90=20=EB=B9=8C=EB=8D=94=ED=8C=A8=ED=84=B4=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/member/entity/Member.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java index 416ed7c..dcbd7ce 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java @@ -13,6 +13,7 @@ import java.time.Year; import lombok.AccessLevel; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import org.hibernate.annotations.ColumnDefault; @@ -41,7 +42,7 @@ public class Member { @NotNull private Role role; - private Year birthYear; + private int birthYear; @Length(max = 1) private String gender; @@ -54,4 +55,17 @@ public class Member { private int ticketCount; private LocalDateTime ticketPreviousPublicationTime; + + @Builder + public Member(Long memberId, String email, String name, PlatformType platformType, Role role, int birthYear, + String gender, String phoneNumber) { + this.memberId = memberId; + this.email = email; + this.name = name; + this.platformType = platformType; + this.role = role; + this.birthYear = birthYear; + this.gender = gender; + this.phoneNumber = phoneNumber; + } } From 9adee3a3139844a5a553f065b0ecaaedfee5f6b0 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 06:13:53 +0900 Subject: [PATCH 070/465] =?UTF-8?q?[ADD]=20AuthType=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/auth/service/vo/enums/AuthType.java | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/enums/AuthType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/enums/AuthType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/enums/AuthType.java new file mode 100644 index 0000000..7ef1dec --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/enums/AuthType.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums; + +public enum AuthType { + SIGN_UP, LOGIN, SIGN_OUT +} From 7253f7615b1409985a2f6df20bfe76cdee927f84 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 06:14:26 +0900 Subject: [PATCH 071/465] =?UTF-8?q?[ADD]=20NaverMemberVO=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 --- .../global/auth/service/vo/NaverMemberVO.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverMemberVO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverMemberVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverMemberVO.java new file mode 100644 index 0000000..b927260 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverMemberVO.java @@ -0,0 +1,25 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import lombok.Getter; + +@Getter +@JsonIgnoreProperties(ignoreUnknown = true) +public class NaverMemberVO { + private String resultCode; + private String message; + + @JsonProperty("response") + private Response response; + + @Getter + @JsonIgnoreProperties(ignoreUnknown = true) + public static class Response { + private String gender; + private String email; + private String mobile; + private String name; + private String birthyear; + } +} \ No newline at end of file From cb190c31bfbdfd76fe0f2cb97a8148c321c28a3b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 06:15:22 +0900 Subject: [PATCH 072/465] =?UTF-8?q?[ADD]=20MemberSignUpVO=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 --- .../auth/service/vo/MemberSignUpVO.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java index a4a2a01..14d8e1a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java @@ -1,10 +1,29 @@ package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; +import lombok.Builder; +import lombok.Getter; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor -public class MemberSignUpVO { - private final Long memberId; - private final String email; - private final String memberName; +@Builder +@Getter +public record MemberSignUpVO(Long memberId, String email, String name, PlatformType platformType, Role role, + String birthYear, String gender, String phoneNumber, AuthType authType) { + public static MemberSignUpVO of(Member member, PlatformType platformType, AuthType authtype) { + return MemberSignUpVO.builder() + .memberId(member.getMemberId()) + .email(member.getEmail()) + .name(member.getName()) + .platformType(platformType) + .role(Role.USER) + .birthYear(member.getBirthYear()) + .gender(member.getGender()) + .phoneNumber(member.getPhoneNumber()) + .authType(authtype) + .build(); + } } From f3cc9836afe7e86aad2d538db93171fce69854d9 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 06:17:38 +0900 Subject: [PATCH 073/465] =?UTF-8?q?[ADD]=20webClient=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/build.gradle | 67 ++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 32 deletions(-) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index 7ab8cb6..e78211a 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -1,59 +1,62 @@ plugins { - id 'java' - id 'org.springframework.boot' version '3.2.1' - id 'io.spring.dependency-management' version '1.1.4' + id 'java' + id 'org.springframework.boot' version '3.2.1' + id 'io.spring.dependency-management' version '1.1.4' } group = 'com.nonsoolmate' version = '0.0.1-SNAPSHOT' java { - sourceCompatibility = '17' + sourceCompatibility = '17' } repositories { - mavenCentral() + mavenCentral() } dependencies { - // spring boot - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'org.springframework.boot:spring-boot-starter-web' + // spring boot + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'org.springframework.boot:spring-boot-starter-web' - // security - implementation 'com.auth0:java-jwt:4.2.1' + // security + implementation 'com.auth0:java-jwt:4.2.1' - // lombok - compileOnly 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' + // Spring WebFlux + implementation 'org.springframework.boot:spring-boot-starter-webflux' - // h2 - runtimeOnly 'com.h2database:h2' + // lombok + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' - // mysql - runtimeOnly 'com.mysql:mysql-connector-j' + // h2 + runtimeOnly 'com.h2database:h2' - // AWS sdk - implementation("software.amazon.awssdk:bom:2.21.0") - implementation("software.amazon.awssdk:s3:2.21.0") + // mysql + runtimeOnly 'com.mysql:mysql-connector-j' - // swagger - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' + // AWS sdk + implementation("software.amazon.awssdk:bom:2.21.0") + implementation("software.amazon.awssdk:s3:2.21.0") - // mapper - implementation 'org.mapstruct:mapstruct:1.5.3.Final' - annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final' + // swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' - // validate - implementation 'org.hibernate.validator:hibernate-validator' + // mapper + implementation 'org.mapstruct:mapstruct:1.5.3.Final' + annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final' - // Health Check - implementation 'org.springframework.boot:spring-boot-starter-actuator' + // validate + implementation 'org.hibernate.validator:hibernate-validator' - // test - testImplementation 'org.springframework.boot:spring-boot-starter-test' + // Health Check + implementation 'org.springframework.boot:spring-boot-starter-actuator' + + // test + testImplementation 'org.springframework.boot:spring-boot-starter-test' } tasks.named('test') { - useJUnitPlatform() + useJUnitPlatform() } From 15d06feb57d8a044d67fd159856cbdaeb464dc51 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 06:19:40 +0900 Subject: [PATCH 074/465] =?UTF-8?q?[FEAT]=20=EB=84=A4=EC=9D=B4=EB=B2=84=20?= =?UTF-8?q?=EC=86=8C=EC=85=9C=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=20=EB=8B=A8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/entity/Member.java | 6 +- .../member/repository/MemberRepository.java | 3 + .../auth/controller/dto/MemberRequestDTO.java | 6 +- .../global/auth/service/AuthService.java | 37 ++++++++++++ .../auth/service/AuthServiceProvider.java | 25 ++++++++ .../global/auth/service/NaverAuthService.java | 57 +++++++++++++++++++ 6 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java index dcbd7ce..875cf46 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java @@ -42,7 +42,8 @@ public class Member { @NotNull private Role role; - private int birthYear; + @Length(max = 4) + private String birthYear; @Length(max = 1) private String gender; @@ -57,9 +58,8 @@ public class Member { private LocalDateTime ticketPreviousPublicationTime; @Builder - public Member(Long memberId, String email, String name, PlatformType platformType, Role role, int birthYear, + public Member(String email, String name, PlatformType platformType, Role role, String birthYear, String gender, String phoneNumber) { - this.memberId = memberId; this.email = email; this.name = name; this.platformType = platformType; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java index f760bb6..6e83c3d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java @@ -1,9 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.repository; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; public interface MemberRepository extends JpaRepository { Optional findByEmail(String email); + + Optional findByPlatformTypeAndEmail(PlatformType platformType, String email); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java index 15435f0..d749c93 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java @@ -1,5 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto; -public record MemberRequestDTO(String email, String memberName, String platformType, String gender, int Year, - String phoneNumber) { +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; +import jakarta.validation.constraints.NotNull; + +public record MemberRequestDTO(@NotNull PlatformType platformType) { } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java new file mode 100644 index 0000000..67da5df --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java @@ -0,0 +1,37 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.service; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; +import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberException; +import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberExceptionType; +import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; +import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; +import jakarta.transaction.Transactional; +import lombok.RequiredArgsConstructor; + +@Transactional +@RequiredArgsConstructor +public abstract class AuthService { + private final MemberRepository memberRepository; + + public abstract MemberSignUpVO saveMemberOrLogin(String platformType, MemberRequestDTO request); + + protected Member getMember(PlatformType platformType, String email) { + return memberRepository.findByPlatformTypeAndEmail(platformType, email) + .orElseThrow(() -> new MemberException(MemberExceptionType.NOT_FOUND_MEMBER)); + } + + protected Member saveUser(MemberRequestDTO request, String email, String name, String birthday, String gender, + String phoneNumber) { + Member newMember = createSocialMember(email, name, request.platformType(), birthday, gender, phoneNumber); + return memberRepository.saveAndFlush(newMember); + } + + private static Member createSocialMember(String email, String name, PlatformType platformType, String birthYear, + String gender, String phoneNumber) { + return Member.builder().email(email).name(name).platformType(platformType).role(Role.USER).birthYear(birthYear) + .gender(gender).phoneNumber(phoneNumber).build(); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java new file mode 100644 index 0000000..715b1e5 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java @@ -0,0 +1,25 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.service; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; +import jakarta.annotation.PostConstruct; +import java.util.HashMap; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +@Component +@RequiredArgsConstructor +public class AuthServiceProvider { + private static final Map authServiceMap = new HashMap<>(); + + private final NaverAuthService naverAuthService; + + @PostConstruct + void init() { + authServiceMap.put(PlatformType.NAVER, naverAuthService); + } + + public AuthService getAuthService(PlatformType platformType) { + return authServiceMap.get(platformType); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java new file mode 100644 index 0000000..331669e --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java @@ -0,0 +1,57 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.service; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; +import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.NaverMemberVO; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; +import jakarta.security.auth.message.AuthException; +import java.util.Map; +import org.springframework.web.reactive.function.client.WebClient; +import org.springframework.stereotype.Service; +import org.springframework.web.reactive.function.client.WebClientResponseException; + +@Service +public class NaverAuthService extends AuthService { + + private final WebClient webClient; + + public NaverAuthService(MemberRepository memberRepository, WebClient webClient) { + super(memberRepository); + this.webClient = webClient; + } + + @Override + public MemberSignUpVO saveMemberOrLogin(String platformToken, MemberRequestDTO request) { + NaverMemberVO naverMemberInfo = getNaverMemberInfo(platformToken); + + Member foundMember = getMember(request.platformType(), naverMemberInfo.getResponse().getEmail()); + if (foundMember != null) { + return MemberSignUpVO.of(foundMember, request.platformType(), AuthType.LOGIN); + } + Member savedMember = saveUser(request, naverMemberInfo.getResponse().getEmail(), + naverMemberInfo.getResponse().getName(), + naverMemberInfo.getResponse().getBirthyear(), naverMemberInfo.getResponse().getGender(), + naverMemberInfo.getResponse().getMobile()); + + return MemberSignUpVO.of(savedMember, request.platformType(), AuthType.SIGN_UP); + } + + // TODO:: ํ† ํฐ ๋งŒ๋ฃŒ์‹œ์— ๋Œ€ํ•œ ์—๋Ÿฌ ์ถ”๊ฐ€ + // TODO:: Auth ํŒจํ‚ค์ง€ ๋”ฐ๋กœ ๋บ„๊นŒ? + // TODO:: uri yml๋กœ ๋นผ์•ผ์ง€.. + private NaverMemberVO getNaverMemberInfo(String accessToken) { + try { + return webClient.get() + .uri("https://openapi.naver.com/v1/nid/me") + .headers(headers -> headers.setBearerAuth(accessToken)) + .retrieve() + .bodyToMono(NaverMemberVO.class) + .block(); + } catch (WebClientResponseException e) { + // WebClientResponseException์ด ๋ฐœ์ƒํ•˜๋ฉด ํ•ด๋‹น ์˜ˆ์™ธ๋ฅผ throw + throw new RuntimeException("Error while fetching Naver member info", e); + } + } +} From 18886d9ab9cc7ad9e5ea9da2306bf3839c62eb37 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 06:21:51 +0900 Subject: [PATCH 075/465] =?UTF-8?q?[SYTLE]=20=EA=B3=B5=EB=B0=B1=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/auth/jwt/service/JwtService.java | 31 +++++++------------ 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java index 8e7cdb1..106e756 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.security.jwt.service; +package com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service; import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; @@ -35,8 +35,8 @@ public class JwtService { private String refreshHeader; /** - * JWT์˜ Subject์™€ Claim์œผ๋กœ email ์‚ฌ์šฉ -> ํด๋ ˆ์ž„์˜ name์„ "email"์œผ๋กœ ์„ค์ • - * JWT์˜ ํ—ค๋”์— ๋“ค์–ด์˜ค๋Š” ๊ฐ’ : 'Authorization(Key) = Bearer {ํ† ํฐ} (Value)' ํ˜•์‹ + * JWT์˜ Subject์™€ Claim์œผ๋กœ email ์‚ฌ์šฉ -> ํด๋ ˆ์ž„์˜ name์„ "email"์œผ๋กœ ์„ค์ • JWT์˜ ํ—ค๋”์— ๋“ค์–ด์˜ค๋Š” ๊ฐ’ : 'Authorization(Key) = Bearer {ํ† ํฐ} + * (Value)' ํ˜•์‹ */ private static final String ACCESS_TOKEN_SUBJECT = "AccessToken"; private static final String REFRESH_TOKEN_SUBJECT = "RefreshToken"; @@ -62,8 +62,7 @@ public String createAccessToken(String email) { } /** - * RefreshToken ์ƒ์„ฑ - * RefreshToken์€ Claim์— email๋„ ๋„ฃ์ง€ ์•Š์œผ๋ฏ€๋กœ withClaim() X + * RefreshToken ์ƒ์„ฑ RefreshToken์€ Claim์— email๋„ ๋„ฃ์ง€ ์•Š์œผ๋ฏ€๋กœ withClaim() X */ public String createRefreshToken() { Date now = new Date(); @@ -96,9 +95,7 @@ public void sendAccessAndRefreshToken(HttpServletResponse response, String acces } /** - * ํ—ค๋”์—์„œ RefreshToken ์ถ”์ถœ - * ํ† ํฐ ํ˜•์‹ : Bearer XXX์—์„œ Bearer๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ˆœ์ˆ˜ ํ† ํฐ๋งŒ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด์„œ - * ํ—ค๋”๋ฅผ ๊ฐ€์ ธ์˜จ ํ›„ "Bearer"๋ฅผ ์‚ญ์ œ(""๋กœ replace) + * ํ—ค๋”์—์„œ RefreshToken ์ถ”์ถœ ํ† ํฐ ํ˜•์‹ : Bearer XXX์—์„œ Bearer๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ˆœ์ˆ˜ ํ† ํฐ๋งŒ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด์„œ ํ—ค๋”๋ฅผ ๊ฐ€์ ธ์˜จ ํ›„ "Bearer"๋ฅผ ์‚ญ์ œ(""๋กœ replace) */ public Optional extractRefreshToken(HttpServletRequest request) { return Optional.ofNullable(request.getHeader(refreshHeader)) @@ -107,9 +104,7 @@ public Optional extractRefreshToken(HttpServletRequest request) { } /** - * ํ—ค๋”์—์„œ AccessToken ์ถ”์ถœ - * ํ† ํฐ ํ˜•์‹ : Bearer XXX์—์„œ Bearer๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ˆœ์ˆ˜ ํ† ํฐ๋งŒ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด์„œ - * ํ—ค๋”๋ฅผ ๊ฐ€์ ธ์˜จ ํ›„ "Bearer"๋ฅผ ์‚ญ์ œ(""๋กœ replace) + * ํ—ค๋”์—์„œ AccessToken ์ถ”์ถœ ํ† ํฐ ํ˜•์‹ : Bearer XXX์—์„œ Bearer๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ˆœ์ˆ˜ ํ† ํฐ๋งŒ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด์„œ ํ—ค๋”๋ฅผ ๊ฐ€์ ธ์˜จ ํ›„ "Bearer"๋ฅผ ์‚ญ์ œ(""๋กœ replace) */ public Optional extractAccessToken(HttpServletRequest request) { return Optional.ofNullable(request.getHeader(accessHeader)) @@ -118,11 +113,8 @@ public Optional extractAccessToken(HttpServletRequest request) { } /** - * AccessToken์—์„œ Email ์ถ”์ถœ - * ์ถ”์ถœ ์ „์— JWT.require()๋กœ ๊ฒ€์ฆ๊ธฐ ์ƒ์„ฑ - * verify๋กœ AceessToken ๊ฒ€์ฆ ํ›„ - * ์œ ํšจํ•˜๋‹ค๋ฉด getClaim()์œผ๋กœ ์ด๋ฉ”์ผ ์ถ”์ถœ - * ์œ ํšจํ•˜์ง€ ์•Š๋‹ค๋ฉด ๋นˆ Optional ๊ฐ์ฒด ๋ฐ˜ํ™˜ + * AccessToken์—์„œ Email ์ถ”์ถœ ์ถ”์ถœ ์ „์— JWT.require()๋กœ ๊ฒ€์ฆ๊ธฐ ์ƒ์„ฑ verify๋กœ AceessToken ๊ฒ€์ฆ ํ›„ ์œ ํšจํ•˜๋‹ค๋ฉด getClaim()์œผ๋กœ ์ด๋ฉ”์ผ ์ถ”์ถœ ์œ ํšจํ•˜์ง€ ์•Š๋‹ค๋ฉด ๋นˆ + * Optional ๊ฐ์ฒด ๋ฐ˜ํ™˜ */ public Optional extractEmail(String accessToken) { try { @@ -153,15 +145,14 @@ public void setRefreshTokenHeader(HttpServletResponse response, String refreshTo } /** - * RefreshToken DB ์ €์žฅ(์—…๋ฐ์ดํŠธ) - * LoginSuccessHandler + * RefreshToken DB ์ €์žฅ(์—…๋ฐ์ดํŠธ) LoginSuccessHandler */ public void updateRefreshToken(String email, String refreshToken) { log.info("updateRefreshToken, refresh = {} / email = {}", refreshToken, email); memberRepository.findByEmail(email) .ifPresentOrElse( user -> { - // user.updateRefreshToken(refreshToken); + // user.updateRefreshToken(refreshToken); memberRepository.saveAndFlush(user); }, () -> new Exception("์ผ์น˜ํ•˜๋Š” ํšŒ์›์ด ์—†์Šต๋‹ˆ๋‹ค.") @@ -177,4 +168,4 @@ public boolean isTokenValid(String token) { return false; } } -} +} \ No newline at end of file From a6487d9888e66a39c8a8c958b9519c05b219610c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 07:41:13 +0900 Subject: [PATCH 076/465] =?UTF-8?q?[STYLE]=20auth=20>=20controller=20>=20d?= =?UTF-8?q?to=20=EA=B5=AC=EC=A1=B0=20request=20=EB=B0=8F=20response=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/dto/{ => request}/MemberRequestDTO.java | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/{ => request}/MemberRequestDTO.java (100%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/MemberRequestDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java From fd4ad3243ab02cf9b9a9ebc4323df72d8861e717 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 07:42:14 +0900 Subject: [PATCH 077/465] =?UTF-8?q?[FIX]=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/auth/controller/dto/request/MemberRequestDTO.java | 2 +- .../nonsoolmateServer/global/auth/service/AuthService.java | 2 +- .../global/auth/service/NaverAuthService.java | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java index d749c93..37653f7 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto; +package com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import jakarta.validation.constraints.NotNull; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java index 67da5df..dd89455 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java @@ -6,7 +6,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberException; import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; -import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java index 331669e..62fcc25 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java @@ -2,12 +2,10 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; -import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.NaverMemberVO; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; -import jakarta.security.auth.message.AuthException; -import java.util.Map; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClientResponseException; From f31ce1981ebfd4d52331aa4ec24163515fb31479 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 10:26:05 +0900 Subject: [PATCH 078/465] =?UTF-8?q?[FIX]=20ErrorType,=20SucessType=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=AA=85=ED=99=95=ED=95=98=EA=B2=8C=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 --- .../{ErrorType.java => CommonErrorType.java} | 14 +++++--- .../error/exception/CommonSuccessType.java | 33 +++++++++++++++++++ .../global/success/Success.java | 26 --------------- 3 files changed, 43 insertions(+), 30 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/{ErrorType.java => CommonErrorType.java} (70%) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/success/Success.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ErrorType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java similarity index 70% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ErrorType.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java index 1923639..ec8a1ac 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ErrorType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum ErrorType { +public enum ErrorType implements BusinessExceptionType { /** * 404 Not Found */ @@ -20,10 +20,16 @@ public enum ErrorType { ; - private final HttpStatus httpStatus; + private final HttpStatus status; private final String message; - public int getHttpStatusCode() { - return httpStatus.value(); + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java new file mode 100644 index 0000000..f169c78 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java @@ -0,0 +1,33 @@ +package com.nonsoolmate.nonsoolmateServer.global.error.exception; + +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import org.springframework.http.HttpStatus; + +@AllArgsConstructor(access = AccessLevel.PRIVATE) +public enum Success implements BusinessSucessType { + + // 200 OK + GET_SERVER_PROFILE(HttpStatus.OK, "์„œ๋ฒ„ ํ”„๋กœํ•„ ํ™•์ธ ์™„๋ฃŒ"); + + // 201 created + + + private final HttpStatus httpStatus; + private final String message; + + @Override + public HttpStatus status() { + return null; + } + + @Override + public String message() { + return null; + } + + @Override + public int getHttpStatusCode() { + return BusinessSucessType.super.getHttpStatusCode(); + } +} \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/success/Success.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/success/Success.java deleted file mode 100644 index 949bdee..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/success/Success.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.success; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import org.springframework.http.HttpStatus; - -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public enum Success { - - // 200 OK - GET_SERVER_PROFILE(HttpStatus.OK, "์„œ๋ฒ„ ํ”„๋กœํ•„ ํ™•์ธ ์™„๋ฃŒ"); - - // 201 created - - - private final HttpStatus httpStatus; - private final String message; - - public int getHttpStatus(){ - return httpStatus.value(); - } - - public String getMessage(){ - return message; - } -} \ No newline at end of file From 2839b699253964e5053981fc149908161b023618 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 10:27:01 +0900 Subject: [PATCH 079/465] =?UTF-8?q?[FEAT]=20=EC=86=8C=EC=85=9C=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20Controller=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 40 +++++++++++++++++++ .../dto/response/MemberAuthResponseDTO.java | 10 +++++ .../global/auth/exception/AuthException.java | 10 +++++ .../auth/exception/AuthExceptionType.java | 28 +++++++++++++ .../global/auth/exception/AuthSucessType.java | 24 +++++++++++ .../global/auth/jwt/service/JwtService.java | 32 +++++++++++---- .../global/auth/service/NaverAuthService.java | 7 ++-- .../auth/service/vo/MemberSignUpVO.java | 4 -- .../controller/ServerProfileController.java | 4 +- .../global/common/response/ApiResponse.java | 20 +++++----- .../global/error/ErrorResponse.java | 4 +- .../global/error/GlobalExceptionHandler.java | 4 +- .../error/exception/BusinessSucessType.java | 13 ++++++ .../error/exception/CommonErrorType.java | 2 +- .../error/exception/CommonSuccessType.java | 14 ++----- 15 files changed, 173 insertions(+), 43 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/response/MemberAuthResponseDTO.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthException.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessSucessType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java new file mode 100644 index 0000000..6856f1d --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java @@ -0,0 +1,40 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.controller; + +import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.response.MemberAuthResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.auth.exception.AuthSucessType; +import com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service.JwtService; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.AuthServiceProvider; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; +import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/auth") +@Slf4j +public class AuthController { + private final AuthServiceProvider authServiceProvider; + private final JwtService jwtService; + + @PostMapping("/social/login") + public ApiResponse login(@RequestHeader(value = "platform-token") final String platformToken, + @RequestBody @Valid final + MemberRequestDTO request, HttpServletResponse response) { + MemberSignUpVO vo = authServiceProvider.getAuthService(request.platformType()) + .saveMemberOrLogin(platformToken, request); + jwtService.setSignedUpMemberToken(vo, response); + return ApiResponse.success(AuthSucessType.LOGIN_SUCCESS, + MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name())); + } + + +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/response/MemberAuthResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/response/MemberAuthResponseDTO.java new file mode 100644 index 0000000..4f6c8e5 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/response/MemberAuthResponseDTO.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.response; + +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; +import jakarta.validation.constraints.NotNull; + +public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String name) { + public static MemberAuthResponseDTO of(Long memberId, AuthType authType, String name) { + return new MemberAuthResponseDTO(memberId, authType, name); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthException.java new file mode 100644 index 0000000..12b63ca --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthException.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; + +public class AuthException extends BusinessException { + public AuthException(BusinessExceptionType exceptionType) { + super(exceptionType); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java new file mode 100644 index 0000000..07006cf --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java @@ -0,0 +1,28 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum AuthExceptionType implements BusinessExceptionType { + + /** + * 401 Unauthorized + */ + UNAUTHORIZED_MEMBER_LOGIN(HttpStatus.UNAUTHORIZED, "๋กœ๊ทธ์ธ์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java new file mode 100644 index 0000000..6f844c3 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java @@ -0,0 +1,24 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor +public enum AuthSucessType implements BusinessSucessType { + LOGIN_SUCCESS(HttpStatus.OK, "๋กœ๊ทธ์ธ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } + +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java index 106e756..5f0e763 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java @@ -2,7 +2,9 @@ import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.util.Date; @@ -41,6 +43,7 @@ public class JwtService { private static final String ACCESS_TOKEN_SUBJECT = "AccessToken"; private static final String REFRESH_TOKEN_SUBJECT = "RefreshToken"; private static final String EMAIL_CLAIM = "email"; + private static final String MEMBER_ID_CLAIM = "memberId"; private static final String BEARER = "Bearer "; private final MemberRepository memberRepository; @@ -48,7 +51,7 @@ public class JwtService { /** * AccessToken ์ƒ์„ฑ ๋ฉ”์†Œ๋“œ */ - public String createAccessToken(String email) { + public String createAccessToken(String email, Long memberId) { Date now = new Date(); return JWT.create() // JWT ํ† ํฐ์„ ์ƒ์„ฑํ•˜๋Š” ๋นŒ๋” ๋ฐ˜ํ™˜ .withSubject(ACCESS_TOKEN_SUBJECT) // JWT์˜ Subject ์ง€์ • -> AccessToken์ด๋ฏ€๋กœ AccessToken @@ -57,6 +60,7 @@ public String createAccessToken(String email) { //ํด๋ ˆ์ž„์œผ๋กœ๋Š” ์ €ํฌ๋Š” email ํ•˜๋‚˜๋งŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. //์ถ”๊ฐ€์ ์œผ๋กœ ์‹๋ณ„์ž๋‚˜, ์ด๋ฆ„ ๋“ฑ์˜ ์ •๋ณด๋ฅผ ๋” ์ถ”๊ฐ€ํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค. //์ถ”๊ฐ€ํ•˜์‹ค ๊ฒฝ์šฐ .withClaim(ํด๋ž˜์ž„ ์ด๋ฆ„, ํด๋ž˜์ž„ ๊ฐ’) ์œผ๋กœ ์„ค์ •ํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค + .withClaim(MEMBER_ID_CLAIM, memberId) .withClaim(EMAIL_CLAIM, email) .sign(Algorithm.HMAC512(secretKey)); // HMAC512 ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์‚ฌ์šฉ, application-jwt.yml์—์„œ ์ง€์ •ํ•œ secret ํ‚ค๋กœ ์•”ํ˜ธํ™” } @@ -72,14 +76,15 @@ public String createRefreshToken() { .sign(Algorithm.HMAC512(secretKey)); } - /** - * AccessToken ํ—ค๋”์— ์‹ค์–ด์„œ ๋ณด๋‚ด๊ธฐ - */ - public void sendAccessToken(HttpServletResponse response, String accessToken) { - response.setStatus(HttpServletResponse.SC_OK); - + public void setSignedUpMemberToken(MemberSignUpVO vo, HttpServletResponse response) { + String accessToken = createAccessToken(vo.email(), vo.memberId()); response.setHeader(accessHeader, accessToken); - log.info("์žฌ๋ฐœ๊ธ‰๋œ Access Token : {}", accessToken); + + if (vo.role().equals(Role.USER)) { + String refreshToken = createRefreshToken(); + updateRefreshTokenByMemberId(vo.memberId(), refreshToken); + response.setHeader(refreshHeader, refreshToken); + } } /** @@ -168,4 +173,15 @@ public boolean isTokenValid(String token) { return false; } } + + // TODO: Redis ์‚ฌ์šฉํ•ด์„œ refresh token ๊ด€๋ฆฌ + public void updateRefreshTokenByMemberId(Long memberId, String refreshToken) { + memberRepository + .findById(memberId) + .ifPresent( + member -> { + //member.updateRefreshToken(refreshToken); + memberRepository.saveAndFlush(member); + }); + } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java index 62fcc25..9ea2515 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java @@ -6,18 +6,17 @@ import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.NaverMemberVO; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClientResponseException; @Service public class NaverAuthService extends AuthService { + WebClient webClient = WebClient.builder().build(); - private final WebClient webClient; - - public NaverAuthService(MemberRepository memberRepository, WebClient webClient) { + public NaverAuthService(MemberRepository memberRepository) { super(memberRepository); - this.webClient = webClient; } @Override diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java index 14d8e1a..f3cfa92 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java @@ -5,12 +5,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; import lombok.Builder; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -@RequiredArgsConstructor @Builder -@Getter public record MemberSignUpVO(Long memberId, String email, String name, PlatformType platformType, Role role, String birthYear, String gender, String phoneNumber, AuthType authType) { public static MemberSignUpVO of(Member member, PlatformType platformType, AuthType authtype) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java index f15fadd..ce697cc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java @@ -1,7 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.global.common.controller; import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; -import com.nonsoolmate.nonsoolmateServer.global.success.Success; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.CommonSuccessType; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; import org.springframework.web.bind.annotation.GetMapping; @@ -15,6 +15,6 @@ public class ServerProfileController { @GetMapping("/profile") public ApiResponse getProfile() { - return ApiResponse.success(Success.GET_SERVER_PROFILE ,env.getActiveProfiles()[0]); + return ApiResponse.success(CommonSuccessType.GET_SERVER_PROFILE, env.getActiveProfiles()[0]); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java index 3dc5dc0..6c051b6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java @@ -1,7 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.global.common.response; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.ErrorType; -import com.nonsoolmate.nonsoolmateServer.global.success.Success; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; @@ -15,19 +15,19 @@ public class ApiResponse { private final String message; private T data; - public static ApiResponse success(Success success) { - return new ApiResponse<>(success.getHttpStatus(), success.getMessage()); + public static ApiResponse success(BusinessSucessType successType) { + return new ApiResponse<>(successType.getHttpStatusCode(), successType.message()); } - public static ApiResponse success(Success success, T data) { - return new ApiResponse(success.getHttpStatus(), success.getMessage(), data); + public static ApiResponse success(BusinessSucessType successType, T data) { + return new ApiResponse(successType.getHttpStatusCode(), successType.message(), data); } - public static ApiResponse error(ErrorType error) { - return new ApiResponse<>(error.getHttpStatusCode(), error.getMessage()); + public static ApiResponse error(BusinessExceptionType exceptionType) { + return new ApiResponse<>(exceptionType.getHttpStatusCode(), exceptionType.message()); } - public static ApiResponse error(ErrorType error, T data) { - return new ApiResponse(error.getHttpStatusCode(), error.getMessage(), data); + public static ApiResponse error(BusinessExceptionType exceptionType, T data) { + return new ApiResponse(exceptionType.getHttpStatusCode(), exceptionType.message(), data); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java index 780b7dc..e98ae0b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java @@ -1,10 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.global.error; import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.ErrorType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.CommonErrorType; public record ErrorResponse(int code, String message) { - public static ErrorResponse of(ErrorType errorType) { + public static ErrorResponse of(CommonErrorType errorType) { return new ErrorResponse( errorType.getHttpStatusCode(), errorType.getMessage() diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index 2b79a67..ef89ac0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -22,13 +22,13 @@ protected ResponseEntity handleCustomException(BusinessException @ExceptionHandler({Exception.class}) protected ApiResponse handleServerException(Exception ex) { log.error(ex.getMessage()); - return ApiResponse.error(ErrorType.INTERNAL_SERVER_ERROR); + return ApiResponse.error(CommonErrorType.INTERNAL_SERVER_ERROR); } @ExceptionHandler(NoHandlerFoundException.class) protected ApiResponse handleNotFoundException(final NoHandlerFoundException ex) { HashMap pathMap = new HashMap<>(); pathMap.put("path", ex.getRequestURL()); - return ApiResponse.error(ErrorType.NOT_FOUND_PATH, pathMap); + return ApiResponse.error(CommonErrorType.NOT_FOUND_PATH, pathMap); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessSucessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessSucessType.java new file mode 100644 index 0000000..1695cf1 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessSucessType.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.global.error.exception; + +import org.springframework.http.HttpStatus; + +public interface BusinessSucessType { + HttpStatus status(); + + String message(); + + default int getHttpStatusCode() { + return status().value(); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java index ec8a1ac..2073ef4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum ErrorType implements BusinessExceptionType { +public enum CommonErrorType implements BusinessExceptionType { /** * 404 Not Found */ diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java index f169c78..df195f0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java @@ -5,29 +5,23 @@ import org.springframework.http.HttpStatus; @AllArgsConstructor(access = AccessLevel.PRIVATE) -public enum Success implements BusinessSucessType { +public enum CommonSuccessType implements BusinessSucessType { // 200 OK GET_SERVER_PROFILE(HttpStatus.OK, "์„œ๋ฒ„ ํ”„๋กœํ•„ ํ™•์ธ ์™„๋ฃŒ"); // 201 created - - private final HttpStatus httpStatus; + private final HttpStatus status; private final String message; @Override public HttpStatus status() { - return null; + return this.status; } @Override public String message() { - return null; - } - - @Override - public int getHttpStatusCode() { - return BusinessSucessType.super.getHttpStatusCode(); + return this.message; } } \ No newline at end of file From 9cba9acdd42d12ba42c72b1b7d0fc79127901fc3 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 6 Jan 2024 17:28:06 +0900 Subject: [PATCH 080/465] =?UTF-8?q?[FIX]=20=EC=86=8C=EC=85=9C=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=95=A1=EC=84=B8=EC=8A=A4=20=ED=86=A0?= =?UTF-8?q?=ED=81=B0=20=EB=B0=9C=EA=B8=89=20=EC=9D=B4=EC=8A=88=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/entity/enums/Role.java | 2 +- .../auth/controller/AuthController.java | 13 ++-- .../auth/exception/AuthExceptionType.java | 6 ++ .../global/auth/jwt/service/JwtService.java | 6 +- .../global/auth/service/AuthService.java | 5 +- .../global/auth/service/NaverAuthService.java | 75 +++++++++++++++---- .../auth/service/vo/MemberSignUpVO.java | 2 +- .../global/auth/service/vo/NaverTokenVO.java | 13 ++++ .../global/error/GlobalExceptionHandler.java | 1 + 9 files changed, 95 insertions(+), 28 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverTokenVO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java index 6ec2a47..9a10668 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java @@ -1,5 +1,5 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums; public enum Role { - ADMIN, USER + ROLE_ADMIN, ROLE_USER } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java index 6856f1d..f5ffbcc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java @@ -1,5 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.global.auth.controller; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.response.MemberAuthResponseDTO; import com.nonsoolmate.nonsoolmateServer.global.auth.exception.AuthSucessType; @@ -11,6 +12,7 @@ import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -26,12 +28,13 @@ public class AuthController { private final JwtService jwtService; @PostMapping("/social/login") - public ApiResponse login(@RequestHeader(value = "platform-token") final String platformToken, - @RequestBody @Valid final - MemberRequestDTO request, HttpServletResponse response) { + public ApiResponse login( + @RequestHeader(value = "authorization-code") final String authorizationCode, + @RequestBody @Valid final + MemberRequestDTO request, HttpServletResponse response) { MemberSignUpVO vo = authServiceProvider.getAuthService(request.platformType()) - .saveMemberOrLogin(platformToken, request); - jwtService.setSignedUpMemberToken(vo, response); + .saveMemberOrLogin(authorizationCode, request); + jwtService.issueToken(vo, response); return ApiResponse.success(AuthSucessType.LOGIN_SUCCESS, MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name())); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java index 07006cf..559a6b1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java @@ -2,12 +2,18 @@ import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; import lombok.AccessLevel; +import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum AuthExceptionType implements BusinessExceptionType { + /** + * 400 Bad Request + */ + INVALID_MEMBER_PLATFORM_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ํ”Œ๋žซํผ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + /** * 401 Unauthorized */ diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java index 5f0e763..30646d9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java @@ -76,11 +76,11 @@ public String createRefreshToken() { .sign(Algorithm.HMAC512(secretKey)); } - public void setSignedUpMemberToken(MemberSignUpVO vo, HttpServletResponse response) { + public void issueToken(MemberSignUpVO vo, HttpServletResponse response) { String accessToken = createAccessToken(vo.email(), vo.memberId()); response.setHeader(accessHeader, accessToken); - if (vo.role().equals(Role.USER)) { + if (vo.role().equals(Role.ROLE_USER)) { String refreshToken = createRefreshToken(); updateRefreshTokenByMemberId(vo.memberId(), refreshToken); response.setHeader(refreshHeader, refreshToken); @@ -131,7 +131,7 @@ public Optional extractEmail(String accessToken) { .asString()); } catch (Exception e) { log.error("์•ก์„ธ์Šค ํ† ํฐ์ด ์œ ํšจํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."); - return Optional.empty(); + return null; } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java index dd89455..032b764 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java @@ -20,7 +20,7 @@ public abstract class AuthService { protected Member getMember(PlatformType platformType, String email) { return memberRepository.findByPlatformTypeAndEmail(platformType, email) - .orElseThrow(() -> new MemberException(MemberExceptionType.NOT_FOUND_MEMBER)); + .orElse(null); } protected Member saveUser(MemberRequestDTO request, String email, String name, String birthday, String gender, @@ -31,7 +31,8 @@ protected Member saveUser(MemberRequestDTO request, String email, String name, S private static Member createSocialMember(String email, String name, PlatformType platformType, String birthYear, String gender, String phoneNumber) { - return Member.builder().email(email).name(name).platformType(platformType).role(Role.USER).birthYear(birthYear) + return Member.builder().email(email).name(name).platformType(platformType).role(Role.ROLE_USER) + .birthYear(birthYear) .gender(gender).phoneNumber(phoneNumber).build(); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java index 9ea2515..22850bf 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java @@ -3,25 +3,38 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.global.auth.exception.AuthException; +import com.nonsoolmate.nonsoolmateServer.global.auth.exception.AuthExceptionType; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.NaverMemberVO; +import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.NaverTokenVO; import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClientResponseException; @Service public class NaverAuthService extends AuthService { - WebClient webClient = WebClient.builder().build(); + + @Value("${naver.client-id}") + private String clientId; + @Value("${naver.client-secret}") + private String clientSecret; + @Value("${naver.state}") + private String state; public NaverAuthService(MemberRepository memberRepository) { super(memberRepository); } @Override - public MemberSignUpVO saveMemberOrLogin(String platformToken, MemberRequestDTO request) { - NaverMemberVO naverMemberInfo = getNaverMemberInfo(platformToken); + public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { + String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); + System.out.println("accessToken = " + accessToken); + NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); Member foundMember = getMember(request.platformType(), naverMemberInfo.getResponse().getEmail()); if (foundMember != null) { @@ -38,17 +51,47 @@ public MemberSignUpVO saveMemberOrLogin(String platformToken, MemberRequestDTO r // TODO:: ํ† ํฐ ๋งŒ๋ฃŒ์‹œ์— ๋Œ€ํ•œ ์—๋Ÿฌ ์ถ”๊ฐ€ // TODO:: Auth ํŒจํ‚ค์ง€ ๋”ฐ๋กœ ๋บ„๊นŒ? // TODO:: uri yml๋กœ ๋นผ์•ผ์ง€.. - private NaverMemberVO getNaverMemberInfo(String accessToken) { - try { - return webClient.get() - .uri("https://openapi.naver.com/v1/nid/me") - .headers(headers -> headers.setBearerAuth(accessToken)) - .retrieve() - .bodyToMono(NaverMemberVO.class) - .block(); - } catch (WebClientResponseException e) { - // WebClientResponseException์ด ๋ฐœ์ƒํ•˜๋ฉด ํ•ด๋‹น ์˜ˆ์™ธ๋ฅผ throw - throw new RuntimeException("Error while fetching Naver member info", e); - } +// private NaverMemberVO getNaverMemberInfo(String accessToken) { +// try { +// WebClient webClient = WebClient.builder().build(); +// return webClient.get() +// .uri("https://openapi.naver.com/v1/nid/me") +// .headers(headers -> headers.setBearerAuth(accessToken)) +// .retrieve() +// .bodyToMono(NaverMemberVO.class) +// .block(); +// } catch (WebClientResponseException e) { +// throw new AuthException(AuthExceptionType.INVALID_MEMBER_PLATFORM_TOKEN); +// } +// } + + public NaverMemberVO getNaverMemberInfo(String accessToken) { + WebClient webClient = WebClient.builder().build(); + return webClient.post() + .uri("https://openapi.naver.com/v1/nid/me") + .header("Authorization", "Bearer " + accessToken) + .retrieve() + .bodyToMono(NaverMemberVO.class) + .block(); + } + + private NaverTokenVO getAccessToken(String authorizationCode, String clientId, String clientSecret, String state) { + WebClient webClient = WebClient.builder().build(); + return webClient.post() + .uri(uriBuilder -> + uriBuilder + .scheme("https") // ์Šคํ‚ด์„ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ • + .host("nid.naver.com") // ํ˜ธ์ŠคํŠธ๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ • + .path("/oauth2.0/token") + .queryParam("grant_type", "authorization_code") + .queryParam("client_id", clientId) + .queryParam("client_secret", clientSecret) + .queryParam("code", authorizationCode) + .queryParam("state", state) + .build() + ) + .retrieve() + .bodyToMono(NaverTokenVO.class) + .block(); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java index f3cfa92..2f0c293 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java @@ -15,7 +15,7 @@ public static MemberSignUpVO of(Member member, PlatformType platformType, AuthTy .email(member.getEmail()) .name(member.getName()) .platformType(platformType) - .role(Role.USER) + .role(Role.ROLE_USER) .birthYear(member.getBirthYear()) .gender(member.getGender()) .phoneNumber(member.getPhoneNumber()) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverTokenVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverTokenVO.java new file mode 100644 index 0000000..af5a6cb --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverTokenVO.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import lombok.Getter; + +@Getter +@JsonIgnoreProperties(ignoreUnknown = true) +public class NaverTokenVO { + private String access_token; + private String refresh_token; + private String token_type; + private String expires_in; +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index ef89ac0..d9a68af 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -22,6 +22,7 @@ protected ResponseEntity handleCustomException(BusinessException @ExceptionHandler({Exception.class}) protected ApiResponse handleServerException(Exception ex) { log.error(ex.getMessage()); + ex.printStackTrace(); return ApiResponse.error(CommonErrorType.INTERNAL_SERVER_ERROR); } From 3e1c1ec54a410765ed92276c4af23066f857ef30 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sun, 7 Jan 2024 15:35:56 +0900 Subject: [PATCH 081/465] =?UTF-8?q?[FIX]=20thread-safe=20=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20AuthServiceProvider=EC=97=90=EC=84=9C=20Ha?= =?UTF-8?q?shMap=EC=9D=B4=20=EC=95=84=EB=8B=8C=20ConcurrentHashMap?= =?UTF-8?q?=EC=9D=84=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=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 --- .../global/auth/service/AuthServiceProvider.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java index 715b1e5..58dbd55 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java @@ -2,15 +2,14 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import jakarta.annotation.PostConstruct; -import java.util.HashMap; -import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @Component @RequiredArgsConstructor public class AuthServiceProvider { - private static final Map authServiceMap = new HashMap<>(); + private static final ConcurrentHashMap authServiceMap = new ConcurrentHashMap<>(); private final NaverAuthService naverAuthService; From f5f2e25303ce2cac487cc8ccdb4118fe27512482 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 7 Jan 2024 16:35:38 +0900 Subject: [PATCH 082/465] =?UTF-8?q?[ADD]=20CORS=20=EC=84=A4=EC=A0=95=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 --- .../global/config/SecurityConfig.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java new file mode 100644 index 0000000..12744c1 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java @@ -0,0 +1,60 @@ +package com.nonsoolmate.nonsoolmateServer.global.config; + +import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; +import com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service.JwtService; +import io.swagger.v3.oas.models.PathItem.HttpMethod; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@Configuration +@RequiredArgsConstructor +public class SecurityConfig { + + private static final String[] AUTH_WHITELIST = { + "/", "/error", "/webjars/**", + + // Swagger + "/swagger-resources/**", + "/swagger-ui/**", + "/v3/api-docs/**", + "/webjars/**", + + // Authentication + "/login/**", + "/auth/**", + "/oauth2/**", + "/api/v1/auth/**", // ์ž์ฒด ๋กœ๊ทธ์ธ ์š”์ฒญ + "/api/v1/oauth2/**", // OAuth ์†Œ์…œ ๋กœ๊ทธ์ธ ์š”์ฒญ + "/login", + + // client + "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**" + }; + + + //cors ์—๋Ÿฌ๋ฅผ ๋Œ€์‘ํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”์†Œ๋“œ + @Bean + public WebMvcConfigurer corsConfigurer() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("https://nonsoolmate.com", "localhost:3000") + .allowedOriginPatterns("https://nonsoolmate.com", "localhost:3000") + .allowedMethods( + HttpMethod.GET.name(), + HttpMethod.POST.name(), + HttpMethod.PUT.name(), + HttpMethod.PATCH.name() + ); + } + }; + } + + + +} From 9e93562e51a41fd0fe96c91fc2ff39fe90e9922d Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 7 Jan 2024 17:17:22 +0900 Subject: [PATCH 083/465] =?UTF-8?q?[ADD]=20spring=20security=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 --- nonsoolmateServer/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index e78211a..2ab9e17 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -22,10 +22,12 @@ dependencies { // security implementation 'com.auth0:java-jwt:4.2.1' + implementation 'org.springframework.boot:spring-boot-starter-security' // Spring WebFlux implementation 'org.springframework.boot:spring-boot-starter-webflux' + // lombok compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' @@ -55,6 +57,8 @@ dependencies { // test testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.springframework.security:spring-security-test' + } tasks.named('test') { From b4b7b8d09e72a069e5d7d1678df8133a15aee3a4 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 7 Jan 2024 17:18:41 +0900 Subject: [PATCH 084/465] =?UTF-8?q?[CHORE]=20SecurityConfig=20WhiteList=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 --- .../nonsoolmateServer/global/config/SecurityConfig.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java index 12744c1..3d50add 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java @@ -11,6 +11,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration +@EnableWebSecurity @RequiredArgsConstructor public class SecurityConfig { @@ -24,12 +25,7 @@ public class SecurityConfig { "/webjars/**", // Authentication - "/login/**", "/auth/**", - "/oauth2/**", - "/api/v1/auth/**", // ์ž์ฒด ๋กœ๊ทธ์ธ ์š”์ฒญ - "/api/v1/oauth2/**", // OAuth ์†Œ์…œ ๋กœ๊ทธ์ธ ์š”์ฒญ - "/login", // client "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**" From 7e025a66bb38d8ae3c4b53238fb1b0bf2bf4ba89 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Mon, 8 Jan 2024 10:43:49 +0900 Subject: [PATCH 085/465] [DOCS] update project structure --- README.md | 85 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index dda3335..540e891 100644 --- a/README.md +++ b/README.md @@ -34,8 +34,7 @@ - ํ•ด์ œ: ๋ฌธ์ œ์ด๋ฏธ์ง€ & ํ•ด์ œ PDF ์กฐํšŒ
- ์ฒจ์‚ญ: ๋ฌธ์ œ์ด๋ฏธ์ง€_ํ•ด์ œPDF ์กฐํšŒ
- ์ฒจ์‚ญ: ์ฒจ์‚ญPDF_ํ•ด์ œPDF ์กฐํšŒ
-- ์•ก์„ธ์Šค ํ† ํฐ ์žฌ๋ฐœ๊ธ‰
-- ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰
+- ํ† ํฐ ์žฌ๋ฐœ๊ธ‰ @@ -68,48 +67,56 @@ ~~~ ๐Ÿ“ฆ nonsoolmateServer โ”œโ”€โ”€ ๐Ÿ“‚ domain +โ”‚ โ”œโ”€ ๐Ÿ“‚ auth +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service โ”‚ โ”œโ”€ ๐Ÿ“‚ member -โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ controller -โ”‚ โ”œโ”€ ๐Ÿ“‚ member -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository -โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service โ”‚ โ”œโ”€ ๐Ÿ“‚ selectUniversity -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository -โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service โ”‚ โ”œโ”€ ๐Ÿ“‚ university -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository -โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ entity +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service โ”‚ โ””โ”€ ๐Ÿ“‚ universityExamRecord -โ”‚ โ”œโ”€ ๐Ÿ“‚ controller -โ”‚ โ”œโ”€ ๐Ÿ“‚ entity -โ”‚ โ”œโ”€ ๐Ÿ“‚ exception -โ”‚ โ”œโ”€ ๐Ÿ“‚ repository -โ”‚ โ””โ”€ ๐Ÿ“‚ service -โ”œโ”€โ”€ ๐Ÿ“‚ global -โ”‚ โ”œโ”€ ๐Ÿ“‚ jwt +โ”‚ โ”œโ”€ ๐Ÿ“‚ controller +โ”‚ โ”œโ”€ ๐Ÿ“‚ entity +โ”‚ โ”œโ”€ ๐Ÿ“‚ exception +โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”œโ”€โ”€ ๐Ÿ“‚ external +โ”‚ โ”œโ”€ ๐Ÿ“‚ aws +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ config +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ”œโ”€ ๐Ÿ“‚ oauth +โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ”œโ”€ ๐Ÿ“‚ redis +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ config โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service -โ”‚ โ””โ”€ ๐Ÿ“‚ security -โ”‚ โ”œโ”€ ๐Ÿ“‚ handler -โ”‚ โ”œโ”€ ๐Ÿ“‚ filter -โ”‚ โ””โ”€ ๐Ÿ“‚ config -โ””โ”€ ๐Ÿ“‚ external - โ”œโ”€ ๐Ÿ“‚ s3 - โ”‚ โ”œโ”€ ๐Ÿ“‚ config - โ”‚ โ””โ”€ ๐Ÿ“‚ service - โ”œโ”€ ๐Ÿ“‚ redis - โ”‚ โ”œโ”€ ๐Ÿ“‚ config - โ”‚ โ””โ”€ ๐Ÿ“‚ service - โ””โ”€ ๐Ÿ“‚ oauth - โ””โ”€ ๐Ÿ“‚ service +โ”‚ โ””โ”€ ๐Ÿ“‚ swagger +โ”‚ โ””โ”€ ๐Ÿ“‚ config +โ””โ”€ ๐Ÿ“‚ global + โ”œโ”€ ๐Ÿ“‚ common + โ”œโ”€ ๐Ÿ“‚ error + โ”œโ”€ ๐Ÿ“‚ jwt + โ”‚ โ””โ”€ ๐Ÿ“‚ service + โ”œโ”€ ๐Ÿ“‚ security + โ”‚ โ”œโ”€ ๐Ÿ“‚ handler + โ”‚ โ”œโ”€ ๐Ÿ“‚ filter + โ”‚ โ””โ”€ ๐Ÿ“‚ config + โ””โ”€ ๐Ÿ“‚ util + โ””โ”€ ๐Ÿ“‚ mapper ~~~

From f974949e910f86b5cf2d8a82a0c72bd3800719fb Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Mon, 8 Jan 2024 10:45:25 +0900 Subject: [PATCH 086/465] =?UTF-8?q?[DOCS]=20project=20structure:=20global?= =?UTF-8?q?=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 540e891..03a7777 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,8 @@ โ”‚ โ””โ”€ ๐Ÿ“‚ swagger โ”‚ โ””โ”€ ๐Ÿ“‚ config โ””โ”€ ๐Ÿ“‚ global - โ”œโ”€ ๐Ÿ“‚ common + โ”œโ”€ ๐Ÿ“‚ controller + โ”œโ”€ ๐Ÿ“‚ response โ”œโ”€ ๐Ÿ“‚ error โ”œโ”€ ๐Ÿ“‚ jwt โ”‚ โ””โ”€ ๐Ÿ“‚ service From 9f48d9aa63ead786806897be7b038f2b60408b9a Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Mon, 8 Jan 2024 15:43:32 +0900 Subject: [PATCH 087/465] =?UTF-8?q?[DOCS]=20CI=20script=EC=97=90=EC=84=9C?= =?UTF-8?q?=20pull=5Frequest=20=EC=9D=BC=20=EB=95=8C=20=EC=8B=A4=ED=96=89?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EB=A1=9C=EC=A7=81=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CI.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/dev-CI.yml b/.github/workflows/dev-CI.yml index 76c9862..05a75ec 100644 --- a/.github/workflows/dev-CI.yml +++ b/.github/workflows/dev-CI.yml @@ -3,8 +3,6 @@ name: NONSOOLMATE DEV CI on: push: branches: [ "dev" ] - pull_request: - branches: [ "dev" ] jobs: build: From 4eafd1ade36fe157ae6caa61ef162dae478241f1 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 10:31:53 +0900 Subject: [PATCH 088/465] =?UTF-8?q?[STYLE]=20common=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 18 +++++++----------- .../dto/request/MemberRequestDTO.java | 2 +- .../dto/response/MemberAuthResponseDTO.java | 4 ++-- .../auth/exception/AuthException.java | 2 +- .../auth/exception/AuthExceptionType.java | 2 +- .../auth/exception/AuthSucessType.java | 2 +- .../auth/service/AuthService.java | 8 +++----- .../auth/service/AuthServiceProvider.java | 4 +++- .../auth/service/vo/MemberSignUpVO.java | 4 ++-- .../aws}/config/AWSConfig.java | 2 +- .../external/aws/service/dummy.txt | 1 + .../oauth}/service/NaverAuthService.java | 18 +++++++----------- .../oauth}/service/vo/NaverMemberVO.java | 2 +- .../oauth}/service/vo/NaverTokenVO.java | 2 +- .../oauth/service/vo/enums/AuthType.java | 5 +++++ .../external/redis/config/dummy.txt | 1 + .../external/redis/service/dummy.txt | 1 + .../swagger}/config/SwaggerConfig.java | 2 +- .../global/auth/service/vo/enums/AuthType.java | 5 ----- .../{auth => }/jwt/service/JwtService.java | 4 ++-- .../{ => security}/config/SecurityConfig.java | 7 ++----- .../global/security/filter/dummy.txt | 1 + .../global/security/handler/dummy.txt | 1 + .../global/util/mapper/dummy.txt | 1 + 24 files changed, 47 insertions(+), 52 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/controller/AuthController.java (72%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/controller/dto/request/MemberRequestDTO.java (77%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/controller/dto/response/MemberAuthResponseDTO.java (70%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/exception/AuthException.java (83%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/exception/AuthExceptionType.java (93%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/exception/AuthSucessType.java (89%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/service/AuthService.java (81%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/service/AuthServiceProvider.java (77%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => domain}/auth/service/vo/MemberSignUpVO.java (87%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => external/aws}/config/AWSConfig.java (96%) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global/auth => external/oauth}/service/NaverAuthService.java (83%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global/auth => external/oauth}/service/vo/NaverMemberVO.java (89%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global/auth => external/oauth}/service/vo/NaverTokenVO.java (81%) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/enums/AuthType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/service/dummy.txt rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{global => external/swagger}/config/SwaggerConfig.java (85%) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/enums/AuthType.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/{auth => }/jwt/service/JwtService.java (98%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/{ => security}/config/SecurityConfig.java (84%) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/handler/dummy.txt create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/mapper/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java similarity index 72% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index f5ffbcc..32105b7 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -1,18 +1,16 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.controller; +package com.nonsoolmate.nonsoolmateServer.domain.auth.controller; -import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; -import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request.MemberRequestDTO; -import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.response.MemberAuthResponseDTO; -import com.nonsoolmate.nonsoolmateServer.global.auth.exception.AuthSucessType; -import com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service.JwtService; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.AuthServiceProvider; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSucessType; +import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; +import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthServiceProvider; +import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -38,6 +36,4 @@ public ApiResponse login( return ApiResponse.success(AuthSucessType.LOGIN_SUCCESS, MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name())); } - - } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java similarity index 77% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java index 37653f7..cdb3941 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/request/MemberRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request; +package com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import jakarta.validation.constraints.NotNull; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/response/MemberAuthResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java similarity index 70% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/response/MemberAuthResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java index 4f6c8e5..c26db37 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/controller/dto/response/MemberAuthResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java @@ -1,6 +1,6 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.response; +package com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import jakarta.validation.constraints.NotNull; public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String name) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthException.java similarity index 83% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthException.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthException.java index 12b63ca..9b4d1d4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthException.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.exception; +package com.nonsoolmate.nonsoolmateServer.domain.auth.exception; import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java similarity index 93% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index 559a6b1..e398aa2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.exception; +package com.nonsoolmate.nonsoolmateServer.domain.auth.exception; import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; import lombok.AccessLevel; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSucessType.java similarity index 89% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSucessType.java index 6f844c3..35845ce 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSucessType.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.exception; +package com.nonsoolmate.nonsoolmateServer.domain.auth.exception; import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; import lombok.RequiredArgsConstructor; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java similarity index 81% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index 032b764..a263ed9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -1,13 +1,11 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.service; +package com.nonsoolmate.nonsoolmateServer.domain.auth.service; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; -import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberException; -import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; -import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request.MemberRequestDTO; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthServiceProvider.java similarity index 77% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthServiceProvider.java index 58dbd55..ad238eb 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/AuthServiceProvider.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthServiceProvider.java @@ -1,6 +1,8 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.service; +package com.nonsoolmate.nonsoolmateServer.domain.auth.service; +import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthService; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.NaverAuthService; import jakarta.annotation.PostConstruct; import java.util.concurrent.ConcurrentHashMap; import lombok.RequiredArgsConstructor; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/vo/MemberSignUpVO.java similarity index 87% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/vo/MemberSignUpVO.java index 2f0c293..528df25 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/MemberSignUpVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/vo/MemberSignUpVO.java @@ -1,9 +1,9 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo; +package com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import lombok.Builder; @Builder diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/config/AWSConfig.java similarity index 96% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/config/AWSConfig.java index 9ff98e1..eef8f43 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/AWSConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/config/AWSConfig.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.config; +package com.nonsoolmate.nonsoolmateServer.external.aws.config; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java similarity index 83% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 22850bf..9463bbe 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -1,20 +1,16 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.service; +package com.nonsoolmate.nonsoolmateServer.external.oauth.service; +import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthService; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; -import com.nonsoolmate.nonsoolmateServer.global.auth.controller.dto.request.MemberRequestDTO; -import com.nonsoolmate.nonsoolmateServer.global.auth.exception.AuthException; -import com.nonsoolmate.nonsoolmateServer.global.auth.exception.AuthExceptionType; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.NaverMemberVO; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.NaverTokenVO; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums.AuthType; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.NaverMemberVO; +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.NaverTokenVO; +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.stereotype.Service; -import org.springframework.web.reactive.function.client.WebClientResponseException; @Service public class NaverAuthService extends AuthService { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverMemberVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/NaverMemberVO.java similarity index 89% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverMemberVO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/NaverMemberVO.java index b927260..a96e962 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverMemberVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/NaverMemberVO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo; +package com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverTokenVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/NaverTokenVO.java similarity index 81% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverTokenVO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/NaverTokenVO.java index af5a6cb..64ff2ce 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/NaverTokenVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/NaverTokenVO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo; +package com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Getter; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/enums/AuthType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/enums/AuthType.java new file mode 100644 index 0000000..bfb9e76 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/vo/enums/AuthType.java @@ -0,0 +1,5 @@ +package com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums; + +public enum AuthType { + SIGN_UP, LOGIN, SIGN_OUT +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/service/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/service/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SwaggerConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java similarity index 85% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SwaggerConfig.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java index 64a711f..d595fa1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SwaggerConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.config; +package com.nonsoolmate.nonsoolmateServer.external.swagger.config; import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.info.Info; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/enums/AuthType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/enums/AuthType.java deleted file mode 100644 index 7ef1dec..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/service/vo/enums/AuthType.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.enums; - -public enum AuthType { - SIGN_UP, LOGIN, SIGN_OUT -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java similarity index 98% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 30646d9..2afcf01 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -1,10 +1,10 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service; +package com.nonsoolmate.nonsoolmateServer.global.jwt.service; import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; -import com.nonsoolmate.nonsoolmateServer.global.auth.service.vo.MemberSignUpVO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.util.Date; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java similarity index 84% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 3d50add..8382e71 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -1,7 +1,5 @@ -package com.nonsoolmate.nonsoolmateServer.global.config; +package com.nonsoolmate.nonsoolmateServer.global.security.config; -import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; -import com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service.JwtService; import io.swagger.v3.oas.models.PathItem.HttpMethod; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Bean; @@ -28,7 +26,7 @@ public class SecurityConfig { "/auth/**", // client - "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**" + "/", "/css/**", "/images/**", "/js/**", "/favicon.ico", "/h2-console/**" }; @@ -52,5 +50,4 @@ public void addCorsMappings(CorsRegistry registry) { } - } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/handler/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/handler/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/handler/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/mapper/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/mapper/dummy.txt new file mode 100644 index 0000000..bf24627 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/mapper/dummy.txt @@ -0,0 +1 @@ +ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 9a01c58f9b3472e65a907a8c6777a6a8a4a1cfd4 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 10:46:13 +0900 Subject: [PATCH 089/465] =?UTF-8?q?[STYLE]=20global=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=82=B4=20common=20=ED=8C=A8=ED=82=A4=EC=A7=80=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 2 +- .../{common => }/controller/ServerProfileController.java | 4 ++-- .../global/error/GlobalExceptionHandler.java | 2 +- .../global/{common => }/response/ApiResponse.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/{common => }/controller/ServerProfileController.java (80%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/{common => }/response/ApiResponse.java (94%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 32105b7..04e6265 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -6,7 +6,7 @@ import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthServiceProvider; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; -import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java similarity index 80% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java index ce697cc..ce17e0a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/controller/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java @@ -1,6 +1,6 @@ -package com.nonsoolmate.nonsoolmateServer.global.common.controller; +package com.nonsoolmate.nonsoolmateServer.global.controller; -import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.error.exception.CommonSuccessType; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index d9a68af..7273a99 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.global.error; -import com.nonsoolmate.nonsoolmateServer.global.common.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.error.exception.*; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java similarity index 94% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java index 6c051b6..70fe41e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/common/response/ApiResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.common.response; +package com.nonsoolmate.nonsoolmateServer.global.response; import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; From 358c523793f799e8d67b5d4f3d22102173f5b2de Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 11:03:53 +0900 Subject: [PATCH 090/465] =?UTF-8?q?[FIX]=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/entity/Member.java | 5 ----- .../domain/selectUniversity/entity/SelectUniversity.java | 2 -- .../domain/university/entity/University.java | 2 -- .../universityExamRecord/entity/UniversityExamRecord.java | 2 -- 4 files changed, 11 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java index 875cf46..e4184f4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java @@ -10,19 +10,15 @@ import jakarta.persistence.Id; import jakarta.validation.constraints.NotNull; import java.time.LocalDateTime; -import java.time.Year; import lombok.AccessLevel; -import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; -import org.hibernate.annotations.ColumnDefault; import org.hibernate.validator.constraints.Length; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor public class Member { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @@ -52,7 +48,6 @@ public class Member { @Length(max = 13) private String phoneNumber; - @ColumnDefault("0") private int ticketCount; private LocalDateTime ticketPreviousPublicationTime; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java index ce8eea4..48a40a6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java @@ -9,14 +9,12 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import lombok.AccessLevel; -import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor public class SelectUniversity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java index 3e1e829..eb9eb77 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/University.java @@ -6,14 +6,12 @@ import jakarta.persistence.Id; import jakarta.validation.constraints.NotNull; import lombok.AccessLevel; -import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor public class University { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java index 9d1a8a7..e5fe4c4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java @@ -14,14 +14,12 @@ import jakarta.validation.constraints.NotNull; import java.sql.Time; import lombok.AccessLevel; -import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor public class UniversityExamRecord { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) From fb58e494a8c630c865bb731d3bae5cf92d160a44 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 14:54:12 +0900 Subject: [PATCH 091/465] =?UTF-8?q?[REFACTOR]=20ResponseEntity=EC=95=88?= =?UTF-8?q?=EC=97=90=20ApiResponse=EB=A5=BC=20=EB=84=A3=EC=96=B4=20?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=EA=B0=92=20=EB=A7=9E=EC=B6=94=EC=96=B4?= =?UTF-8?q?=EC=A3=BC=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 7 ++++--- .../controller/ServerProfileController.java | 6 ++++-- .../global/error/ErrorResponse.java | 20 ------------------- .../global/error/GlobalExceptionHandler.java | 16 ++++++++------- .../error/exception/BusinessException.java | 5 ----- 5 files changed, 17 insertions(+), 37 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 04e6265..af9752f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -11,6 +11,7 @@ import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -26,14 +27,14 @@ public class AuthController { private final JwtService jwtService; @PostMapping("/social/login") - public ApiResponse login( + public ResponseEntity> login( @RequestHeader(value = "authorization-code") final String authorizationCode, @RequestBody @Valid final MemberRequestDTO request, HttpServletResponse response) { MemberSignUpVO vo = authServiceProvider.getAuthService(request.platformType()) .saveMemberOrLogin(authorizationCode, request); jwtService.issueToken(vo, response); - return ApiResponse.success(AuthSucessType.LOGIN_SUCCESS, - MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name())); + return ResponseEntity.ok().body(ApiResponse.success(AuthSucessType.LOGIN_SUCCESS, + MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name()))); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java index ce17e0a..6218328 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java @@ -4,6 +4,7 @@ import com.nonsoolmate.nonsoolmateServer.global.error.exception.CommonSuccessType; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,7 +15,8 @@ public class ServerProfileController { private final Environment env; @GetMapping("/profile") - public ApiResponse getProfile() { - return ApiResponse.success(CommonSuccessType.GET_SERVER_PROFILE, env.getActiveProfiles()[0]); + public ResponseEntity> getProfile() { + return ResponseEntity.ok() + .body(ApiResponse.success(CommonSuccessType.GET_SERVER_PROFILE, env.getActiveProfiles()[0])); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java deleted file mode 100644 index e98ae0b..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/ErrorResponse.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.error; - -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.CommonErrorType; - -public record ErrorResponse(int code, String message) { - public static ErrorResponse of(CommonErrorType errorType) { - return new ErrorResponse( - errorType.getHttpStatusCode(), - errorType.getMessage() - ); - } - - public static ErrorResponse of(BusinessExceptionType exceptionType) { - return new ErrorResponse( - exceptionType.getHttpStatusCode(), - exceptionType.message() - ); - } -} \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index 7273a99..fbc9cac 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -3,6 +3,7 @@ import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.error.exception.*; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -14,22 +15,23 @@ @Slf4j public class GlobalExceptionHandler { @ExceptionHandler({BusinessException.class}) - protected ResponseEntity handleCustomException(BusinessException ex) { + protected ResponseEntity handleCustomException(BusinessException ex) { log.error("๐Ÿšจ BusinessException occured: {} ๐Ÿšจ", ex.getMessage()); - return ResponseEntity.status(ex.getHttpStatus()).body(ErrorResponse.of(ex.getExceptionType())); + return ResponseEntity.status(ex.getExceptionType().status()).body(ApiResponse.error(ex.getExceptionType())); } @ExceptionHandler({Exception.class}) - protected ApiResponse handleServerException(Exception ex) { + protected ResponseEntity handleServerException(Exception ex) { log.error(ex.getMessage()); - ex.printStackTrace(); - return ApiResponse.error(CommonErrorType.INTERNAL_SERVER_ERROR); + return ResponseEntity.status(HttpStatus.BAD_GATEWAY) + .body(ApiResponse.error(CommonErrorType.INTERNAL_SERVER_ERROR)); } @ExceptionHandler(NoHandlerFoundException.class) - protected ApiResponse handleNotFoundException(final NoHandlerFoundException ex) { + protected ResponseEntity handleNotFoundException(final NoHandlerFoundException ex) { HashMap pathMap = new HashMap<>(); pathMap.put("path", ex.getRequestURL()); - return ApiResponse.error(CommonErrorType.NOT_FOUND_PATH, pathMap); + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(ApiResponse.error(CommonErrorType.NOT_FOUND_PATH, pathMap)); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java index c8f46ef..82e9c15 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java @@ -10,9 +10,4 @@ public BusinessException(BusinessExceptionType exceptionType) { super(exceptionType.message()); this.exceptionType = exceptionType; } - - public int getHttpStatus() { - return exceptionType.status().value(); - } - } \ No newline at end of file From 72eaabc884f7a986a3834cf9ded96c36a92a813b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 15:05:35 +0900 Subject: [PATCH 092/465] =?UTF-8?q?[REFACTOR]=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EB=B0=9C=EA=B8=89=20responsebody=EC=97=90=20=EB=8B=B4=EC=95=84?= =?UTF-8?q?=20=EB=84=98=EA=B8=B0=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 5 ++--- .../controller/dto/response/MemberAuthResponseDTO.java | 8 +++++--- .../global/jwt/service/JwtService.java | 10 +++++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index af9752f..3ac2b68 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -33,8 +33,7 @@ public ResponseEntity> login( MemberRequestDTO request, HttpServletResponse response) { MemberSignUpVO vo = authServiceProvider.getAuthService(request.platformType()) .saveMemberOrLogin(authorizationCode, request); - jwtService.issueToken(vo, response); - return ResponseEntity.ok().body(ApiResponse.success(AuthSucessType.LOGIN_SUCCESS, - MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name()))); + MemberAuthResponseDTO memberAuthResponseDTO = jwtService.issueToken(vo, response); + return ResponseEntity.ok().body(ApiResponse.success(AuthSucessType.LOGIN_SUCCESS, memberAuthResponseDTO)); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java index c26db37..5b7a169 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java @@ -3,8 +3,10 @@ import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import jakarta.validation.constraints.NotNull; -public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String name) { - public static MemberAuthResponseDTO of(Long memberId, AuthType authType, String name) { - return new MemberAuthResponseDTO(memberId, authType, name); +public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String name, + @NotNull String accessToken, @NotNull String refreshToken) { + public static MemberAuthResponseDTO of(Long memberId, AuthType authType, String name, String accessToken, + String refreshToken) { + return new MemberAuthResponseDTO(memberId, authType, name, accessToken, refreshToken); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 2afcf01..f4d7405 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -2,6 +2,9 @@ import com.auth0.jwt.JWT; import com.auth0.jwt.algorithms.Algorithm; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; @@ -76,15 +79,16 @@ public String createRefreshToken() { .sign(Algorithm.HMAC512(secretKey)); } - public void issueToken(MemberSignUpVO vo, HttpServletResponse response) { + public MemberAuthResponseDTO issueToken(MemberSignUpVO vo, HttpServletResponse response) { String accessToken = createAccessToken(vo.email(), vo.memberId()); - response.setHeader(accessHeader, accessToken); if (vo.role().equals(Role.ROLE_USER)) { String refreshToken = createRefreshToken(); updateRefreshTokenByMemberId(vo.memberId(), refreshToken); - response.setHeader(refreshHeader, refreshToken); + return MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name(), accessToken, refreshToken); } + + throw new AuthException(AuthExceptionType.UNAUTHORIZED_MEMBER_LOGIN); } /** From a4f8d9651940e07209b747ab9aafda72bf2369bc Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 15:21:30 +0900 Subject: [PATCH 093/465] =?UTF-8?q?[DEL]=20=EC=A3=BC=EC=84=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oauth/service/NaverAuthService.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 9463bbe..29880ed 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -44,23 +44,6 @@ public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestD return MemberSignUpVO.of(savedMember, request.platformType(), AuthType.SIGN_UP); } - // TODO:: ํ† ํฐ ๋งŒ๋ฃŒ์‹œ์— ๋Œ€ํ•œ ์—๋Ÿฌ ์ถ”๊ฐ€ - // TODO:: Auth ํŒจํ‚ค์ง€ ๋”ฐ๋กœ ๋บ„๊นŒ? - // TODO:: uri yml๋กœ ๋นผ์•ผ์ง€.. -// private NaverMemberVO getNaverMemberInfo(String accessToken) { -// try { -// WebClient webClient = WebClient.builder().build(); -// return webClient.get() -// .uri("https://openapi.naver.com/v1/nid/me") -// .headers(headers -> headers.setBearerAuth(accessToken)) -// .retrieve() -// .bodyToMono(NaverMemberVO.class) -// .block(); -// } catch (WebClientResponseException e) { -// throw new AuthException(AuthExceptionType.INVALID_MEMBER_PLATFORM_TOKEN); -// } -// } - public NaverMemberVO getNaverMemberInfo(String accessToken) { WebClient webClient = WebClient.builder().build(); return webClient.post() From 9e3ae9c4b084bb380d80a99aa1b97e4d4cdacabd Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 15:24:26 +0900 Subject: [PATCH 094/465] =?UTF-8?q?[DEL]=20=EB=94=94=EB=B2=84=EA=B9=85?= =?UTF-8?q?=EC=9A=A9=20print=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/oauth/service/NaverAuthService.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 29880ed..882c5bf 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -29,10 +29,9 @@ public NaverAuthService(MemberRepository memberRepository) { @Override public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); - System.out.println("accessToken = " + accessToken); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); - Member foundMember = getMember(request.platformType(), naverMemberInfo.getResponse().getEmail()); + if (foundMember != null) { return MemberSignUpVO.of(foundMember, request.platformType(), AuthType.LOGIN); } From 2a5ad770a33d3e3c0866dfdd251b0b053dce71a6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 15:41:16 +0900 Subject: [PATCH 095/465] =?UTF-8?q?[FEAT]=20AuthService=20transcational=20?= =?UTF-8?q?=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20readOnly=20?= =?UTF-8?q?=EC=98=B5=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/auth/service/AuthService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index a263ed9..2f62af2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -6,10 +6,10 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; -import jakarta.transaction.Transactional; import lombok.RequiredArgsConstructor; +import org.springframework.transaction.annotation.Transactional; -@Transactional +@Transactional(readOnly = true) @RequiredArgsConstructor public abstract class AuthService { private final MemberRepository memberRepository; @@ -21,6 +21,7 @@ protected Member getMember(PlatformType platformType, String email) { .orElse(null); } + @Transactional protected Member saveUser(MemberRequestDTO request, String email, String name, String birthday, String gender, String phoneNumber) { Member newMember = createSocialMember(email, name, request.platformType(), birthday, gender, phoneNumber); From 78afb5dfab8ca0f86dfaff703297b5b796cb2d11 Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Mon, 8 Jan 2024 23:04:30 +0900 Subject: [PATCH 096/465] =?UTF-8?q?[DOCS]=20CI=20PR=20=EB=B0=9C=EC=83=9D?= =?UTF-8?q?=EC=8B=9C=20=EC=9E=91=EB=8F=99=ED=95=98=EB=8F=84=EB=A1=9D=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 --- .github/workflows/dev-CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-CI.yml b/.github/workflows/dev-CI.yml index 05a75ec..e205ee7 100644 --- a/.github/workflows/dev-CI.yml +++ b/.github/workflows/dev-CI.yml @@ -1,7 +1,7 @@ name: NONSOOLMATE DEV CI on: - push: + pull_request: branches: [ "dev" ] jobs: From 86a00c5139e0671f1fda3706a517b75bd9f2c6dc Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 8 Jan 2024 22:20:11 +0900 Subject: [PATCH 097/465] =?UTF-8?q?[DEL]=20=EB=8D=94=EB=AF=B8=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/external/redis/config/dummy.txt | 1 - .../nonsoolmateServer/global/security/filter/dummy.txt | 1 - 2 files changed, 2 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 395f5ed1e44b9cedf23700ed7304ccfc41598644 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 8 Jan 2024 22:21:30 +0900 Subject: [PATCH 098/465] =?UTF-8?q?[ADD]=20SecurityConfig=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 --- .../security/config/SecurityConfig.java | 49 ++++++++++++++++++- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 8382e71..9772daf 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -1,10 +1,18 @@ package com.nonsoolmate.nonsoolmateServer.global.security.config; +import com.nonsoolmate.nonsoolmateServer.global.security.filter.JwtAuthenticationFilter; import io.swagger.v3.oas.models.PathItem.HttpMethod; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.crypto.factory.PasswordEncoderFactories; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -23,12 +31,14 @@ public class SecurityConfig { "/webjars/**", // Authentication - "/auth/**", + "/auth/**", "/login/**","/authTest", // client - "/", "/css/**", "/images/**", "/js/**", "/favicon.ico", "/h2-console/**" + "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**" }; + private final JwtAuthenticationFilter jwtAuthenticationFilter; + //cors ์—๋Ÿฌ๋ฅผ ๋Œ€์‘ํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”์†Œ๋“œ @Bean @@ -49,5 +59,40 @@ public void addCorsMappings(CorsRegistry registry) { }; } + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + + http + .csrf(AbstractHttpConfigurer::disable) + .formLogin(AbstractHttpConfigurer::disable) + .httpBasic(AbstractHttpConfigurer::disable) + .sessionManagement(session -> { + session.sessionCreationPolicy(SessionCreationPolicy.STATELESS); + }) + .headers((headerConfig) -> + headerConfig.frameOptions(frameOptionsConfig -> + frameOptionsConfig.disable() + ) + ) + // .userDetailsService(memberAuthService) + ; + + //== URL๋ณ„ ๊ถŒํ•œ ๊ด€๋ฆฌ ์˜ต์…˜ ==// + http.authorizeHttpRequests(auth -> { + auth.requestMatchers(AUTH_WHITELIST).permitAll(); + auth.anyRequest().authenticated(); + }) + // ์›๋ž˜ ์Šคํ”„๋ง ์‹œํ๋ฆฌํ‹ฐ ํ•„ํ„ฐ ์ˆœ์„œ๊ฐ€ LogoutFilter ์ดํ›„์— ๋กœ๊ทธ์ธ ํ•„ํ„ฐ ๋™์ž‘ + .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); + + + return http.build(); + } + + @Bean + public PasswordEncoder passwordEncoder() { + return PasswordEncoderFactories.createDelegatingPasswordEncoder(); + } + } From 85fb0ab55cf6ebc6bd2c7d8a625f4b5a62ca6305 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 8 Jan 2024 22:22:42 +0900 Subject: [PATCH 099/465] =?UTF-8?q?[FEAT]=20redis=20config=20=EB=B0=8F=20r?= =?UTF-8?q?epository=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/redis/config/RedisConfig.java | 22 +++++++++++++++++ .../repository/RedisTokenRepository.java | 24 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/RedisConfig.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/RedisConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/RedisConfig.java new file mode 100644 index 0000000..6dc4d34 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/RedisConfig.java @@ -0,0 +1,22 @@ +package com.nonsoolmate.nonsoolmateServer.external.redis.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory; + +@Configuration +public class RedisConfig { + + @Value("${spring.redis.host}") + private String redisHost; + + @Value("${spring.redis.port}") + private int redisPort; + + @Bean + public RedisConnectionFactory redisConnectionFactory() { + return new LettuceConnectionFactory(redisHost, redisPort); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java new file mode 100644 index 0000000..1570ca8 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java @@ -0,0 +1,24 @@ +package com.nonsoolmate.nonsoolmateServer.external.redis.repository; + + +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.NOT_FOUND_REFRESH_TOKEN; + +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; + + +import com.nonsoolmate.nonsoolmateServer.global.jwt.service.vo.RefreshTokenVO; +import java.util.Optional; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface RedisTokenRepository extends CrudRepository { + Optional findByMemberId(String memberId); + + default RefreshTokenVO findByMemberIdOrElseThrowException(String memberId) { + return findByMemberId(memberId) + .filter(refreshTokenVO -> !refreshTokenVO.isBlack()) + .orElseThrow( + () -> new AuthException(NOT_FOUND_REFRESH_TOKEN)); + } +} From 8086500713879a2eae6f5f68feef6643e87076d4 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 8 Jan 2024 22:23:46 +0900 Subject: [PATCH 100/465] =?UTF-8?q?[FEAT]=20Jwt=20=ED=95=84=ED=84=B0=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/repository/MemberRepository.java | 11 + .../global/auth/domain/CustomAuthUser.java | 51 +++++ .../global/jwt/service/JwtService.java | 195 +++++++----------- .../global/jwt/service/JwtTokenProvider.java | 85 ++++++++ .../global/jwt/service/MemberAuthService.java | 36 ++++ .../global/jwt/utils/RequestUtils.java | 64 ++++++ .../filter/JwtAuthenticationFilter.java | 56 +++++ .../security/filter/JwtExceptionFilter.java | 4 + 8 files changed, 379 insertions(+), 123 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/domain/CustomAuthUser.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/MemberAuthService.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/RequestUtils.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java index 6e83c3d..c0a03ed 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java @@ -1,5 +1,9 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.repository; + +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.NOT_FOUND_REFRESH_TOKEN; + +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import java.util.Optional; @@ -9,4 +13,11 @@ public interface MemberRepository extends JpaRepository { Optional findByEmail(String email); Optional findByPlatformTypeAndEmail(PlatformType platformType, String email); + + Optional findByMemberId(Long memberId); + + default Member findByMemberIdOrElseThrowException(Long memberId){ + return findByMemberId(memberId).orElseThrow( + () -> new AuthException(NOT_FOUND_REFRESH_TOKEN)); + } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/domain/CustomAuthUser.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/domain/CustomAuthUser.java new file mode 100644 index 0000000..af7e0a5 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/domain/CustomAuthUser.java @@ -0,0 +1,51 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.domain; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; +import java.util.Collection; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +@Getter +@RequiredArgsConstructor +public class CustomAuthUser implements UserDetails { + + private final Member member; + private final Role authority; + @Override + public Collection getAuthorities() { + return null; + } + + @Override + public String getPassword() { + return null; + } + + @Override + public String getUsername() { + return null; + } + + @Override + public boolean isAccountNonExpired() { + return false; + } + + @Override + public boolean isAccountNonLocked() { + return false; + } + + @Override + public boolean isCredentialsNonExpired() { + return false; + } + + @Override + public boolean isEnabled() { + return false; + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index f4d7405..76bd1bb 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -1,13 +1,22 @@ package com.nonsoolmate.nonsoolmateServer.global.jwt.service; -import com.auth0.jwt.JWT; -import com.auth0.jwt.algorithms.Algorithm; + +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_ACCESS_TOKEN; +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_REFRESH_TOKEN; + +import com.fasterxml.jackson.core.JsonProcessingException; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberReissueResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType; +import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; -import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; + +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; +import com.nonsoolmate.nonsoolmateServer.external.redis.repository.RedisTokenRepository; +import com.nonsoolmate.nonsoolmateServer.global.jwt.service.vo.RefreshTokenVO; +import io.jsonwebtoken.Claims; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.util.Date; @@ -17,15 +26,18 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @Getter @Slf4j public class JwtService { + private static final String AUTH_USER = "memberId"; + private static final String BEARER = "Bearer "; + private static final String EMAIL_CLAIM = "email"; + private static final String MEMBER_ID_CLAIM = "memberId"; - @Value("${jwt.secretKey}") - private String secretKey; @Value("${jwt.access.expiration}") private Long accessTokenExpirationPeriod; @@ -39,51 +51,16 @@ public class JwtService { @Value("${jwt.refresh.header}") private String refreshHeader; - /** - * JWT์˜ Subject์™€ Claim์œผ๋กœ email ์‚ฌ์šฉ -> ํด๋ ˆ์ž„์˜ name์„ "email"์œผ๋กœ ์„ค์ • JWT์˜ ํ—ค๋”์— ๋“ค์–ด์˜ค๋Š” ๊ฐ’ : 'Authorization(Key) = Bearer {ํ† ํฐ} - * (Value)' ํ˜•์‹ - */ - private static final String ACCESS_TOKEN_SUBJECT = "AccessToken"; - private static final String REFRESH_TOKEN_SUBJECT = "RefreshToken"; - private static final String EMAIL_CLAIM = "email"; - private static final String MEMBER_ID_CLAIM = "memberId"; - private static final String BEARER = "Bearer "; - private final MemberRepository memberRepository; + private final com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service.JwtTokenProvider jwtTokenProvider; + private final RedisTokenRepository redisTokenRepository; - /** - * AccessToken ์ƒ์„ฑ ๋ฉ”์†Œ๋“œ - */ - public String createAccessToken(String email, Long memberId) { - Date now = new Date(); - return JWT.create() // JWT ํ† ํฐ์„ ์ƒ์„ฑํ•˜๋Š” ๋นŒ๋” ๋ฐ˜ํ™˜ - .withSubject(ACCESS_TOKEN_SUBJECT) // JWT์˜ Subject ์ง€์ • -> AccessToken์ด๋ฏ€๋กœ AccessToken - .withExpiresAt(new Date(now.getTime() + accessTokenExpirationPeriod)) // ํ† ํฐ ๋งŒ๋ฃŒ ์‹œ๊ฐ„ ์„ค์ • - - //ํด๋ ˆ์ž„์œผ๋กœ๋Š” ์ €ํฌ๋Š” email ํ•˜๋‚˜๋งŒ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. - //์ถ”๊ฐ€์ ์œผ๋กœ ์‹๋ณ„์ž๋‚˜, ์ด๋ฆ„ ๋“ฑ์˜ ์ •๋ณด๋ฅผ ๋” ์ถ”๊ฐ€ํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค. - //์ถ”๊ฐ€ํ•˜์‹ค ๊ฒฝ์šฐ .withClaim(ํด๋ž˜์ž„ ์ด๋ฆ„, ํด๋ž˜์ž„ ๊ฐ’) ์œผ๋กœ ์„ค์ •ํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค - .withClaim(MEMBER_ID_CLAIM, memberId) - .withClaim(EMAIL_CLAIM, email) - .sign(Algorithm.HMAC512(secretKey)); // HMAC512 ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์‚ฌ์šฉ, application-jwt.yml์—์„œ ์ง€์ •ํ•œ secret ํ‚ค๋กœ ์•”ํ˜ธํ™” - } - - /** - * RefreshToken ์ƒ์„ฑ RefreshToken์€ Claim์— email๋„ ๋„ฃ์ง€ ์•Š์œผ๋ฏ€๋กœ withClaim() X - */ - public String createRefreshToken() { - Date now = new Date(); - return JWT.create() - .withSubject(REFRESH_TOKEN_SUBJECT) - .withExpiresAt(new Date(now.getTime() + refreshTokenExpirationPeriod)) - .sign(Algorithm.HMAC512(secretKey)); - } public MemberAuthResponseDTO issueToken(MemberSignUpVO vo, HttpServletResponse response) { - String accessToken = createAccessToken(vo.email(), vo.memberId()); + String accessToken = jwtTokenProvider.createAccessToken(vo.email(), vo.memberId(), accessTokenExpirationPeriod); if (vo.role().equals(Role.ROLE_USER)) { - String refreshToken = createRefreshToken(); + String refreshToken = jwtTokenProvider.createRefreshToken(refreshTokenExpirationPeriod); updateRefreshTokenByMemberId(vo.memberId(), refreshToken); return MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name(), accessToken, refreshToken); } @@ -91,101 +68,73 @@ public MemberAuthResponseDTO issueToken(MemberSignUpVO vo, HttpServletResponse r throw new AuthException(AuthExceptionType.UNAUTHORIZED_MEMBER_LOGIN); } - /** - * AccessToken + RefreshToken ํ—ค๋”์— ์‹ค์–ด์„œ ๋ณด๋‚ด๊ธฐ - */ - public void sendAccessAndRefreshToken(HttpServletResponse response, String accessToken, String refreshToken) { - response.setStatus(HttpServletResponse.SC_OK); + public MemberReissueResponseDTO reissueToken(HttpServletRequest request, HttpServletResponse response) { + String refreshToken = extractRefreshToken(request); + String accessToken = extractAccessToken(request); - setAccessTokenHeader(response, accessToken); - setRefreshTokenHeader(response, refreshToken); - log.info("{}", refreshToken); - log.info("Access Token, Refresh Token ํ—ค๋” ์„ค์ • ์™„๋ฃŒ"); - } - - /** - * ํ—ค๋”์—์„œ RefreshToken ์ถ”์ถœ ํ† ํฐ ํ˜•์‹ : Bearer XXX์—์„œ Bearer๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ˆœ์ˆ˜ ํ† ํฐ๋งŒ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด์„œ ํ—ค๋”๋ฅผ ๊ฐ€์ ธ์˜จ ํ›„ "Bearer"๋ฅผ ์‚ญ์ œ(""๋กœ replace) - */ - public Optional extractRefreshToken(HttpServletRequest request) { - return Optional.ofNullable(request.getHeader(refreshHeader)) - .filter(refreshToken -> refreshToken.startsWith(BEARER)) - .map(refreshToken -> refreshToken.replace(BEARER, "")); - } + if (!validateToken(refreshToken)) { + throw new AuthException(INVALID_REFRESH_TOKEN); + } - /** - * ํ—ค๋”์—์„œ AccessToken ์ถ”์ถœ ํ† ํฐ ํ˜•์‹ : Bearer XXX์—์„œ Bearer๋ฅผ ์ œ์™ธํ•˜๊ณ  ์ˆœ์ˆ˜ ํ† ํฐ๋งŒ ๊ฐ€์ ธ์˜ค๊ธฐ ์œ„ํ•ด์„œ ํ—ค๋”๋ฅผ ๊ฐ€์ ธ์˜จ ํ›„ "Bearer"๋ฅผ ์‚ญ์ œ(""๋กœ replace) - */ - public Optional extractAccessToken(HttpServletRequest request) { - return Optional.ofNullable(request.getHeader(accessHeader)) - .filter(refreshToken -> refreshToken.startsWith(BEARER)) - .map(refreshToken -> refreshToken.replace(BEARER, "")); - } + Claims tokenClaims = jwtTokenProvider.getTokenClaims(accessToken); + RefreshTokenVO foundRefreshToken = redisTokenRepository.findByMemberIdOrElseThrowException(String.valueOf(tokenClaims.get(MEMBER_ID_CLAIM))); - /** - * AccessToken์—์„œ Email ์ถ”์ถœ ์ถ”์ถœ ์ „์— JWT.require()๋กœ ๊ฒ€์ฆ๊ธฐ ์ƒ์„ฑ verify๋กœ AceessToken ๊ฒ€์ฆ ํ›„ ์œ ํšจํ•˜๋‹ค๋ฉด getClaim()์œผ๋กœ ์ด๋ฉ”์ผ ์ถ”์ถœ ์œ ํšจํ•˜์ง€ ์•Š๋‹ค๋ฉด ๋นˆ - * Optional ๊ฐ์ฒด ๋ฐ˜ํ™˜ - */ - public Optional extractEmail(String accessToken) { - try { - // ํ† ํฐ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌํ•˜๋Š” ๋ฐ์— ์‚ฌ์šฉํ•  ์•Œ๊ณ ๋ฆฌ์ฆ˜์ด ์žˆ๋Š” JWT verifier builder ๋ฐ˜ํ™˜ - return Optional.ofNullable(JWT.require(Algorithm.HMAC512(secretKey)) - .build() // ๋ฐ˜ํ™˜๋œ ๋นŒ๋”๋กœ JWT verifier ์ƒ์„ฑ - .verify(accessToken) // accessToken์„ ๊ฒ€์ฆํ•˜๊ณ  ์œ ํšจํ•˜์ง€ ์•Š๋‹ค๋ฉด ์˜ˆ์™ธ ๋ฐœ์ƒ - .getClaim(EMAIL_CLAIM) // claim(Emial) ๊ฐ€์ ธ์˜ค๊ธฐ - .asString()); - } catch (Exception e) { - log.error("์•ก์„ธ์Šค ํ† ํฐ์ด ์œ ํšจํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."); - return null; + if(!foundRefreshToken.getRefreshToken().equals(refreshToken)){ + throw new AuthException(INVALID_REFRESH_TOKEN); } - } - /** - * AccessToken ํ—ค๋” ์„ค์ • - */ - public void setAccessTokenHeader(HttpServletResponse response, String accessToken) { - response.setHeader(accessHeader, "Bearer " + accessToken); - } + Integer o = (Integer) tokenClaims.get(MEMBER_ID_CLAIM); + Long memberId = o.longValue(); + String email = (String) tokenClaims.get(EMAIL_CLAIM); + + String newAccessToken = jwtTokenProvider.createAccessToken(email, memberId, accessTokenExpirationPeriod); + String newRefreshToken = jwtTokenProvider.createRefreshToken(refreshTokenExpirationPeriod); + + updateRefreshTokenByMemberId(memberId, newRefreshToken); - /** - * RefreshToken ํ—ค๋” ์„ค์ • - */ - public void setRefreshTokenHeader(HttpServletResponse response, String refreshToken) { - response.setHeader(refreshHeader, refreshToken); + return MemberReissueResponseDTO.of(memberId, AuthType.LOGIN, newAccessToken, newRefreshToken); } - /** - * RefreshToken DB ์ €์žฅ(์—…๋ฐ์ดํŠธ) LoginSuccessHandler - */ - public void updateRefreshToken(String email, String refreshToken) { - log.info("updateRefreshToken, refresh = {} / email = {}", refreshToken, email); - memberRepository.findByEmail(email) - .ifPresentOrElse( - user -> { - // user.updateRefreshToken(refreshToken); - memberRepository.saveAndFlush(user); - }, - () -> new Exception("์ผ์น˜ํ•˜๋Š” ํšŒ์›์ด ์—†์Šต๋‹ˆ๋‹ค.") - ); + + public Long extractMemberIdFromAccessToken(final String atk) throws JsonProcessingException { + Claims tokenClaims = jwtTokenProvider.getTokenClaims(atk); + return jwtTokenProvider.getMemberIdFromClaim(tokenClaims, AUTH_USER); } - public boolean isTokenValid(String token) { + public Boolean validateToken(final String atk) { try { - JWT.require(Algorithm.HMAC512(secretKey)).build().verify(token); - return true; + Claims tokenClaims = jwtTokenProvider.getTokenClaims(atk); + return !tokenClaims.getExpiration().before(new Date()); } catch (Exception e) { - log.error("์œ ํšจํ•˜์ง€ ์•Š์€ ํ† ํฐ์ž…๋‹ˆ๋‹ค. {}", e.getMessage()); return false; } } - // TODO: Redis ์‚ฌ์šฉํ•ด์„œ refresh token ๊ด€๋ฆฌ - public void updateRefreshTokenByMemberId(Long memberId, String refreshToken) { - memberRepository - .findById(memberId) - .ifPresent( - member -> { - //member.updateRefreshToken(refreshToken); - memberRepository.saveAndFlush(member); + private String extractRefreshToken(HttpServletRequest request) { + return Optional.ofNullable(request.getHeader(refreshHeader)) + .filter(refreshToken -> refreshToken.startsWith(BEARER)) + .map(refreshToken -> refreshToken.replace(BEARER, "")) + .orElseThrow(() -> new AuthException(INVALID_REFRESH_TOKEN)); + } + + private String extractAccessToken(HttpServletRequest request) { + return Optional.ofNullable(request.getHeader(accessHeader)) + .filter(refreshToken -> refreshToken.startsWith(BEARER)) + .map(refreshToken -> refreshToken.replace(BEARER, "")) + .orElseThrow(() -> new AuthException(INVALID_ACCESS_TOKEN)); + } + + + public void updateRefreshTokenByMemberId(Long memberId, String newRefreshToken) { + redisTokenRepository.findByMemberId(String.valueOf(memberId)) + .ifPresent(refreshToken -> { + refreshToken.updateBlack(true); }); + log.info("newRefreshToken = {}", newRefreshToken); + redisTokenRepository.save(RefreshTokenVO.builder() + .memberId(String.valueOf(memberId)) + .black(false) + .refreshToken(newRefreshToken) + .build()); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java new file mode 100644 index 0000000..0c8c146 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java @@ -0,0 +1,85 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Header; +import io.jsonwebtoken.JwtParser; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; +import io.jsonwebtoken.io.Decoders; +import io.jsonwebtoken.security.Keys; +import java.security.Key; +import java.util.Date; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +@Slf4j +@Component +public class JwtTokenProvider { + private static final String ACCESS_TOKEN_SUBJECT = "AccessToken"; + private static final String REFRESH_TOKEN_SUBJECT = "RefreshToken"; + private static final String EMAIL_CLAIM = "email"; + private static final String MEMBER_ID_CLAIM = "memberId"; + + + private final Key key; + private final ObjectMapper objectMapper; + + public JwtTokenProvider(@Value("${jwt.secretKey}") String secretKey, ObjectMapper objectMapper) { + byte[] keyBytes = Decoders.BASE64.decode(secretKey); + + this.key = Keys.hmacShaKeyFor(keyBytes); + this.objectMapper = objectMapper; + } + + public String createAccessToken(String email, Long memberId, Long expirationTime) { + Date now = new Date(); + + return Jwts.builder() + .setSubject(ACCESS_TOKEN_SUBJECT) + .claim(MEMBER_ID_CLAIM, memberId) + .claim(EMAIL_CLAIM, email) + .setIssuedAt(now) //ํ† ํฐ ๋ฐœํ–‰ ์‹œ๊ฐ„ ์ •๋ณด + .setExpiration(new Date(now.getTime() + expirationTime)) //ํ† ํฐ ๋งŒ๋ฃŒ ์‹œ๊ฐ„ ์„ค์ • + .signWith(key, SignatureAlgorithm.HS256) + .compact(); + } + + public String createRefreshToken(Long expirationTime) { + Date now = new Date(); + + return Jwts.builder() + .setSubject(REFRESH_TOKEN_SUBJECT) + .setIssuedAt(now) //ํ† ํฐ ๋ฐœํ–‰ ์‹œ๊ฐ„ ์ •๋ณด + .setExpiration(new Date(now.getTime() + expirationTime)) //ํ† ํฐ ๋งŒ๋ฃŒ ์‹œ๊ฐ„ ์„ค์ • + .signWith(key, SignatureAlgorithm.HS256) + .compact(); + } + + + public Claims getTokenClaims(final String token) { + JwtParser build = Jwts.parserBuilder() + .setSigningKey(key) + .build(); + + return Jwts.parserBuilder() + .setSigningKey(key) + .build() + .parseClaimsJws(token) + .getBody(); + } + + public Claims makeInfoToClaim(String infoName, final Long memberId) throws JsonProcessingException { + String claimValue = objectMapper.writeValueAsString(memberId); + Claims claims = Jwts.claims(); + claims.put(infoName, claimValue); + return claims; + } + + public Long getMemberIdFromClaim(Claims claims, String infoName) throws JsonProcessingException { + + return claims.get(infoName, Long.class); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/MemberAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/MemberAuthService.java new file mode 100644 index 0000000..d8ad8c1 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/MemberAuthService.java @@ -0,0 +1,36 @@ +package com.nonsoolmate.nonsoolmateServer.global.jwt.service; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; + +import com.nonsoolmate.nonsoolmateServer.global.jwt.utils.PasswordUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.User.UserBuilder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class MemberAuthService implements UserDetailsService { + private final MemberRepository memberRepository; + + @Override + public UserDetails loadUserByUsername(String memberId) throws UsernameNotFoundException { + Member member = memberRepository.findByMemberIdOrElseThrowException(Long.parseLong(memberId)); + + String password = PasswordUtil.generateRandomPassword(); + + UserBuilder password1 = User.builder() + .username(member.getEmail()) + .password(password); + + return org.springframework.security.core.userdetails.User.builder() + .username(member.getEmail()) + .password(password) + .roles(member.getRole().name()) + .build(); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/RequestUtils.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/RequestUtils.java new file mode 100644 index 0000000..d384476 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/RequestUtils.java @@ -0,0 +1,64 @@ +package com.nonsoolmate.nonsoolmateServer.global.jwt.utils; + + +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_ACCESS_TOKEN; +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSuccessType.LOGIN_SUCCESS; +import static org.springframework.http.HttpHeaders.AUTHORIZATION; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSuccessType; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import org.springframework.beans.factory.annotation.Value; + +public abstract class RequestUtils { + + @Value("${jwt.access.header}") + private static String accessHeader = "Authorization"; + public static final String BEARER_HEADER = "Bearer "; + + + private static final ObjectMapper objectMapper = new ObjectMapper(); + + public static boolean isContainsAccessToken(HttpServletRequest request) { + String authorization = request.getHeader(accessHeader); + return authorization != null + && authorization.startsWith(BEARER_HEADER); + } + + // ์œ ํšจํ•œ Authorization Bearer Token์—์„œ AccessToken ๋งŒ ๋ฝ‘์•„์˜ค๊ธฐ + public static String getAuthorizationAccessToken(HttpServletRequest request) { + // "Bearer " ๋ฌธ์ž์—ด ์ œ์™ธํ•˜๊ณ  ๋ฝ‘์•„์˜ค๊ธฐ + return request.getHeader(AUTHORIZATION).substring(7); + } + + public static void setBodyOnResponse(HttpServletResponse response, AuthSuccessType success, Object bodyData) { + response.setStatus(LOGIN_SUCCESS.getHttpStatusCode()); + response.setContentType("application/json"); + response.setCharacterEncoding("utf-8"); + try { + String body = objectMapper.writeValueAsString(ApiResponse.success(success, bodyData)); + response.getWriter().write(body); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static void setErrorBodyOnResponse(HttpServletResponse response, AuthExceptionType error){ + + response.setStatus(INVALID_ACCESS_TOKEN.getHttpStatusCode()); + response.setContentType("application/json"); + response.setCharacterEncoding("utf-8"); + try { + String body = objectMapper.writeValueAsString(ApiResponse.error(error)); + response.getWriter().write(body); + } catch (IOException e) { + e.printStackTrace(); + } + } + +} + diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java new file mode 100644 index 0000000..a649f56 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java @@ -0,0 +1,56 @@ +package com.nonsoolmate.nonsoolmateServer.global.security.filter; + + + +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.UNAUTHORIZED_ACCESS_TOKEN; + +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; +import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; +import com.nonsoolmate.nonsoolmateServer.global.jwt.service.MemberAuthService; +import com.nonsoolmate.nonsoolmateServer.global.jwt.utils.RequestUtils; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +@Component +@RequiredArgsConstructor +@Slf4j +public class JwtAuthenticationFilter extends OncePerRequestFilter { + + private final JwtService jwtService; + private final MemberAuthService memberAuthService; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { + if (RequestUtils.isContainsAccessToken(request)) { + String authorizationAccessToken = RequestUtils.getAuthorizationAccessToken((HttpServletRequest) request); + + if (jwtService.validateToken(authorizationAccessToken)) { + Long memberId = jwtService.extractMemberIdFromAccessToken(authorizationAccessToken); + + UserDetails userDetails = memberAuthService.loadUserByUsername(String.valueOf(memberId)); + + Authentication authentication + = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); + log.info("Authentication Principal : {}", authentication.getPrincipal().toString()); + SecurityContextHolder.getContext().setAuthentication(authentication); + + } + else { + throw new AuthException(UNAUTHORIZED_ACCESS_TOKEN); + } + } + filterChain.doFilter(request, response); + } + +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java new file mode 100644 index 0000000..020ac17 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java @@ -0,0 +1,4 @@ +package com.nonsoolmate.nonsoolmateServer.global.security.filter; + +public class JwtExceptionFilter { +} From a53bd932771a490eaa7d3e527fce64dfa6667aac Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 8 Jan 2024 22:24:12 +0900 Subject: [PATCH 101/465] =?UTF-8?q?[ADD]=20Jwt=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/build.gradle | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index 2ab9e17..4846039 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -23,6 +23,13 @@ dependencies { // security implementation 'com.auth0:java-jwt:4.2.1' implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'org.springframework.boot:spring-boot-starter-data-redis' + + // jwt + implementation 'io.jsonwebtoken:jjwt-api:0.11.5' + runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5' + runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5' + // Spring WebFlux implementation 'org.springframework.boot:spring-boot-starter-webflux' @@ -59,6 +66,9 @@ dependencies { testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' + // mac m1 setting + implementation 'io.netty:netty-resolver-dns-native-macos:4.1.68.Final:osx-aarch_64' + } tasks.named('test') { From 5f34d7e745c586d440151502169ff7d4e6066ba3 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 8 Jan 2024 22:26:32 +0900 Subject: [PATCH 102/465] =?UTF-8?q?[FEAT]=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=20=ED=86=A0=ED=81=B0=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/AuthController.java | 26 ++++++++++++- .../response/MemberReissueResponseDTO.java | 12 ++++++ .../auth/exception/AuthExceptionType.java | 13 ++++++- ...thSucessType.java => AuthSuccessType.java} | 5 ++- .../global/auth/exception/AuthSucessType.java | 4 ++ .../global/jwt/service/vo/RefreshTokenVO.java | 39 +++++++++++++++++++ .../global/jwt/utils/PasswordUtil.java | 30 ++++++++++++++ 7 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/{AuthSucessType.java => AuthSuccessType.java} (77%) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/vo/RefreshTokenVO.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/PasswordUtil.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 3ac2b68..7768353 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -2,16 +2,19 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSucessType; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberReissueResponseDTO; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthServiceProvider; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSuccessType; +import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; @@ -34,6 +37,25 @@ public ResponseEntity> login( MemberSignUpVO vo = authServiceProvider.getAuthService(request.platformType()) .saveMemberOrLogin(authorizationCode, request); MemberAuthResponseDTO memberAuthResponseDTO = jwtService.issueToken(vo, response); - return ResponseEntity.ok().body(ApiResponse.success(AuthSucessType.LOGIN_SUCCESS, memberAuthResponseDTO)); + return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.LOGIN_SUCCESS, memberAuthResponseDTO)); + } + + @PostMapping("/reissue") + public ResponseEntity> reissue(HttpServletRequest request, HttpServletResponse response){ + MemberReissueResponseDTO memberReissueResponseDTO = jwtService.reissueToken(request, response); + return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.REISSUE_SUCCESS, memberReissueResponseDTO)); + } + + @GetMapping("/authTest") + public String authTest(HttpServletRequest request, HttpServletResponse response) { + + try{ + response.sendRedirect("https://nid.naver.com/oauth2.0/authorize?&client_id=l1su6a1jp2mTKIXQBqZD&redirect_uri=http://localhost:8080/login/oauth2/code/naver&response_type=code"); + } + catch (Exception e){ + System.out.println("e = " + e); + } + + return "SUCCESS"; } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java new file mode 100644 index 0000000..e10ff4f --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java @@ -0,0 +1,12 @@ +package com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response; + +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; +import jakarta.validation.constraints.NotNull; + +public record MemberReissueResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, + @NotNull String accessToken, @NotNull String refreshToken) { + public static MemberReissueResponseDTO of(Long memberId, AuthType authType, String accessToken, + String refreshToken) { + return new MemberReissueResponseDTO(memberId, authType, accessToken, refreshToken); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index e398aa2..06105d1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -13,11 +13,22 @@ public enum AuthExceptionType implements BusinessExceptionType { * 400 Bad Request */ INVALID_MEMBER_PLATFORM_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ํ”Œ๋žซํผ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + INVALID_ACCESS_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), /** * 401 Unauthorized */ - UNAUTHORIZED_MEMBER_LOGIN(HttpStatus.UNAUTHORIZED, "๋กœ๊ทธ์ธ์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + UNAUTHORIZED_MEMBER_LOGIN(HttpStatus.UNAUTHORIZED, "๋กœ๊ทธ์ธ์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + UNAUTHORIZED_ACCESS_TOKEN(HttpStatus.UNAUTHORIZED, "๊ธฐํ•œ์ด ๋งŒ๋ฃŒ๋œ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + + + /** + * 404 Not Found + */ + + NOT_FOUND_MEMBER(HttpStatus.NOT_FOUND, "์œ ํšจํ•œ ๋ฉค๋ฒ„๋ฅผ ์ฐพ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค."), + NOT_FOUND_REFRESH_TOKEN(HttpStatus.NOT_FOUND, "์œ ํšจํ•œ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์ฐพ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSucessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java similarity index 77% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSucessType.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java index 35845ce..85aa0bd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSucessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java @@ -5,8 +5,9 @@ import org.springframework.http.HttpStatus; @RequiredArgsConstructor -public enum AuthSucessType implements BusinessSucessType { - LOGIN_SUCCESS(HttpStatus.OK, "๋กœ๊ทธ์ธ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); +public enum AuthSuccessType implements BusinessSucessType { + LOGIN_SUCCESS(HttpStatus.OK, "๋กœ๊ทธ์ธ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + REISSUE_SUCCESS(HttpStatus.OK, "๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java new file mode 100644 index 0000000..3cf0812 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java @@ -0,0 +1,4 @@ +package com.nonsoolmate.nonsoolmateServer.global.auth.exception; + +public class AuthSucessType { +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/vo/RefreshTokenVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/vo/RefreshTokenVO.java new file mode 100644 index 0000000..1a86bc3 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/vo/RefreshTokenVO.java @@ -0,0 +1,39 @@ +package com.nonsoolmate.nonsoolmateServer.global.jwt.service.vo; + + +import lombok.Builder; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.springframework.data.annotation.Id; +import org.springframework.data.redis.core.RedisHash; +import org.springframework.data.redis.core.index.Indexed; + + +@Getter +@NoArgsConstructor +@RedisHash(value = "refresh", timeToLive = 604800016) +public class RefreshTokenVO { + @Id + @Indexed + private String memberId; + + private boolean black; + + private String refreshToken; + + + public void updateRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + public void updateBlack(boolean black) { + this.black = black; + } + + @Builder + public RefreshTokenVO(String memberId, boolean black, String refreshToken) { + this.memberId = memberId; + this.black = black; + this.refreshToken = refreshToken; + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/PasswordUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/PasswordUtil.java new file mode 100644 index 0000000..aeec629 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/PasswordUtil.java @@ -0,0 +1,30 @@ +package com.nonsoolmate.nonsoolmateServer.global.jwt.utils; + +import java.util.Random; + +public class PasswordUtil { + + public static String generateRandomPassword() { + int index = 0; + char[] charSet = new char[] { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' + }; //๋ฐฐ์—ด์•ˆ์˜ ๋ฌธ์ž ์ˆซ์ž๋Š” ์›ํ•˜๋Š”๋Œ€๋กœ + + StringBuffer password = new StringBuffer(); + Random random = new Random(); + + for (int i = 0; i < 8 ; i++) { + double rd = random.nextDouble(); + index = (int) (charSet.length * rd); + + password.append(charSet[index]); + } + System.out.println(password); + return password.toString(); + //StringBuffer๋ฅผ String์œผ๋กœ ๋ณ€ํ™˜ํ•ด์„œ return ํ•˜๋ ค๋ฉด toString()์„ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค. + } +} From e4164fb6c566806d9ba25a8b7c43b4b04dc9d50f Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 8 Jan 2024 22:57:09 +0900 Subject: [PATCH 103/465] =?UTF-8?q?[REFACTOR]=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=82=B4=EC=9A=A9=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/MemberReissueResponseDTO.java | 7 +++---- .../domain/auth/service/AuthService.java | 2 +- .../domain/auth/service/vo/MemberSignUpVO.java | 2 +- .../domain/member/entity/enums/Role.java | 2 +- .../global/auth/exception/AuthSucessType.java | 4 ---- .../global/jwt/service/JwtService.java | 4 ++-- .../{auth/domain => security}/CustomAuthUser.java | 2 +- .../security/filter/JwtAuthenticationFilter.java | 2 +- .../service/MemberAuthService.java | 15 +++------------ 9 files changed, 13 insertions(+), 27 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/{auth/domain => security}/CustomAuthUser.java (94%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/{jwt => security}/service/MemberAuthService.java (63%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java index e10ff4f..fa1a8f3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java @@ -3,10 +3,9 @@ import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import jakarta.validation.constraints.NotNull; -public record MemberReissueResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, - @NotNull String accessToken, @NotNull String refreshToken) { - public static MemberReissueResponseDTO of(Long memberId, AuthType authType, String accessToken, +public record MemberReissueResponseDTO(@NotNull Long memberId, @NotNull String accessToken, @NotNull String refreshToken) { + public static MemberReissueResponseDTO of(Long memberId, String accessToken, String refreshToken) { - return new MemberReissueResponseDTO(memberId, authType, accessToken, refreshToken); + return new MemberReissueResponseDTO(memberId, accessToken, refreshToken); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index 2f62af2..b13f28f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -30,7 +30,7 @@ protected Member saveUser(MemberRequestDTO request, String email, String name, S private static Member createSocialMember(String email, String name, PlatformType platformType, String birthYear, String gender, String phoneNumber) { - return Member.builder().email(email).name(name).platformType(platformType).role(Role.ROLE_USER) + return Member.builder().email(email).name(name).platformType(platformType).role(Role.USER) .birthYear(birthYear) .gender(gender).phoneNumber(phoneNumber).build(); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/vo/MemberSignUpVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/vo/MemberSignUpVO.java index 528df25..48ea150 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/vo/MemberSignUpVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/vo/MemberSignUpVO.java @@ -15,7 +15,7 @@ public static MemberSignUpVO of(Member member, PlatformType platformType, AuthTy .email(member.getEmail()) .name(member.getName()) .platformType(platformType) - .role(Role.ROLE_USER) + .role(Role.USER) .birthYear(member.getBirthYear()) .gender(member.getGender()) .phoneNumber(member.getPhoneNumber()) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java index 9a10668..6ec2a47 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/Role.java @@ -1,5 +1,5 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums; public enum Role { - ROLE_ADMIN, ROLE_USER + ADMIN, USER } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java deleted file mode 100644 index 3cf0812..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/exception/AuthSucessType.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.exception; - -public class AuthSucessType { -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 76bd1bb..15c2c1c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -59,7 +59,7 @@ public class JwtService { public MemberAuthResponseDTO issueToken(MemberSignUpVO vo, HttpServletResponse response) { String accessToken = jwtTokenProvider.createAccessToken(vo.email(), vo.memberId(), accessTokenExpirationPeriod); - if (vo.role().equals(Role.ROLE_USER)) { + if (vo.role().equals(Role.USER)) { String refreshToken = jwtTokenProvider.createRefreshToken(refreshTokenExpirationPeriod); updateRefreshTokenByMemberId(vo.memberId(), refreshToken); return MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name(), accessToken, refreshToken); @@ -92,7 +92,7 @@ public MemberReissueResponseDTO reissueToken(HttpServletRequest request, HttpSer updateRefreshTokenByMemberId(memberId, newRefreshToken); - return MemberReissueResponseDTO.of(memberId, AuthType.LOGIN, newAccessToken, newRefreshToken); + return MemberReissueResponseDTO.of(memberId, newAccessToken, newRefreshToken); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/domain/CustomAuthUser.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/CustomAuthUser.java similarity index 94% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/domain/CustomAuthUser.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/CustomAuthUser.java index af7e0a5..da4a38a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/auth/domain/CustomAuthUser.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/CustomAuthUser.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.domain; +package com.nonsoolmate.nonsoolmateServer.global.security; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java index a649f56..ca39da9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java @@ -6,7 +6,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; -import com.nonsoolmate.nonsoolmateServer.global.jwt.service.MemberAuthService; +import com.nonsoolmate.nonsoolmateServer.global.security.service.MemberAuthService; import com.nonsoolmate.nonsoolmateServer.global.jwt.utils.RequestUtils; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/MemberAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/service/MemberAuthService.java similarity index 63% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/MemberAuthService.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/service/MemberAuthService.java index d8ad8c1..ff7996c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/MemberAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/service/MemberAuthService.java @@ -1,12 +1,11 @@ -package com.nonsoolmate.nonsoolmateServer.global.jwt.service; +package com.nonsoolmate.nonsoolmateServer.global.security.service; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; +import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; import com.nonsoolmate.nonsoolmateServer.global.jwt.utils.PasswordUtil; import lombok.RequiredArgsConstructor; -import org.springframework.security.core.userdetails.User; -import org.springframework.security.core.userdetails.User.UserBuilder; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UsernameNotFoundException; @@ -23,14 +22,6 @@ public UserDetails loadUserByUsername(String memberId) throws UsernameNotFoundEx String password = PasswordUtil.generateRandomPassword(); - UserBuilder password1 = User.builder() - .username(member.getEmail()) - .password(password); - - return org.springframework.security.core.userdetails.User.builder() - .username(member.getEmail()) - .password(password) - .roles(member.getRole().name()) - .build(); + return new CustomAuthUser(member, member.getRole()); } } From e328612a5e52242c26d52b02c2631800d2466df8 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 8 Jan 2024 23:00:22 +0900 Subject: [PATCH 104/465] =?UTF-8?q?[REFACTOR]=20=EB=94=94=EB=B2=84?= =?UTF-8?q?=EA=B9=85=EC=9A=A9=20=ED=94=84=EB=A6=B0=ED=8A=B8=EB=AC=B8=20log?= =?UTF-8?q?=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 --- .../domain/auth/controller/AuthController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 7768353..f8913df 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -53,7 +53,7 @@ public String authTest(HttpServletRequest request, HttpServletResponse response) response.sendRedirect("https://nid.naver.com/oauth2.0/authorize?&client_id=l1su6a1jp2mTKIXQBqZD&redirect_uri=http://localhost:8080/login/oauth2/code/naver&response_type=code"); } catch (Exception e){ - System.out.println("e = " + e); + log.info("authTest = {}", e); } return "SUCCESS"; From 5a3fc82797516b3e304ff3ed6d02e4fc4b4b3f14 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 23:21:34 +0900 Subject: [PATCH 105/465] =?UTF-8?q?[FIX]=20Redis=20Value=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/external/redis/config/RedisConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/RedisConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/RedisConfig.java index 6dc4d34..9197b8b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/RedisConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/config/RedisConfig.java @@ -9,10 +9,10 @@ @Configuration public class RedisConfig { - @Value("${spring.redis.host}") + @Value("${spring.data.redis.host}") private String redisHost; - @Value("${spring.redis.port}") + @Value("${spring.data.redis.port}") private int redisPort; @Bean From 5693144578a7fb1dad4d4ad34a1d5684bf02b43c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 8 Jan 2024 23:22:36 +0900 Subject: [PATCH 106/465] =?UTF-8?q?[FIX]=20JwtService=20import=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/jwt/service/JwtService.java | 24 +++++++++---------- .../global/jwt/service/JwtTokenProvider.java | 3 +-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 15c2c1c..efa2e7d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -12,8 +12,6 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; - -import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import com.nonsoolmate.nonsoolmateServer.external.redis.repository.RedisTokenRepository; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.vo.RefreshTokenVO; import io.jsonwebtoken.Claims; @@ -26,7 +24,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @@ -52,7 +49,7 @@ public class JwtService { private String refreshHeader; private final MemberRepository memberRepository; - private final com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service.JwtTokenProvider jwtTokenProvider; + private final JwtTokenProvider jwtTokenProvider; private final RedisTokenRepository redisTokenRepository; @@ -77,9 +74,10 @@ public MemberReissueResponseDTO reissueToken(HttpServletRequest request, HttpSer } Claims tokenClaims = jwtTokenProvider.getTokenClaims(accessToken); - RefreshTokenVO foundRefreshToken = redisTokenRepository.findByMemberIdOrElseThrowException(String.valueOf(tokenClaims.get(MEMBER_ID_CLAIM))); + RefreshTokenVO foundRefreshToken = redisTokenRepository.findByMemberIdOrElseThrowException( + String.valueOf(tokenClaims.get(MEMBER_ID_CLAIM))); - if(!foundRefreshToken.getRefreshToken().equals(refreshToken)){ + if (!foundRefreshToken.getRefreshToken().equals(refreshToken)) { throw new AuthException(INVALID_REFRESH_TOKEN); } @@ -127,14 +125,14 @@ private String extractAccessToken(HttpServletRequest request) { public void updateRefreshTokenByMemberId(Long memberId, String newRefreshToken) { redisTokenRepository.findByMemberId(String.valueOf(memberId)) - .ifPresent(refreshToken -> { - refreshToken.updateBlack(true); - }); + .ifPresent(refreshToken -> { + refreshToken.updateBlack(true); + }); log.info("newRefreshToken = {}", newRefreshToken); redisTokenRepository.save(RefreshTokenVO.builder() - .memberId(String.valueOf(memberId)) - .black(false) - .refreshToken(newRefreshToken) - .build()); + .memberId(String.valueOf(memberId)) + .black(false) + .refreshToken(newRefreshToken) + .build()); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java index 0c8c146..0216fd6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java @@ -1,9 +1,8 @@ -package com.nonsoolmate.nonsoolmateServer.global.auth.jwt.service; +package com.nonsoolmate.nonsoolmateServer.global.jwt.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import io.jsonwebtoken.Claims; -import io.jsonwebtoken.Header; import io.jsonwebtoken.JwtParser; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; From cb118456e4c503d4b5e68786c025805447e869c8 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:01:24 +0900 Subject: [PATCH 107/465] =?UTF-8?q?[DEL]=20dummy=20file=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/controller/dummy.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 09aca4e5707abef083faea1d5f8fa3c23996ad41 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:17:03 +0900 Subject: [PATCH 108/465] =?UTF-8?q?[DEL]=20dummy.txt=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/service/dummy.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 7e775fe61c0d2f90a312c57ac2af05460917b503 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:32:46 +0900 Subject: [PATCH 109/465] =?UTF-8?q?[FEAT]=20SecurityUtil=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/util/SecurityUtil.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java new file mode 100644 index 0000000..ffa8b3a --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java @@ -0,0 +1,35 @@ +package com.nonsoolmate.nonsoolmateServer.global.security.util; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import org.springframework.security.core.context.SecurityContextHolder; + +public class SecurityUtil { + private static final String ANONYMOUS_USER = "anonymousUser"; + + public static Member getLoginMember() { + return getLoginMemberAuthInfo().getMember(); + } + + private static CustomAuthUser getLoginMemberAuthInfo() { + return (CustomAuthUser) + SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + } + + public static Map getLoginMemberInfo() { + Map memberInfoMap = new HashMap<>(); + memberInfoMap.put("member", getLoginMember()); + return memberInfoMap; + } + + private static Optional getUserAuthDetails() { + Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + if (principal.equals(ANONYMOUS_USER)) { + return Optional.empty(); + } + return Optional.of((CustomAuthUser) principal); + } +} From f6b6fcf4a040693fdf65f286db065454b396ee00 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:33:12 +0900 Subject: [PATCH 110/465] =?UTF-8?q?[ADD]=20MemberSuccessType=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 --- .../member/exception/MemberSuccessType.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java new file mode 100644 index 0000000..3b45b98 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java @@ -0,0 +1,23 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor +public enum MemberSuccessType implements BusinessSucessType { + GET_MEMBER_NAME_SUCCESS(HttpStatus.OK, "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} From a7a4415be1616ef4c72accabf1ca7f0c6160446a Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:34:16 +0900 Subject: [PATCH 111/465] =?UTF-8?q?[FEAT]=20MyController=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MyController.java | 24 +++++++++++++++++++ .../dto/response/nicknameResponseDTO.java | 7 ++++++ 2 files changed, 31 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java new file mode 100644 index 0000000..5194700 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -0,0 +1,24 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller; + +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; +import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/my") +@RequiredArgsConstructor +public class MyController { + private final MemberService memberService; + + @GetMapping("/name") + public ResponseEntity> getName() { + return ResponseEntity.ok() + .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname())); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java new file mode 100644 index 0000000..24bd2b6 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; + +public record nicknameResponseDTO(String memberName) { + static public nicknameResponseDTO of(String memberName) { + return new nicknameResponseDTO(memberName); + } +} From 6409e0874ec13914520c47d093f410d322ff96ec Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:34:53 +0900 Subject: [PATCH 112/465] =?UTF-8?q?[FEAT]=20MemberService=20=EB=82=B4=20ge?= =?UTF-8?q?tName()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/MemberService.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java new file mode 100644 index 0000000..ce38924 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -0,0 +1,21 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.service; + +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; +import com.nonsoolmate.nonsoolmateServer.global.security.util.SecurityUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class MemberService { + private final MemberRepository memberRepository; + + public nicknameResponseDTO getNickname() { + Member member = SecurityUtil.getLoginMember(); + return nicknameResponseDTO.of(member.getName()); + } +} From 60b26f34832ddf274f537855172ee0f6fc48fe16 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:48:04 +0900 Subject: [PATCH 113/465] =?UTF-8?q?[ADD]=20=EC=B2=A8=EC=82=AD=EA=B6=8C=20?= =?UTF-8?q?=EA=B0=9C=EC=88=98=20=EC=A1=B0=ED=9A=8C=20SuccessType=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/member/exception/MemberSuccessType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java index 3b45b98..45e5256 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java @@ -6,7 +6,8 @@ @RequiredArgsConstructor public enum MemberSuccessType implements BusinessSucessType { - GET_MEMBER_NAME_SUCCESS(HttpStatus.OK, "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + GET_MEMBER_NAME_SUCCESS(HttpStatus.OK, "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + GET_MEMBER_TICKET_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From 0660a64eb04a1bfa11109ac540778b8996291686 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:48:50 +0900 Subject: [PATCH 114/465] =?UTF-8?q?[REFACTOR]=20nickname=20->=20name=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=A6=AC=ED=8C=A9=ED=84=B0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 4 ++-- .../member/controller/dto/response/NameResponseDTO.java | 7 +++++++ .../controller/dto/response/nicknameResponseDTO.java | 7 ------- .../domain/member/service/MemberService.java | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 5194700..289eb6b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.controller; -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; @@ -17,7 +17,7 @@ public class MyController { private final MemberService memberService; @GetMapping("/name") - public ResponseEntity> getName() { + public ResponseEntity> getName() { return ResponseEntity.ok() .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname())); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java new file mode 100644 index 0000000..70f2a93 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; + +public record NameResponseDTO(String memberName) { + static public NameResponseDTO of(String memberName) { + return new NameResponseDTO(memberName); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java deleted file mode 100644 index 24bd2b6..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; - -public record nicknameResponseDTO(String memberName) { - static public nicknameResponseDTO of(String memberName) { - return new nicknameResponseDTO(memberName); - } -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index ce38924..477aac0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.service; -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.global.security.util.SecurityUtil; @@ -14,8 +14,8 @@ public class MemberService { private final MemberRepository memberRepository; - public nicknameResponseDTO getNickname() { + public NameResponseDTO getNickname() { Member member = SecurityUtil.getLoginMember(); - return nicknameResponseDTO.of(member.getName()); + return NameResponseDTO.of(member.getName()); } } From 446af04bc39375dde1969e0d7a76d37a9b85e06e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:49:57 +0900 Subject: [PATCH 115/465] =?UTF-8?q?[ADD]=20TicketResponseDTO=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 --- .../member/controller/dto/response/TicketResponseDTO.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java new file mode 100644 index 0000000..ccd6060 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; + +public record TicketResponseDTO(String memberName, int ticketCount) { + static public TicketResponseDTO of(String memberName, int ticketCount) { + return new TicketResponseDTO(memberName, ticketCount); + } +} From 1f18f0c8415ac8fcda86cf83287d5f39a09d2352 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:50:46 +0900 Subject: [PATCH 116/465] =?UTF-8?q?[FEAT]=20MemberService=20getTicket()=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/MemberService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index 477aac0..1c859c1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -1,6 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.service; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.global.security.util.SecurityUtil; @@ -18,4 +19,9 @@ public NameResponseDTO getNickname() { Member member = SecurityUtil.getLoginMember(); return NameResponseDTO.of(member.getName()); } + + public TicketResponseDTO getTicket() { + Member member = SecurityUtil.getLoginMember(); + return TicketResponseDTO.of(member.getName(), member.getTicketCount()); + } } From da592710e4302273cd3d3e2dab00cc419ff8f236 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:52:22 +0900 Subject: [PATCH 117/465] =?UTF-8?q?[FEAT]=20MyController=20getTicket()=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 289eb6b..11cb895 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -1,6 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.controller; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; @@ -21,4 +22,10 @@ public ResponseEntity> getName() { return ResponseEntity.ok() .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname())); } + + @GetMapping("/ticket") + public ResponseEntity> getTicket() { + return ResponseEntity.ok() + .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_TICKET_SUCCESS, memberService.getTicket())); + } } From 21926116d7ecf3dc5126c68f4ef927a7df047f3d Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 03:10:51 +0900 Subject: [PATCH 118/465] =?UTF-8?q?[REFACTOR]=20name=20->=20memberName?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=ED=95=84=EB=93=9C=20=ED=86=B5=EC=9D=BC?= =?UTF-8?q?=EC=84=B1=20=EC=9E=88=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/dto/response/MemberAuthResponseDTO.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java index 5b7a169..2c3fd98 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java @@ -3,10 +3,10 @@ import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import jakarta.validation.constraints.NotNull; -public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String name, +public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String memberName, @NotNull String accessToken, @NotNull String refreshToken) { - public static MemberAuthResponseDTO of(Long memberId, AuthType authType, String name, String accessToken, + public static MemberAuthResponseDTO of(Long memberId, AuthType authType, String memberName, String accessToken, String refreshToken) { - return new MemberAuthResponseDTO(memberId, authType, name, accessToken, refreshToken); + return new MemberAuthResponseDTO(memberId, authType, memberName, accessToken, refreshToken); } } From dc0a6f2e74ce8da20c2dd0046439bd7feb541b6c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 03:11:28 +0900 Subject: [PATCH 119/465] =?UTF-8?q?[FIX]=20AuthService=20=EB=B0=8F=20Naver?= =?UTF-8?q?Service=20insert=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 11 ++++++----- .../domain/auth/service/AuthService.java | 2 ++ .../external/oauth/service/NaverAuthService.java | 3 +++ .../global/jwt/service/JwtService.java | 5 ++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index f8913df..a79f5d0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -41,7 +41,8 @@ public ResponseEntity> login( } @PostMapping("/reissue") - public ResponseEntity> reissue(HttpServletRequest request, HttpServletResponse response){ + public ResponseEntity> reissue(HttpServletRequest request, + HttpServletResponse response) { MemberReissueResponseDTO memberReissueResponseDTO = jwtService.reissueToken(request, response); return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.REISSUE_SUCCESS, memberReissueResponseDTO)); } @@ -49,10 +50,10 @@ public ResponseEntity> reissue(HttpServlet @GetMapping("/authTest") public String authTest(HttpServletRequest request, HttpServletResponse response) { - try{ - response.sendRedirect("https://nid.naver.com/oauth2.0/authorize?&client_id=l1su6a1jp2mTKIXQBqZD&redirect_uri=http://localhost:8080/login/oauth2/code/naver&response_type=code"); - } - catch (Exception e){ + try { + response.sendRedirect( + "https://nid.naver.com/oauth2.0/authorize?&client_id=iuUGaSHmzPMxKmNlc0BD&redirect_uri=http://localhost:8080/login/oauth2/code/naver&response_type=code"); + } catch (Exception e) { log.info("authTest = {}", e); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index b13f28f..dc39a11 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -7,9 +7,11 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Transactional(readOnly = true) +@Service @RequiredArgsConstructor public abstract class AuthService { private final MemberRepository memberRepository; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 882c5bf..5105313 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -9,10 +9,12 @@ import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.NaverTokenVO; import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import org.springframework.beans.factory.annotation.Value; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.stereotype.Service; @Service +@Transactional(readOnly = true) public class NaverAuthService extends AuthService { @Value("${naver.client-id}") @@ -27,6 +29,7 @@ public NaverAuthService(MemberRepository memberRepository) { } @Override + @Transactional public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index efa2e7d..0e85730 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -24,11 +24,13 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @Getter @Slf4j +@Transactional(readOnly = true) public class JwtService { private static final String AUTH_USER = "memberId"; private static final String BEARER = "Bearer "; @@ -52,7 +54,7 @@ public class JwtService { private final JwtTokenProvider jwtTokenProvider; private final RedisTokenRepository redisTokenRepository; - + @Transactional public MemberAuthResponseDTO issueToken(MemberSignUpVO vo, HttpServletResponse response) { String accessToken = jwtTokenProvider.createAccessToken(vo.email(), vo.memberId(), accessTokenExpirationPeriod); @@ -123,6 +125,7 @@ private String extractAccessToken(HttpServletRequest request) { } + @Transactional public void updateRefreshTokenByMemberId(Long memberId, String newRefreshToken) { redisTokenRepository.findByMemberId(String.valueOf(memberId)) .ifPresent(refreshToken -> { From f771b309119793b03a5be99c1fb40be605ebaa40 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 08:49:49 +0900 Subject: [PATCH 120/465] =?UTF-8?q?[REFACTOR]=20AuthService=20=EB=82=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=8A=B8=EB=9E=9C=EC=9E=AD=EC=85=98=20?= =?UTF-8?q?=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=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 --- .../nonsoolmateServer/domain/auth/service/AuthService.java | 1 + .../external/oauth/service/NaverAuthService.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index dc39a11..238a227 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -16,6 +16,7 @@ public abstract class AuthService { private final MemberRepository memberRepository; + @Transactional public abstract MemberSignUpVO saveMemberOrLogin(String platformType, MemberRequestDTO request); protected Member getMember(PlatformType platformType, String email) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 5105313..a5e59e9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -29,7 +29,6 @@ public NaverAuthService(MemberRepository memberRepository) { } @Override - @Transactional public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); From 192e29bc12924fc60270b8ad8874b74f9a111b00 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 08:55:23 +0900 Subject: [PATCH 121/465] =?UTF-8?q?[DEL]=20dummy.txt=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/university/controller/dummy.txt | 1 - .../nonsoolmateServer/domain/university/repository/dummy.txt | 1 - .../nonsoolmateServer/domain/university/service/dummy.txt | 1 - 3 files changed, 3 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 630de6d774af4060e3ea428ea01568b157548776 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 08:55:42 +0900 Subject: [PATCH 122/465] =?UTF-8?q?[ADD]=20UniversityExamResponseDTO=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 --- .../controller/dto/UniversityExamInfoResponseDTO.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamInfoResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamInfoResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamInfoResponseDTO.java new file mode 100644 index 0000000..1db95f9 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamInfoResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto; + +public record UniversityExamInfoResponseDTO(Long examId, String examName, int examTimeLimit) { + public static UniversityExamInfoResponseDTO of(Long examId, String examName, int examTimeLimit) { + return new UniversityExamInfoResponseDTO(examId, examName, examTimeLimit); + } +} From 1e8f19e32261c6be0c867377c0103630207de500 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 08:57:39 +0900 Subject: [PATCH 123/465] =?UTF-8?q?[ADD]=20UniversityExamRepository=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 --- .../university/repository/UniversityExamRepository.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java new file mode 100644 index 0000000..cc30933 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java @@ -0,0 +1,9 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.repository; + +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UniversityExamRepository extends JpaRepository { + Optional findByUniversityExamId(Long universityId); +} From e18ba0a61d19271dba5b0b5ec13bebc5310a6956 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 10:09:15 +0900 Subject: [PATCH 124/465] =?UTF-8?q?[ADD]=20UniversityExam=20Exception=20?= =?UTF-8?q?=EB=B0=8F=20Type=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/UniversityExamException.java | 10 +++++++ .../UniversityExamExceptionType.java | 28 +++++++++++++++++++ .../exception/UniversityExamSuccessType.java | 27 ++++++++++++++++++ .../domain/university/exception/dummy.txt | 1 - 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamException.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamException.java new file mode 100644 index 0000000..8a05c6e --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamException.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; + +public class UniversityExamException extends BusinessException { + public UniversityExamException(BusinessExceptionType exceptionType) { + super(exceptionType); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java new file mode 100644 index 0000000..8fd41b5 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java @@ -0,0 +1,28 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum UniversityExamExceptionType implements BusinessExceptionType { + + /** + * 404 Not Found + */ + NOT_FOUND_UNIVERSITY_EXAM(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java new file mode 100644 index 0000000..3015ab9 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java @@ -0,0 +1,27 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum UniversityExamSuccessType implements BusinessSucessType { + /** + * 200 OK + */ + GET_UNIVERSITY_EXAM_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return null; + } + + @Override + public String message() { + return null; + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 39ec08e2476c2fc49ca23928a9e5270b6497eb6c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 10:10:32 +0900 Subject: [PATCH 125/465] =?UTF-8?q?[FIX]=20examTimeLimit=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/entity/UniversityExam.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java index 7412d79..cdd90c3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java @@ -36,8 +36,8 @@ public class UniversityExam { private String examAnswerUrl; @NotNull - private Year examYear; + private int examYear; @NotNull - private Time examTimeLimit; + private int examTimeLimit; } \ No newline at end of file From 375d49403dc4fc1eb641645ac64b4a3510bbd86c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 10:11:34 +0900 Subject: [PATCH 126/465] =?UTF-8?q?[FEAT]=20UniversityExamService=20?= =?UTF-8?q?=EB=82=B4=EC=97=90=20getUniversityExam()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamService.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java new file mode 100644 index 0000000..ea46175 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -0,0 +1,26 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.service; + +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; +import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; + +@Service +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class UniversityExamService { + private final UniversityExamRepository universityExamRepository; + + public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { + UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) + .orElseThrow(() -> new UniversityExamException( + UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); + return UniversityExamInfoResponseDTO.of(universityExam.getUniversityExamId(), universityExam.getExamName(), + universityExam.getExamTimeLimit()); + } + +} From 411d420515aea4765eb14e940d05f8298ba9e935 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:01:24 +0900 Subject: [PATCH 127/465] =?UTF-8?q?[DEL]=20dummy=20file=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/controller/dummy.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 007c362b2beafbe608d4e62be994d5ab64326a68 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:17:03 +0900 Subject: [PATCH 128/465] =?UTF-8?q?[DEL]=20dummy.txt=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/service/dummy.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 0767d42e51584b2d1740776b83c9d14592ace772 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:32:46 +0900 Subject: [PATCH 129/465] =?UTF-8?q?[FEAT]=20SecurityUtil=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/util/SecurityUtil.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java new file mode 100644 index 0000000..ffa8b3a --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java @@ -0,0 +1,35 @@ +package com.nonsoolmate.nonsoolmateServer.global.security.util; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import org.springframework.security.core.context.SecurityContextHolder; + +public class SecurityUtil { + private static final String ANONYMOUS_USER = "anonymousUser"; + + public static Member getLoginMember() { + return getLoginMemberAuthInfo().getMember(); + } + + private static CustomAuthUser getLoginMemberAuthInfo() { + return (CustomAuthUser) + SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + } + + public static Map getLoginMemberInfo() { + Map memberInfoMap = new HashMap<>(); + memberInfoMap.put("member", getLoginMember()); + return memberInfoMap; + } + + private static Optional getUserAuthDetails() { + Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); + if (principal.equals(ANONYMOUS_USER)) { + return Optional.empty(); + } + return Optional.of((CustomAuthUser) principal); + } +} From d2803f035d32b24d39d4d9250cc764a338c09ac1 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:33:12 +0900 Subject: [PATCH 130/465] =?UTF-8?q?[ADD]=20MemberSuccessType=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 --- .../member/exception/MemberSuccessType.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java new file mode 100644 index 0000000..3b45b98 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java @@ -0,0 +1,23 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor +public enum MemberSuccessType implements BusinessSucessType { + GET_MEMBER_NAME_SUCCESS(HttpStatus.OK, "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} From e60d7fdc3c539a4756f993e432065ebac1c20b1f Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:34:16 +0900 Subject: [PATCH 131/465] =?UTF-8?q?[FEAT]=20MyController=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MyController.java | 24 +++++++++++++++++++ .../dto/response/nicknameResponseDTO.java | 7 ++++++ 2 files changed, 31 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java new file mode 100644 index 0000000..5194700 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -0,0 +1,24 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller; + +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; +import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/my") +@RequiredArgsConstructor +public class MyController { + private final MemberService memberService; + + @GetMapping("/name") + public ResponseEntity> getName() { + return ResponseEntity.ok() + .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname())); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java new file mode 100644 index 0000000..24bd2b6 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; + +public record nicknameResponseDTO(String memberName) { + static public nicknameResponseDTO of(String memberName) { + return new nicknameResponseDTO(memberName); + } +} From 75ea79456ece08c7997b7323b4abb64a744c9edb Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:34:53 +0900 Subject: [PATCH 132/465] =?UTF-8?q?[FEAT]=20MemberService=20=EB=82=B4=20ge?= =?UTF-8?q?tName()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/MemberService.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java new file mode 100644 index 0000000..ce38924 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -0,0 +1,21 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.service; + +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; +import com.nonsoolmate.nonsoolmateServer.global.security.util.SecurityUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class MemberService { + private final MemberRepository memberRepository; + + public nicknameResponseDTO getNickname() { + Member member = SecurityUtil.getLoginMember(); + return nicknameResponseDTO.of(member.getName()); + } +} From 5a2c8ad3548d77fd7c87f0c461df3656ebf66bea Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 11:30:12 +0900 Subject: [PATCH 133/465] =?UTF-8?q?[FEAT]=20CustomAuthUser=EC=97=90?= =?UTF-8?q?=EC=84=9C=20getUsername()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/global/security/CustomAuthUser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/CustomAuthUser.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/CustomAuthUser.java index da4a38a..f4b1e1c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/CustomAuthUser.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/CustomAuthUser.java @@ -14,6 +14,7 @@ public class CustomAuthUser implements UserDetails { private final Member member; private final Role authority; + @Override public Collection getAuthorities() { return null; @@ -26,7 +27,7 @@ public String getPassword() { @Override public String getUsername() { - return null; + return member.getName(); } @Override From 6966a1339d0398ae2ab8e0cf5aa942b3828b40f7 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 11:31:14 +0900 Subject: [PATCH 134/465] =?UTF-8?q?[FEAT]=20UniversityExamController=20get?= =?UTF-8?q?UniversityExam()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamController.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java new file mode 100644 index 0000000..0ed81f5 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -0,0 +1,21 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.controller; + +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.service.UniversityExamService; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/university/exam") +@RequiredArgsConstructor +public class UniversityExamController { + private final UniversityExamService universityExamService; + + @GetMapping("/info/{id}") + public UniversityExamInfoResponseDTO getUniversityExam(@PathVariable("id") Long universityExamId) { + return universityExamService.getUniversityExam(universityExamId); + } +} From 91a9db0ebfbd9797dbb30052f202ccb82c160809 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:48:04 +0900 Subject: [PATCH 135/465] =?UTF-8?q?[ADD]=20=EC=B2=A8=EC=82=AD=EA=B6=8C=20?= =?UTF-8?q?=EA=B0=9C=EC=88=98=20=EC=A1=B0=ED=9A=8C=20SuccessType=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/member/exception/MemberSuccessType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java index 3b45b98..45e5256 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java @@ -6,7 +6,8 @@ @RequiredArgsConstructor public enum MemberSuccessType implements BusinessSucessType { - GET_MEMBER_NAME_SUCCESS(HttpStatus.OK, "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + GET_MEMBER_NAME_SUCCESS(HttpStatus.OK, "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + GET_MEMBER_TICKET_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From 87cbf9dba54e44cf3b8b2b5d16cc4fc42a58325c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:48:50 +0900 Subject: [PATCH 136/465] =?UTF-8?q?[REFACTOR]=20nickname=20->=20name=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=A6=AC=ED=8C=A9=ED=84=B0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 4 ++-- .../member/controller/dto/response/NameResponseDTO.java | 7 +++++++ .../controller/dto/response/nicknameResponseDTO.java | 7 ------- .../domain/member/service/MemberService.java | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 5194700..289eb6b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.controller; -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; @@ -17,7 +17,7 @@ public class MyController { private final MemberService memberService; @GetMapping("/name") - public ResponseEntity> getName() { + public ResponseEntity> getName() { return ResponseEntity.ok() .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname())); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java new file mode 100644 index 0000000..70f2a93 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; + +public record NameResponseDTO(String memberName) { + static public NameResponseDTO of(String memberName) { + return new NameResponseDTO(memberName); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java deleted file mode 100644 index 24bd2b6..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; - -public record nicknameResponseDTO(String memberName) { - static public nicknameResponseDTO of(String memberName) { - return new nicknameResponseDTO(memberName); - } -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index ce38924..477aac0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.service; -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.global.security.util.SecurityUtil; @@ -14,8 +14,8 @@ public class MemberService { private final MemberRepository memberRepository; - public nicknameResponseDTO getNickname() { + public NameResponseDTO getNickname() { Member member = SecurityUtil.getLoginMember(); - return nicknameResponseDTO.of(member.getName()); + return NameResponseDTO.of(member.getName()); } } From ff499fef62d515a64f36eb9866c1f8ce6bb02634 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:49:57 +0900 Subject: [PATCH 137/465] =?UTF-8?q?[ADD]=20TicketResponseDTO=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 --- .../member/controller/dto/response/TicketResponseDTO.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java new file mode 100644 index 0000000..ccd6060 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; + +public record TicketResponseDTO(String memberName, int ticketCount) { + static public TicketResponseDTO of(String memberName, int ticketCount) { + return new TicketResponseDTO(memberName, ticketCount); + } +} From 5b079ee9e505812bc5b7dd810991929a4d6cfcfd Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:50:46 +0900 Subject: [PATCH 138/465] =?UTF-8?q?[FEAT]=20MemberService=20getTicket()=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/MemberService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index 477aac0..1c859c1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -1,6 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.service; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.global.security.util.SecurityUtil; @@ -18,4 +19,9 @@ public NameResponseDTO getNickname() { Member member = SecurityUtil.getLoginMember(); return NameResponseDTO.of(member.getName()); } + + public TicketResponseDTO getTicket() { + Member member = SecurityUtil.getLoginMember(); + return TicketResponseDTO.of(member.getName(), member.getTicketCount()); + } } From b7629adb8a275db57bbbbc67fe9a0d220d5c3638 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:52:22 +0900 Subject: [PATCH 139/465] =?UTF-8?q?[FEAT]=20MyController=20getTicket()=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 289eb6b..11cb895 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -1,6 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.controller; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; @@ -21,4 +22,10 @@ public ResponseEntity> getName() { return ResponseEntity.ok() .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname())); } + + @GetMapping("/ticket") + public ResponseEntity> getTicket() { + return ResponseEntity.ok() + .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_TICKET_SUCCESS, memberService.getTicket())); + } } From 0a73878325da4c4cbec4e4915599f9375a3a17dd Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 03:10:51 +0900 Subject: [PATCH 140/465] =?UTF-8?q?[REFACTOR]=20name=20->=20memberName?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=ED=95=84=EB=93=9C=20=ED=86=B5=EC=9D=BC?= =?UTF-8?q?=EC=84=B1=20=EC=9E=88=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/dto/response/MemberAuthResponseDTO.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java index 5b7a169..2c3fd98 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java @@ -3,10 +3,10 @@ import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import jakarta.validation.constraints.NotNull; -public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String name, +public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String memberName, @NotNull String accessToken, @NotNull String refreshToken) { - public static MemberAuthResponseDTO of(Long memberId, AuthType authType, String name, String accessToken, + public static MemberAuthResponseDTO of(Long memberId, AuthType authType, String memberName, String accessToken, String refreshToken) { - return new MemberAuthResponseDTO(memberId, authType, name, accessToken, refreshToken); + return new MemberAuthResponseDTO(memberId, authType, memberName, accessToken, refreshToken); } } From 9bd93723e2d25057824867ffd0690e644a25a6a3 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 03:11:28 +0900 Subject: [PATCH 141/465] =?UTF-8?q?[FIX]=20AuthService=20=EB=B0=8F=20Naver?= =?UTF-8?q?Service=20insert=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 11 ++++++----- .../domain/auth/service/AuthService.java | 2 ++ .../external/oauth/service/NaverAuthService.java | 3 +++ .../global/jwt/service/JwtService.java | 5 ++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index f8913df..a79f5d0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -41,7 +41,8 @@ public ResponseEntity> login( } @PostMapping("/reissue") - public ResponseEntity> reissue(HttpServletRequest request, HttpServletResponse response){ + public ResponseEntity> reissue(HttpServletRequest request, + HttpServletResponse response) { MemberReissueResponseDTO memberReissueResponseDTO = jwtService.reissueToken(request, response); return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.REISSUE_SUCCESS, memberReissueResponseDTO)); } @@ -49,10 +50,10 @@ public ResponseEntity> reissue(HttpServlet @GetMapping("/authTest") public String authTest(HttpServletRequest request, HttpServletResponse response) { - try{ - response.sendRedirect("https://nid.naver.com/oauth2.0/authorize?&client_id=l1su6a1jp2mTKIXQBqZD&redirect_uri=http://localhost:8080/login/oauth2/code/naver&response_type=code"); - } - catch (Exception e){ + try { + response.sendRedirect( + "https://nid.naver.com/oauth2.0/authorize?&client_id=iuUGaSHmzPMxKmNlc0BD&redirect_uri=http://localhost:8080/login/oauth2/code/naver&response_type=code"); + } catch (Exception e) { log.info("authTest = {}", e); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index b13f28f..dc39a11 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -7,9 +7,11 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Transactional(readOnly = true) +@Service @RequiredArgsConstructor public abstract class AuthService { private final MemberRepository memberRepository; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 882c5bf..5105313 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -9,10 +9,12 @@ import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.NaverTokenVO; import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import org.springframework.beans.factory.annotation.Value; +import org.springframework.transaction.annotation.Transactional; import org.springframework.web.reactive.function.client.WebClient; import org.springframework.stereotype.Service; @Service +@Transactional(readOnly = true) public class NaverAuthService extends AuthService { @Value("${naver.client-id}") @@ -27,6 +29,7 @@ public NaverAuthService(MemberRepository memberRepository) { } @Override + @Transactional public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index efa2e7d..0e85730 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -24,11 +24,13 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor @Getter @Slf4j +@Transactional(readOnly = true) public class JwtService { private static final String AUTH_USER = "memberId"; private static final String BEARER = "Bearer "; @@ -52,7 +54,7 @@ public class JwtService { private final JwtTokenProvider jwtTokenProvider; private final RedisTokenRepository redisTokenRepository; - + @Transactional public MemberAuthResponseDTO issueToken(MemberSignUpVO vo, HttpServletResponse response) { String accessToken = jwtTokenProvider.createAccessToken(vo.email(), vo.memberId(), accessTokenExpirationPeriod); @@ -123,6 +125,7 @@ private String extractAccessToken(HttpServletRequest request) { } + @Transactional public void updateRefreshTokenByMemberId(Long memberId, String newRefreshToken) { redisTokenRepository.findByMemberId(String.valueOf(memberId)) .ifPresent(refreshToken -> { From 194999459bbbc134bf6ec4b37ddf514b4456cb51 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 08:49:49 +0900 Subject: [PATCH 142/465] =?UTF-8?q?[REFACTOR]=20AuthService=20=EB=82=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=8A=B8=EB=9E=9C=EC=9E=AD=EC=85=98=20?= =?UTF-8?q?=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=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 --- .../nonsoolmateServer/domain/auth/service/AuthService.java | 1 + .../external/oauth/service/NaverAuthService.java | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index dc39a11..238a227 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -16,6 +16,7 @@ public abstract class AuthService { private final MemberRepository memberRepository; + @Transactional public abstract MemberSignUpVO saveMemberOrLogin(String platformType, MemberRequestDTO request); protected Member getMember(PlatformType platformType, String email) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 5105313..a5e59e9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -29,7 +29,6 @@ public NaverAuthService(MemberRepository memberRepository) { } @Override - @Transactional public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); From 6d57c327724973e9616e193d9811ed391b999f46 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 12:21:18 +0900 Subject: [PATCH 143/465] =?UTF-8?q?[REFACTOR]=20@AuthenticationPrincipal?= =?UTF-8?q?=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/controller/MyController.java | 13 ++++--- .../domain/member/service/MemberService.java | 8 ++--- .../global/security/AuthUser.java | 13 +++++++ .../global/security/util/SecurityUtil.java | 35 ------------------- 4 files changed, 25 insertions(+), 44 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/AuthUser.java delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 11cb895..8d94027 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -2,9 +2,12 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -18,14 +21,16 @@ public class MyController { private final MemberService memberService; @GetMapping("/name") - public ResponseEntity> getName() { + public ResponseEntity> getName(@AuthUser Member member) { return ResponseEntity.ok() - .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname())); + .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, + memberService.getNickname(member))); } @GetMapping("/ticket") - public ResponseEntity> getTicket() { + public ResponseEntity> getTicket(@AuthUser Member member) { return ResponseEntity.ok() - .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_TICKET_SUCCESS, memberService.getTicket())); + .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_TICKET_SUCCESS, + memberService.getTicket(member))); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index 1c859c1..e00cd93 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -4,7 +4,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; -import com.nonsoolmate.nonsoolmateServer.global.security.util.SecurityUtil; +import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -15,13 +15,11 @@ public class MemberService { private final MemberRepository memberRepository; - public NameResponseDTO getNickname() { - Member member = SecurityUtil.getLoginMember(); + public NameResponseDTO getNickname(Member member) { return NameResponseDTO.of(member.getName()); } - public TicketResponseDTO getTicket() { - Member member = SecurityUtil.getLoginMember(); + public TicketResponseDTO getTicket(Member member) { return TicketResponseDTO.of(member.getName(), member.getTicketCount()); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/AuthUser.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/AuthUser.java new file mode 100644 index 0000000..9e3d470 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/AuthUser.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.global.security; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.security.core.annotation.AuthenticationPrincipal; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.PARAMETER) +@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") +public @interface AuthUser { +} \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java deleted file mode 100644 index ffa8b3a..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/util/SecurityUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.security.util; - -import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; -import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import org.springframework.security.core.context.SecurityContextHolder; - -public class SecurityUtil { - private static final String ANONYMOUS_USER = "anonymousUser"; - - public static Member getLoginMember() { - return getLoginMemberAuthInfo().getMember(); - } - - private static CustomAuthUser getLoginMemberAuthInfo() { - return (CustomAuthUser) - SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - } - - public static Map getLoginMemberInfo() { - Map memberInfoMap = new HashMap<>(); - memberInfoMap.put("member", getLoginMember()); - return memberInfoMap; - } - - private static Optional getUserAuthDetails() { - Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal(); - if (principal.equals(ANONYMOUS_USER)) { - return Optional.empty(); - } - return Optional.of((CustomAuthUser) principal); - } -} From f5011f666dc278cc7f1f2fd6d305d9c373dc1275 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 12:45:03 +0900 Subject: [PATCH 144/465] =?UTF-8?q?[FEAT]=20getUniversityExam=20Reponse=20?= =?UTF-8?q?=ED=98=95=EC=8B=9D=20=EB=A7=9E=EC=B6=94=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/controller/UniversityExamController.java | 9 +++++++-- .../university/exception/UniversityExamSuccessType.java | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index 0ed81f5..99dc533 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -1,8 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.controller; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.university.service.UniversityExamService; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -15,7 +18,9 @@ public class UniversityExamController { private final UniversityExamService universityExamService; @GetMapping("/info/{id}") - public UniversityExamInfoResponseDTO getUniversityExam(@PathVariable("id") Long universityExamId) { - return universityExamService.getUniversityExam(universityExamId); + public ResponseEntity> getUniversityExam( + @PathVariable("id") Long universityExamId) { + return ResponseEntity.ok().body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_SUCCESS, + universityExamService.getUniversityExam(universityExamId))); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java index 3015ab9..1379de2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java @@ -17,11 +17,11 @@ public enum UniversityExamSuccessType implements BusinessSucessType { @Override public HttpStatus status() { - return null; + return this.status; } @Override public String message() { - return null; + return this.message; } } From bea8a9838c74dbecc639ec078f05e55aec7509e5 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 12:46:20 +0900 Subject: [PATCH 145/465] =?UTF-8?q?[CHORE]=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=ED=95=B8=EB=93=A4=EB=9F=AC=EC=97=90=EC=84=9C=20handleServerExc?= =?UTF-8?q?eption=20=EB=B0=98=ED=99=98=20status=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/global/error/GlobalExceptionHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index fbc9cac..ac9cbb1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -23,7 +23,7 @@ protected ResponseEntity handleCustomException(BusinessException ex @ExceptionHandler({Exception.class}) protected ResponseEntity handleServerException(Exception ex) { log.error(ex.getMessage()); - return ResponseEntity.status(HttpStatus.BAD_GATEWAY) + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(ApiResponse.error(CommonErrorType.INTERNAL_SERVER_ERROR)); } From 1d2a76bc06cadb44e25330d16a2e6ecdbe962346 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:34:16 +0900 Subject: [PATCH 146/465] =?UTF-8?q?[FEAT]=20MyController=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 1 - .../controller/dto/response/nicknameResponseDTO.java | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 8d94027..70bdfd1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -7,7 +7,6 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; -import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java new file mode 100644 index 0000000..24bd2b6 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; + +public record nicknameResponseDTO(String memberName) { + static public nicknameResponseDTO of(String memberName) { + return new nicknameResponseDTO(memberName); + } +} From 90408b8b28e53e2dfbade79e642a2d5bcc418ec4 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:34:53 +0900 Subject: [PATCH 147/465] =?UTF-8?q?[FEAT]=20MemberService=20=EB=82=B4=20ge?= =?UTF-8?q?tName()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/MemberService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index e00cd93..39ce38a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -1,7 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.service; +<<<<<<< HEAD import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; +======= +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +>>>>>>> 6409e08 ([FEAT] MemberService ๋‚ด getName() ๊ตฌํ˜„) import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; From 79617e8efc9a4d96f68f0c45b91ef723f8ac5092 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:48:50 +0900 Subject: [PATCH 148/465] =?UTF-8?q?[REFACTOR]=20nickname=20->=20name=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=A6=AC=ED=8C=A9=ED=84=B0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 13 +++++++++++++ .../dto/response/nicknameResponseDTO.java | 7 ------- .../domain/member/service/MemberService.java | 4 ++++ 3 files changed, 17 insertions(+), 7 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 70bdfd1..bd330b8 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -1,8 +1,21 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.controller; +<<<<<<< HEAD import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +======= +<<<<<<< HEAD +<<<<<<< HEAD +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; +======= +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; +>>>>>>> a7a4415 ([FEAT] MyController ๊ฐœ๋ฐœ) +======= +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; +>>>>>>> 0660a64 ([REFACTOR] nickname -> name ๋„ค์ด๋ฐ ๋ฆฌํŒฉํ„ฐ๋ง) +>>>>>>> 726184a ([REFACTOR] nickname -> name ๋„ค์ด๋ฐ ๋ฆฌํŒฉํ„ฐ๋ง) import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java deleted file mode 100644 index 24bd2b6..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/nicknameResponseDTO.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; - -public record nicknameResponseDTO(String memberName) { - static public nicknameResponseDTO of(String memberName) { - return new nicknameResponseDTO(memberName); - } -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index 39ce38a..1d1f374 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -1,11 +1,15 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.service; +<<<<<<< HEAD <<<<<<< HEAD import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; ======= import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; >>>>>>> 6409e08 ([FEAT] MemberService ๋‚ด getName() ๊ตฌํ˜„) +======= +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; +>>>>>>> 0660a64 ([REFACTOR] nickname -> name ๋„ค์ด๋ฐ ๋ฆฌํŒฉํ„ฐ๋ง) import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; From 65e1e08ef960c6b9675e0c44becab603aec8746d Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:50:46 +0900 Subject: [PATCH 149/465] =?UTF-8?q?[FEAT]=20MemberService=20getTicket()=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/service/MemberService.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index 1d1f374..e00cd93 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -1,15 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.service; -<<<<<<< HEAD -<<<<<<< HEAD import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; -======= -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; ->>>>>>> 6409e08 ([FEAT] MemberService ๋‚ด getName() ๊ตฌํ˜„) -======= -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; ->>>>>>> 0660a64 ([REFACTOR] nickname -> name ๋„ค์ด๋ฐ ๋ฆฌํŒฉํ„ฐ๋ง) import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.global.security.CustomAuthUser; From 66b98fc8d3a66dbd9d47235a2bbe9dcb8f9289e2 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 01:52:22 +0900 Subject: [PATCH 150/465] =?UTF-8?q?[FEAT]=20MyController=20getTicket()=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index bd330b8..70bdfd1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -1,21 +1,8 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.controller; -<<<<<<< HEAD import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; -======= -<<<<<<< HEAD -<<<<<<< HEAD -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; -======= -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.nicknameResponseDTO; ->>>>>>> a7a4415 ([FEAT] MyController ๊ฐœ๋ฐœ) -======= -import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; ->>>>>>> 0660a64 ([REFACTOR] nickname -> name ๋„ค์ด๋ฐ ๋ฆฌํŒฉํ„ฐ๋ง) ->>>>>>> 726184a ([REFACTOR] nickname -> name ๋„ค์ด๋ฐ ๋ฆฌํŒฉํ„ฐ๋ง) import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; From 94c584cfeec49a0d955c4db64671c013226afd11 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 03:11:28 +0900 Subject: [PATCH 151/465] =?UTF-8?q?[FIX]=20AuthService=20=EB=B0=8F=20Naver?= =?UTF-8?q?Service=20insert=20=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/oauth/service/NaverAuthService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index a5e59e9..5105313 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -29,6 +29,7 @@ public NaverAuthService(MemberRepository memberRepository) { } @Override + @Transactional public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); From ff2dc56c222319e66512a1213d6712b07e1ef014 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 08:49:49 +0900 Subject: [PATCH 152/465] =?UTF-8?q?[REFACTOR]=20AuthService=20=EB=82=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=8A=B8=EB=9E=9C=EC=9E=AD=EC=85=98=20?= =?UTF-8?q?=EC=96=B4=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=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 --- .../external/oauth/service/NaverAuthService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 5105313..a5e59e9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -29,7 +29,6 @@ public NaverAuthService(MemberRepository memberRepository) { } @Override - @Transactional public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); From fc44149f66e41c1eaff2b224b362fe781b2a09dc Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 15:06:13 +0900 Subject: [PATCH 153/465] =?UTF-8?q?[CHORE]=20gitignore=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/.gitignore b/nonsoolmateServer/.gitignore index d131927..b778e8a 100644 --- a/nonsoolmateServer/.gitignore +++ b/nonsoolmateServer/.gitignore @@ -38,4 +38,5 @@ out/ ## setting file *.yml -*.yaml \ No newline at end of file +*.yaml +!**/resoruces/**/data/ \ No newline at end of file From 8a3ce91a9b8548f6e015bc44febc1a1cd20c50c6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 15:09:45 +0900 Subject: [PATCH 154/465] =?UTF-8?q?[CHORE]=20gitignore=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 --- nonsoolmateServer/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/.gitignore b/nonsoolmateServer/.gitignore index b778e8a..a52bd78 100644 --- a/nonsoolmateServer/.gitignore +++ b/nonsoolmateServer/.gitignore @@ -39,4 +39,4 @@ out/ ## setting file *.yml *.yaml -!**/resoruces/**/data/ \ No newline at end of file +*.sql \ No newline at end of file From 914426dc7b5bd3820c31a76ce54bd10c2cb04081 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 16:56:29 +0900 Subject: [PATCH 155/465] =?UTF-8?q?[DEL]=20=EB=8D=94=EB=AF=B8=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/selectUniversity/exception/dummy.txt | 1 - .../domain/selectUniversity/repository/dummy.txt | 1 - .../nonsoolmateServer/domain/selectUniversity/service/dummy.txt | 1 - 3 files changed, 3 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 7e280fd427e501889ca647b520aabfacbc7e9e79 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 16:56:51 +0900 Subject: [PATCH 156/465] =?UTF-8?q?[ADD]=20sql=20=ED=8C=8C=EC=9D=BC=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 --- nonsoolmateServer/.gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/.gitignore b/nonsoolmateServer/.gitignore index d131927..497f440 100644 --- a/nonsoolmateServer/.gitignore +++ b/nonsoolmateServer/.gitignore @@ -38,4 +38,6 @@ out/ ## setting file *.yml -*.yaml \ No newline at end of file +*.yaml + +*.sql \ No newline at end of file From c7a8b0e4feb21f2bf6b83c5f8a82862d742cf5af Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 16:57:07 +0900 Subject: [PATCH 157/465] =?UTF-8?q?[ADD]=20UniversityExamImageResponseDTO?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/dto/UniversityExamImageResponseDTO.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageResponseDTO.java new file mode 100644 index 0000000..ed4279a --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto; + +public record UniversityExamImageResponseDTO(String examImgUrl) { + static public UniversityExamImageResponseDTO of(String examImgUrl) { + return new UniversityExamImageResponseDTO(examImgUrl); + } +} From 0e555a13eabd993e7168659aced5c30b67ee680e Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 16:57:44 +0900 Subject: [PATCH 158/465] =?UTF-8?q?[ADD]=20"/actuator/health"=20white=20li?= =?UTF-8?q?st=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 9772daf..e7d7602 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -34,7 +34,7 @@ public class SecurityConfig { "/auth/**", "/login/**","/authTest", // client - "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**" + "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**", "/actuator/health" }; private final JwtAuthenticationFilter jwtAuthenticationFilter; From 73c0fef56870b722d87452bb921e878cd0aac8ae Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 16:57:50 +0900 Subject: [PATCH 159/465] =?UTF-8?q?[ADD]=20UniversityExamSuccessType=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/university/exception/UniversityExamSuccessType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java index 1379de2..28c23a1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java @@ -10,7 +10,8 @@ public enum UniversityExamSuccessType implements BusinessSucessType { /** * 200 OK */ - GET_UNIVERSITY_EXAM_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"); + GET_UNIVERSITY_EXAM_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), + GET_UNIVERSITY_EXAM_IMAGE_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"); private final HttpStatus status; private final String message; From c4aedbff4a5736d2730487681f9bbafd32090aaf Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 16:58:21 +0900 Subject: [PATCH 160/465] =?UTF-8?q?[ADD]=20UniversityExamImageRepository?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/UniversityExamImageRepository.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java new file mode 100644 index 0000000..2c01faa --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java @@ -0,0 +1,11 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.repository; + +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExamImage; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UniversityExamImageRepository extends JpaRepository { + Page findAllByUniversityExam(UniversityExam universityExam, Pageable pageable); +} From 5214bcd5de8892a98cb3498dfc3e158ffb9e0887 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 16:59:20 +0900 Subject: [PATCH 161/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=A1=B0=ED=9A=8C=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SelectUniversityController.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java new file mode 100644 index 0000000..ced28a5 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java @@ -0,0 +1,28 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller; + +import static com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception.SelectUniversitySuccessType.GET_SELECT_UNIVERSITIES_SUCCESS; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.service.SelectUniversityService; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/select-university") +public class SelectUniversityController { + + private final SelectUniversityService selectUniversityService; + @GetMapping + public ResponseEntity>> getSelectUniversities(@AuthUser Member member){ + + return ResponseEntity.ok().body(ApiResponse.success(GET_SELECT_UNIVERSITIES_SUCCESS, selectUniversityService.getSelectUniversities(member))); + } +} From 6372d971d06115d51fa5f38e9206cc4a68b0f05c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 16:59:24 +0900 Subject: [PATCH 162/465] =?UTF-8?q?[FEAT]=20UniversityExamService=20getUni?= =?UTF-8?q?versityExamImages()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamService.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index ea46175..98aab68 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -1,10 +1,15 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.service; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExamImage; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType; +import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamImageRepository; 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; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; @@ -14,6 +19,7 @@ @RequiredArgsConstructor public class UniversityExamService { private final UniversityExamRepository universityExamRepository; + private final UniversityExamImageRepository universityExamImageRepository; public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) @@ -23,4 +29,14 @@ public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { universityExam.getExamTimeLimit()); } -} + public Page getUniversityExamImages(Long id, Pageable pageable) { + UniversityExam universityExam = universityExamRepository.findByUniversityExamId(id) + .orElseThrow(() -> new UniversityExamException( + UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); + Page universityExamImages = universityExamImageRepository.findAllByUniversityExam( + universityExam, + pageable); + return universityExamImages.map(image -> UniversityExamImageResponseDTO.of(image.getUniversityExamImageUrl())); + } + +} \ No newline at end of file From 8abf875decdc21dee420993caf93b57052322a22 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 16:59:58 +0900 Subject: [PATCH 163/465] =?UTF-8?q?[ADD]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC=20=ED=81=B4?= =?UTF-8?q?=EB=9E=98=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/SelectUniversityException.java | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityException.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityException.java new file mode 100644 index 0000000..859eae5 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityException.java @@ -0,0 +1,8 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; + +public class SelectUniversityException extends BusinessException { + public SelectUniversityException(BusinessExceptionType exceptionType) {super(exceptionType);} +} From a0df6a3c4e9d16e15c53f0edd20759ce866b08f6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 17:00:17 +0900 Subject: [PATCH 164/465] =?UTF-8?q?[FEAT]=20UniversityExamController=20get?= =?UTF-8?q?UniversityExamImages()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamController.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index 99dc533..e74884d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -1,14 +1,19 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.controller; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.university.service.UniversityExamService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController @@ -23,4 +28,13 @@ public ResponseEntity> getUniversityE return ResponseEntity.ok().body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_SUCCESS, universityExamService.getUniversityExam(universityExamId))); } + + @GetMapping("{id}/image") + public ResponseEntity>> getUniversityExamImages( + @PathVariable("id") Long id, @RequestParam(defaultValue = "0") int page, Pageable pageable) { + PageRequest pageRequest = PageRequest.of(page, 1); + Page images = universityExamService.getUniversityExamImages(id, pageRequest); + return ResponseEntity.ok() + .body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_SUCCESS, images)); + } } From 56d07b2b779fb6e06a76b8baf9c9f0e0a94ea77c Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 17:00:44 +0900 Subject: [PATCH 165/465] =?UTF-8?q?[ADD]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=84=B1=EA=B3=B5,=20=EC=8B=A4=ED=8C=A8=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20enum=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SelectUniversityExceptionType.java | 22 ++++++++++++++++++ .../SelectUniversitySuccessType.java | 23 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java new file mode 100644 index 0000000..387e8aa --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java @@ -0,0 +1,22 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) + +public enum SelectUniversityExceptionType implements BusinessExceptionType { + ; + + @Override + public HttpStatus status() { + return null; + } + + @Override + public String message() { + return null; + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java new file mode 100644 index 0000000..b542226 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java @@ -0,0 +1,23 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor +public enum SelectUniversitySuccessType implements BusinessSucessType { + GET_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} From c3a652f59d5622b97c891f2f8e95a18cf77da240 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 17:01:28 +0900 Subject: [PATCH 166/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=A1=B0=ED=9A=8C=20Repository=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/SelectUniversityRepository.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java new file mode 100644 index 0000000..a9a3955 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.repository; + + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.entity.SelectUniversity; +import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface SelectUniversityRepository extends JpaRepository { + + List findAllByMember(Member member); + +} From fa22dd5e64de992b66e2af1a765cc07784451e6f Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 17:01:42 +0900 Subject: [PATCH 167/465] =?UTF-8?q?[ADD]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=A1=B0=ED=9A=8C=20DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SelectUniversityResponseDTO.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java new file mode 100644 index 0000000..1f38d9a --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; + + +public record SelectUniversityResponseDTO( + Long universityId, String universityName, boolean memberStatus +) { + static public SelectUniversityResponseDTO of(Long universityId, String universityName, boolean memberStatus) { + return new SelectUniversityResponseDTO(universityId, universityName, memberStatus); + } +} From e5d112a6dadc296929f36e6b167f62a2b95c1ae0 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 17:01:51 +0900 Subject: [PATCH 168/465] =?UTF-8?q?[ADD]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=A1=B0=ED=9A=8C=20Service=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java new file mode 100644 index 0000000..6ef0495 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -0,0 +1,42 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.service; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.entity.SelectUniversity; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.repository.SelectUniversityRepository; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; +import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityRepository; +import java.util.ArrayList; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class SelectUniversityService { + private final SelectUniversityRepository selectUniversityRepository; + private final UniversityRepository universityRepository; + + + public List getSelectUniversities(Member member){ + List selectUniversities = selectUniversityRepository.findAllByMember(member); + List selectUniversityResponseDTOS = new ArrayList<>(); + + universityRepository.findAll().stream().forEach(university -> { + boolean status = false; + + for(SelectUniversity selectUniversity : selectUniversities){ + if(university.getUniversityId() == selectUniversity.getUniversity().getUniversityId()){ + status = true; + } + } + selectUniversityResponseDTOS.add(SelectUniversityResponseDTO.of(university.getUniversityId(), + university.getUniversityName() + university.getUniversityCollege(), status)); + + }); + + return selectUniversityResponseDTOS; + } +} From 80d6919ded1ff0407fbb7f2ba4d0d303e538b276 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 17:02:31 +0900 Subject: [PATCH 169/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=A1=B0=ED=9A=8C=20Repository=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/repository/UniversityRepository.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java new file mode 100644 index 0000000..9a88ad4 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java @@ -0,0 +1,9 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.repository; + +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; +import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UniversityRepository extends JpaRepository { + List findAll(); +} From 68560469011fa68d47055557504c97ec18cffc9d Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 9 Jan 2024 17:02:42 +0900 Subject: [PATCH 170/465] [DEL] sql --- .../src/main/resources/init/data.sql | 44 +++++++++++++++++++ .../src/main/resources/init/schema.sql | 16 +++++++ 2 files changed, 60 insertions(+) create mode 100644 nonsoolmateServer/src/main/resources/init/data.sql create mode 100644 nonsoolmateServer/src/main/resources/init/schema.sql diff --git a/nonsoolmateServer/src/main/resources/init/data.sql b/nonsoolmateServer/src/main/resources/init/data.sql new file mode 100644 index 0000000..3f57ee0 --- /dev/null +++ b/nonsoolmateServer/src/main/resources/init/data.sql @@ -0,0 +1,44 @@ +INSERT INTO member (birth_year, gender, ticket_count, member_id, ticket_previous_publication_time, phone_number, email, + name, platform_type, role) +VALUES ('2001', 'F', 5, DEFAULT, '2024-01-09 12:30:00.000000', '010-4688-4301', 'wlgns72@naver.com', '๊น€์„ฑ์€', 'NAVER', + 'USER'), + ('1999', 'M', 5, DEFAULT, '2024-01-09 12:30:00.000000', '010-9472-6796', 'thdalsrb79@naver.com', '์†ก๋ฏผ๊ทœ', 'NAVER', + 'USER'); +INSERT INTO university (university_id, university_college, university_name) +VALUES (1, '์ธ๋ฌธ', '์ˆ™๋ช…์—ฌ์ž๋Œ€ํ•™๊ต'), + (2, '์ธ๋ฌธ์‚ฌํšŒ', '์ค‘์•™๋Œ€ํ•™๊ต'), + (3, '์ธ๋ฌธ์‚ฌํšŒ', 'ํ•œ์–‘๋Œ€ํ•™๊ต'); + +INSERT INTO university_exam (exam_time_limit, exam_year, university_exam_id, university_id, exam_answer_url, exam_name) +VALUES (70, 2021, 1, 1, 'http://example.com/answer1', '์ˆ™๋ช…์—ฌ์ž๋Œ€ํ•™๊ต ์ธ๋ฌธ1'), + (60, 2022, 2, 1, 'http://example.com/answer2', '์ˆ™๋ช…์—ฌ์ž๋Œ€ํ•™๊ต ์ธ๋ฌธ2'), + (90, 2023, 3, 1, 'http://example.com/answer3', '์ˆ™๋ช…์—ฌ์ž๋Œ€ํ•™๊ต ์ธ๋ฌธ3'); + +INSERT INTO university_exam (exam_time_limit, exam_year, university_exam_id, university_id, exam_answer_url, exam_name) +VALUES (70, 2021, 4, 2, 'http://example.com/answer1', '์ค‘์•™๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ1'), + (60, 2022, 5, 2, 'http://example.com/answer2', '์ค‘์•™๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ2'), + (90, 2023, 6, 2, 'http://example.com/answer3', '์ค‘์•™๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ3'); + +INSERT INTO university_exam (exam_time_limit, exam_year, university_exam_id, university_id, exam_answer_url, exam_name) +VALUES (70, 2021, 7, 3, 'http://example.com/answer1', 'ํ•œ์–‘๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ1'), + (60, 2022, 8, 3, 'http://example.com/answer2', 'ํ•œ์–‘๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ2'), + (90, 2023, 9, 3, 'http://example.com/answer3', 'ํ•œ์–‘๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ3'); + +INSERT INTO university_exam_image (university_exam_id, university_exam_image_id, university_exam_image_url) +VALUES (1, 1, 'http://example.com/image1.jpg'), + (1, 2, 'http://example.com/image2.jpg'), + (1, 3, 'http://example.com/image3.jpg'), + (1, 4, 'http://example.com/image2.jpg'), + (1, 5, 'http://example.com/image3.jpg'); + +INSERT INTO university_exam_image (university_exam_id, university_exam_image_id, university_exam_image_url) +VALUES (2, 6, 'http://example.com/image1.jpg'), + (2, 7, 'http://example.com/image2.jpg'), + (2, 8, 'http://example.com/image3.jpg'), + (2, 9, 'http://example.com/image2.jpg'), + (2, 10, 'http://example.com/image3.jpg'); + +INSERT INTO select_university(select_university_id, member_id, university_id) +VALUES (1, 2, 1), + (2, 2, 2), + (3, 2, 3); \ No newline at end of file diff --git a/nonsoolmateServer/src/main/resources/init/schema.sql b/nonsoolmateServer/src/main/resources/init/schema.sql new file mode 100644 index 0000000..f7a72e0 --- /dev/null +++ b/nonsoolmateServer/src/main/resources/init/schema.sql @@ -0,0 +1,16 @@ +-- Drop tables +DROP TABLE IF EXISTS university_exam_record; +DROP TABLE IF EXISTS university_exam_image; +DROP TABLE IF EXISTS university_exam; +DROP TABLE IF EXISTS select_university; +DROP TABLE IF EXISTS university; +DROP TABLE IF EXISTS member; + + +-- Create tables +CREATE TABLE member (birth_year VARCHAR(4), gender VARCHAR(1), ticket_count INTEGER NOT NULL, member_id BIGINT NOT NULL AUTO_INCREMENT, ticket_previous_publication_time DATETIME(6), phone_number VARCHAR(13) NOT NULL, email VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, platform_type VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, PRIMARY KEY (member_id)); +CREATE TABLE university (university_id BIGINT NOT NULL AUTO_INCREMENT, university_college VARCHAR(255) NOT NULL, university_name VARCHAR(255) NOT NULL, PRIMARY KEY (university_id)); +CREATE TABLE select_university (member_id BIGINT, select_university_id BIGINT NOT NULL AUTO_INCREMENT, university_id BIGINT, PRIMARY KEY (select_university_id), CONSTRAINT FKec0867nm7obvy1x99a9tk9rmb FOREIGN KEY (member_id) REFERENCES member (member_id), CONSTRAINT FK3pb0dmtg91s615viu7hrb7yaa FOREIGN KEY (university_id) REFERENCES university (university_id)); +CREATE TABLE university_exam (exam_time_limit INTEGER NOT NULL, exam_year INTEGER NOT NULL, university_exam_id BIGINT NOT NULL AUTO_INCREMENT, university_id BIGINT, exam_answer_url VARCHAR(255) NOT NULL, exam_name VARCHAR(255) NOT NULL, PRIMARY KEY (university_exam_id), CONSTRAINT FKrm0hmkec0inobawjyl5dxva4w FOREIGN KEY (university_id) REFERENCES university (university_id)); +CREATE TABLE university_exam_image (university_exam_id BIGINT, university_exam_image_id BIGINT NOT NULL AUTO_INCREMENT, university_exam_image_url VARCHAR(255) NOT NULL, PRIMARY KEY (university_exam_image_id), CONSTRAINT FKrnbevxfm5321rafunrqw9w688 FOREIGN KEY (university_exam_id) REFERENCES university_exam (university_exam_id)) ENGINE=InnoDB; +CREATE TABLE university_exam_record (time_take_exam INTEGER NOT NULL, member_id BIGINT, university_exam_id BIGINT, university_exam_record_id BIGINT NOT NULL AUTO_INCREMENT, exam_record_result_url VARCHAR(255) NOT NULL, exam_record_sheet_url VARCHAR(255) NOT NULL, exam_result_status VARCHAR(255) CHECK (exam_result_status IN ('ONGOING', 'FINISH')) NOT NULL, PRIMARY KEY (university_exam_record_id), CONSTRAINT FKeuxybcdgr72j6se1mjco3vtxu FOREIGN KEY (member_id) REFERENCES member (member_id), CONSTRAINT FKbm9ythclpkhsr1oa7nooqgl1q FOREIGN KEY (university_exam_id) REFERENCES university_exam (university_exam_id)); From b65f497dd237bd9ef7de95651a677b491125be99 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 23:27:44 +0900 Subject: [PATCH 171/465] =?UTF-8?q?[ADD]=20=EB=8C=80=ED=95=99=EB=B3=84=20?= =?UTF-8?q?=EC=8B=9C=ED=97=98=20=EC=A1=B0=ED=9A=8C=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=A5=B8=20SuccessType=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/SelectUniversitySuccessType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java index b542226..d01d517 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java @@ -6,7 +6,8 @@ @RequiredArgsConstructor public enum SelectUniversitySuccessType implements BusinessSucessType { - GET_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + GET_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + GET_SELECT_UNIVERSITY_EXAMS_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From db3c4309d476e096d59a07b826b68c791971d924 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 23:28:26 +0900 Subject: [PATCH 172/465] =?UTF-8?q?[ADD]=20ResponseDTO=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 --- .../dto/response/SelectUniversityExamResponseDTO.java | 9 +++++++++ .../response/SelectUniversityExamsResponseDTO.java | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java new file mode 100644 index 0000000..52e3860 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java @@ -0,0 +1,9 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; + +public record SelectUniversityExamResponseDTO(Long universityId, String examName, int examTimeLimit, + String examStatus) { + public static SelectUniversityExamResponseDTO of(Long universityId, String examName, int examTimeLimit, + String examStatus) { + return new SelectUniversityExamResponseDTO(universityId, examName, examTimeLimit, examStatus); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java new file mode 100644 index 0000000..2056e5e --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java @@ -0,0 +1,11 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; + +import java.util.List; + +public record SelectUniversityExamsResponseDTO(Long universityId, String universityName, + List examList) { + public static SelectUniversityExamsResponseDTO of(Long universityId, String universityName, + List examList) { + return new SelectUniversityExamsResponseDTO(universityId, universityName, examList); + } +} From 3f7287e406bdec783ec36cacaa4b286d25e317c4 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 23:35:30 +0900 Subject: [PATCH 173/465] =?UTF-8?q?[ADD]=20universityCollege=20=ED=95=84?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SelectUniversityExamsResponseDTO.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java index 2056e5e..6794002 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java @@ -2,10 +2,11 @@ import java.util.List; -public record SelectUniversityExamsResponseDTO(Long universityId, String universityName, +public record SelectUniversityExamsResponseDTO(Long universityId, String universityName, String universityCollege, List examList) { public static SelectUniversityExamsResponseDTO of(Long universityId, String universityName, + String universityCollege, List examList) { - return new SelectUniversityExamsResponseDTO(universityId, universityName, examList); + return new SelectUniversityExamsResponseDTO(universityId, universityName, universityCollege, examList); } } From 54b78978bb04caf3480e0e462380d07b451a1e31 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 23:36:06 +0900 Subject: [PATCH 174/465] =?UTF-8?q?[FIX]=20ExamResultStatus=20=EC=83=81?= =?UTF-8?q?=EC=88=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/enums/ExamResultStatus.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/enums/ExamResultStatus.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/enums/ExamResultStatus.java index cfabd14..802d42a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/enums/ExamResultStatus.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/enums/ExamResultStatus.java @@ -1,5 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.enums; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter public enum ExamResultStatus { - ONGOING, FINISH + ONGOING("์ฒจ์‚ญ ์ง„ํ–‰ ์ค‘"), FINISH("์ฒจ์‚ญ ์™„๋ฃŒ"); + + private final String status; } From 86909d94bb67cffd47c45997d4b0791fd04f401e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 23:37:28 +0900 Subject: [PATCH 175/465] =?UTF-8?q?[FIX]=20UniversityExamRecord=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20timeTakeExam=20=ED=83=80=EC=9E=85?= =?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 --- .../entity/UniversityExamRecord.java | 2 +- .../src/main/resources/init/data.sql | 44 ------------------- .../src/main/resources/init/schema.sql | 16 ------- 3 files changed, 1 insertion(+), 61 deletions(-) delete mode 100644 nonsoolmateServer/src/main/resources/init/data.sql delete mode 100644 nonsoolmateServer/src/main/resources/init/schema.sql diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java index e5fe4c4..cc34dcf 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java @@ -38,7 +38,7 @@ public class UniversityExamRecord { private ExamResultStatus examResultStatus; @NotNull - private Time timeTakeExam; + private int timeTakeExam; @NotNull private String examRecordSheetUrl; diff --git a/nonsoolmateServer/src/main/resources/init/data.sql b/nonsoolmateServer/src/main/resources/init/data.sql deleted file mode 100644 index 3f57ee0..0000000 --- a/nonsoolmateServer/src/main/resources/init/data.sql +++ /dev/null @@ -1,44 +0,0 @@ -INSERT INTO member (birth_year, gender, ticket_count, member_id, ticket_previous_publication_time, phone_number, email, - name, platform_type, role) -VALUES ('2001', 'F', 5, DEFAULT, '2024-01-09 12:30:00.000000', '010-4688-4301', 'wlgns72@naver.com', '๊น€์„ฑ์€', 'NAVER', - 'USER'), - ('1999', 'M', 5, DEFAULT, '2024-01-09 12:30:00.000000', '010-9472-6796', 'thdalsrb79@naver.com', '์†ก๋ฏผ๊ทœ', 'NAVER', - 'USER'); -INSERT INTO university (university_id, university_college, university_name) -VALUES (1, '์ธ๋ฌธ', '์ˆ™๋ช…์—ฌ์ž๋Œ€ํ•™๊ต'), - (2, '์ธ๋ฌธ์‚ฌํšŒ', '์ค‘์•™๋Œ€ํ•™๊ต'), - (3, '์ธ๋ฌธ์‚ฌํšŒ', 'ํ•œ์–‘๋Œ€ํ•™๊ต'); - -INSERT INTO university_exam (exam_time_limit, exam_year, university_exam_id, university_id, exam_answer_url, exam_name) -VALUES (70, 2021, 1, 1, 'http://example.com/answer1', '์ˆ™๋ช…์—ฌ์ž๋Œ€ํ•™๊ต ์ธ๋ฌธ1'), - (60, 2022, 2, 1, 'http://example.com/answer2', '์ˆ™๋ช…์—ฌ์ž๋Œ€ํ•™๊ต ์ธ๋ฌธ2'), - (90, 2023, 3, 1, 'http://example.com/answer3', '์ˆ™๋ช…์—ฌ์ž๋Œ€ํ•™๊ต ์ธ๋ฌธ3'); - -INSERT INTO university_exam (exam_time_limit, exam_year, university_exam_id, university_id, exam_answer_url, exam_name) -VALUES (70, 2021, 4, 2, 'http://example.com/answer1', '์ค‘์•™๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ1'), - (60, 2022, 5, 2, 'http://example.com/answer2', '์ค‘์•™๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ2'), - (90, 2023, 6, 2, 'http://example.com/answer3', '์ค‘์•™๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ3'); - -INSERT INTO university_exam (exam_time_limit, exam_year, university_exam_id, university_id, exam_answer_url, exam_name) -VALUES (70, 2021, 7, 3, 'http://example.com/answer1', 'ํ•œ์–‘๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ1'), - (60, 2022, 8, 3, 'http://example.com/answer2', 'ํ•œ์–‘๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ2'), - (90, 2023, 9, 3, 'http://example.com/answer3', 'ํ•œ์–‘๋Œ€ํ•™๊ต ์ธ๋ฌธ์‚ฌํšŒ3'); - -INSERT INTO university_exam_image (university_exam_id, university_exam_image_id, university_exam_image_url) -VALUES (1, 1, 'http://example.com/image1.jpg'), - (1, 2, 'http://example.com/image2.jpg'), - (1, 3, 'http://example.com/image3.jpg'), - (1, 4, 'http://example.com/image2.jpg'), - (1, 5, 'http://example.com/image3.jpg'); - -INSERT INTO university_exam_image (university_exam_id, university_exam_image_id, university_exam_image_url) -VALUES (2, 6, 'http://example.com/image1.jpg'), - (2, 7, 'http://example.com/image2.jpg'), - (2, 8, 'http://example.com/image3.jpg'), - (2, 9, 'http://example.com/image2.jpg'), - (2, 10, 'http://example.com/image3.jpg'); - -INSERT INTO select_university(select_university_id, member_id, university_id) -VALUES (1, 2, 1), - (2, 2, 2), - (3, 2, 3); \ No newline at end of file diff --git a/nonsoolmateServer/src/main/resources/init/schema.sql b/nonsoolmateServer/src/main/resources/init/schema.sql deleted file mode 100644 index f7a72e0..0000000 --- a/nonsoolmateServer/src/main/resources/init/schema.sql +++ /dev/null @@ -1,16 +0,0 @@ --- Drop tables -DROP TABLE IF EXISTS university_exam_record; -DROP TABLE IF EXISTS university_exam_image; -DROP TABLE IF EXISTS university_exam; -DROP TABLE IF EXISTS select_university; -DROP TABLE IF EXISTS university; -DROP TABLE IF EXISTS member; - - --- Create tables -CREATE TABLE member (birth_year VARCHAR(4), gender VARCHAR(1), ticket_count INTEGER NOT NULL, member_id BIGINT NOT NULL AUTO_INCREMENT, ticket_previous_publication_time DATETIME(6), phone_number VARCHAR(13) NOT NULL, email VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, platform_type VARCHAR(255) NOT NULL, role VARCHAR(255) NOT NULL, PRIMARY KEY (member_id)); -CREATE TABLE university (university_id BIGINT NOT NULL AUTO_INCREMENT, university_college VARCHAR(255) NOT NULL, university_name VARCHAR(255) NOT NULL, PRIMARY KEY (university_id)); -CREATE TABLE select_university (member_id BIGINT, select_university_id BIGINT NOT NULL AUTO_INCREMENT, university_id BIGINT, PRIMARY KEY (select_university_id), CONSTRAINT FKec0867nm7obvy1x99a9tk9rmb FOREIGN KEY (member_id) REFERENCES member (member_id), CONSTRAINT FK3pb0dmtg91s615viu7hrb7yaa FOREIGN KEY (university_id) REFERENCES university (university_id)); -CREATE TABLE university_exam (exam_time_limit INTEGER NOT NULL, exam_year INTEGER NOT NULL, university_exam_id BIGINT NOT NULL AUTO_INCREMENT, university_id BIGINT, exam_answer_url VARCHAR(255) NOT NULL, exam_name VARCHAR(255) NOT NULL, PRIMARY KEY (university_exam_id), CONSTRAINT FKrm0hmkec0inobawjyl5dxva4w FOREIGN KEY (university_id) REFERENCES university (university_id)); -CREATE TABLE university_exam_image (university_exam_id BIGINT, university_exam_image_id BIGINT NOT NULL AUTO_INCREMENT, university_exam_image_url VARCHAR(255) NOT NULL, PRIMARY KEY (university_exam_image_id), CONSTRAINT FKrnbevxfm5321rafunrqw9w688 FOREIGN KEY (university_exam_id) REFERENCES university_exam (university_exam_id)) ENGINE=InnoDB; -CREATE TABLE university_exam_record (time_take_exam INTEGER NOT NULL, member_id BIGINT, university_exam_id BIGINT, university_exam_record_id BIGINT NOT NULL AUTO_INCREMENT, exam_record_result_url VARCHAR(255) NOT NULL, exam_record_sheet_url VARCHAR(255) NOT NULL, exam_result_status VARCHAR(255) CHECK (exam_result_status IN ('ONGOING', 'FINISH')) NOT NULL, PRIMARY KEY (university_exam_record_id), CONSTRAINT FKeuxybcdgr72j6se1mjco3vtxu FOREIGN KEY (member_id) REFERENCES member (member_id), CONSTRAINT FKbm9ythclpkhsr1oa7nooqgl1q FOREIGN KEY (university_exam_id) REFERENCES university_exam (university_exam_id)); From 3651eb04614e5c56d5ea94dfb480d6e85d9ba1e8 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 23:39:07 +0900 Subject: [PATCH 176/465] =?UTF-8?q?[ADD]=20UniversityExamrepository,=20Uni?= =?UTF-8?q?versityExamRecordRepository=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/UniversityExamRepository.java | 4 ++++ .../repository/UniversityExamRecordRepository.java | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/UniversityExamRecordRepository.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java index cc30933..753ff10 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java @@ -1,9 +1,13 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.repository; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import java.util.List; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; public interface UniversityExamRepository extends JpaRepository { Optional findByUniversityExamId(Long universityId); + + List findAllByUniversity(University university); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/UniversityExamRecordRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/UniversityExamRecordRepository.java new file mode 100644 index 0000000..7c15295 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/UniversityExamRecordRepository.java @@ -0,0 +1,11 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; +import java.util.Optional; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface UniversityExamRecordRepository extends JpaRepository { + Optional findByUniversityExamAndMember(UniversityExam university, Member member); +} From 48b8552e9d7a5519b8b1cc728427bb6ded551b19 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 23:39:52 +0900 Subject: [PATCH 177/465] =?UTF-8?q?[FEAT]=20SelectUniversityService=20getS?= =?UTF-8?q?electUniversityExams()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 56 +++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 6ef0495..b9cb227 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -1,11 +1,16 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.service; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamsResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.entity.SelectUniversity; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.repository.SelectUniversityRepository; -import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityRepository; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; import java.util.ArrayList; import java.util.List; import lombok.RequiredArgsConstructor; @@ -18,17 +23,19 @@ public class SelectUniversityService { private final SelectUniversityRepository selectUniversityRepository; private final UniversityRepository universityRepository; + private final UniversityExamRepository universityExamRepository; + private final UniversityExamRecordRepository universityExamRecordRepository; - public List getSelectUniversities(Member member){ + public List getSelectUniversities(Member member) { List selectUniversities = selectUniversityRepository.findAllByMember(member); List selectUniversityResponseDTOS = new ArrayList<>(); universityRepository.findAll().stream().forEach(university -> { boolean status = false; - for(SelectUniversity selectUniversity : selectUniversities){ - if(university.getUniversityId() == selectUniversity.getUniversity().getUniversityId()){ + for (SelectUniversity selectUniversity : selectUniversities) { + if (university.getUniversityId() == selectUniversity.getUniversity().getUniversityId()) { status = true; } } @@ -39,4 +46,45 @@ public List getSelectUniversities(Member member){ return selectUniversityResponseDTOS; } + + public List getSelectUniversityExams(Member member) { + List selectUniversityExamsResponseDTOS = new ArrayList<>(); + List selectUniversities = selectUniversityRepository.findAllByMember(member); + + for (SelectUniversity selectUniversity : selectUniversities) { + selectUniversityExamsResponseDTOS.add(getSelectUniversityExamsResponseDTO(selectUniversity, member)); + } + + return selectUniversityExamsResponseDTOS; + } + + private SelectUniversityExamsResponseDTO getSelectUniversityExamsResponseDTO(SelectUniversity selectUniversity, + Member member) { + List selectUniversityExamResponseDTOS = new ArrayList<>(); + + List universityExams = universityExamRepository.findAllByUniversity( + selectUniversity.getUniversity()); + + selectUniversityExamResponseDTOS = getSelectUniversityExamResponseDTOS(universityExams, member); + + return SelectUniversityExamsResponseDTO.of(selectUniversity.getUniversity().getUniversityId(), + selectUniversity.getUniversity().getUniversityName(), + selectUniversity.getUniversity().getUniversityCollege(), selectUniversityExamResponseDTOS); + } + + private List getSelectUniversityExamResponseDTOS( + List universityExams, Member member) { + UniversityExamRecord universityExamRecord; + List selectUniversityExamResponseDTOS = new ArrayList<>(); + for (UniversityExam universityExam : universityExams) { + universityExamRecord = universityExamRecordRepository.findByUniversityExamAndMember(universityExam, member) + .orElse(null); + String status = + universityExamRecord == null ? "์‹œํ—˜ ์‘์‹œ ์ „" : universityExamRecord.getExamResultStatus().getStatus(); + selectUniversityExamResponseDTOS.add( + SelectUniversityExamResponseDTO.of(universityExam.getUniversityExamId(), + universityExam.getExamName(), universityExam.getExamTimeLimit(), status)); + } + return selectUniversityExamResponseDTOS; + } } From 8464572f1256ed3e6b0c42c2efea80865d2b4135 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 9 Jan 2024 23:40:34 +0900 Subject: [PATCH 178/465] =?UTF-8?q?[FEAT]=20SelectUniversityController=20g?= =?UTF-8?q?etSelectUniversityExams()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SelectUniversityController.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java index ced28a5..14b487c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java @@ -1,8 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller; import static com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception.SelectUniversitySuccessType.GET_SELECT_UNIVERSITIES_SUCCESS; +import static com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception.SelectUniversitySuccessType.GET_SELECT_UNIVERSITY_EXAMS_SUCCESS; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamsResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.service.SelectUniversityService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; @@ -20,9 +22,19 @@ public class SelectUniversityController { private final SelectUniversityService selectUniversityService; + @GetMapping - public ResponseEntity>> getSelectUniversities(@AuthUser Member member){ + public ResponseEntity>> getSelectUniversities( + @AuthUser Member member) { + + return ResponseEntity.ok().body(ApiResponse.success(GET_SELECT_UNIVERSITIES_SUCCESS, + selectUniversityService.getSelectUniversities(member))); + } - return ResponseEntity.ok().body(ApiResponse.success(GET_SELECT_UNIVERSITIES_SUCCESS, selectUniversityService.getSelectUniversities(member))); + @GetMapping("/exam") + public ResponseEntity>> getSelectUniversityExams( + @AuthUser Member member) { + return ResponseEntity.ok().body(ApiResponse.success(GET_SELECT_UNIVERSITY_EXAMS_SUCCESS, + selectUniversityService.getSelectUniversityExams(member))); } } From 49075374602a3fd5634ce4c6f09f2f56f36e8499 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 10 Jan 2024 08:30:30 +0900 Subject: [PATCH 179/465] =?UTF-8?q?[FIX]=20=EB=A7=A4=EC=A7=81=20=EB=A6=AC?= =?UTF-8?q?=ED=84=B0=EB=9F=B4=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectUniversity/service/SelectUniversityService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index b9cb227..97ede2b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -25,6 +25,7 @@ public class SelectUniversityService { private final UniversityRepository universityRepository; private final UniversityExamRepository universityExamRepository; private final UniversityExamRecordRepository universityExamRecordRepository; + private final static String BEFORE_EXAM = "์‹œํ—˜ ์‘์‹œ ์ „"; public List getSelectUniversities(Member member) { @@ -60,7 +61,7 @@ public List getSelectUniversityExams(Member me private SelectUniversityExamsResponseDTO getSelectUniversityExamsResponseDTO(SelectUniversity selectUniversity, Member member) { - List selectUniversityExamResponseDTOS = new ArrayList<>(); + List selectUniversityExamResponseDTOS; List universityExams = universityExamRepository.findAllByUniversity( selectUniversity.getUniversity()); @@ -80,7 +81,7 @@ private List getSelectUniversityExamResponseDTO universityExamRecord = universityExamRecordRepository.findByUniversityExamAndMember(universityExam, member) .orElse(null); String status = - universityExamRecord == null ? "์‹œํ—˜ ์‘์‹œ ์ „" : universityExamRecord.getExamResultStatus().getStatus(); + universityExamRecord == null ? BEFORE_EXAM : universityExamRecord.getExamResultStatus().getStatus(); selectUniversityExamResponseDTOS.add( SelectUniversityExamResponseDTO.of(universityExam.getUniversityExamId(), universityExam.getExamName(), universityExam.getExamTimeLimit(), status)); From df7c6aac6e3ba9d410fc6acfb3012b66256194c0 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 09:40:53 +0900 Subject: [PATCH 180/465] =?UTF-8?q?[FIX]=20=EC=B6=9C=EB=A0=A5=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=96=91=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectUniversity/service/SelectUniversityService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 97ede2b..e212598 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -26,6 +26,8 @@ public class SelectUniversityService { private final UniversityExamRepository universityExamRepository; private final UniversityExamRecordRepository universityExamRecordRepository; private final static String BEFORE_EXAM = "์‹œํ—˜ ์‘์‹œ ์ „"; + private final static String LEFT_BRACKET = "("; + private final static String RIGHT_BRACKET = ")"; public List getSelectUniversities(Member member) { @@ -41,7 +43,8 @@ public List getSelectUniversities(Member member) { } } selectUniversityResponseDTOS.add(SelectUniversityResponseDTO.of(university.getUniversityId(), - university.getUniversityName() + university.getUniversityCollege(), status)); + university.getUniversityName() + LEFT_BRACKET + university.getUniversityCollege() + RIGHT_BRACKET, + status)); }); From 227ff8c84bc0a4f4e88af7942f02813da459a1d8 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:01:21 +0900 Subject: [PATCH 181/465] =?UTF-8?q?[DEL]=20=EB=8D=94=EB=AF=B8=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/universityExamRecord/repository/dummy.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 779a16db3187113af38056b774291e75bfbb4712 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:11:52 +0900 Subject: [PATCH 182/465] =?UTF-8?q?[ADD]=20=EB=B9=8C=EB=8D=94=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/selectUniversity/entity/SelectUniversity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java index 48a40a6..3863a77 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java @@ -9,6 +9,7 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import lombok.AccessLevel; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -27,4 +28,10 @@ public class SelectUniversity { @ManyToOne @JoinColumn(name = "university_id") private University university; + + @Builder + public SelectUniversity(Member member, University university) { + this.member = member; + this.university = university; + } } From 382853aea1f53323d890ccce0a83e9f32cb8b157 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:12:37 +0900 Subject: [PATCH 183/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=88=98=EC=A0=95=20controller=EB=8B=A8=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SelectUniversityController.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java index 14b487c..cf982ba 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java @@ -2,17 +2,23 @@ import static com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception.SelectUniversitySuccessType.GET_SELECT_UNIVERSITIES_SUCCESS; import static com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception.SelectUniversitySuccessType.GET_SELECT_UNIVERSITY_EXAMS_SUCCESS; +import static com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception.SelectUniversitySuccessType.PATCH_SELECT_UNIVERSITIES_SUCCESS; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.request.SelectUniversityRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamsResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityUpdateResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.service.SelectUniversityService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import jakarta.validation.Valid; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -37,4 +43,13 @@ public ResponseEntity>> getSe return ResponseEntity.ok().body(ApiResponse.success(GET_SELECT_UNIVERSITY_EXAMS_SUCCESS, selectUniversityService.getSelectUniversityExams(member))); } + + @PatchMapping + public ResponseEntity> patchSelectUniversities( + @AuthUser Member member, + @RequestBody @Valid final List request) { + + return ResponseEntity.ok().body(ApiResponse.success(PATCH_SELECT_UNIVERSITIES_SUCCESS, + selectUniversityService.patchSelectUniversities(member, request))); + } } From 1d9cbb80eb8228b9e3f733f4079c006f9ee2f88c Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:13:01 +0900 Subject: [PATCH 184/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=82=AD=EC=A0=9C=20=EB=A9=94=EC=84=9C=EB=93=9C=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 --- .../repository/SelectUniversityRepository.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java index a9a3955..1708ed5 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java @@ -3,11 +3,16 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.entity.SelectUniversity; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.transaction.annotation.Transactional; public interface SelectUniversityRepository extends JpaRepository { List findAllByMember(Member member); + @Transactional + void deleteByMemberAndUniversity(Member member, University university); + } From 74a91e59b6249df3a22e03a72eea0312f4e57ebb Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:13:28 +0900 Subject: [PATCH 185/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=88=98=EC=A0=95=20service=EB=8B=A8=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 51 ++++++++++++++++++- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index e212598..a8e0709 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -1,24 +1,27 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.service; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.request.SelectUniversityRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamsResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityUpdateResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.entity.SelectUniversity; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.repository.SelectUniversityRepository; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityRepository; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; @Service -@Transactional(readOnly = true) @RequiredArgsConstructor public class SelectUniversityService { private final SelectUniversityRepository selectUniversityRepository; @@ -91,4 +94,48 @@ private List getSelectUniversityExamResponseDTO } return selectUniversityExamResponseDTOS; } + + public SelectUniversityUpdateResponseDTO patchSelectUniversities( + Member member, + List request) { + + List prevUniversityIds = selectUniversityRepository.findAllByMember(member).stream() + .map(univ -> univ.getUniversity().getUniversityId()) + .toList(); + List curUniversityIds = request.stream().map(req -> req.universityId()).toList(); + + Map universityMap = new HashMap<>(); + + curUniversityIds.stream().forEach(curUniversityId -> { + universityMap.put(curUniversityId, universityRepository.findByUniversityIdOrElseThrowException(curUniversityId)); + + boolean isPresent = false; + for(Long prevUniversityId : prevUniversityIds){ + if(prevUniversityId == curUniversityId) isPresent = true; + } + + if(!isPresent){ + selectUniversityRepository.save(SelectUniversity + .builder() + .member(member) + .university(universityMap.get(curUniversityId)) + .build()); + } + }); + + prevUniversityIds.stream().forEach(prevUniversityId ->{ + universityMap.put(prevUniversityId, universityRepository.findByUniversityIdOrElseThrowException(prevUniversityId)); + + boolean isPresent = false; + for(Long curUniversityId : curUniversityIds){ + if(prevUniversityId == curUniversityId) isPresent = true; + } + + if(!isPresent){ + selectUniversityRepository.deleteByMemberAndUniversity(member, universityMap.get(prevUniversityId)); + } + }); + + return SelectUniversityUpdateResponseDTO.of(true); + } } From 1a5c7d60299a5dcbb4773250573ce80dd021f44f Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:13:57 +0900 Subject: [PATCH 186/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=A1=B0=ED=9A=8C=20=EB=A9=94=EC=84=9C=EB=93=9C=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 --- .../university/repository/UniversityRepository.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java index 9a88ad4..c6b3d59 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java @@ -1,9 +1,20 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.repository; +import static com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception.SelectUniversityExceptionType.INVALID_SELECTED_UNIVERSITY; + +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception.SelectUniversityException; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; import java.util.List; +import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; public interface UniversityRepository extends JpaRepository { List findAll(); + + Optional findByUniversityId(Long universityId); + + default University findByUniversityIdOrElseThrowException(Long universityId){ + return findByUniversityId(universityId).orElseThrow( + ()-> new SelectUniversityException(INVALID_SELECTED_UNIVERSITY)); + } } From 3360a6c0f77454cd3cba1a6a5f47bc05d74035b9 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:14:10 +0900 Subject: [PATCH 187/465] =?UTF-8?q?[ADD]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=88=98=EC=A0=95=20DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SelectUniversityUpdateResponseDTO.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java new file mode 100644 index 0000000..38cd1a6 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java @@ -0,0 +1,9 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; + +public record SelectUniversityUpdateResponseDTO( + boolean isSelected +) { + static public SelectUniversityUpdateResponseDTO of(boolean isSelected) { + return new SelectUniversityUpdateResponseDTO(isSelected); + } +} From 31a901da156967878621a47201d796c2d3d7faeb Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:14:32 +0900 Subject: [PATCH 188/465] =?UTF-8?q?[ADD]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=88=98=EC=A0=95=EA=B4=80=EB=A0=A8=20=EC=84=B1?= =?UTF-8?q?=EA=B3=B5=20enum=20Type=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/SelectUniversitySuccessType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java index d01d517..981234d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java @@ -7,7 +7,8 @@ @RequiredArgsConstructor public enum SelectUniversitySuccessType implements BusinessSucessType { GET_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), - GET_SELECT_UNIVERSITY_EXAMS_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + GET_SELECT_UNIVERSITY_EXAMS_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + PATCH_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.CREATED, "๋ชฉํ‘œ ๋Œ€ํ•™ ์ˆ˜์ •์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From ebf594bd0267d0d91ec519966d9f4baef02af8c9 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:14:51 +0900 Subject: [PATCH 189/465] =?UTF-8?q?[ADD]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=88=98=EC=A0=95=EA=B4=80=EB=A0=A8=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=20DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/dto/request/SelectUniversityRequestDTO.java | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java new file mode 100644 index 0000000..dbd139a --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java @@ -0,0 +1,6 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.request; + +public record SelectUniversityRequestDTO( + Long universityId +) { +} From f65dca2549ea758ec5d5da6c0cf6411f209bc582 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 10:15:24 +0900 Subject: [PATCH 190/465] =?UTF-8?q?[ADD]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=98=88=EC=99=B8=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=EC=9C=A0=ED=9A=A8=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=EA=B5=90=20=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC=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 --- .../exception/SelectUniversityExceptionType.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java index 387e8aa..ae8a7b2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java @@ -8,15 +8,16 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum SelectUniversityExceptionType implements BusinessExceptionType { - ; + INVALID_SELECTED_UNIVERSITY(HttpStatus.BAD_REQUEST, "์œ ํšจํ•œ ๋ชฉํ‘œ ๋Œ€ํ•™๊ต๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค"); + + private final HttpStatus status; + private final String message; @Override public HttpStatus status() { - return null; + return this.status; } @Override - public String message() { - return null; - } + public String message() {return this.message; } } From 0074124013129e2b8c3f46f70688b5d864723839 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 23:49:02 +0900 Subject: [PATCH 191/465] =?UTF-8?q?[DEL]=20=EB=8D=94=EB=AF=B8=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/universityExamRecord/controller/dummy.txt | 1 - .../domain/universityExamRecord/exception/dummy.txt | 1 - .../domain/universityExamRecord/service/dummy.txt | 1 - .../nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt | 1 - 4 files changed, 4 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/dummy.txt delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From f2c5fe9cf7ba877340f466ac92f6825d4e3c717e Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 23:49:39 +0900 Subject: [PATCH 192/465] =?UTF-8?q?[ADD]=20presignedUrl=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/config/AWSConfig.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/config/AWSConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/config/AWSConfig.java index eef8f43..4c30a2e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/config/AWSConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/config/AWSConfig.java @@ -6,12 +6,14 @@ import software.amazon.awssdk.auth.credentials.SystemPropertyCredentialsProvider; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.presigner.S3Presigner; @Configuration public class AWSConfig { private static final String AWS_ACCESS_KEY_ID = "aws.accessKeyId"; private static final String AWS_SECRET_ACCESS_KEY = "aws.secretAccessKey"; + private static final String AWS_REGION = "aws.region"; private final String accessKey; private final String secretKey; @@ -30,6 +32,7 @@ public AWSConfig(@Value("${aws-property.access-key}") final String accessKey, public SystemPropertyCredentialsProvider systemPropertyCredentialsProvider() { System.setProperty(AWS_ACCESS_KEY_ID, accessKey); System.setProperty(AWS_SECRET_ACCESS_KEY, secretKey); + System.setProperty(AWS_REGION, regionString); return SystemPropertyCredentialsProvider.create(); } @@ -45,4 +48,12 @@ public S3Client getS3Client() { .credentialsProvider(systemPropertyCredentialsProvider()) .build(); } + + @Bean + public S3Presigner getS3Presigner() { + return S3Presigner.builder() + .region(getRegion()) + .credentialsProvider(systemPropertyCredentialsProvider()) + .build(); + } } \ No newline at end of file From bd3826a729eede44e69af558600b6cfac5037603 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 23:55:20 +0900 Subject: [PATCH 193/465] =?UTF-8?q?[FEAT]=20presignedUrl=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=EC=9D=98=20=EC=A1=B0=ED=9A=8C=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/S3Service.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java new file mode 100644 index 0000000..6da515d --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -0,0 +1,49 @@ +package com.nonsoolmate.nonsoolmateServer.external.aws.service; + +import com.nonsoolmate.nonsoolmateServer.external.aws.config.AWSConfig; +import java.time.Duration; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; +import software.amazon.awssdk.services.s3.model.GetObjectRequest; +import software.amazon.awssdk.services.s3.presigner.S3Presigner; +import software.amazon.awssdk.services.s3.presigner.model.GetObjectPresignRequest; +import software.amazon.awssdk.services.s3.presigner.model.PresignedGetObjectRequest; + +@Component +@RequiredArgsConstructor +@Slf4j +public class S3Service { + + @Value("${aws-property.s3-bucket-name}") + private String bucketName; + private final AWSConfig awsConfig; + + // ๋งŒ๋ฃŒ์‹œ๊ฐ„ 1๋ถ„ + private static final Long PRE_SIGNED_URL_EXPIRE_MINUTE = 60L; + + public String createPresignedGetUrl(String path, String fileName) { + final String key = path + fileName; + + try (S3Presigner presigner = S3Presigner.create()) { + + GetObjectRequest objectRequest = GetObjectRequest.builder() + .bucket(bucketName) + .key(key) + .build(); + + GetObjectPresignRequest presignRequest = GetObjectPresignRequest.builder() + .signatureDuration(Duration.ofMinutes(PRE_SIGNED_URL_EXPIRE_MINUTE)) // The URL will expire in 10 minutes. + .getObjectRequest(objectRequest) + .build(); + + PresignedGetObjectRequest presignedRequest = presigner.presignGetObject(presignRequest); + log.info("Presigned URL: [{}]", presignedRequest.url().toString()); + log.info("HTTP method: [{}]", presignedRequest.httpRequest().method()); + + return presignedRequest.url().toExternalForm(); + } + } + +} From dfcec65e94239d948512c114b8831ca9baba6fc6 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 10 Jan 2024 23:55:50 +0900 Subject: [PATCH 194/465] =?UTF-8?q?[FIX]=20Url=20->=20FileName=20=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EC=88=98=20=EC=9D=B4=EB=A6=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../universityExamRecord/entity/UniversityExamRecord.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java index cc34dcf..5a3e536 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java @@ -41,8 +41,8 @@ public class UniversityExamRecord { private int timeTakeExam; @NotNull - private String examRecordSheetUrl; + private String examRecordSheetFileName; // ๋‚ด ๋‹ต์•ˆ @NotNull - private String examRecordResultUrl; + private String examRecordResultFileName; // ์ฒจ์‚ญ } \ No newline at end of file From 705e5775315bf150a1d2dcd0231d3cb4539d18dc Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:01:20 +0900 Subject: [PATCH 195/465] =?UTF-8?q?[FEAT]=20=EC=B2=A8=EC=82=ADPDF,=20?= =?UTF-8?q?=ED=95=B4=EC=A0=9CPDF=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=8A=A5?= =?UTF-8?q?=20Controller=EB=8B=A8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniversityExamRecordController.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java new file mode 100644 index 0000000..4467d3e --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -0,0 +1,32 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller; + +import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SUCCESS; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordService; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/university/exam-record") +@RequiredArgsConstructor +public class UniversityExamRecordController { + + private final UniversityExamRecordService universityExamRecordService; + + @GetMapping("/{id}") + public ResponseEntity> getUniversityExamRecord( + @PathVariable("id") Long universityExamId, + @AuthUser Member member + ) { + return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_RECORD_SUCCESS, + universityExamRecordService.getUniversityExamRecord(universityExamId, member))); + } +} From 7422cc080cc15b60ec326a18bef0b51285fc5378 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:02:20 +0900 Subject: [PATCH 196/465] =?UTF-8?q?[ADD]=20UniversityExamRecord=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/UniversityExamRecordException.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordException.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordException.java new file mode 100644 index 0000000..4b95f5b --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordException.java @@ -0,0 +1,11 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; + +public class UniversityExamRecordException extends BusinessException { + public UniversityExamRecordException( + BusinessExceptionType exceptionType) { + super(exceptionType); + } +} From b6f8cd4c8d29a90151ac8bd697bdad28d874ee44 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:02:33 +0900 Subject: [PATCH 197/465] =?UTF-8?q?[ADD]=20UniversityExamRecord=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=20enum=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniversityExamRecordExceptionType.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java new file mode 100644 index 0000000..d29ca26 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java @@ -0,0 +1,24 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum UniversityExamRecordExceptionType implements BusinessExceptionType { + NOT_FOUND_UNIVERSITY_EXAM_RECORD(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก์ž…๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} From e1e6167f60ca45f9556504acc5c07281c5683b90 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:03:04 +0900 Subject: [PATCH 198/465] =?UTF-8?q?[FEAT]=20UniversityExamRecord=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/UniversityExamRecordRepository.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/UniversityExamRecordRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/UniversityExamRecordRepository.java index 7c15295..e704893 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/UniversityExamRecordRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/repository/UniversityExamRecordRepository.java @@ -1,11 +1,20 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository; +import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordExceptionType.NOT_FOUND_UNIVERSITY_EXAM_RECORD; + import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; public interface UniversityExamRecordRepository extends JpaRepository { Optional findByUniversityExamAndMember(UniversityExam university, Member member); + + default UniversityExamRecord findByUniversityExamAndMemberOrElseThrowException(UniversityExam university, + Member member) { + return findByUniversityExamAndMember(university, member).orElseThrow( + () -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM_RECORD)); + } } From 82dc0c451a8e3d2ef1bad00bbf17390934870d77 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:03:36 +0900 Subject: [PATCH 199/465] =?UTF-8?q?[ADD]=20=EC=B2=A8=EC=82=ADPDF,=20?= =?UTF-8?q?=ED=95=B4=EC=A0=9CPDF=20=EC=9D=91=EB=8B=B5=ED=95=98=EB=8A=94=20?= =?UTF-8?q?DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/UniversityExamRecordResponseDTO.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResponseDTO.java new file mode 100644 index 0000000..7605d58 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResponseDTO.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; + +public record UniversityExamRecordResponseDTO( + String examAnswerUrl, + String examResultUrl +) { + public static UniversityExamRecordResponseDTO of(String examAnswerUrl, String examResultUrl){ + return new UniversityExamRecordResponseDTO(examAnswerUrl, examResultUrl); + } +} From 19286b1d57a97a3663bbd01a4b3645dee038e106 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:04:30 +0900 Subject: [PATCH 200/465] =?UTF-8?q?[FEAT]=20=EC=B2=A8=EC=82=ADPDF,=20?= =?UTF-8?q?=ED=95=B4=EC=A0=9CPDF=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=A6=84?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20=ED=9B=84=20presigned=20Url=20=EB=A6=AC?= =?UTF-8?q?=ED=84=B4=ED=95=98=EB=8A=94=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java new file mode 100644 index 0000000..babbdec --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -0,0 +1,46 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service; + +import static com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; +import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; +import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class UniversityExamRecordService { + + private static final String EXAM_ANSWER_FOLDER_NAME = "exam-answer/"; + private static final String EXAM_RESULT_FOLDER_NAME = "exam-result/"; + + + private final UniversityExamRecordRepository universityExamRecordRepository; + private final UniversityExamRepository universityExamRepository; + private final S3Service s3Service; + + public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityExamId, Member member) { + + UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) + .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); + + UniversityExamRecord universityExamRecord = universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( + universityExam, member); + + String answerUrl = s3Service.createPresignedGetUrl(EXAM_ANSWER_FOLDER_NAME, + universityExam.getExamAnswerFileName()); + String resultUrl = s3Service.createPresignedGetUrl(EXAM_RESULT_FOLDER_NAME, + universityExamRecord.getExamRecordResultFileName()); + + return UniversityExamRecordResponseDTO.of(answerUrl, resultUrl); + } + +} From 5671f7a1fe95e2a99d954ed8abc35dd5ed113d6a Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:04:54 +0900 Subject: [PATCH 201/465] =?UTF-8?q?[ADD]=20UniversityExamRecord=20?= =?UTF-8?q?=EC=84=B1=EA=B3=B5=20enum=20=EC=B6=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniversityExamRecordSuccessType.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java new file mode 100644 index 0000000..295da4f --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java @@ -0,0 +1,24 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum UniversityExamRecordSuccessType implements BusinessSucessType { + GET_UNIVERSITY_EXAM_RECORD_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF, ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} From d7ee445bb3c6defe18a1baaf2ad1d8febe2566fa Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:24:43 +0900 Subject: [PATCH 202/465] =?UTF-8?q?[FIX]=20Url=20->=20FileName=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=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 --- .../domain/university/entity/UniversityExam.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java index cdd90c3..cb18e05 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java @@ -33,7 +33,7 @@ public class UniversityExam { private String examName; @NotNull - private String examAnswerUrl; + private String examAnswerFileName; @NotNull private int examYear; From 894cb3d44db7e80daba32a3e0f3002d44e222d59 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 00:49:24 +0900 Subject: [PATCH 203/465] =?UTF-8?q?[FIX]=20=EC=9C=A0=ED=9A=A8=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/external/aws/service/S3Service.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index 6da515d..a18eebe 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -20,8 +20,7 @@ public class S3Service { private String bucketName; private final AWSConfig awsConfig; - // ๋งŒ๋ฃŒ์‹œ๊ฐ„ 1๋ถ„ - private static final Long PRE_SIGNED_URL_EXPIRE_MINUTE = 60L; + private static final Long PRE_SIGNED_URL_EXPIRE_MINUTE = 1L; public String createPresignedGetUrl(String path, String fileName) { final String key = path + fileName; From a8925e8730beb67bebb6040b8678808cb37aad85 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 01:58:15 +0900 Subject: [PATCH 204/465] =?UTF-8?q?[FEAT]=20=EB=AC=B8=EC=A0=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EB=B0=8F=20=ED=95=B4=EC=A0=9C=20PDF=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20controller=20=EB=8B=A8=20=EA=B0=9C?= =?UTF-8?q?=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamController.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index e74884d..c2d3115 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -1,5 +1,8 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.controller; +import static com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_AND_ANSWER_SUCCESS; + +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageAndAnswerResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamSuccessType; @@ -37,4 +40,13 @@ public ResponseEntity>> getUniv return ResponseEntity.ok() .body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_SUCCESS, images)); } + + + @GetMapping("{id}/answer") + public ResponseEntity> getUniversityExamImageAndAnswer( + @PathVariable("id") Long universityExamId + ) { + return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_IMAGE_AND_ANSWER_SUCCESS, + universityExamService.getUniversityExamImageAndAnswer(universityExamId))); + } } From 808502bb6cd27d0db7037c9180ee87a257bc2671 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 01:58:39 +0900 Subject: [PATCH 205/465] =?UTF-8?q?[ADD]=20UniversityExamExceptionType=20?= =?UTF-8?q?=EB=A9=94=EC=84=B8=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/exception/UniversityExamExceptionType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java index 8fd41b5..a435d90 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java @@ -11,7 +11,8 @@ public enum UniversityExamExceptionType implements BusinessExceptionType { /** * 404 Not Found */ - NOT_FOUND_UNIVERSITY_EXAM(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค."); + NOT_FOUND_UNIVERSITY_EXAM(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค."), + NOT_FOUND_UNIVERSITY_EXAM_IMAGE(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜ ์ž…๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From 0305d62fd88eeb04b9cf21351dcd57a1fb06797f Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 01:58:58 +0900 Subject: [PATCH 206/465] =?UTF-8?q?[FIX]=20Url=20->=20FileName=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/entity/UniversityExamImage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java index 2160369..188c04e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java @@ -26,5 +26,5 @@ public class UniversityExamImage { private UniversityExam universityExam; @NotNull - private String universityExamImageUrl; + private String universityExamImageFileName; } \ No newline at end of file From 700e7a3371cd0dd9bd4ded25c9c205f12e0da02c Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 01:59:47 +0900 Subject: [PATCH 207/465] =?UTF-8?q?[ADD]=20=EB=AC=B8=EC=A0=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EB=B0=8F=20?= =?UTF-8?q?=ED=95=B4=EC=A0=9C=20PDF=20url=20=EB=B0=98=ED=99=98=20DTO=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 --- .../UniversityExamImageAndAnswerResponseDTO.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageAndAnswerResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageAndAnswerResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageAndAnswerResponseDTO.java new file mode 100644 index 0000000..b61df2b --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageAndAnswerResponseDTO.java @@ -0,0 +1,14 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto; + +import java.util.List; + +public record UniversityExamImageAndAnswerResponseDTO( + String university, String college, List examQuestionList, String examAnswerUrl +) { + static public UniversityExamImageAndAnswerResponseDTO of(String university, String college, + List examQuestionList, + String examAnswerUrl) { + return new UniversityExamImageAndAnswerResponseDTO(university, college, examQuestionList, examAnswerUrl); + } +} + From 11a9119ad0b5213975547eec0622d640d0c5d151 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 02:00:26 +0900 Subject: [PATCH 208/465] =?UTF-8?q?[FEAT]=20=EB=8C=80=ED=95=99=20=EC=8B=9C?= =?UTF-8?q?=ED=97=98=20=EC=A1=B0=ED=9A=8C=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/repository/UniversityExamImageRepository.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java index 2c01faa..4a454b8 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java @@ -2,10 +2,15 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExamImage; +import java.util.List; +import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; public interface UniversityExamImageRepository extends JpaRepository { Page findAllByUniversityExam(UniversityExam universityExam, Pageable pageable); + + List findAllByUniversityExam(UniversityExam universityExam); + } From 3bde9a70832dc3c4edda5152b926e5d469d2f0b2 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 02:00:44 +0900 Subject: [PATCH 209/465] =?UTF-8?q?[ADD]=20UniversityExamSuccessType=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 --- .../university/exception/UniversityExamSuccessType.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java index 28c23a1..f1e5fa4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java @@ -11,7 +11,9 @@ public enum UniversityExamSuccessType implements BusinessSucessType { * 200 OK */ GET_UNIVERSITY_EXAM_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), - GET_UNIVERSITY_EXAM_IMAGE_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"); + GET_UNIVERSITY_EXAM_IMAGE_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), + GET_UNIVERSITY_EXAM_IMAGE_AND_ANSWER_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"); + private final HttpStatus status; private final String message; From 306a54c417fe2f237df9bce2ce7af9285e116c38 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 02:01:19 +0900 Subject: [PATCH 210/465] =?UTF-8?q?[FEAT]=20=EB=AC=B8=EC=A0=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=EB=B0=8F=20=ED=95=B4=EC=A0=9C=20PDF=20pre?= =?UTF-8?q?signedUrl=20=EC=83=9D=EC=84=B1=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamService.java | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 98aab68..51d85b5 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -1,5 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.service; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageAndAnswerResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; @@ -7,6 +8,9 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamImageRepository; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; +import java.util.ArrayList; +import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -18,8 +22,14 @@ @Transactional(readOnly = true) @RequiredArgsConstructor public class UniversityExamService { + private static final String EXAM_ANSWER_PATH = "exam-answer/"; + private static final String EXAM_IMAGE_PATH = "exam-image/"; + + private final UniversityExamRepository universityExamRepository; private final UniversityExamImageRepository universityExamImageRepository; + private final S3Service s3Service; + public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) @@ -36,7 +46,33 @@ public Page getUniversityExamImages(Long id, Pag Page universityExamImages = universityExamImageRepository.findAllByUniversityExam( universityExam, pageable); - return universityExamImages.map(image -> UniversityExamImageResponseDTO.of(image.getUniversityExamImageUrl())); + return universityExamImages.map( + image -> UniversityExamImageResponseDTO.of(image.getUniversityExamImageFileName())); + } + + public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(Long universityExamId) { + UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) + .orElseThrow(() -> new UniversityExamException( + UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); + + String examAnswerUrl = s3Service.createPresignedGetUrl(EXAM_ANSWER_PATH, + universityExam.getExamAnswerFileName()); + List examImageUrls = new ArrayList<>(); + + List UniversityExamImages = universityExamImageRepository.findAllByUniversityExam( + universityExam); + + UniversityExamImages.stream().forEach(universityExamImage -> { + String presignedGetUrl = s3Service.createPresignedGetUrl(EXAM_IMAGE_PATH, + universityExamImage.getUniversityExamImageFileName()); + + examImageUrls.add( + UniversityExamImageResponseDTO.of(presignedGetUrl)); + }); + + return UniversityExamImageAndAnswerResponseDTO.of( + universityExam.getUniversity().getUniversityName(), + universityExam.getUniversity().getUniversityCollege(), examImageUrls, examAnswerUrl); } } \ No newline at end of file From f38af4dbdedff2e027acd65d91f2f75833e8765a Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 02:43:32 +0900 Subject: [PATCH 211/465] =?UTF-8?q?[FIX]=20DTO=20=EA=B0=92=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SelectUniversityResponseDTO.java | 6 +++--- .../selectUniversity/service/SelectUniversityService.java | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java index 1f38d9a..6d1d444 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java @@ -2,9 +2,9 @@ public record SelectUniversityResponseDTO( - Long universityId, String universityName, boolean memberStatus + Long universityId, String universityName, String collegeName, boolean memberStatus ) { - static public SelectUniversityResponseDTO of(Long universityId, String universityName, boolean memberStatus) { - return new SelectUniversityResponseDTO(universityId, universityName, memberStatus); + static public SelectUniversityResponseDTO of(Long universityId, String universityName, String collegeName, boolean memberStatus) { + return new SelectUniversityResponseDTO(universityId, universityName, collegeName, memberStatus); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index a8e0709..657a35f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -29,8 +29,6 @@ public class SelectUniversityService { private final UniversityExamRepository universityExamRepository; private final UniversityExamRecordRepository universityExamRecordRepository; private final static String BEFORE_EXAM = "์‹œํ—˜ ์‘์‹œ ์ „"; - private final static String LEFT_BRACKET = "("; - private final static String RIGHT_BRACKET = ")"; public List getSelectUniversities(Member member) { @@ -46,7 +44,7 @@ public List getSelectUniversities(Member member) { } } selectUniversityResponseDTOS.add(SelectUniversityResponseDTO.of(university.getUniversityId(), - university.getUniversityName() + LEFT_BRACKET + university.getUniversityCollege() + RIGHT_BRACKET, + university.getUniversityName(),university.getUniversityCollege(), status)); }); From ffb2988cbdcfbf820bc7e8618f44b9ed7d4ec7cb Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 06:01:48 +0900 Subject: [PATCH 212/465] =?UTF-8?q?[ADD]=20pem=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/.gitignore b/nonsoolmateServer/.gitignore index a52bd78..a50f4aa 100644 --- a/nonsoolmateServer/.gitignore +++ b/nonsoolmateServer/.gitignore @@ -39,4 +39,5 @@ out/ ## setting file *.yml *.yaml -*.sql \ No newline at end of file +*.sql +*.pem \ No newline at end of file From 2b584cfb9613ee45da352eb4ff2e8b87eee3b390 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 06:02:30 +0900 Subject: [PATCH 213/465] =?UTF-8?q?[ADD]=20cloudfront=20=EC=9D=98=EC=A1=B4?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index 4846039..3c3ec8a 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -48,6 +48,10 @@ dependencies { // AWS sdk implementation("software.amazon.awssdk:bom:2.21.0") implementation("software.amazon.awssdk:s3:2.21.0") + compileOnly group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.534' + implementation 'software.amazon.awssdk:cloudfront:2.18.26' // AWS SDK for Java v2์˜ ๋ฒ„์ „ + + compileOnly group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws', version: '2.2.1.RELEASE' // swagger implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' From 6e24cf5a09f1eaa5343983c63113d43f2e4988c2 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 06:23:53 +0900 Subject: [PATCH 214/465] =?UTF-8?q?[ADD]=20cloudfront=20=EA=B0=9D=EC=B2=B4?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/S3Service.java | 80 ++++++++++++++----- 1 file changed, 62 insertions(+), 18 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index a18eebe..f30f1c5 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -1,15 +1,20 @@ package com.nonsoolmate.nonsoolmateServer.external.aws.service; +import com.amazonaws.services.cloudfront.CloudFrontUrlSigner; +import com.amazonaws.services.cloudfront.util.SignerUtils; import com.nonsoolmate.nonsoolmateServer.external.aws.config.AWSConfig; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.security.spec.InvalidKeySpecException; import java.time.Duration; +import java.util.Date; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import software.amazon.awssdk.services.s3.model.GetObjectRequest; -import software.amazon.awssdk.services.s3.presigner.S3Presigner; -import software.amazon.awssdk.services.s3.presigner.model.GetObjectPresignRequest; -import software.amazon.awssdk.services.s3.presigner.model.PresignedGetObjectRequest; +import org.springframework.util.ResourceUtils; + @Component @RequiredArgsConstructor @@ -20,29 +25,68 @@ public class S3Service { private String bucketName; private final AWSConfig awsConfig; + @Value("${aws-property.distribution-domain}") + private String distributionDomain; + + @Value("${aws-property.private-key-file-path}") + private String privateKeyFilePath; + + @Value("${aws-property.key-pair-id}") + private String keyPairId; + private static final Long PRE_SIGNED_URL_EXPIRE_MINUTE = 1L; public String createPresignedGetUrl(String path, String fileName) { final String key = path + fileName; + String s3ObjectKey = key; // S3 ๊ฐ์ฒด ํ‚ค - try (S3Presigner presigner = S3Presigner.create()) { - - GetObjectRequest objectRequest = GetObjectRequest.builder() - .bucket(bucketName) - .key(key) - .build(); + // ํ˜„์žฌ ์‹œ๊ฐ„์—์„œ 1์‹œ๊ฐ„ ์œ ํšจํ•œ URL ์ƒ์„ฑ + Duration duration = Duration.ofHours(1); + Date expirationTime = new Date(System.currentTimeMillis() + duration.toMillis()); + File privateKeyFile = null; + String signedUrl = null; + SignerUtils.Protocol protocol = SignerUtils.Protocol.https; + try { + privateKeyFile = ResourceUtils.getFile(privateKeyFilePath); - GetObjectPresignRequest presignRequest = GetObjectPresignRequest.builder() - .signatureDuration(Duration.ofMinutes(PRE_SIGNED_URL_EXPIRE_MINUTE)) // The URL will expire in 10 minutes. - .getObjectRequest(objectRequest) - .build(); + signedUrl = CloudFrontUrlSigner.getSignedURLWithCannedPolicy( + protocol, + distributionDomain, + privateKeyFile, + s3ObjectKey, + keyPairId, + expirationTime + ); - PresignedGetObjectRequest presignedRequest = presigner.presignGetObject(presignRequest); - log.info("Presigned URL: [{}]", presignedRequest.url().toString()); - log.info("HTTP method: [{}]", presignedRequest.httpRequest().method()); + System.out.println("Signed URL: " + signedUrl); + }catch (FileNotFoundException e){ + log.info("FileNotFoundException = {}", e); + }catch (IOException e){ + log.info(""); + }catch (InvalidKeySpecException e){ - return presignedRequest.url().toExternalForm(); } + return signedUrl; + +// +// try (S3Presigner presigner = S3Presigner.create()) { +// +// GetObjectRequest objectRequest = GetObjectRequest.builder() +// .bucket(bucketName) +// .key(key) +// .build(); +// +// GetObjectPresignRequest presignRequest = GetObjectPresignRequest.builder() +// .signatureDuration(Duration.ofMinutes(PRE_SIGNED_URL_EXPIRE_MINUTE)) // The URL will expire in 10 minutes. +// .getObjectRequest(objectRequest) +// .build(); +// +// PresignedGetObjectRequest presignedRequest = presigner.presignGetObject(presignRequest); +// log.info("Presigned URL: [{}]", presignedRequest.url().toString()); +// log.info("HTTP method: [{}]", presignedRequest.httpRequest().method()); +// +// return presignedRequest.url().toExternalForm(); +// } } } From e5111c6cfa2b103210dfca0e7ce06c2d1998c24d Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 06:28:38 +0900 Subject: [PATCH 215/465] =?UTF-8?q?[DEL]=20=EC=9D=B4=EC=A0=84=20=EC=BD=94?= =?UTF-8?q?=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 --- .../external/aws/service/S3Service.java | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index f30f1c5..a0389bc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -62,31 +62,11 @@ public String createPresignedGetUrl(String path, String fileName) { }catch (FileNotFoundException e){ log.info("FileNotFoundException = {}", e); }catch (IOException e){ - log.info(""); + log.info("IOException = {}", e); }catch (InvalidKeySpecException e){ - + log.info("InvalidKeySpecException = {}", e); } return signedUrl; - -// -// try (S3Presigner presigner = S3Presigner.create()) { -// -// GetObjectRequest objectRequest = GetObjectRequest.builder() -// .bucket(bucketName) -// .key(key) -// .build(); -// -// GetObjectPresignRequest presignRequest = GetObjectPresignRequest.builder() -// .signatureDuration(Duration.ofMinutes(PRE_SIGNED_URL_EXPIRE_MINUTE)) // The URL will expire in 10 minutes. -// .getObjectRequest(objectRequest) -// .build(); -// -// PresignedGetObjectRequest presignedRequest = presigner.presignGetObject(presignRequest); -// log.info("Presigned URL: [{}]", presignedRequest.url().toString()); -// log.info("HTTP method: [{}]", presignedRequest.httpRequest().method()); -// -// return presignedRequest.url().toExternalForm(); -// } } } From 12e83be9b5a279ff85fa10eb2ffe41b57788500f Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 17:11:23 +0900 Subject: [PATCH 216/465] =?UTF-8?q?[REFACTOR]=20S3Service=EC=97=90?= =?UTF-8?q?=EC=84=9C=20CloudFront=20=EB=A1=9C=EC=A7=81=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC=ED=95=98=EC=97=AC=20CloudService=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamService.java | 8 ++-- .../service/UniversityExamRecordService.java | 8 ++-- ...{S3Service.java => CloudFrontService.java} | 39 ++++++------------- 3 files changed, 20 insertions(+), 35 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/{S3Service.java => CloudFrontService.java} (62%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 51d85b5..1335127 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -8,7 +8,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamImageRepository; -import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; import java.util.ArrayList; import java.util.List; import lombok.RequiredArgsConstructor; @@ -28,7 +28,7 @@ public class UniversityExamService { private final UniversityExamRepository universityExamRepository; private final UniversityExamImageRepository universityExamImageRepository; - private final S3Service s3Service; + private final CloudFrontService cloudFrontService; public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { @@ -55,7 +55,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); - String examAnswerUrl = s3Service.createPresignedGetUrl(EXAM_ANSWER_PATH, + String examAnswerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_PATH, universityExam.getExamAnswerFileName()); List examImageUrls = new ArrayList<>(); @@ -63,7 +63,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L universityExam); UniversityExamImages.stream().forEach(universityExamImage -> { - String presignedGetUrl = s3Service.createPresignedGetUrl(EXAM_IMAGE_PATH, + String presignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_IMAGE_PATH, universityExamImage.getUniversityExamImageFileName()); examImageUrls.add( diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index babbdec..2563739 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -9,7 +9,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; -import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -25,7 +25,7 @@ public class UniversityExamRecordService { private final UniversityExamRecordRepository universityExamRecordRepository; private final UniversityExamRepository universityExamRepository; - private final S3Service s3Service; + private final CloudFrontService cloudFrontService; public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityExamId, Member member) { @@ -35,9 +35,9 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx UniversityExamRecord universityExamRecord = universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( universityExam, member); - String answerUrl = s3Service.createPresignedGetUrl(EXAM_ANSWER_FOLDER_NAME, + String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, universityExam.getExamAnswerFileName()); - String resultUrl = s3Service.createPresignedGetUrl(EXAM_RESULT_FOLDER_NAME, + String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamRecord.getExamRecordResultFileName()); return UniversityExamRecordResponseDTO.of(answerUrl, resultUrl); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java similarity index 62% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index a0389bc..e34c186 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -19,12 +19,7 @@ @Component @RequiredArgsConstructor @Slf4j -public class S3Service { - - @Value("${aws-property.s3-bucket-name}") - private String bucketName; - private final AWSConfig awsConfig; - +public class CloudFrontService { @Value("${aws-property.distribution-domain}") private String distributionDomain; @@ -34,21 +29,14 @@ public class S3Service { @Value("${aws-property.key-pair-id}") private String keyPairId; - private static final Long PRE_SIGNED_URL_EXPIRE_MINUTE = 1L; - - public String createPresignedGetUrl(String path, String fileName) { - final String key = path + fileName; - String s3ObjectKey = key; // S3 ๊ฐ์ฒด ํ‚ค - - // ํ˜„์žฌ ์‹œ๊ฐ„์—์„œ 1์‹œ๊ฐ„ ์œ ํšจํ•œ URL ์ƒ์„ฑ - Duration duration = Duration.ofHours(1); + public String createPreSignedGetUrl(String path, String fileName) { + String s3ObjectKey = path + fileName; // S3 ๊ฐ์ฒด ํ‚ค + Duration duration = Duration.ofMinutes(1); Date expirationTime = new Date(System.currentTimeMillis() + duration.toMillis()); - File privateKeyFile = null; - String signedUrl = null; SignerUtils.Protocol protocol = SignerUtils.Protocol.https; + String signedUrl = null; try { - privateKeyFile = ResourceUtils.getFile(privateKeyFilePath); - + File privateKeyFile = ResourceUtils.getFile(privateKeyFilePath); signedUrl = CloudFrontUrlSigner.getSignedURLWithCannedPolicy( protocol, distributionDomain, @@ -57,16 +45,13 @@ public String createPresignedGetUrl(String path, String fileName) { keyPairId, expirationTime ); - - System.out.println("Signed URL: " + signedUrl); - }catch (FileNotFoundException e){ - log.info("FileNotFoundException = {}", e); - }catch (IOException e){ - log.info("IOException = {}", e); - }catch (InvalidKeySpecException e){ - log.info("InvalidKeySpecException = {}", e); + } catch (FileNotFoundException e) { + throw new RuntimeException(e); + } catch (InvalidKeySpecException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); } return signedUrl; } - } From 887c544e793dce3f02433c1815c81100d44472dd Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 17:53:55 +0900 Subject: [PATCH 217/465] =?UTF-8?q?[FIX]=20naver=20=EC=86=8C=EC=85=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=20YML=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20Value=20=EA=B2=BD=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 --- .../domain/auth/controller/AuthController.java | 11 +++++++++-- .../external/oauth/service/NaverAuthService.java | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index a79f5d0..09b969a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -13,6 +13,7 @@ import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -29,6 +30,11 @@ public class AuthController { private final AuthServiceProvider authServiceProvider; private final JwtService jwtService; + @Value("${spring.security.oauth2.client.naver.client-id}") + private String clientId; + @Value("${spring.security.oauth2.client.naver.redirect-uri}") + private String redirectUri; + @PostMapping("/social/login") public ResponseEntity> login( @RequestHeader(value = "authorization-code") final String authorizationCode, @@ -49,10 +55,11 @@ public ResponseEntity> reissue(HttpServlet @GetMapping("/authTest") public String authTest(HttpServletRequest request, HttpServletResponse response) { - + String redirectURL = "https://nid.naver.com/oauth2.0/authorize?client_id=" + clientId + + "&redirect_uri=" + redirectUri + "&response_type=code"; try { response.sendRedirect( - "https://nid.naver.com/oauth2.0/authorize?&client_id=iuUGaSHmzPMxKmNlc0BD&redirect_uri=http://localhost:8080/login/oauth2/code/naver&response_type=code"); + redirectURL); } catch (Exception e) { log.info("authTest = {}", e); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index a5e59e9..9af47b9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -17,11 +17,11 @@ @Transactional(readOnly = true) public class NaverAuthService extends AuthService { - @Value("${naver.client-id}") + @Value("${spring.security.oauth2.client.naver.client-id}") private String clientId; - @Value("${naver.client-secret}") + @Value("${spring.security.oauth2.client.naver.client-secret}") private String clientSecret; - @Value("${naver.state}") + @Value("${spring.security.oauth2.client.naver.state}") private String state; public NaverAuthService(MemberRepository memberRepository) { From 08253fa459addf67f537160e17d86aacf785bda9 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 17:54:48 +0900 Subject: [PATCH 218/465] =?UTF-8?q?[DEL]=20=EC=95=88=EC=93=B0=EB=8A=94=20i?= =?UTF-8?q?mport=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/CloudFrontService.java | 1 - 1 file changed, 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index e34c186..1b04f0c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -2,7 +2,6 @@ import com.amazonaws.services.cloudfront.CloudFrontUrlSigner; import com.amazonaws.services.cloudfront.util.SignerUtils; -import com.nonsoolmate.nonsoolmateServer.external.aws.config.AWSConfig; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; From 79b59c0f309f49451827009712f44aed7e2bc9b4 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 18:06:44 +0900 Subject: [PATCH 219/465] =?UTF-8?q?[FEAT]=20S3=20Service=EB=82=B4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20getUploadPreSignedUrl=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/S3Service.java | 50 +++++++++++++++++++ .../aws/service/vo/PreSignedUrlVO.java | 15 ++++++ 2 files changed, 65 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/vo/PreSignedUrlVO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java new file mode 100644 index 0000000..7c5b0b8 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -0,0 +1,50 @@ +package com.nonsoolmate.nonsoolmateServer.external.aws.service; + +import com.nonsoolmate.nonsoolmateServer.external.aws.config.AWSConfig; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; +import java.time.Duration; +import java.util.UUID; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import software.amazon.awssdk.services.s3.presigner.S3Presigner; +import software.amazon.awssdk.services.s3.model.PutObjectRequest; +import software.amazon.awssdk.services.s3.presigner.model.PutObjectPresignRequest; +import java.net.URL; + +@Service +@RequiredArgsConstructor +@Slf4j +public class S3Service { + @Value("${aws-property.s3-bucket-name}") + private String bucketName; + private final AWSConfig awsConfig; + private static final Long PRE_SIGNED_URL_EXPIRE_MINUTE = 1L; + + public PreSignedUrlVO getUploadPreSignedUrl(final String prefix) { + String uuidFileName = generateZipFileName(); + String key = prefix + uuidFileName; + + S3Presigner preSigner = awsConfig.getS3Presigner(); + + PutObjectRequest putObjectRequest = PutObjectRequest.builder() + .bucket(bucketName) + .key(key) + .build(); + + PutObjectPresignRequest preSignedUrlRequest = PutObjectPresignRequest.builder() + .signatureDuration(Duration.ofMinutes(PRE_SIGNED_URL_EXPIRE_MINUTE)) + .putObjectRequest(putObjectRequest) + .build(); + + URL url = preSigner.presignPutObject(preSignedUrlRequest).url(); + + return PreSignedUrlVO.of(uuidFileName, url.toString()); + } + + private String generateZipFileName() { + return UUID.randomUUID() + ".zip"; + } + +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/vo/PreSignedUrlVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/vo/PreSignedUrlVO.java new file mode 100644 index 0000000..0173b0c --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/vo/PreSignedUrlVO.java @@ -0,0 +1,15 @@ +package com.nonsoolmate.nonsoolmateServer.external.aws.service.vo; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class PreSignedUrlVO { + private String fileName; + private String url; + + public static PreSignedUrlVO of(String fileName, String url) { + return new PreSignedUrlVO(fileName, url); + } +} From 2bee54b236021bd260a66a0acf87188a4b6a3bc3 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 18:16:53 +0900 Subject: [PATCH 220/465] =?UTF-8?q?[ADD]=20S3=20Bucket=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=20=EC=9D=B4=EB=A6=84=20static=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=A1=9C=20=EB=B6=84=EB=A6=AC=ED=95=B4=EC=84=9C=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 --- .../service/UniversityExamRecordService.java | 7 ++----- .../nonsoolmateServer/external/aws/FolderName.java | 10 ++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 2563739..83c31cc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -1,6 +1,8 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service; import static com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM; +import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_ANSWER_FOLDER_NAME; +import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_RESULT_FOLDER_NAME; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; @@ -18,11 +20,6 @@ @Transactional(readOnly = true) @RequiredArgsConstructor public class UniversityExamRecordService { - - private static final String EXAM_ANSWER_FOLDER_NAME = "exam-answer/"; - private static final String EXAM_RESULT_FOLDER_NAME = "exam-result/"; - - private final UniversityExamRecordRepository universityExamRecordRepository; private final UniversityExamRepository universityExamRepository; private final CloudFrontService cloudFrontService; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java new file mode 100644 index 0000000..b1a348d --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.external.aws; + +import lombok.Getter; + +@Getter +public class FolderName { + public static final String EXAM_ANSWER_FOLDER_NAME = "exam-answer/"; + public static final String EXAM_RESULT_FOLDER_NAME = "exam-result/"; + public static final String EXAM_SHEET_FOLDER_NAME = "exam-sheet/"; +} From 64d768f7dfab15b08f66ab094ee8a42131272aa5 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 19:44:57 +0900 Subject: [PATCH 221/465] =?UTF-8?q?[CHORE]=20CI/CD=20SCRIPT=EB=82=B4=20clo?= =?UTF-8?q?udfront-private-key=20=EC=83=9D=EC=84=B1=20=EC=BD=94=EB=93=9C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CD.yml | 4 +++- .github/workflows/dev-CI.yml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-CD.yml b/.github/workflows/dev-CD.yml index e0b516d..6a96fea 100644 --- a/.github/workflows/dev-CD.yml +++ b/.github/workflows/dev-CD.yml @@ -20,10 +20,12 @@ jobs: distribution: 'temurin' java-version: '17' - - name: application.yaml ์ƒ์„ฑ + - name: resources ํด๋” ๋‚ด ํŒŒ์ผ ์ƒ์„ฑ run: | mkdir -p src/main/resources echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application.yaml + mkdir -p src/main/resources/key + echo "${{ secrets.CLOUDFRONT_PRIVATE_KEY }}" > src/main/resources/key/cloudfront-private-key.pem working-directory: ${{ env.working-directory }} - name: ๋นŒ๋“œ diff --git a/.github/workflows/dev-CI.yml b/.github/workflows/dev-CI.yml index e205ee7..7d0c0f1 100644 --- a/.github/workflows/dev-CI.yml +++ b/.github/workflows/dev-CI.yml @@ -20,10 +20,12 @@ jobs: distribution: 'temurin' java-version: '17' - - name: application.yaml ์ƒ์„ฑ + - name: resources ํด๋” ๋‚ด ํŒŒ์ผ ์ƒ์„ฑ run: | mkdir -p src/main/resources echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application.yaml + mkdir -p src/main/resources/key + echo "${{ secrets.CLOUDFRONT_PRIVATE_KEY }}" > src/main/resources/key/cloudfront-private-key.pem working-directory: ${{ env.working-directory }} - name: build From 62d27094f6eb76a4ccad618ebff8bc8bfe1264d4 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 20:19:25 +0900 Subject: [PATCH 222/465] =?UTF-8?q?[FEAT]=20=EC=B2=A8=EC=82=AD=20PDF=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20controller=EB=8B=A8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamRecordController.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index 4467d3e..6b8b11a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -1,9 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller; +import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS; import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SUCCESS; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResultResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; @@ -29,4 +31,13 @@ public ResponseEntity> getUniversit return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_RECORD_SUCCESS, universityExamRecordService.getUniversityExamRecord(universityExamId, member))); } + + @GetMapping("/result/{id}") + public ResponseEntity> getUniversityExamRecordResult( + @PathVariable("id") Long universityExamId, + @AuthUser Member member + ){ + return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS, + universityExamRecordService.getUniversityExamRecordResult(universityExamId, member))); + } } From e8d7b2657e6c59863ef364d0fa3a36f2a51f0ccc Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 20:19:41 +0900 Subject: [PATCH 223/465] =?UTF-8?q?[ADD]=20=EC=B2=A8=EC=82=AD=20PDF=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20DTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/UniversityExamRecordResultResponseDTO.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java new file mode 100644 index 0000000..decffa4 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java @@ -0,0 +1,9 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; + +public record UniversityExamRecordResultResponseDTO( + String examResultUrl +) { + public static UniversityExamRecordResultResponseDTO of(String examResultUrl){ + return new UniversityExamRecordResultResponseDTO(examResultUrl); + } +} From 5d4540500b0bc2ec9ec9d24f6a8b10703a9ffd82 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 20:20:00 +0900 Subject: [PATCH 224/465] =?UTF-8?q?[FEAT]=20=EC=B2=A8=EC=82=AD=20PDF=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 83c31cc..b347a19 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -9,6 +9,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResultResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; @@ -40,4 +41,18 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx return UniversityExamRecordResponseDTO.of(answerUrl, resultUrl); } + public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long universityExamId, Member member) { + + UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) + .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); + + UniversityExamRecord universityExamRecord = universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( + universityExam, member); + + String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, + universityExamRecord.getExamRecordResultFileName()); + + return UniversityExamRecordResultResponseDTO.of(resultUrl); + } + } From 788e78db3fb22de8430504a7f3b7becc49b9db37 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 20:20:14 +0900 Subject: [PATCH 225/465] =?UTF-8?q?[ADD]=20=EC=B2=A8=EC=82=AD=20PDF=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20=EC=84=B1=EA=B3=B5=20enum=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 --- .../exception/UniversityExamRecordSuccessType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java index 295da4f..1b2e69c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java @@ -7,7 +7,8 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum UniversityExamRecordSuccessType implements BusinessSucessType { - GET_UNIVERSITY_EXAM_RECORD_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF, ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."); + GET_UNIVERSITY_EXAM_RECORD_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF, ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), + GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From 07110e32480f54f6afcc6af779d7ad1185d977b0 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 20:50:21 +0900 Subject: [PATCH 226/465] =?UTF-8?q?[FIX]=20=EB=A7=A4=EC=A7=81=20=EB=A6=AC?= =?UTF-8?q?=ED=84=B0=EB=9F=B4=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...UniversityExamImageAndAnswerResponseDTO.java | 0 .../UniversityExamImageResponseDTO.java | 0 .../UniversityExamInfoResponseDTO.java | 0 .../service/UniversityExamService.java | 17 ++++++++--------- 4 files changed, 8 insertions(+), 9 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/{ => response}/UniversityExamImageAndAnswerResponseDTO.java (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/{ => response}/UniversityExamImageResponseDTO.java (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/{ => response}/UniversityExamInfoResponseDTO.java (100%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageAndAnswerResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageAndAnswerResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamImageResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamInfoResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/UniversityExamInfoResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 1335127..af53e6e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -1,8 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.service; -import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageAndAnswerResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; +import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_ANSWER_FOLDER_NAME; +import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_RESULT_FOLDER_NAME; + +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageAndAnswerResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamInfoResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExamImage; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; @@ -22,10 +25,6 @@ @Transactional(readOnly = true) @RequiredArgsConstructor public class UniversityExamService { - private static final String EXAM_ANSWER_PATH = "exam-answer/"; - private static final String EXAM_IMAGE_PATH = "exam-image/"; - - private final UniversityExamRepository universityExamRepository; private final UniversityExamImageRepository universityExamImageRepository; private final CloudFrontService cloudFrontService; @@ -55,7 +54,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); - String examAnswerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_PATH, + String examAnswerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, universityExam.getExamAnswerFileName()); List examImageUrls = new ArrayList<>(); @@ -63,7 +62,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L universityExam); UniversityExamImages.stream().forEach(universityExamImage -> { - String presignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_IMAGE_PATH, + String presignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamImage.getUniversityExamImageFileName()); examImageUrls.add( From 12e70d7dabb835bcfa5fa2a07fcfe29a5dcfc172 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 20:59:11 +0900 Subject: [PATCH 227/465] =?UTF-8?q?[ADD]=20UniversityExamResultPreSignedUr?= =?UTF-8?q?lResponseDTO=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniversityExamResultPreSignedUrlResponseDTO.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamResultPreSignedUrlResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamResultPreSignedUrlResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamResultPreSignedUrlResponseDTO.java new file mode 100644 index 0000000..9748569 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamResultPreSignedUrlResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response; + +public record UniversityExamResultPreSignedUrlResponseDTO(String resultFileName, String preSignedUrl) { + static public UniversityExamResultPreSignedUrlResponseDTO of(String resultFileName, String preSignedUrl) { + return new UniversityExamResultPreSignedUrlResponseDTO(resultFileName, preSignedUrl); + } +} From bf300bbce57c08a01822976ea06e48ca2294ce6e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 20:59:58 +0900 Subject: [PATCH 228/465] =?UTF-8?q?[STYLE]=20DTO=20response=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=20=EB=82=B4=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/UniversityExamImageAndAnswerResponseDTO.java | 2 +- .../controller/dto/response/UniversityExamImageResponseDTO.java | 2 +- .../controller/dto/response/UniversityExamInfoResponseDTO.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java index b61df2b..776dd72 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto; +package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response; import java.util.List; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java index ed4279a..4e328ee 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto; +package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response; public record UniversityExamImageResponseDTO(String examImgUrl) { static public UniversityExamImageResponseDTO of(String examImgUrl) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java index 1db95f9..9ba7c16 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto; +package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response; public record UniversityExamInfoResponseDTO(Long examId, String examName, int examTimeLimit) { public static UniversityExamInfoResponseDTO of(Long examId, String examName, int examTimeLimit) { From b5ddef799c59fd29b15f59809b798b1ed78f0245 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 21:11:57 +0900 Subject: [PATCH 229/465] =?UTF-8?q?[REFACTOR]=20result=20->=20sheet=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/UniversityExamRecordResultResponseDTO.java | 9 --------- .../dto/UniversityExamRecordSheetResponseDTO.java | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordSheetResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java deleted file mode 100644 index decffa4..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; - -public record UniversityExamRecordResultResponseDTO( - String examResultUrl -) { - public static UniversityExamRecordResultResponseDTO of(String examResultUrl){ - return new UniversityExamRecordResultResponseDTO(examResultUrl); - } -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordSheetResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordSheetResponseDTO.java new file mode 100644 index 0000000..e9a8125 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordSheetResponseDTO.java @@ -0,0 +1,9 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; + +public record UniversityExamRecordSheetResponseDTO( + String examResultUrl +) { + public static UniversityExamRecordSheetResponseDTO of(String examResultUrl) { + return new UniversityExamRecordSheetResponseDTO(examResultUrl); + } +} From d41f4c0d6715de5aaf9c737a3b10fcefacfc927e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 21:14:34 +0900 Subject: [PATCH 230/465] =?UTF-8?q?[ADD]=20=EB=8B=B5=EC=95=88=EC=A7=80=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20PresignedUrl=20=EB=B0=9C=EA=B8=89?= =?UTF-8?q?=EC=97=90=20=EC=84=B1=EA=B3=B5=20=ED=83=80=EC=9E=85=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 --- .../exception/UniversityExamRecordSuccessType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java index 1b2e69c..174c44c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java @@ -8,7 +8,8 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum UniversityExamRecordSuccessType implements BusinessSucessType { GET_UNIVERSITY_EXAM_RECORD_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF, ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), - GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."); + GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), + GET_UNIVERSITY_EXAM_RECORD_SHEET_PRESIGNED_SUCCESS(HttpStatus.OK, "๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From 8540a7da6611a1b5dface61ee91d383e08bf86e7 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 21:15:05 +0900 Subject: [PATCH 231/465] =?UTF-8?q?[REFACTOR]=20response=20dto=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=20=EA=B2=BD=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20import=EB=AC=B8=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/controller/UniversityExamController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index c2d3115..2138736 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -2,9 +2,9 @@ import static com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_AND_ANSWER_SUCCESS; -import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageAndAnswerResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamImageResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.UniversityExamInfoResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageAndAnswerResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamInfoResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.university.service.UniversityExamService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; From 626e4c8d46c8f2b0c48654830d64b0bcc4d38374 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 21:20:42 +0900 Subject: [PATCH 232/465] =?UTF-8?q?[FEAT]=20UniversityExamRecordSheetServi?= =?UTF-8?q?ce=20-=20getUniversityExamRecordSheetPreSignedUrl=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...niversityExamRecordResultResponseDTO.java} | 0 ...sityExamResultPreSignedUrlResponseDTO.java | 0 .../UniversityExamRecordSheetService.java | 21 +++++++++++++++++++ 3 files changed, 21 insertions(+) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/{UniversityExamRecordSheetResponseDTO.java => UniversityExamRecordResultResponseDTO.java} (100%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/{university/controller/dto/response => universityExamRecord/controller/dto}/UniversityExamResultPreSignedUrlResponseDTO.java (100%) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordSheetService.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordSheetResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordSheetResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamResultPreSignedUrlResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java similarity index 100% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamResultPreSignedUrlResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordSheetService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordSheetService.java new file mode 100644 index 0000000..8592fae --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordSheetService.java @@ -0,0 +1,21 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service; + +import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_SHEET_FOLDER_NAME; + +import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional(readOnly = true) +@RequiredArgsConstructor +public class UniversityExamRecordSheetService { + private final S3Service s3Service; + + public PreSignedUrlVO getUniversityExamRecordSheetPreSignedUrl() { + return s3Service.getUploadPreSignedUrl(EXAM_SHEET_FOLDER_NAME); + } + +} From f89cd70e6307a2e86117479317e0a22cd7d48829 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 21:21:32 +0900 Subject: [PATCH 233/465] =?UTF-8?q?[REFACOTOR]=20DTO=20=EA=B2=BD=EB=A1=9C?= =?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 --- .../dto/UniversityExamRecordResultResponseDTO.java | 6 +++--- .../dto/UniversityExamResultPreSignedUrlResponseDTO.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java index e9a8125..51f9291 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java @@ -1,9 +1,9 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; -public record UniversityExamRecordSheetResponseDTO( +public record UniversityExamRecordResultResponseDTO( String examResultUrl ) { - public static UniversityExamRecordSheetResponseDTO of(String examResultUrl) { - return new UniversityExamRecordSheetResponseDTO(examResultUrl); + public static UniversityExamRecordResultResponseDTO of(String examResultUrl) { + return new UniversityExamRecordResultResponseDTO(examResultUrl); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java index 9748569..e567c58 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response; +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; public record UniversityExamResultPreSignedUrlResponseDTO(String resultFileName, String preSignedUrl) { static public UniversityExamResultPreSignedUrlResponseDTO of(String resultFileName, String preSignedUrl) { From edb70383fcab0d90f4ff8500bba9ab5fd3418c9e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 21:26:38 +0900 Subject: [PATCH 234/465] =?UTF-8?q?[FEAT]=20UniversityExamRecordController?= =?UTF-8?q?=20-=20getUniversityExamSheetPreSignedUrl=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniversityExamRecordController.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index 6b8b11a..4d41a26 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -4,9 +4,13 @@ import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SUCCESS; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamResultPreSignedUrlResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResultResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordService; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordSheetService; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import lombok.RequiredArgsConstructor; @@ -22,22 +26,28 @@ public class UniversityExamRecordController { private final UniversityExamRecordService universityExamRecordService; + private final UniversityExamRecordSheetService universityExamRecordSheetService; @GetMapping("/{id}") public ResponseEntity> getUniversityExamRecord( - @PathVariable("id") Long universityExamId, - @AuthUser Member member - ) { + @PathVariable("id") Long universityExamId, @AuthUser Member member) { return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_RECORD_SUCCESS, universityExamRecordService.getUniversityExamRecord(universityExamId, member))); } @GetMapping("/result/{id}") public ResponseEntity> getUniversityExamRecordResult( - @PathVariable("id") Long universityExamId, - @AuthUser Member member - ){ + @PathVariable("id") Long universityExamId, @AuthUser Member member) { return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS, universityExamRecordService.getUniversityExamRecordResult(universityExamId, member))); } + + @GetMapping("/sheet/presigned") + public ResponseEntity> getUniversityExamSheetPreSignedUrl() { + PreSignedUrlVO universityExamRecordSheetPreSignedUrlVO = universityExamRecordSheetService.getUniversityExamRecordSheetPreSignedUrl(); + return ResponseEntity.ok().body(ApiResponse.success( + UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SHEET_PRESIGNED_SUCCESS, + UniversityExamResultPreSignedUrlResponseDTO.of(universityExamRecordSheetPreSignedUrlVO.getFileName(), + universityExamRecordSheetPreSignedUrlVO.getFileName()))); + } } From 9450d0975297fb26d400632d438f1cad3beb9f40 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 21:32:08 +0900 Subject: [PATCH 235/465] =?UTF-8?q?[FIX]=20UnviersityExamResultPreSignedUr?= =?UTF-8?q?lResponseDTO=20url=EC=97=90=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=EC=9C=BC=EB=A1=9C=20=EC=A0=84=EB=8B=AC=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamRecordController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index 4d41a26..0ac48ef 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -48,6 +48,6 @@ public ResponseEntity> return ResponseEntity.ok().body(ApiResponse.success( UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SHEET_PRESIGNED_SUCCESS, UniversityExamResultPreSignedUrlResponseDTO.of(universityExamRecordSheetPreSignedUrlVO.getFileName(), - universityExamRecordSheetPreSignedUrlVO.getFileName()))); + universityExamRecordSheetPreSignedUrlVO.getUrl()))); } } From 9f808194d963839e1aa1c9e5355431c31f00b983 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 21:34:05 +0900 Subject: [PATCH 236/465] =?UTF-8?q?[REFACTOR]=20response=20DTO=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamRecordController.java | 6 +++--- .../dto/UniversityExamResultPreSignedUrlResponseDTO.java | 7 ------- .../dto/UniversityExamSheetPreSignedUrlResponseDTO.java | 7 +++++++ 3 files changed, 10 insertions(+), 10 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamSheetPreSignedUrlResponseDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index 0ac48ef..dec5ace 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -4,7 +4,7 @@ import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SUCCESS; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; -import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamResultPreSignedUrlResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamSheetPreSignedUrlResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResultResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType; @@ -43,11 +43,11 @@ public ResponseEntity> getUni } @GetMapping("/sheet/presigned") - public ResponseEntity> getUniversityExamSheetPreSignedUrl() { + public ResponseEntity> getUniversityExamSheetPreSignedUrl() { PreSignedUrlVO universityExamRecordSheetPreSignedUrlVO = universityExamRecordSheetService.getUniversityExamRecordSheetPreSignedUrl(); return ResponseEntity.ok().body(ApiResponse.success( UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SHEET_PRESIGNED_SUCCESS, - UniversityExamResultPreSignedUrlResponseDTO.of(universityExamRecordSheetPreSignedUrlVO.getFileName(), + UniversityExamSheetPreSignedUrlResponseDTO.of(universityExamRecordSheetPreSignedUrlVO.getFileName(), universityExamRecordSheetPreSignedUrlVO.getUrl()))); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java deleted file mode 100644 index e567c58..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamResultPreSignedUrlResponseDTO.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; - -public record UniversityExamResultPreSignedUrlResponseDTO(String resultFileName, String preSignedUrl) { - static public UniversityExamResultPreSignedUrlResponseDTO of(String resultFileName, String preSignedUrl) { - return new UniversityExamResultPreSignedUrlResponseDTO(resultFileName, preSignedUrl); - } -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamSheetPreSignedUrlResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamSheetPreSignedUrlResponseDTO.java new file mode 100644 index 0000000..978775c --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamSheetPreSignedUrlResponseDTO.java @@ -0,0 +1,7 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; + +public record UniversityExamSheetPreSignedUrlResponseDTO(String resultFileName, String preSignedUrl) { + static public UniversityExamSheetPreSignedUrlResponseDTO of(String resultFileName, String preSignedUrl) { + return new UniversityExamSheetPreSignedUrlResponseDTO(resultFileName, preSignedUrl); + } +} From b23f0dc4797741115e7d53de3c7b79af4164b332 Mon Sep 17 00:00:00 2001 From: Mingyu Song <100754581+mikekks@users.noreply.github.com> Date: Thu, 11 Jan 2024 22:11:35 +0900 Subject: [PATCH 237/465] =?UTF-8?q?[DOCS]=20readme=20=EC=88=98=EC=A0=95(2?= =?UTF-8?q?=EC=B0=A8=20=EA=B3=BC=EC=A0=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 03a7777..8f41057 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,8 @@

## ๐Ÿ› ๏ธ Architecture Structure -![nonsoolmate Server Architecture](https://github.com/nonsoolmate/NONSOOLMATE-SERVER/assets/81363864/5f1dd158-2f6f-485e-8ec8-ea39241418e2) +![image](https://github.com/nonsoolmate/NONSOOLMATE-SERVER/assets/100754581/ec2e9c0d-e3f9-4feb-81f6-c1cb842beb8b) +

@@ -103,6 +104,7 @@ โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service โ”‚ โ”œโ”€ ๐Ÿ“‚ redis โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ config +โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service โ”‚ โ””โ”€ ๐Ÿ“‚ swagger โ”‚ โ””โ”€ ๐Ÿ“‚ config @@ -111,9 +113,11 @@ โ”œโ”€ ๐Ÿ“‚ response โ”œโ”€ ๐Ÿ“‚ error โ”œโ”€ ๐Ÿ“‚ jwt - โ”‚ โ””โ”€ ๐Ÿ“‚ service + โ”‚ โ”œโ”€ ๐Ÿ“‚ utils + โ”‚ โ””โ”€ ๐Ÿ“‚ service โ”œโ”€ ๐Ÿ“‚ security โ”‚ โ”œโ”€ ๐Ÿ“‚ handler + โ”‚ โ”œโ”€ ๐Ÿ“‚ service โ”‚ โ”œโ”€ ๐Ÿ“‚ filter โ”‚ โ””โ”€ ๐Ÿ“‚ config โ””โ”€ ๐Ÿ“‚ util @@ -121,6 +125,9 @@ ~~~

+## ๐Ÿ“š ERD +แ„‰แ…ณแ„แ…ณแ„…แ…ตแ†ซแ„‰แ…ฃแ†บ 2024-01-11 แ„‹แ…ฉแ„’แ…ฎ 10 03 04 + ## ๐Ÿ” Nonsoolmate Server's Rule ## 1. ๐Ÿ‘ปย Commit Convention @@ -180,7 +187,7 @@ main - ์•„๋ž˜ 3๊ฐ€์ง€๋Š” ๊ธฐ์–ตํ•ด์ฃผ์„ธ์š” - else ์ง€์–‘ํ•˜๊ธฐ - ์šฐํ…Œ์ฝ” ์ฝ”๋“œ ์ปจ๋ฒค์…˜ ์ ์šฉํ•˜๊ธฐ - - `**cmd + option + L`** + - `cmd + option + L` ### 3.1 ์šฐํ…Œ์ฝ” ์ฝ”๋“œ ์ปจ๋ฒค์…˜ @@ -189,8 +196,8 @@ main ### 3.2 ๋ฉ”์†Œ๋“œ๋ช… -- ***CRUD Create Read Update Delete๋กœ ์‹œ์ž‘ํ•˜๊ธฐ!*** - - ์˜ˆ์‹œ: readUser createUser readBoard updateUser +- ***CRUD Create get(Read) Update Delete๋กœ ์‹œ์ž‘ํ•˜๊ธฐ!*** + - ์˜ˆ์‹œ: getUser(readUser) createUser readBoard updateUser - **์ปจํŠธ๋กค๋Ÿฌ & ์„œ๋น„์Šค ๋ฉ”์„œ๋“œ๋ช… ์ตœ๋Œ€ํ•œ ๋น„์Šทํ•˜๊ฒŒ ๋„ค์ด๋ฐ** ### 3.3 DTO๋ช… From 4946a04708dfc6eca6a8676dd087941fbca7e6ad Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 22:58:21 +0900 Subject: [PATCH 238/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20"=E3=84=B1-=E3=85=8E"=EC=88=9C=20=EC=A0=95=EB=A0=AC?= =?UTF-8?q?=20=EC=BF=BC=EB=A6=AC=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/SelectUniversityRepository.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java index 1708ed5..a8bfe4e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java @@ -6,12 +6,16 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; import org.springframework.transaction.annotation.Transactional; public interface SelectUniversityRepository extends JpaRepository { List findAllByMember(Member member); + @Query("select su from SelectUniversity su where su.member =:member order by su.university.universityName asc, su.university.universityCollege asc") + List findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc(Member member); + @Transactional void deleteByMemberAndUniversity(Member member, University university); From 4cb1574f85eefacae9e559f6c6fe8e96a6969692 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 11 Jan 2024 22:58:37 +0900 Subject: [PATCH 239/465] =?UTF-8?q?[FEAT]=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20"=E3=84=B1-=E3=85=8E"=EC=88=9C=20=EC=A0=95=EB=A0=AC?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 657a35f..c687ae3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -32,16 +32,16 @@ public class SelectUniversityService { public List getSelectUniversities(Member member) { - List selectUniversities = selectUniversityRepository.findAllByMember(member); + List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc(member); List selectUniversityResponseDTOS = new ArrayList<>(); - universityRepository.findAll().stream().forEach(university -> { - boolean status = false; + selectUniversities.stream().forEach(selectUniversity -> { + boolean status = true; - for (SelectUniversity selectUniversity : selectUniversities) { - if (university.getUniversityId() == selectUniversity.getUniversity().getUniversityId()) { - status = true; - } + University university = universityRepository.findByUniversityId( + selectUniversity.getUniversity().getUniversityId()).orElse(null); + if(university == null){ + status = false; } selectUniversityResponseDTOS.add(SelectUniversityResponseDTO.of(university.getUniversityId(), university.getUniversityName(),university.getUniversityCollege(), @@ -54,7 +54,7 @@ public List getSelectUniversities(Member member) { public List getSelectUniversityExams(Member member) { List selectUniversityExamsResponseDTOS = new ArrayList<>(); - List selectUniversities = selectUniversityRepository.findAllByMember(member); + List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc(member); for (SelectUniversity selectUniversity : selectUniversities) { selectUniversityExamsResponseDTOS.add(getSelectUniversityExamsResponseDTO(selectUniversity, member)); From 4c0137993a252fedf8fa345d9c14e0a2773adf85 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 23:14:50 +0900 Subject: [PATCH 240/465] =?UTF-8?q?[FIX]=20@ManyToOne(fetch=3DFetchType.LA?= =?UTF-8?q?ZY)=20=EC=A0=81=EC=9A=A9=20=EB=B9=A0=EC=A7=84=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/selectUniversity/entity/SelectUniversity.java | 5 +++-- .../domain/university/entity/UniversityExamImage.java | 3 ++- .../universityExamRecord/entity/UniversityExamRecord.java | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java index 3863a77..e20dcf4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java @@ -3,6 +3,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -21,11 +22,11 @@ public class SelectUniversity { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long selectUniversityId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id") private Member member; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "university_id") private University university; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java index 188c04e..3230c4b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java @@ -1,6 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.entity; import jakarta.persistence.Entity; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -21,7 +22,7 @@ public class UniversityExamImage { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long universityExamImageId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "university_exam_id") private UniversityExam universityExam; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java index 5a3e536..2b5eedf 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java @@ -6,6 +6,7 @@ import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id; @@ -25,11 +26,11 @@ public class UniversityExamRecord { @GeneratedValue(strategy = GenerationType.IDENTITY) private Long universityExamRecordId; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "university_exam_id") private UniversityExam universityExam; - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "member_id") private Member member; From ed8904c01dbc43e251f9bff4cdbee71e0dc40dcb Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 11 Jan 2024 23:25:01 +0900 Subject: [PATCH 241/465] =?UTF-8?q?[ADD]=20UniversityExamRecordIdResponse?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20=ED=8C=A8=ED=82=A4=EC=A7=95?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniversityExamRecordController.java | 22 ++++++++++++++++--- .../UniversityExamRecordIdResponse.java | 4 ++++ .../UniversityExamRecordResponseDTO.java | 8 +++---- ...UniversityExamRecordResultResponseDTO.java | 2 +- ...rsityExamSheetPreSignedUrlResponseDTO.java | 2 +- .../service/UniversityExamRecordService.java | 5 +++-- 6 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/{ => response}/UniversityExamRecordResponseDTO.java (68%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/{ => response}/UniversityExamRecordResultResponseDTO.java (91%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/{ => response}/UniversityExamSheetPreSignedUrlResponseDTO.java (92%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index dec5ace..42b4c51 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -4,19 +4,23 @@ import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SUCCESS; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; -import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamSheetPreSignedUrlResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResultResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamSheetPreSignedUrlResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResultResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordIdResponse; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordService; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordSheetService; import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -50,4 +54,16 @@ public ResponseEntity> g UniversityExamSheetPreSignedUrlResponseDTO.of(universityExamRecordSheetPreSignedUrlVO.getFileName(), universityExamRecordSheetPreSignedUrlVO.getUrl()))); } + + @PostMapping("/{id}/sheet") + public ResponseEntity> createUniversityExamRecord( + @PathVariable("id") Long universityExamId, + @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, + @AuthUser Member member) { + return ResponseEntity.ok().body(ApiResponse.success( + UniversityExamRecordSuccessType.CREATE_UNIVERSITY_EXAM_RECORD_SUCCESS, + UniversityExamRecordIdResponse.of( + universityExamRecordService.createUniversityExamRecord(universityExamId, + createUniversityExamRequestDTO, member)))); + } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java new file mode 100644 index 0000000..2936a3d --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java @@ -0,0 +1,4 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; + +public class UniversityExamRecordIdResponse { +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java similarity index 68% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java index 7605d58..12b20ab 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java @@ -1,10 +1,10 @@ -package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; public record UniversityExamRecordResponseDTO( - String examAnswerUrl, - String examResultUrl + String examAnswerUrl, + String examResultUrl ) { - public static UniversityExamRecordResponseDTO of(String examAnswerUrl, String examResultUrl){ + public static UniversityExamRecordResponseDTO of(String examAnswerUrl, String examResultUrl) { return new UniversityExamRecordResponseDTO(examAnswerUrl, examResultUrl); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java similarity index 91% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java index 51f9291..6613d0b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamRecordResultResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; public record UniversityExamRecordResultResponseDTO( String examResultUrl diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamSheetPreSignedUrlResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java similarity index 92% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamSheetPreSignedUrlResponseDTO.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java index 978775c..b29f560 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/UniversityExamSheetPreSignedUrlResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto; +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; public record UniversityExamSheetPreSignedUrlResponseDTO(String resultFileName, String preSignedUrl) { static public UniversityExamSheetPreSignedUrlResponseDTO of(String resultFileName, String preSignedUrl) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index b347a19..d67b8f2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -8,8 +8,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; -import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResponseDTO; -import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.UniversityExamRecordResultResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResultResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; @@ -55,4 +55,5 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long return UniversityExamRecordResultResponseDTO.of(resultUrl); } + public UniversityExamIdResponseDTO createUniversityExamRecord() } From 6f9a2308c283e1522c6ab73ef24ccbe753dc389d Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:43:54 +0900 Subject: [PATCH 242/465] =?UTF-8?q?[ADD]=20AWS=20Error=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 --- .../external/aws/error/AWSException.java | 10 +++++++ .../external/aws/error/AWSExceptionType.java | 28 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java new file mode 100644 index 0000000..60a4ee7 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.external.aws.error; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; + +public class AWSException extends BusinessException { + public AWSException( + AWSExceptionType exceptionType) { + super(exceptionType); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java new file mode 100644 index 0000000..c559805 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java @@ -0,0 +1,28 @@ +package com.nonsoolmate.nonsoolmateServer.external.aws.error; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum AWSExceptionType implements BusinessExceptionType { + DELETE_FILE_AWS_S3_FAIL(HttpStatus.BAD_REQUEST, "S3 ํŒŒ์ผ ์‚ญ์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), + NOT_FOUND_FILE_AWS_S3(HttpStatus.BAD_REQUEST, "S3์—์„œ ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), + GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PresignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), + NOT_FOUND_CLOUD_PRIVATE_KEY_FAIL(HttpStatus.NOT_FOUND, "Cloud Private Key ์กฐํšŒ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), + INVALID_KEY_SPEC_FAIL(HttpStatus.BAD_REQUEST, "Cloud Private Key Spec์ด ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค"); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} From 907cf46964dda827711e754fe471939a30d092d0 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:44:35 +0900 Subject: [PATCH 243/465] =?UTF-8?q?[ADD]=20=EC=8B=9C=ED=97=98=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20request=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/CreateUniversityExamRequestDTO.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java new file mode 100644 index 0000000..c2be46b --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java @@ -0,0 +1,11 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.request; + +import jakarta.validation.constraints.NotNull; + +public record CreateUniversityExamRequestDTO(@NotNull Long universityExamId, @NotNull int memberTakeTimeExam, + String memberSheetFileName) { + public static CreateUniversityExamRequestDTO of(Long universityExamId, int memberTakeTimeExam, + String memberSheetFileName) { + return new CreateUniversityExamRequestDTO(universityExamId, memberTakeTimeExam, memberSheetFileName); + } +} From f69e10eeb8750e8feaf1d757adf94b7d4af9baeb Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:45:19 +0900 Subject: [PATCH 244/465] =?UTF-8?q?[FIX]=20CloudFrontService=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B8=EB=93=A4=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 --- .../external/aws/service/CloudFrontService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index 1b04f0c..6a41ea8 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -2,6 +2,8 @@ import com.amazonaws.services.cloudfront.CloudFrontUrlSigner; import com.amazonaws.services.cloudfront.util.SignerUtils; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSExceptionType; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -45,11 +47,11 @@ public String createPreSignedGetUrl(String path, String fileName) { expirationTime ); } catch (FileNotFoundException e) { - throw new RuntimeException(e); + throw new AWSException(AWSExceptionType.NOT_FOUND_CLOUD_PRIVATE_KEY_FAIL); } catch (InvalidKeySpecException e) { - throw new RuntimeException(e); + throw new AWSException(AWSExceptionType.INVALID_KEY_SPEC_FAIL); } catch (IOException e) { - throw new RuntimeException(e); + throw new AWSException(AWSExceptionType.GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL); } return signedUrl; } From bb4c48490de93508cad115fe307568ec48679aab Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:48:39 +0900 Subject: [PATCH 245/465] =?UTF-8?q?[ADD]=20=EC=8B=9C=ED=97=98=20=EA=B8=B0?= =?UTF-8?q?=EB=A1=9D=20=EC=97=90=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/UniversityExamRecordExceptionType.java | 3 ++- .../exception/UniversityExamRecordSuccessType.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java index d29ca26..263754e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java @@ -7,7 +7,8 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum UniversityExamRecordExceptionType implements BusinessExceptionType { - NOT_FOUND_UNIVERSITY_EXAM_RECORD(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก์ž…๋‹ˆ๋‹ค."); + NOT_FOUND_UNIVERSITY_EXAM_RECORD(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก์ž…๋‹ˆ๋‹ค."), + CREATE_UNIVERSITY_EXAM_RECORD_FAIL(HttpStatus.BAD_REQUEST, "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก ์ƒ์„ฑ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java index 174c44c..f8b0dbc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java @@ -9,7 +9,8 @@ public enum UniversityExamRecordSuccessType implements BusinessSucessType { GET_UNIVERSITY_EXAM_RECORD_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF, ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), - GET_UNIVERSITY_EXAM_RECORD_SHEET_PRESIGNED_SUCCESS(HttpStatus.OK, "๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."); + GET_UNIVERSITY_EXAM_RECORD_SHEET_PRESIGNED_SUCCESS(HttpStatus.OK, "๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), + CREATE_UNIVERSITY_EXAM_RECORD_SUCCESS(HttpStatus.CREATED, "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From 76601d42f403f45f89027f978f7252ad019978d6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:49:25 +0900 Subject: [PATCH 246/465] =?UTF-8?q?[FIX]=20universityExamRecord=20?= =?UTF-8?q?=EC=97=94=ED=8B=B0=ED=8B=B0=20=EB=B9=8C=EB=8D=94=20=ED=8C=A8?= =?UTF-8?q?=ED=84=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/UniversityExamRecord.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java index 2b5eedf..d92d1f6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java @@ -15,6 +15,7 @@ import jakarta.validation.constraints.NotNull; import java.sql.Time; import lombok.AccessLevel; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -44,6 +45,15 @@ public class UniversityExamRecord { @NotNull private String examRecordSheetFileName; // ๋‚ด ๋‹ต์•ˆ - @NotNull private String examRecordResultFileName; // ์ฒจ์‚ญ + + @Builder + public UniversityExamRecord(UniversityExam universityExam, Member member, ExamResultStatus examResultStatus, + int timeTakeExam, String examRecordSheetFileName) { + this.universityExam = universityExam; + this.member = member; + this.examResultStatus = examResultStatus; + this.timeTakeExam = timeTakeExam; + this.examRecordSheetFileName = examRecordSheetFileName; + } } \ No newline at end of file From ad06b6055ac855d73cc88a2a1d6d8057254f89de Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:51:47 +0900 Subject: [PATCH 247/465] =?UTF-8?q?[FEAT]=20S3Service=EC=97=90=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EA=B2=BD=EB=A1=9C=20=EA=B2=80=EC=A6=9D=20=EB=B0=8F?= =?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD=EC=A0=9C=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/S3Service.java | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index 7c5b0b8..cdeb6ff 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -1,6 +1,8 @@ package com.nonsoolmate.nonsoolmateServer.external.aws.service; import com.nonsoolmate.nonsoolmateServer.external.aws.config.AWSConfig; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSExceptionType; import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; import java.time.Duration; import java.util.UUID; @@ -8,6 +10,10 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import software.amazon.awssdk.services.s3.S3Client; +import software.amazon.awssdk.services.s3.model.DeleteObjectRequest; +import software.amazon.awssdk.services.s3.model.GetUrlRequest; +import software.amazon.awssdk.services.s3.model.S3Exception; import software.amazon.awssdk.services.s3.presigner.S3Presigner; import software.amazon.awssdk.services.s3.model.PutObjectRequest; import software.amazon.awssdk.services.s3.presigner.model.PutObjectPresignRequest; @@ -47,4 +53,37 @@ private String generateZipFileName() { return UUID.randomUUID() + ".zip"; } + public String validateURL(final String prefix, final String fileName) { + try { + String zipUrl = prefix + fileName; + GetUrlRequest request = GetUrlRequest.builder() + .bucket(bucketName) + .key(zipUrl) + .build(); + + S3Client s3Client = awsConfig.getS3Client(); + + URL url = s3Client.utilities().getUrl(request); + if (zipUrl.equals(url.toString())) { + return fileName; + } + throw new AWSException(AWSExceptionType.NOT_FOUND_FILE_AWS_S3); + } catch (S3Exception e) { + throw new AWSException(AWSExceptionType.NOT_FOUND_FILE_AWS_S3); + } + } + + public void deleteFile(final String prefix, final String fileName) { + String key = prefix + fileName; + final S3Client s3Client = awsConfig.getS3Client(); + try { + s3Client.deleteObject((DeleteObjectRequest.Builder builder) -> + builder.bucket(bucketName) + .key(key) + .build() + ); + } catch (S3Exception e) { + throw new AWSException(AWSExceptionType.DELETE_FILE_AWS_S3_FAIL); + } + } } From 2e3bc1feaac72e0c20093834483763e13e0f2301 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:52:34 +0900 Subject: [PATCH 248/465] =?UTF-8?q?[ADD]=20UniversityExamRecordIdResponse?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/UniversityExamRecordIdResponse.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java index 2936a3d..a3f9afa 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java @@ -1,4 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; -public class UniversityExamRecordIdResponse { -} +public record UniversityExamRecordIdResponse(Long universityExamRecordId) { + public static UniversityExamRecordIdResponse of(Long universityExamRecordId) { + return new UniversityExamRecordIdResponse(universityExamRecordId); + } +} \ No newline at end of file From 3c8a5e86b6691609e5ce017ea9dac0f601715541 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:53:27 +0900 Subject: [PATCH 249/465] =?UTF-8?q?[FEAT]=20UniversityExamRecordService=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index d67b8f2..2367aac 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -3,16 +3,23 @@ import static com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM; import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_ANSWER_FOLDER_NAME; import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_RESULT_FOLDER_NAME; +import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_SHEET_FOLDER_NAME; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordIdResponse; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResultResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.request.CreateUniversityExamRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.enums.ExamResultStatus; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordException; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,6 +31,7 @@ public class UniversityExamRecordService { private final UniversityExamRecordRepository universityExamRecordRepository; private final UniversityExamRepository universityExamRepository; private final CloudFrontService cloudFrontService; + private final S3Service s3Service; public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityExamId, Member member) { @@ -55,5 +63,38 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long return UniversityExamRecordResultResponseDTO.of(resultUrl); } - public UniversityExamIdResponseDTO createUniversityExamRecord() + @Transactional + public UniversityExamRecordIdResponse createUniversityExamRecord( + CreateUniversityExamRequestDTO request, Member member) { + UniversityExam universityExam = getUniversityExam(request.universityExamId()); + try { + String fileName = s3Service.validateURL(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); + UniversityExamRecord universityexamRecord = createUniversityExamRecord(universityExam, member, + request.memberTakeTimeExam(), + fileName); + UniversityExamRecord saveUniversityUniversityExamRecord = universityExamRecordRepository.save( + universityexamRecord); + return UniversityExamRecordIdResponse.of(saveUniversityUniversityExamRecord.getUniversityExamRecordId()); + } catch (RuntimeException e) { + s3Service.deleteFile(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); + throw new UniversityExamRecordException( + UniversityExamRecordExceptionType.CREATE_UNIVERSITY_EXAM_RECORD_FAIL); + } + } + + private UniversityExamRecord createUniversityExamRecord(UniversityExam universityExam, Member member, + int takeTimeExam, String sheetFileName) { + return UniversityExamRecord.builder() + .universityExam(universityExam) + .examResultStatus(ExamResultStatus.ONGOING) + .member(member) + .timeTakeExam(takeTimeExam) + .examRecordSheetFileName(sheetFileName) + .build(); + } + + private UniversityExam getUniversityExam(Long universityExamId) { + return universityExamRepository.findByUniversityExamId(universityExamId) + .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); + } } From 35aea7ef852ae95c3c925e182d4be459ff80eb68 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 01:54:13 +0900 Subject: [PATCH 250/465] =?UTF-8?q?[FEAT]=20UniversityExamRecordController?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamRecordController.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index 42b4c51..e1b4e83 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -8,6 +8,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResultResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordIdResponse; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.request.CreateUniversityExamRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordService; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordSheetService; @@ -16,6 +17,7 @@ import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -55,15 +57,13 @@ public ResponseEntity> g universityExamRecordSheetPreSignedUrlVO.getUrl()))); } - @PostMapping("/{id}/sheet") + @PostMapping("/sheet") public ResponseEntity> createUniversityExamRecord( - @PathVariable("id") Long universityExamId, @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, @AuthUser Member member) { - return ResponseEntity.ok().body(ApiResponse.success( + return ResponseEntity.status(HttpStatus.CREATED).body(ApiResponse.success( UniversityExamRecordSuccessType.CREATE_UNIVERSITY_EXAM_RECORD_SUCCESS, - UniversityExamRecordIdResponse.of( - universityExamRecordService.createUniversityExamRecord(universityExamId, - createUniversityExamRequestDTO, member)))); + universityExamRecordService.createUniversityExamRecord( + createUniversityExamRequestDTO, member))); } } From 018c2067337a8f1dc3f78d1ce93ff43dc0b0051b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 02:01:17 +0900 Subject: [PATCH 251/465] =?UTF-8?q?[FEAT]=20createUniversityExamRecord=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20=EB=B0=8F=20UniversityExamRecordService=20?= =?UTF-8?q?=EB=B0=98=EB=B3=B5=20=EB=A1=9C=EC=A7=81=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 2367aac..26546c2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -35,11 +35,8 @@ public class UniversityExamRecordService { public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityExamId, Member member) { - UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) - .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); - - UniversityExamRecord universityExamRecord = universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( - universityExam, member); + UniversityExam universityExam = getUniversityExam(universityExamId); + UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, universityExam.getExamAnswerFileName()); @@ -51,11 +48,8 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long universityExamId, Member member) { - UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) - .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); - - UniversityExamRecord universityExamRecord = universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( - universityExam, member); + UniversityExam universityExam = getUniversityExam(universityExamId); + UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamRecord.getExamRecordResultFileName()); @@ -97,4 +91,10 @@ private UniversityExam getUniversityExam(Long universityExamId) { return universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); } + + private UniversityExamRecord getUniversityExamByUniversityExamAndMember(UniversityExam universityExam, + Member member) { + return universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( + universityExam, member); + } } From ae65bead3092e2aefdf669f11fbc4e33acf41991 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 03:00:47 +0900 Subject: [PATCH 252/465] =?UTF-8?q?[FIX]=20S3Service=20=EB=82=B4=20validat?= =?UTF-8?q?eURL=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/external/aws/service/S3Service.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index cdeb6ff..76210cb 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -60,11 +60,9 @@ public String validateURL(final String prefix, final String fileName) { .bucket(bucketName) .key(zipUrl) .build(); - S3Client s3Client = awsConfig.getS3Client(); - URL url = s3Client.utilities().getUrl(request); - if (zipUrl.equals(url.toString())) { + if (zipUrl.equals(url.getPath().substring(1))) { return fileName; } throw new AWSException(AWSExceptionType.NOT_FOUND_FILE_AWS_S3); From d4688dc94fcca7f984abd5a214e5c611653fc34c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 10:27:42 +0900 Subject: [PATCH 253/465] =?UTF-8?q?[DEL]=20=EB=B3=B4=EC=95=88=EC=A0=81?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=B7=A8=EC=95=BD=ED=95=9C=20sdk=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 --- nonsoolmateServer/build.gradle | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index 3c3ec8a..e2a4c9a 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -48,11 +48,7 @@ dependencies { // AWS sdk implementation("software.amazon.awssdk:bom:2.21.0") implementation("software.amazon.awssdk:s3:2.21.0") - compileOnly group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.534' - implementation 'software.amazon.awssdk:cloudfront:2.18.26' // AWS SDK for Java v2์˜ ๋ฒ„์ „ - - compileOnly group: 'org.springframework.cloud', name: 'spring-cloud-starter-aws', version: '2.2.1.RELEASE' - + implementation 'software.amazon.awssdk:cloudfront:2.22.3' // swagger implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' From 8c39fe457d1b45a220d6d97832a8bbf660a96e69 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 10:29:41 +0900 Subject: [PATCH 254/465] =?UTF-8?q?[FIX]=20AWS=20SDK=20for=20Java=202.x=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=EC=97=90=20=EB=94=B0=EB=9D=BC=20clo?= =?UTF-8?q?udFront=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aws/service/CloudFrontService.java | 52 ++++++++----------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index 6a41ea8..b7cbd52 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -1,20 +1,18 @@ package com.nonsoolmate.nonsoolmateServer.external.aws.service; -import com.amazonaws.services.cloudfront.CloudFrontUrlSigner; -import com.amazonaws.services.cloudfront.util.SignerUtils; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSExceptionType; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.security.spec.InvalidKeySpecException; -import java.time.Duration; -import java.util.Date; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import org.springframework.util.ResourceUtils; +import software.amazon.awssdk.services.cloudfront.CloudFrontUtilities; +import software.amazon.awssdk.services.cloudfront.model.CannedSignerRequest; +import software.amazon.awssdk.services.cloudfront.url.SignedUrl; @Component @@ -30,29 +28,23 @@ public class CloudFrontService { @Value("${aws-property.key-pair-id}") private String keyPairId; - public String createPreSignedGetUrl(String path, String fileName) { - String s3ObjectKey = path + fileName; // S3 ๊ฐ์ฒด ํ‚ค - Duration duration = Duration.ofMinutes(1); - Date expirationTime = new Date(System.currentTimeMillis() + duration.toMillis()); - SignerUtils.Protocol protocol = SignerUtils.Protocol.https; - String signedUrl = null; + public String createPreSignedGetUrl(String path, String fileName, int expireTime) { + String resourcePath = path + fileName; + String cloudFrontUrl = "https://" + distributionDomain + "/" + resourcePath; + Instant expirationTime = Instant.now().plus(expireTime, ChronoUnit.MINUTES); + Path keyPath = Paths.get(privateKeyFilePath); try { - File privateKeyFile = ResourceUtils.getFile(privateKeyFilePath); - signedUrl = CloudFrontUrlSigner.getSignedURLWithCannedPolicy( - protocol, - distributionDomain, - privateKeyFile, - s3ObjectKey, - keyPairId, - expirationTime - ); - } catch (FileNotFoundException e) { - throw new AWSException(AWSExceptionType.NOT_FOUND_CLOUD_PRIVATE_KEY_FAIL); - } catch (InvalidKeySpecException e) { - throw new AWSException(AWSExceptionType.INVALID_KEY_SPEC_FAIL); - } catch (IOException e) { + CloudFrontUtilities cloudFrontUtilities = CloudFrontUtilities.create(); + CannedSignerRequest cannedSignerRequest = CannedSignerRequest.builder() + .resourceUrl(cloudFrontUrl) + .privateKey(keyPath) + .keyPairId(keyPairId) + .expirationDate(expirationTime) + .build(); + SignedUrl signedUrl = cloudFrontUtilities.getSignedUrlWithCannedPolicy(cannedSignerRequest); + return signedUrl.url(); + } catch (Exception e) { throw new AWSException(AWSExceptionType.GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL); } - return signedUrl; } } From dc980d10a8b99c8538a609e058e5483ff70ede7e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 10:30:52 +0900 Subject: [PATCH 255/465] =?UTF-8?q?[FIX]=20AWS=20SDK=20for=20Java=202.x=20?= =?UTF-8?q?=EC=9D=98=EC=A1=B4=EC=84=B1=EC=97=90=20=EB=94=B0=EB=9D=BC=20Clo?= =?UTF-8?q?udService=20=ED=95=A8=EC=88=98=20=ED=98=B8=EC=B6=9C=20=EB=B6=80?= =?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 --- .../domain/university/service/UniversityExamService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index af53e6e..6a079e4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -55,7 +55,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); String examAnswerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, - universityExam.getExamAnswerFileName()); + universityExam.getExamAnswerFileName(), universityExam.getExamTimeLimit()); List examImageUrls = new ArrayList<>(); List UniversityExamImages = universityExamImageRepository.findAllByUniversityExam( @@ -63,7 +63,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L UniversityExamImages.stream().forEach(universityExamImage -> { String presignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamImage.getUniversityExamImageFileName()); + universityExamImage.getUniversityExamImageFileName(), universityExam.getExamTimeLimit()); examImageUrls.add( UniversityExamImageResponseDTO.of(presignedGetUrl)); From 62595884d1ae7153e4697c83f67315ea52a693cb Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 10:32:13 +0900 Subject: [PATCH 256/465] =?UTF-8?q?[FIX]=20validateURL=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EC=97=90=EC=84=9C=20=EC=8B=A4=EC=A0=9C=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EC=9D=B4=20=EC=A1=B4=EC=9E=AC=ED=95=98=EB=8A=94?= =?UTF-8?q?=EC=A7=80=EC=97=90=20=EB=8C=80=ED=95=9C=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20=ED=98=B8=EC=B6=9C=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=8B=A8=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=BD=94=EB=93=9C=20=EC=9C=84=EC=B9=98=20try=20?= =?UTF-8?q?=EB=B0=96=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 8 ++++---- .../external/aws/error/AWSExceptionType.java | 6 ++---- .../external/aws/service/S3Service.java | 16 ++++++++++------ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 26546c2..b86c433 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -39,9 +39,9 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, - universityExam.getExamAnswerFileName()); + universityExam.getExamAnswerFileName(), universityExam.getExamTimeLimit()); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamRecord.getExamRecordResultFileName()); + universityExamRecord.getExamRecordResultFileName(), universityExam.getExamTimeLimit()); return UniversityExamRecordResponseDTO.of(answerUrl, resultUrl); } @@ -52,7 +52,7 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamRecord.getExamRecordResultFileName()); + universityExamRecord.getExamRecordResultFileName(), universityExam.getExamTimeLimit()); return UniversityExamRecordResultResponseDTO.of(resultUrl); } @@ -61,8 +61,8 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long public UniversityExamRecordIdResponse createUniversityExamRecord( CreateUniversityExamRequestDTO request, Member member) { UniversityExam universityExam = getUniversityExam(request.universityExamId()); + String fileName = s3Service.validateURL(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); try { - String fileName = s3Service.validateURL(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); UniversityExamRecord universityexamRecord = createUniversityExamRecord(universityExam, member, request.memberTakeTimeExam(), fileName); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java index c559805..6130228 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java @@ -8,10 +8,8 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum AWSExceptionType implements BusinessExceptionType { DELETE_FILE_AWS_S3_FAIL(HttpStatus.BAD_REQUEST, "S3 ํŒŒ์ผ ์‚ญ์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), - NOT_FOUND_FILE_AWS_S3(HttpStatus.BAD_REQUEST, "S3์—์„œ ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), - GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PresignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), - NOT_FOUND_CLOUD_PRIVATE_KEY_FAIL(HttpStatus.NOT_FOUND, "Cloud Private Key ์กฐํšŒ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), - INVALID_KEY_SPEC_FAIL(HttpStatus.BAD_REQUEST, "Cloud Private Key Spec์ด ์ž˜๋ชป๋˜์—ˆ์Šต๋‹ˆ๋‹ค"); + NOT_FOUND_FILE_AWS_S3(HttpStatus.NOT_FOUND, "S3์—์„œ ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), + GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PresignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"); private final HttpStatus status; private final String message; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index 76210cb..22815d6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -13,6 +13,8 @@ import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.DeleteObjectRequest; import software.amazon.awssdk.services.s3.model.GetUrlRequest; +import software.amazon.awssdk.services.s3.model.HeadObjectRequest; +import software.amazon.awssdk.services.s3.model.HeadObjectResponse; import software.amazon.awssdk.services.s3.model.S3Exception; import software.amazon.awssdk.services.s3.presigner.S3Presigner; import software.amazon.awssdk.services.s3.model.PutObjectRequest; @@ -56,16 +58,18 @@ private String generateZipFileName() { public String validateURL(final String prefix, final String fileName) { try { String zipUrl = prefix + fileName; - GetUrlRequest request = GetUrlRequest.builder() + S3Client s3Client = awsConfig.getS3Client(); + + HeadObjectRequest request = HeadObjectRequest.builder() .bucket(bucketName) .key(zipUrl) .build(); - S3Client s3Client = awsConfig.getS3Client(); - URL url = s3Client.utilities().getUrl(request); - if (zipUrl.equals(url.getPath().substring(1))) { - return fileName; + + HeadObjectResponse response = s3Client.headObject(request); + if (response == null) { + throw new AWSException(AWSExceptionType.NOT_FOUND_FILE_AWS_S3); } - throw new AWSException(AWSExceptionType.NOT_FOUND_FILE_AWS_S3); + return fileName; } catch (S3Exception e) { throw new AWSException(AWSExceptionType.NOT_FOUND_FILE_AWS_S3); } From 52174c3f275afdd09a804920aa6a2e92c9216b4a Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 14:28:06 +0900 Subject: [PATCH 257/465] =?UTF-8?q?[REFACTOR]=20FolderName=20=EC=B6=94?= =?UTF-8?q?=EC=83=81=20=ED=81=B4=EB=9E=98=EC=8A=A4=EB=A1=9C=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EC=96=B4=20=EA=B0=9D=EC=B2=B4=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EB=B0=A9=EC=A7=80=ED=95=98=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/external/aws/FolderName.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java index b1a348d..0e94cad 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java @@ -1,9 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.external.aws; -import lombok.Getter; - -@Getter -public class FolderName { +public abstract class FolderName { public static final String EXAM_ANSWER_FOLDER_NAME = "exam-answer/"; public static final String EXAM_RESULT_FOLDER_NAME = "exam-result/"; public static final String EXAM_SHEET_FOLDER_NAME = "exam-sheet/"; From 74659a2b417e652412cadcfe31cf9cea6b45958f Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 15:07:29 +0900 Subject: [PATCH 258/465] =?UTF-8?q?[ADD]=20memberExceptionType=EC=97=90=20?= =?UTF-8?q?=ED=8B=B0=EC=BC=93=20=EA=B0=90=EC=86=8C=20=EC=8B=A4=ED=8C=A8=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/exception/MemberExceptionType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java index 3bddd94..b232b67 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java @@ -11,7 +11,8 @@ public enum MemberExceptionType implements BusinessExceptionType { /** * 404 Not Found */ - NOT_FOUND_MEMBER(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์œ ์ €์ž…๋‹ˆ๋‹ค."); + NOT_FOUND_MEMBER(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์œ ์ €์ž…๋‹ˆ๋‹ค."), + MEMBER_USE_TICKET_FAIL(HttpStatus.BAD_REQUEST, "ํ‹ฐ์ผ“ ์‚ฌ์šฉ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. ํ‹ฐ์ผ“์ด ๋ถ€์กฑํ•ฉ๋‹ˆ๋‹ค"); private final HttpStatus status; private final String message; From 395f9604f2c72996a860122b46398ee922c834a3 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 15:08:07 +0900 Subject: [PATCH 259/465] =?UTF-8?q?[FEAT]=20member=20=EC=97=94=ED=8B=B0?= =?UTF-8?q?=ED=8B=B0=20=EB=82=B4=20decreaseTicket()=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/entity/Member.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java index e4184f4..ecfaeb0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java @@ -2,6 +2,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.Role; +import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberException; +import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberExceptionType; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; @@ -63,4 +65,11 @@ public Member(String email, String name, PlatformType platformType, Role role, S this.gender = gender; this.phoneNumber = phoneNumber; } + + public void decreaseTicket() { + if (this.ticketCount <= 0) { + throw new MemberException(MemberExceptionType.MEMBER_USE_TICKET_FAIL); + } + this.ticketCount -= 1; + } } From 294481d258c37b91a2e1d62cb63395ff3477ec30 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 15:09:23 +0900 Subject: [PATCH 260/465] =?UTF-8?q?[FEAT]=20member=20Ticket=20=EA=B0=90?= =?UTF-8?q?=EC=86=8C=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80(decreaseMem?= =?UTF-8?q?berTicketCount)=20=EB=B0=8F=20createUniversityExamRecord=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=B2=98=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index b86c433..33974ed 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -6,6 +6,8 @@ import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_SHEET_FOLDER_NAME; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberException; +import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.UniversityExam; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamException; import com.nonsoolmate.nonsoolmateServer.domain.university.repository.UniversityExamRepository; @@ -18,6 +20,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordException; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; import lombok.RequiredArgsConstructor; @@ -32,6 +35,7 @@ public class UniversityExamRecordService { private final UniversityExamRepository universityExamRepository; private final CloudFrontService cloudFrontService; private final S3Service s3Service; + private final MemberRepository memberRepository; public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityExamId, Member member) { @@ -61,14 +65,17 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long public UniversityExamRecordIdResponse createUniversityExamRecord( CreateUniversityExamRequestDTO request, Member member) { UniversityExam universityExam = getUniversityExam(request.universityExamId()); - String fileName = s3Service.validateURL(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); try { + String fileName = s3Service.validateURL(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); UniversityExamRecord universityexamRecord = createUniversityExamRecord(universityExam, member, request.memberTakeTimeExam(), fileName); UniversityExamRecord saveUniversityUniversityExamRecord = universityExamRecordRepository.save( universityexamRecord); + decreaseMemberTicketCount(member); return UniversityExamRecordIdResponse.of(saveUniversityUniversityExamRecord.getUniversityExamRecordId()); + } catch (AWSException | MemberException e) { + throw e; } catch (RuntimeException e) { s3Service.deleteFile(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); throw new UniversityExamRecordException( @@ -76,6 +83,15 @@ public UniversityExamRecordIdResponse createUniversityExamRecord( } } + private void decreaseMemberTicketCount(Member member) { + try { + member.decreaseTicket(); + memberRepository.save(member); + } catch (MemberException e) { + throw e; + } + } + private UniversityExamRecord createUniversityExamRecord(UniversityExam universityExam, Member member, int takeTimeExam, String sheetFileName) { return UniversityExamRecord.builder() From 00b4851e05e6f2339097ab13580f30fc3719d5e1 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 16:01:02 +0900 Subject: [PATCH 261/465] =?UTF-8?q?[ADD]=20=EB=84=A4=EC=9D=B4=EB=B2=84=20?= =?UTF-8?q?=EC=9D=B8=EA=B0=80=EC=BD=94=EB=93=9C=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=9C=20=EC=97=90=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/exception/AuthExceptionType.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index 06105d1..7743495 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -12,7 +12,7 @@ public enum AuthExceptionType implements BusinessExceptionType { /** * 400 Bad Request */ - INVALID_MEMBER_PLATFORM_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ํ”Œ๋žซํผ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + INVALID_MEMBER_PLATFORM_AUTHORIZATION_CODE(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ํ”Œ๋žซํผ ์ธ๊ฐ€์ฝ”๋“œ์ž…๋‹ˆ๋‹ค."), INVALID_ACCESS_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), @@ -22,7 +22,6 @@ public enum AuthExceptionType implements BusinessExceptionType { UNAUTHORIZED_MEMBER_LOGIN(HttpStatus.UNAUTHORIZED, "๋กœ๊ทธ์ธ์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค."), UNAUTHORIZED_ACCESS_TOKEN(HttpStatus.UNAUTHORIZED, "๊ธฐํ•œ์ด ๋งŒ๋ฃŒ๋œ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), - /** * 404 Not Found */ From 0463921c2b93677527adff455af5b1e851c89d45 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 16:23:28 +0900 Subject: [PATCH 262/465] =?UTF-8?q?[FIX]=20@transactional=20=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=9C=84=EC=B9=98=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 --- .../nonsoolmateServer/domain/auth/service/AuthService.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index 238a227..6ad8ba0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -10,7 +10,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -@Transactional(readOnly = true) @Service @RequiredArgsConstructor public abstract class AuthService { @@ -24,7 +23,6 @@ protected Member getMember(PlatformType platformType, String email) { .orElse(null); } - @Transactional protected Member saveUser(MemberRequestDTO request, String email, String name, String birthday, String gender, String phoneNumber) { Member newMember = createSocialMember(email, name, request.platformType(), birthday, gender, phoneNumber); From 951604a9bc9c0534505717afbede199024cd3ac3 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 16:23:50 +0900 Subject: [PATCH 263/465] =?UTF-8?q?[FEAT]=20=EC=9C=A0=ED=9A=A8=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EC=9D=80=20=EB=84=A4=EC=9D=B4=EB=B2=84=20?= =?UTF-8?q?=EC=9D=B8=EA=B0=80=EC=BD=94=EB=93=9C=EC=97=90=20=EB=8C=80?= =?UTF-8?q?=ED=95=9C=20=EC=97=90=EB=9F=AC=20=EC=B2=98=EB=A6=AC=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oauth/service/NaverAuthService.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 9af47b9..9bafcb2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -1,5 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.external.oauth.service; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthService; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; @@ -43,16 +45,21 @@ public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestD naverMemberInfo.getResponse().getMobile()); return MemberSignUpVO.of(savedMember, request.platformType(), AuthType.SIGN_UP); + } public NaverMemberVO getNaverMemberInfo(String accessToken) { WebClient webClient = WebClient.builder().build(); - return webClient.post() - .uri("https://openapi.naver.com/v1/nid/me") - .header("Authorization", "Bearer " + accessToken) - .retrieve() - .bodyToMono(NaverMemberVO.class) - .block(); + try { + return webClient.post() + .uri("https://openapi.naver.com/v1/nid/me") + .header("Authorization", "Bearer " + accessToken) + .retrieve() + .bodyToMono(NaverMemberVO.class) + .block(); + } catch (Exception e) { + throw new AuthException(AuthExceptionType.INVALID_MEMBER_PLATFORM_AUTHORIZATION_CODE); + } } private NaverTokenVO getAccessToken(String authorizationCode, String clientId, String clientSecret, String state) { @@ -74,4 +81,4 @@ private NaverTokenVO getAccessToken(String authorizationCode, String clientId, S .bodyToMono(NaverTokenVO.class) .block(); } -} +} \ No newline at end of file From 0f3baf73606efcb3b32b15c7a6b5330580fe300b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 16:27:00 +0900 Subject: [PATCH 264/465] =?UTF-8?q?[ADD]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EC=84=B1=EA=B3=B5=EC=97=90=20=EB=94=B0=EB=A5=B8=20?= =?UTF-8?q?SuccessType=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/auth/exception/AuthSuccessType.java | 1 + 1 file changed, 1 insertion(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java index 85aa0bd..b8b7579 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java @@ -6,6 +6,7 @@ @RequiredArgsConstructor public enum AuthSuccessType implements BusinessSucessType { + SIGN_UP_SUCCESS(HttpStatus.CREATED, "ํšŒ์›๊ฐ€์ž…์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), LOGIN_SUCCESS(HttpStatus.OK, "๋กœ๊ทธ์ธ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), REISSUE_SUCCESS(HttpStatus.OK, "๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); From 593e13518f47c628f64f9505fcb9a942bfcd606f Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 16:28:11 +0900 Subject: [PATCH 265/465] =?UTF-8?q?[FEAT]=20AuthType=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=9D=BC=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=EC=9D=BC=20?= =?UTF-8?q?=EC=8B=9C=20SIGN=5FUP=5FSUCCESS=20=EB=B0=98=ED=99=98,=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=EC=9D=BC=20=EC=8B=9C=20LOGIN=5FSUCC?= =?UTF-8?q?ESS=20=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 09b969a..4b1077e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -3,6 +3,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberReissueResponseDTO; +import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthServiceProvider; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; @@ -14,6 +15,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -42,8 +44,12 @@ public ResponseEntity> login( MemberRequestDTO request, HttpServletResponse response) { MemberSignUpVO vo = authServiceProvider.getAuthService(request.platformType()) .saveMemberOrLogin(authorizationCode, request); - MemberAuthResponseDTO memberAuthResponseDTO = jwtService.issueToken(vo, response); - return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.LOGIN_SUCCESS, memberAuthResponseDTO)); + MemberAuthResponseDTO responseDTO = jwtService.issueToken(vo, response); + if (responseDTO.authType().equals(AuthType.SIGN_UP)) { + return ResponseEntity.status(HttpStatus.CREATED) + .body(ApiResponse.success(AuthSuccessType.SIGN_UP_SUCCESS, responseDTO)); + } + return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.LOGIN_SUCCESS, responseDTO)); } @PostMapping("/reissue") From e8f49b4ffcb8384f645d442d88a25e06ee1a0a92 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 17:00:13 +0900 Subject: [PATCH 266/465] =?UTF-8?q?[REFACTOR]=20=EB=84=A4=EC=9D=B4?= =?UTF-8?q?=EB=B2=84=20token-uri,=20user-info-uri=20yml=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/oauth/service/NaverAuthService.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index 9bafcb2..c4fe7d7 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -25,6 +25,12 @@ public class NaverAuthService extends AuthService { private String clientSecret; @Value("${spring.security.oauth2.client.naver.state}") private String state; + @Value("${spring.security.oauth2.client.naver.user-info-uri}") + private String userInfoUri; + @Value("${spring.security.oauth2.client.naver.token-uri.host}") + private String tokenUriHost; + @Value("${spring.security.oauth2.client.naver.token-uri.path}") + private String tokenUriPath; public NaverAuthService(MemberRepository memberRepository) { super(memberRepository); @@ -52,7 +58,7 @@ public NaverMemberVO getNaverMemberInfo(String accessToken) { WebClient webClient = WebClient.builder().build(); try { return webClient.post() - .uri("https://openapi.naver.com/v1/nid/me") + .uri(userInfoUri) .header("Authorization", "Bearer " + accessToken) .retrieve() .bodyToMono(NaverMemberVO.class) @@ -68,8 +74,8 @@ private NaverTokenVO getAccessToken(String authorizationCode, String clientId, S .uri(uriBuilder -> uriBuilder .scheme("https") // ์Šคํ‚ด์„ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ • - .host("nid.naver.com") // ํ˜ธ์ŠคํŠธ๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ • - .path("/oauth2.0/token") + .host(tokenUriHost) // ํ˜ธ์ŠคํŠธ๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ์ง€์ • + .path(tokenUriPath) .queryParam("grant_type", "authorization_code") .queryParam("client_id", clientId) .queryParam("client_secret", clientSecret) From 72d150e3f6b95370beb1e460c832abf6b92590f8 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 17:19:54 +0900 Subject: [PATCH 267/465] =?UTF-8?q?[REFACTOR]=20universityExam=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=EC=97=90=EC=84=9C=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 37 ++++++++++++------- .../university/entity/UniversityExam.java | 10 ++--- .../service/UniversityExamService.java | 9 +++-- .../service/UniversityExamRecordService.java | 6 +-- 4 files changed, 35 insertions(+), 27 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index c687ae3..f90b403 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -32,7 +32,8 @@ public class SelectUniversityService { public List getSelectUniversities(Member member) { - List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc(member); + List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc( + member); List selectUniversityResponseDTOS = new ArrayList<>(); selectUniversities.stream().forEach(selectUniversity -> { @@ -40,11 +41,11 @@ public List getSelectUniversities(Member member) { University university = universityRepository.findByUniversityId( selectUniversity.getUniversity().getUniversityId()).orElse(null); - if(university == null){ + if (university == null) { status = false; } selectUniversityResponseDTOS.add(SelectUniversityResponseDTO.of(university.getUniversityId(), - university.getUniversityName(),university.getUniversityCollege(), + university.getUniversityName(), university.getUniversityCollege(), status)); }); @@ -54,7 +55,8 @@ public List getSelectUniversities(Member member) { public List getSelectUniversityExams(Member member) { List selectUniversityExamsResponseDTOS = new ArrayList<>(); - List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc(member); + List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc( + member); for (SelectUniversity selectUniversity : selectUniversities) { selectUniversityExamsResponseDTOS.add(getSelectUniversityExamsResponseDTO(selectUniversity, member)); @@ -88,7 +90,8 @@ private List getSelectUniversityExamResponseDTO universityExamRecord == null ? BEFORE_EXAM : universityExamRecord.getExamResultStatus().getStatus(); selectUniversityExamResponseDTOS.add( SelectUniversityExamResponseDTO.of(universityExam.getUniversityExamId(), - universityExam.getExamName(), universityExam.getExamTimeLimit(), status)); + universityExam.getUniversityExamName(), universityExam.getUniversityExamTimeLimit(), + status)); } return selectUniversityExamResponseDTOS; } @@ -105,14 +108,17 @@ public SelectUniversityUpdateResponseDTO patchSelectUniversities( Map universityMap = new HashMap<>(); curUniversityIds.stream().forEach(curUniversityId -> { - universityMap.put(curUniversityId, universityRepository.findByUniversityIdOrElseThrowException(curUniversityId)); + universityMap.put(curUniversityId, + universityRepository.findByUniversityIdOrElseThrowException(curUniversityId)); boolean isPresent = false; - for(Long prevUniversityId : prevUniversityIds){ - if(prevUniversityId == curUniversityId) isPresent = true; + for (Long prevUniversityId : prevUniversityIds) { + if (prevUniversityId == curUniversityId) { + isPresent = true; + } } - if(!isPresent){ + if (!isPresent) { selectUniversityRepository.save(SelectUniversity .builder() .member(member) @@ -121,15 +127,18 @@ public SelectUniversityUpdateResponseDTO patchSelectUniversities( } }); - prevUniversityIds.stream().forEach(prevUniversityId ->{ - universityMap.put(prevUniversityId, universityRepository.findByUniversityIdOrElseThrowException(prevUniversityId)); + prevUniversityIds.stream().forEach(prevUniversityId -> { + universityMap.put(prevUniversityId, + universityRepository.findByUniversityIdOrElseThrowException(prevUniversityId)); boolean isPresent = false; - for(Long curUniversityId : curUniversityIds){ - if(prevUniversityId == curUniversityId) isPresent = true; + for (Long curUniversityId : curUniversityIds) { + if (prevUniversityId == curUniversityId) { + isPresent = true; + } } - if(!isPresent){ + if (!isPresent) { selectUniversityRepository.deleteByMemberAndUniversity(member, universityMap.get(prevUniversityId)); } }); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java index cb18e05..6f93651 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java @@ -8,8 +8,6 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import jakarta.validation.constraints.NotNull; -import java.sql.Time; -import java.time.Year; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; @@ -30,14 +28,14 @@ public class UniversityExam { private University university; @NotNull - private String examName; + private String universityExamName; @NotNull - private String examAnswerFileName; + private String universityExamAnswerFileName; @NotNull - private int examYear; + private int universityExamYear; @NotNull - private int examTimeLimit; + private int universityExamTimeLimit; } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 6a079e4..bf51a9b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -34,8 +34,9 @@ public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); - return UniversityExamInfoResponseDTO.of(universityExam.getUniversityExamId(), universityExam.getExamName(), - universityExam.getExamTimeLimit()); + return UniversityExamInfoResponseDTO.of(universityExam.getUniversityExamId(), + universityExam.getUniversityExamName(), + universityExam.getUniversityExamTimeLimit()); } public Page getUniversityExamImages(Long id, Pageable pageable) { @@ -55,7 +56,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); String examAnswerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, - universityExam.getExamAnswerFileName(), universityExam.getExamTimeLimit()); + universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); List examImageUrls = new ArrayList<>(); List UniversityExamImages = universityExamImageRepository.findAllByUniversityExam( @@ -63,7 +64,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L UniversityExamImages.stream().forEach(universityExamImage -> { String presignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamImage.getUniversityExamImageFileName(), universityExam.getExamTimeLimit()); + universityExamImage.getUniversityExamImageFileName(), universityExam.getUniversityExamTimeLimit()); examImageUrls.add( UniversityExamImageResponseDTO.of(presignedGetUrl)); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 33974ed..e6ee2e6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -43,9 +43,9 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, - universityExam.getExamAnswerFileName(), universityExam.getExamTimeLimit()); + universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamRecord.getExamRecordResultFileName(), universityExam.getExamTimeLimit()); + universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); return UniversityExamRecordResponseDTO.of(answerUrl, resultUrl); } @@ -56,7 +56,7 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamRecord.getExamRecordResultFileName(), universityExam.getExamTimeLimit()); + universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); return UniversityExamRecordResultResponseDTO.of(resultUrl); } From cd8d7bd7c932191064ec21bd83f3d82765d156bc Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 17:35:59 +0900 Subject: [PATCH 268/465] =?UTF-8?q?[CHORE]=20repository=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EC=8B=9C=EA=B7=B8=EB=8B=88=EC=B2=98=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/repository/UniversityExamRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java index 753ff10..7e4ab3c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java @@ -9,5 +9,5 @@ public interface UniversityExamRepository extends JpaRepository { Optional findByUniversityExamId(Long universityId); - List findAllByUniversity(University university); + List findAllByUniversityOrderByUniversityExamYearDescUniversityExamNameAsc(University university); } From 9d26f4dc78ca81290171b1175fb7504573b1cbe8 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 17:36:33 +0900 Subject: [PATCH 269/465] =?UTF-8?q?[FEAT]=20SelectUniveristyService?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=8B=9C?= =?UTF-8?q?=EA=B7=B8=EB=8B=88=EC=B2=98=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=8C=80=ED=95=99=20=EC=8B=9C=ED=97=98=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EB=85=84=EB=8F=84=20=ED=8F=AC=ED=95=A8=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index f90b403..8eee668 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -69,7 +69,7 @@ private SelectUniversityExamsResponseDTO getSelectUniversityExamsResponseDTO(Sel Member member) { List selectUniversityExamResponseDTOS; - List universityExams = universityExamRepository.findAllByUniversity( + List universityExams = universityExamRepository.findAllByUniversityOrderByUniversityExamYearDescUniversityExamNameAsc( selectUniversity.getUniversity()); selectUniversityExamResponseDTOS = getSelectUniversityExamResponseDTOS(universityExams, member); @@ -88,14 +88,20 @@ private List getSelectUniversityExamResponseDTO .orElse(null); String status = universityExamRecord == null ? BEFORE_EXAM : universityExamRecord.getExamResultStatus().getStatus(); + String universityExamName = getUniversityExamNameForMyPage(universityExam.getUniversityExamYear(), + universityExam.getUniversityExamName()); selectUniversityExamResponseDTOS.add( SelectUniversityExamResponseDTO.of(universityExam.getUniversityExamId(), - universityExam.getUniversityExamName(), universityExam.getUniversityExamTimeLimit(), + universityExamName, universityExam.getUniversityExamTimeLimit(), status)); } return selectUniversityExamResponseDTOS; } + public String getUniversityExamNameForMyPage(int universityExamYear, String universityExamName) { + return universityExamYear + " " + universityExamName; + } + public SelectUniversityUpdateResponseDTO patchSelectUniversities( Member member, List request) { From af9917943f82c7037a4120fcfacacc05dcacc925 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 19:46:39 +0900 Subject: [PATCH 270/465] =?UTF-8?q?[ADD]=20UniversityExamImage=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=EC=97=90=20page=20=ED=95=84=EB=93=9C=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/university/entity/UniversityExamImage.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java index 3230c4b..1146f89 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java @@ -28,4 +28,7 @@ public class UniversityExamImage { @NotNull private String universityExamImageFileName; + + @NotNull + private int page; } \ No newline at end of file From c3296278b0fdf30d6e5f0811abb8ae4103a7213e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 19:59:23 +0900 Subject: [PATCH 271/465] =?UTF-8?q?Revert=20"[FEAT]=20SelectUniveristyServ?= =?UTF-8?q?ice=EC=97=90=EC=84=9C=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=8B=9C?= =?UTF-8?q?=EA=B7=B8=EB=8B=88=EC=B2=98=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EB=8C=80=ED=95=99=20=EC=8B=9C=ED=97=98=20=EC=9D=B4=EB=A6=84=20?= =?UTF-8?q?=EB=85=84=EB=8F=84=20=ED=8F=AC=ED=95=A8=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EA=B5=AC=ED=98=84"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 9d26f4dc78ca81290171b1175fb7504573b1cbe8. --- .../service/SelectUniversityService.java | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 8eee668..f90b403 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -69,7 +69,7 @@ private SelectUniversityExamsResponseDTO getSelectUniversityExamsResponseDTO(Sel Member member) { List selectUniversityExamResponseDTOS; - List universityExams = universityExamRepository.findAllByUniversityOrderByUniversityExamYearDescUniversityExamNameAsc( + List universityExams = universityExamRepository.findAllByUniversity( selectUniversity.getUniversity()); selectUniversityExamResponseDTOS = getSelectUniversityExamResponseDTOS(universityExams, member); @@ -88,20 +88,14 @@ private List getSelectUniversityExamResponseDTO .orElse(null); String status = universityExamRecord == null ? BEFORE_EXAM : universityExamRecord.getExamResultStatus().getStatus(); - String universityExamName = getUniversityExamNameForMyPage(universityExam.getUniversityExamYear(), - universityExam.getUniversityExamName()); selectUniversityExamResponseDTOS.add( SelectUniversityExamResponseDTO.of(universityExam.getUniversityExamId(), - universityExamName, universityExam.getUniversityExamTimeLimit(), + universityExam.getUniversityExamName(), universityExam.getUniversityExamTimeLimit(), status)); } return selectUniversityExamResponseDTOS; } - public String getUniversityExamNameForMyPage(int universityExamYear, String universityExamName) { - return universityExamYear + " " + universityExamName; - } - public SelectUniversityUpdateResponseDTO patchSelectUniversities( Member member, List request) { From 89c168362f3b6fee8e8320f26d48c56bd1f914c6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 20:00:09 +0900 Subject: [PATCH 272/465] =?UTF-8?q?[ADD]=20UniversityExamImage=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=EC=97=90=20page=20=ED=95=84=EB=93=9C=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/university/entity/UniversityExamImage.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java index 1146f89..d54d074 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java @@ -28,7 +28,6 @@ public class UniversityExamImage { @NotNull private String universityExamImageFileName; - - @NotNull + private int page; } \ No newline at end of file From ce66b4eae4bf6d59b69e83ea86f742fe04e8e497 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 20:32:49 +0900 Subject: [PATCH 273/465] =?UTF-8?q?[ADD]=20ExamImage=20folder=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmate/nonsoolmateServer/external/aws/FolderName.java | 1 + 1 file changed, 1 insertion(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java index 0e94cad..7d40b25 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/FolderName.java @@ -4,4 +4,5 @@ public abstract class FolderName { public static final String EXAM_ANSWER_FOLDER_NAME = "exam-answer/"; public static final String EXAM_RESULT_FOLDER_NAME = "exam-result/"; public static final String EXAM_SHEET_FOLDER_NAME = "exam-sheet/"; + public static final String EXAM_IMAGE_FOLDER_NAME = "exam-image/"; } From f56fc04d9a53cf4db5f6b1bce0366d915eceeaa4 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 20:33:22 +0900 Subject: [PATCH 274/465] =?UTF-8?q?[DEL]=20UniversityExamRepository?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=82=AC=EC=9A=A9=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EB=A9=94=EC=84=9C=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/repository/UniversityExamRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java index 7e4ab3c..753ff10 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java @@ -9,5 +9,5 @@ public interface UniversityExamRepository extends JpaRepository { Optional findByUniversityExamId(Long universityId); - List findAllByUniversityOrderByUniversityExamYearDescUniversityExamNameAsc(University university); + List findAllByUniversity(University university); } From c8af27337b8fd1f32c9819faad29dd031de48400 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 20:34:04 +0900 Subject: [PATCH 275/465] =?UTF-8?q?[FIX]=20=EB=AC=B8=EC=A0=9C=20=EC=9D=B4?= =?UTF-8?q?=EB=AF=B8=EC=A7=80=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=88=98=20?= =?UTF-8?q?=EC=98=A4=EB=A6=84=EC=B0=A8=EC=88=9C=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B0=98=ED=99=98=EB=90=98=EA=B2=8C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniversityExamImageRepository.java | 5 +++-- .../service/UniversityExamService.java | 16 +++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java index 4a454b8..2d0ac08 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamImageRepository.java @@ -9,8 +9,9 @@ import org.springframework.data.jpa.repository.JpaRepository; public interface UniversityExamImageRepository extends JpaRepository { - Page findAllByUniversityExam(UniversityExam universityExam, Pageable pageable); + Page findAllByUniversityExamOrderByPageAsc(UniversityExam universityExam, + Pageable pageable); - List findAllByUniversityExam(UniversityExam universityExam); + List findAllByUniversityExamOrderByPageAsc(UniversityExam universityExam); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index bf51a9b..d108b88 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -1,6 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.service; import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_ANSWER_FOLDER_NAME; +import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_IMAGE_FOLDER_NAME; import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_RESULT_FOLDER_NAME; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageAndAnswerResponseDTO; @@ -43,11 +44,13 @@ public Page getUniversityExamImages(Long id, Pag UniversityExam universityExam = universityExamRepository.findByUniversityExamId(id) .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); - Page universityExamImages = universityExamImageRepository.findAllByUniversityExam( + Page universityExamImages = universityExamImageRepository.findAllByUniversityExamOrderByPageAsc( universityExam, pageable); - return universityExamImages.map( - image -> UniversityExamImageResponseDTO.of(image.getUniversityExamImageFileName())); + return universityExamImages.map(image -> + UniversityExamImageResponseDTO.of(cloudFrontService.createPreSignedGetUrl(EXAM_IMAGE_FOLDER_NAME, + image.getUniversityExamImageFileName(), + image.getUniversityExam().getUniversityExamTimeLimit()))); } public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(Long universityExamId) { @@ -59,15 +62,14 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); List examImageUrls = new ArrayList<>(); - List UniversityExamImages = universityExamImageRepository.findAllByUniversityExam( + List UniversityExamImages = universityExamImageRepository.findAllByUniversityExamOrderByPageAsc( universityExam); UniversityExamImages.stream().forEach(universityExamImage -> { - String presignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, + String preSignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamImage.getUniversityExamImageFileName(), universityExam.getUniversityExamTimeLimit()); - examImageUrls.add( - UniversityExamImageResponseDTO.of(presignedGetUrl)); + UniversityExamImageResponseDTO.of(preSignedGetUrl)); }); return UniversityExamImageAndAnswerResponseDTO.of( From 491ca083ba3bd19b602d91077c7e18bd62385434 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 21:41:08 +0900 Subject: [PATCH 276/465] =?UTF-8?q?[ADD]=20Valid=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/exception/CommonErrorType.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java index 2073ef4..a50e8b7 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java @@ -18,6 +18,8 @@ public enum CommonErrorType implements BusinessExceptionType { */ INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์•Œ ์ˆ˜ ์—†๋Š” ์„œ๋ฒ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"), + // 400 Bad Request + INVALID_INPUT_VALUE(HttpStatus.BAD_REQUEST, "์ž…๋ ฅ๊ฐ’์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค"), ; private final HttpStatus status; From e2363c3e674e5d7cb01df9d3b129a200886aca80 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 21:42:01 +0900 Subject: [PATCH 277/465] =?UTF-8?q?[FEAT]=20GlobalExceptionHandler?= =?UTF-8?q?=EC=97=90=20MethodArgumentNotValidException=EC=97=90=20?= =?UTF-8?q?=EB=8C=80=ED=95=9C=20=EC=97=90=EB=9F=AC=20=ED=95=B8=EB=93=A4?= =?UTF-8?q?=EB=A7=81=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/GlobalExceptionHandler.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index ac9cbb1..db64b4d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -5,6 +5,9 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.validation.BindingResult; +import org.springframework.validation.FieldError; +import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.servlet.NoHandlerFoundException; @@ -34,4 +37,21 @@ protected ResponseEntity handleNotFoundException(final NoHandlerFou return ResponseEntity.status(HttpStatus.NOT_FOUND) .body(ApiResponse.error(CommonErrorType.NOT_FOUND_PATH, pathMap)); } + + @ExceptionHandler(MethodArgumentNotValidException.class) + public ResponseEntity> handleValidationError(MethodArgumentNotValidException exception) { + BindingResult bindingResult = exception.getBindingResult(); + StringBuilder builder = new StringBuilder(); + for (FieldError fieldError : bindingResult.getFieldErrors()) { + builder.append("["); + builder.append(fieldError.getField()); + builder.append("](์€)๋Š” "); + builder.append(fieldError.getDefaultMessage()); + builder.append(" ์ž…๋ ฅ๋œ ๊ฐ’: ["); + builder.append(fieldError.getRejectedValue()); + builder.append("]"); + } + return ResponseEntity.status(HttpStatus.BAD_REQUEST) + .body(ApiResponse.error(CommonErrorType.INVALID_INPUT_VALUE, builder.toString())); + } } From 94d9ce978fe85e408dfc98576b6479393c7655e2 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 21:43:10 +0900 Subject: [PATCH 278/465] =?UTF-8?q?[FEAT]=20SelectUniversityRequestDTO?= =?UTF-8?q?=EC=97=90=20valid=20=EC=9A=94=EC=86=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/dto/request/SelectUniversityRequestDTO.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java index dbd139a..a814b37 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java @@ -1,6 +1,8 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.request; +import jakarta.validation.constraints.NotNull; + public record SelectUniversityRequestDTO( - Long universityId + @NotNull Long universityId ) { } From d27c4fec8c4f2becb5a4e5ebefc5741ef12ede33 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 12 Jan 2024 21:43:38 +0900 Subject: [PATCH 279/465] =?UTF-8?q?[FEAT]=20CreateUniversityExamRequestDTO?= =?UTF-8?q?=20valid=20=EC=9A=94=EC=86=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/request/CreateUniversityExamRequestDTO.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java index c2be46b..21aa770 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java @@ -1,9 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.request; import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Positive; -public record CreateUniversityExamRequestDTO(@NotNull Long universityExamId, @NotNull int memberTakeTimeExam, - String memberSheetFileName) { +public record CreateUniversityExamRequestDTO(@NotNull Long universityExamId, + @Positive int memberTakeTimeExam, + @NotNull String memberSheetFileName) { public static CreateUniversityExamRequestDTO of(Long universityExamId, int memberTakeTimeExam, String memberSheetFileName) { return new CreateUniversityExamRequestDTO(universityExamId, memberTakeTimeExam, memberSheetFileName); From ec44a4bdef8e509362bd37e9f1039dc77335fe7c Mon Sep 17 00:00:00 2001 From: mikekks Date: Fri, 12 Jan 2024 22:14:11 +0900 Subject: [PATCH 280/465] =?UTF-8?q?[FIX]=20filter=EB=8B=A8=EC=97=90?= =?UTF-8?q?=EC=84=9C=EC=9D=98=20=EC=98=88=EC=99=B8=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EC=BD=94=EB=93=9C=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 --- .../filter/JwtAuthenticationFilter.java | 40 ++++++++++++------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java index ca39da9..8bd0aad 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java @@ -1,13 +1,15 @@ package com.nonsoolmate.nonsoolmateServer.global.security.filter; - +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_ACCESS_TOKEN; import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.UNAUTHORIZED_ACCESS_TOKEN; +import com.fasterxml.jackson.core.JsonProcessingException; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; import com.nonsoolmate.nonsoolmateServer.global.security.service.MemberAuthService; import com.nonsoolmate.nonsoolmateServer.global.jwt.utils.RequestUtils; +import io.jsonwebtoken.MalformedJwtException; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; @@ -31,25 +33,35 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { private final MemberAuthService memberAuthService; @Override - protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { - if (RequestUtils.isContainsAccessToken(request)) { - String authorizationAccessToken = RequestUtils.getAuthorizationAccessToken((HttpServletRequest) request); - - if (jwtService.validateToken(authorizationAccessToken)) { - Long memberId = jwtService.extractMemberIdFromAccessToken(authorizationAccessToken); + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws ServletException, IOException { - UserDetails userDetails = memberAuthService.loadUserByUsername(String.valueOf(memberId)); + if (!RequestUtils.isContainsAccessToken(request)) { + return; + } - Authentication authentication - = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); - log.info("Authentication Principal : {}", authentication.getPrincipal().toString()); - SecurityContextHolder.getContext().setAuthentication(authentication); + String authorizationAccessToken = RequestUtils.getAuthorizationAccessToken((HttpServletRequest) request); - } - else { + try { + if (!jwtService.validateToken(authorizationAccessToken)) { throw new AuthException(UNAUTHORIZED_ACCESS_TOKEN); } + + Long memberId = jwtService.extractMemberIdFromAccessToken(authorizationAccessToken); + + UserDetails userDetails = memberAuthService.loadUserByUsername(String.valueOf(memberId)); + + Authentication authentication + = new UsernamePasswordAuthenticationToken(userDetails, null, userDetails.getAuthorities()); + log.info("Authentication Principal : {}", authentication.getPrincipal().toString()); + SecurityContextHolder.getContext().setAuthentication(authentication); + + } catch (JsonProcessingException e) { + throw new AuthException(INVALID_ACCESS_TOKEN); + } catch (AuthException e) { + throw new AuthException(e.getExceptionType()); } + filterChain.doFilter(request, response); } From 82665e21b7d4b7531b36de5beb86764a03f89012 Mon Sep 17 00:00:00 2001 From: mikekks Date: Fri, 12 Jan 2024 22:14:29 +0900 Subject: [PATCH 281/465] =?UTF-8?q?[FEAT]=20JwtExceptionFilter=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/filter/JwtExceptionFilter.java | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java index 020ac17..b83d406 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java @@ -1,4 +1,35 @@ package com.nonsoolmate.nonsoolmateServer.global.security.filter; -public class JwtExceptionFilter { +import com.fasterxml.jackson.databind.ObjectMapper; +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; + +@Component +@RequiredArgsConstructor +public class JwtExceptionFilter extends OncePerRequestFilter { + + private final ObjectMapper objectMapper; + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { + try { + filterChain.doFilter(request, response); + } catch (AuthException e) { + response.setStatus(HttpStatus.UNAUTHORIZED.value()); + response.setContentType(MediaType.APPLICATION_JSON_VALUE); + response.setCharacterEncoding("UTF-8"); + String error = objectMapper.writeValueAsString(ApiResponse.error(e.getExceptionType())); + response.getWriter().write(error); + } + } } From c6007cc4b3aad2bcf4f2370cda6c03067d70cc8c Mon Sep 17 00:00:00 2001 From: mikekks Date: Fri, 12 Jan 2024 22:18:40 +0900 Subject: [PATCH 282/465] =?UTF-8?q?[ADD]=20=EC=95=A1=EC=84=B8=EC=8A=A4=20?= =?UTF-8?q?=ED=86=A0=ED=81=B0=20=EC=98=88=EC=99=B8=20=EC=B2=98=EB=A6=AC=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 --- .../nonsoolmateServer/global/jwt/service/JwtService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 0e85730..b6c87e8 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -15,6 +15,7 @@ import com.nonsoolmate.nonsoolmateServer.external.redis.repository.RedisTokenRepository; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.vo.RefreshTokenVO; import io.jsonwebtoken.Claims; +import io.jsonwebtoken.MalformedJwtException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.util.Date; @@ -105,8 +106,8 @@ public Boolean validateToken(final String atk) { try { Claims tokenClaims = jwtTokenProvider.getTokenClaims(atk); return !tokenClaims.getExpiration().before(new Date()); - } catch (Exception e) { - return false; + } catch (MalformedJwtException e) { + throw new AuthException(INVALID_ACCESS_TOKEN); } } From 213f752ac153f360d39dd42de8386e71626693c2 Mon Sep 17 00:00:00 2001 From: mikekks Date: Fri, 12 Jan 2024 22:19:17 +0900 Subject: [PATCH 283/465] =?UTF-8?q?[ADD]=20JwtExceptionFilter=20config=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 --- .../global/security/config/SecurityConfig.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index e7d7602..a89946f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -1,6 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.global.security.config; import com.nonsoolmate.nonsoolmateServer.global.security.filter.JwtAuthenticationFilter; +import com.nonsoolmate.nonsoolmateServer.global.security.filter.JwtExceptionFilter; import io.swagger.v3.oas.models.PathItem.HttpMethod; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Bean; @@ -38,6 +39,7 @@ public class SecurityConfig { }; private final JwtAuthenticationFilter jwtAuthenticationFilter; + private final JwtExceptionFilter jwtExceptionFilter; //cors ์—๋Ÿฌ๋ฅผ ๋Œ€์‘ํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”์†Œ๋“œ @@ -83,7 +85,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { auth.anyRequest().authenticated(); }) // ์›๋ž˜ ์Šคํ”„๋ง ์‹œํ๋ฆฌํ‹ฐ ํ•„ํ„ฐ ์ˆœ์„œ๊ฐ€ LogoutFilter ์ดํ›„์— ๋กœ๊ทธ์ธ ํ•„ํ„ฐ ๋™์ž‘ - .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); + .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) + .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); return http.build(); From 9a9ed51dfa1d50f46be000fc585825db981460cc Mon Sep 17 00:00:00 2001 From: mikekks Date: Fri, 12 Jan 2024 22:49:23 +0900 Subject: [PATCH 284/465] =?UTF-8?q?[FIX]=20jwt=20=EB=A7=8C=EB=A3=8C=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/global/jwt/service/JwtService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index b6c87e8..9d55bfe 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -3,6 +3,7 @@ import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_ACCESS_TOKEN; import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_REFRESH_TOKEN; +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.UNAUTHORIZED_ACCESS_TOKEN; import com.fasterxml.jackson.core.JsonProcessingException; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; @@ -15,6 +16,7 @@ import com.nonsoolmate.nonsoolmateServer.external.redis.repository.RedisTokenRepository; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.vo.RefreshTokenVO; import io.jsonwebtoken.Claims; +import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.MalformedJwtException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -108,6 +110,8 @@ public Boolean validateToken(final String atk) { return !tokenClaims.getExpiration().before(new Date()); } catch (MalformedJwtException e) { throw new AuthException(INVALID_ACCESS_TOKEN); + } catch (ExpiredJwtException e){ + throw new AuthException(UNAUTHORIZED_ACCESS_TOKEN); } } From 989d14a10402d89ef7fa5733cfe6cc25db0c4d63 Mon Sep 17 00:00:00 2001 From: mikekks Date: Fri, 12 Jan 2024 22:51:10 +0900 Subject: [PATCH 285/465] =?UTF-8?q?[FIX]=20jwt=20parser=20import=EB=AC=B8?= =?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 --- .../global/jwt/service/JwtTokenProvider.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java index 0216fd6..f95d2cd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import io.jsonwebtoken.Claims; -import io.jsonwebtoken.JwtParser; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.io.Decoders; @@ -59,10 +58,6 @@ public String createRefreshToken(Long expirationTime) { public Claims getTokenClaims(final String token) { - JwtParser build = Jwts.parserBuilder() - .setSigningKey(key) - .build(); - return Jwts.parserBuilder() .setSigningKey(key) .build() From 82f0efb920ebab43fb037d09aac2100a1f695e61 Mon Sep 17 00:00:00 2001 From: mikekks Date: Fri, 12 Jan 2024 22:51:27 +0900 Subject: [PATCH 286/465] =?UTF-8?q?[FIX]=20dofilter=20=EB=A1=9C=EC=A7=81?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/filter/JwtAuthenticationFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java index 8bd0aad..2f9355e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java @@ -37,6 +37,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse throws ServletException, IOException { if (!RequestUtils.isContainsAccessToken(request)) { + filterChain.doFilter(request, response); return; } @@ -48,7 +49,6 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse } Long memberId = jwtService.extractMemberIdFromAccessToken(authorizationAccessToken); - UserDetails userDetails = memberAuthService.loadUserByUsername(String.valueOf(memberId)); Authentication authentication From 7bc728d6117bc58c2a488ae496e7923c50ec714f Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 13 Jan 2024 14:15:49 +0900 Subject: [PATCH 287/465] =?UTF-8?q?[FIX]=20SelectUniversityExamsResponseDT?= =?UTF-8?q?O=EB=82=B4=EC=97=90=20=EC=8B=9C=ED=97=98=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EB=94=94=EB=A5=BC=20=EB=82=98=ED=83=80=EB=82=B4=EB=8A=94=20?= =?UTF-8?q?=ED=95=84=EB=93=9C=EB=AA=85=EC=9D=84=20universityExamId?= =?UTF-8?q?=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 --- .../dto/response/SelectUniversityExamsResponseDTO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java index 6794002..1ef9821 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java @@ -4,9 +4,9 @@ public record SelectUniversityExamsResponseDTO(Long universityId, String universityName, String universityCollege, List examList) { - public static SelectUniversityExamsResponseDTO of(Long universityId, String universityName, + public static SelectUniversityExamsResponseDTO of(Long universityExamId, String universityName, String universityCollege, List examList) { - return new SelectUniversityExamsResponseDTO(universityId, universityName, universityCollege, examList); + return new SelectUniversityExamsResponseDTO(universityExamId, universityName, universityCollege, examList); } } From 9b3a7a0cf04a80856352de8dff2734f13eea9328 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 13 Jan 2024 14:18:30 +0900 Subject: [PATCH 288/465] =?UTF-8?q?[FIX]=20SelectUniversityExamResponse=20?= =?UTF-8?q?DTO=EC=97=90=EC=84=9C=20universityId=EB=A5=BC=20examId=EB=A1=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=ED=95=98=EA=B3=A0=20=EB=B3=B8=EB=9E=98=20?= =?UTF-8?q?SelectUniversityExamsResponseDTO=EB=A5=BC=20=EC=9B=90=EB=9E=98?= =?UTF-8?q?=EB=8C=80=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SelectUniversityExamResponseDTO.java | 6 +++--- .../dto/response/SelectUniversityExamsResponseDTO.java | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java index 52e3860..c452e63 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java @@ -1,9 +1,9 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; -public record SelectUniversityExamResponseDTO(Long universityId, String examName, int examTimeLimit, +public record SelectUniversityExamResponseDTO(Long examId, String examName, int examTimeLimit, String examStatus) { - public static SelectUniversityExamResponseDTO of(Long universityId, String examName, int examTimeLimit, + public static SelectUniversityExamResponseDTO of(Long examId, String examName, int examTimeLimit, String examStatus) { - return new SelectUniversityExamResponseDTO(universityId, examName, examTimeLimit, examStatus); + return new SelectUniversityExamResponseDTO(examId, examName, examTimeLimit, examStatus); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java index 1ef9821..6794002 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java @@ -4,9 +4,9 @@ public record SelectUniversityExamsResponseDTO(Long universityId, String universityName, String universityCollege, List examList) { - public static SelectUniversityExamsResponseDTO of(Long universityExamId, String universityName, + public static SelectUniversityExamsResponseDTO of(Long universityId, String universityName, String universityCollege, List examList) { - return new SelectUniversityExamsResponseDTO(universityExamId, universityName, universityCollege, examList); + return new SelectUniversityExamsResponseDTO(universityId, universityName, universityCollege, examList); } } From de9a2492dee92d39b7240dee12c3c5a0a57d727c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 13 Jan 2024 14:30:13 +0900 Subject: [PATCH 289/465] =?UTF-8?q?[FIX]=20=EC=8B=9C=ED=97=98=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20&=20=EC=A0=9C=ED=95=9C=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=EC=97=90=EC=84=9C=20SuccessType=20message=EB=A5=BC=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=8B=9C=ED=97=98=20=EC=A0=95=EB=B3=B4=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=EC=97=90=20=EC=84=B1=EA=B3=B5=ED=96=88=EC=8A=B5?= =?UTF-8?q?=EB=8B=88=EB=8B=A4=20=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/exception/UniversityExamSuccessType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java index f1e5fa4..20a5683 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java @@ -10,7 +10,7 @@ public enum UniversityExamSuccessType implements BusinessSucessType { /** * 200 OK */ - GET_UNIVERSITY_EXAM_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), + GET_UNIVERSITY_EXAM_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์‹œํ—˜ ์ •๋ณด ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), GET_UNIVERSITY_EXAM_IMAGE_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), GET_UNIVERSITY_EXAM_IMAGE_AND_ANSWER_SUCCESS(HttpStatus.OK, "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"); From 5094607c2401072ef39edf7b9ae5e438a0206be3 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 13 Jan 2024 14:32:44 +0900 Subject: [PATCH 290/465] =?UTF-8?q?[FIX]=20/university/exam/info/{id}=20->?= =?UTF-8?q?=20/university/exam/{id}/info=20=EB=A1=9C=20=EA=B2=BD=EB=A1=9C?= =?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 --- .../domain/university/controller/UniversityExamController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index 2138736..4fa8ede 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -25,7 +25,7 @@ public class UniversityExamController { private final UniversityExamService universityExamService; - @GetMapping("/info/{id}") + @GetMapping("/{id}/info") public ResponseEntity> getUniversityExam( @PathVariable("id") Long universityExamId) { return ResponseEntity.ok().body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_SUCCESS, From 9cb16f44c973325664bf5656d6a37c26b9eaaba8 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 16:23:06 +0900 Subject: [PATCH 291/465] =?UTF-8?q?[FIX]=20=ED=95=9C=EA=B8=80=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=9D=B8=EC=BD=94=EB=94=A9=20=EB=A1=9C=EC=A7=81=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 --- .../external/aws/service/CloudFrontService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index b7cbd52..d3e97dc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -2,6 +2,7 @@ import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSExceptionType; +import java.net.URLEncoder; import java.nio.file.Path; import java.nio.file.Paths; import java.time.Instant; @@ -29,11 +30,13 @@ public class CloudFrontService { private String keyPairId; public String createPreSignedGetUrl(String path, String fileName, int expireTime) { - String resourcePath = path + fileName; - String cloudFrontUrl = "https://" + distributionDomain + "/" + resourcePath; - Instant expirationTime = Instant.now().plus(expireTime, ChronoUnit.MINUTES); - Path keyPath = Paths.get(privateKeyFilePath); try { + String encodedFileName = URLEncoder.encode(fileName, "UTF-8"); + String resourcePath = path + encodedFileName; + String cloudFrontUrl = "https://" + distributionDomain + "/" + resourcePath; + Instant expirationTime = Instant.now().plus(expireTime, ChronoUnit.MINUTES); + Path keyPath = Paths.get(privateKeyFilePath); + CloudFrontUtilities cloudFrontUtilities = CloudFrontUtilities.create(); CannedSignerRequest cannedSignerRequest = CannedSignerRequest.builder() .resourceUrl(cloudFrontUrl) @@ -44,6 +47,7 @@ public String createPreSignedGetUrl(String path, String fileName, int expireTime SignedUrl signedUrl = cloudFrontUtilities.getSignedUrlWithCannedPolicy(cannedSignerRequest); return signedUrl.url(); } catch (Exception e) { + log.info("createPreSignedGetUrl = {}", e); throw new AWSException(AWSExceptionType.GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL); } } From 8751fb41cd0c00d7d4ed7dc32f91760f407f9211 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 16:23:30 +0900 Subject: [PATCH 292/465] =?UTF-8?q?[FIX]=20=EB=94=94=EB=A0=89=ED=86=A0?= =?UTF-8?q?=EB=A6=AC=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/service/UniversityExamService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index d108b88..5fba00e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -66,7 +66,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L universityExam); UniversityExamImages.stream().forEach(universityExamImage -> { - String preSignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, + String preSignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_IMAGE_FOLDER_NAME, universityExamImage.getUniversityExamImageFileName(), universityExam.getUniversityExamTimeLimit()); examImageUrls.add( UniversityExamImageResponseDTO.of(preSignedGetUrl)); From eb53fda339f490ad0ef2dc33c8b5fb1f1169f050 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 16:50:55 +0900 Subject: [PATCH 293/465] =?UTF-8?q?[REFACTOR]=20=EC=9D=B8=EC=BD=94?= =?UTF-8?q?=EB=94=A9=20=ED=95=A8=EC=88=98=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/CloudFrontService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index d3e97dc..e3ed8d9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -2,6 +2,7 @@ import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSExceptionType; +import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.file.Path; import java.nio.file.Paths; @@ -31,8 +32,7 @@ public class CloudFrontService { public String createPreSignedGetUrl(String path, String fileName, int expireTime) { try { - String encodedFileName = URLEncoder.encode(fileName, "UTF-8"); - String resourcePath = path + encodedFileName; + String resourcePath = getEncodedResourcePath(path, fileName); String cloudFrontUrl = "https://" + distributionDomain + "/" + resourcePath; Instant expirationTime = Instant.now().plus(expireTime, ChronoUnit.MINUTES); Path keyPath = Paths.get(privateKeyFilePath); @@ -51,4 +51,9 @@ public String createPreSignedGetUrl(String path, String fileName, int expireTime throw new AWSException(AWSExceptionType.GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL); } } + + private String getEncodedResourcePath(String path, String fileName) throws UnsupportedEncodingException { + String encodedFileName = URLEncoder.encode(fileName, "UTF-8"); + return path + encodedFileName; + } } From 438bb63c6b542161f86daf041314aab190a6dbf3 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 13 Jan 2024 17:11:41 +0900 Subject: [PATCH 294/465] =?UTF-8?q?[FIX]=20.pem=20=ED=82=A4=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=83=9D=EC=84=B1=20=EC=97=AC=EB=B6=80=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=EC=9D=84=20=EC=9C=84=ED=95=9C=20CD=20script=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 --- .github/workflows/dev-CD.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dev-CD.yml b/.github/workflows/dev-CD.yml index 6a96fea..4f2674f 100644 --- a/.github/workflows/dev-CD.yml +++ b/.github/workflows/dev-CD.yml @@ -26,6 +26,7 @@ jobs: echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application.yaml mkdir -p src/main/resources/key echo "${{ secrets.CLOUDFRONT_PRIVATE_KEY }}" > src/main/resources/key/cloudfront-private-key.pem + ls src/main/resources/key working-directory: ${{ env.working-directory }} - name: ๋นŒ๋“œ From edf6c09bd6d3100ba4471defafe2eb51f53b4687 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 13 Jan 2024 17:13:21 +0900 Subject: [PATCH 295/465] =?UTF-8?q?[FIX]=20CI=EC=97=90=EC=84=9C=20ls=20?= =?UTF-8?q?=EC=B0=8D=EC=96=B4=EB=B3=B4=EB=8F=84=EB=A1=9D=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 --- .github/workflows/dev-CI.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dev-CI.yml b/.github/workflows/dev-CI.yml index 7d0c0f1..47c064e 100644 --- a/.github/workflows/dev-CI.yml +++ b/.github/workflows/dev-CI.yml @@ -25,7 +25,8 @@ jobs: mkdir -p src/main/resources echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application.yaml mkdir -p src/main/resources/key - echo "${{ secrets.CLOUDFRONT_PRIVATE_KEY }}" > src/main/resources/key/cloudfront-private-key.pem + echo "${{ secrets.CLOUDFRONT_PRIVATE_KEY }}" > src/main/resources/key/cloudfront-private-key.pem + ls src/main/resources/key working-directory: ${{ env.working-directory }} - name: build From a973b88851d7e52748527812f712db120fad746a Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 18:32:33 +0900 Subject: [PATCH 296/465] =?UTF-8?q?[ADD]=20cors=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index a89946f..d62d78f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -49,8 +49,8 @@ public WebMvcConfigurer corsConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") - .allowedOrigins("https://nonsoolmate.com", "localhost:3000") - .allowedOriginPatterns("https://nonsoolmate.com", "localhost:3000") + .allowedOrigins("https://nonsoolmate.com", "localhost:5173") + .allowedOriginPatterns("https://nonsoolmate.com", "localhost:5173") .allowedMethods( HttpMethod.GET.name(), HttpMethod.POST.name(), From 869b7855ddbbb44cb776a60fe50b51399e5b49f4 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 18:33:15 +0900 Subject: [PATCH 297/465] =?UTF-8?q?[ADD]=20cors=20=ED=97=A4=EB=8D=94=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 --- .../nonsoolmateServer/global/security/config/SecurityConfig.java | 1 + 1 file changed, 1 insertion(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index d62d78f..3e1a5c4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -51,6 +51,7 @@ public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("https://nonsoolmate.com", "localhost:5173") .allowedOriginPatterns("https://nonsoolmate.com", "localhost:5173") + .allowedHeaders("*") .allowedMethods( HttpMethod.GET.name(), HttpMethod.POST.name(), From 0fb7cf3cb94eec10a6500ec72cf07dff6539b53e Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 18:55:23 +0900 Subject: [PATCH 298/465] =?UTF-8?q?[FIX]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 3e1a5c4..f92912e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -4,6 +4,7 @@ import com.nonsoolmate.nonsoolmateServer.global.security.filter.JwtExceptionFilter; import io.swagger.v3.oas.models.PathItem.HttpMethod; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -38,6 +39,15 @@ public class SecurityConfig { "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**", "/actuator/health" }; + @Value("${spring.web.domain.server}") + private String serverDomain; + + @Value("${spring.web.domain.client}") + private String clientDomain; + + @Value("${spring.web.domain.client-local}") + private String clientLocalDomain; + private final JwtAuthenticationFilter jwtAuthenticationFilter; private final JwtExceptionFilter jwtExceptionFilter; @@ -49,8 +59,8 @@ public WebMvcConfigurer corsConfigurer() { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") - .allowedOrigins("https://nonsoolmate.com", "localhost:5173") - .allowedOriginPatterns("https://nonsoolmate.com", "localhost:5173") + .allowedOrigins(serverDomain, clientDomain, clientLocalDomain) + .allowedOriginPatterns(serverDomain, clientDomain, clientLocalDomain) .allowedHeaders("*") .allowedMethods( HttpMethod.GET.name(), From fadac5bd91a14d6ca738b34d05118749731c8a6e Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 20:45:30 +0900 Subject: [PATCH 299/465] =?UTF-8?q?[FIX]=20=EB=AA=A9=ED=91=9C=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=A1=B0=ED=9A=8C=20=EB=A1=9C=EC=A7=81=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 --- .../service/SelectUniversityService.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index f90b403..2193b4c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -36,20 +36,21 @@ public List getSelectUniversities(Member member) { member); List selectUniversityResponseDTOS = new ArrayList<>(); - selectUniversities.stream().forEach(selectUniversity -> { - boolean status = true; + universityRepository.findAll().stream().forEach(university -> { + boolean status = false; - University university = universityRepository.findByUniversityId( - selectUniversity.getUniversity().getUniversityId()).orElse(null); - if (university == null) { - status = false; + for(SelectUniversity selectUniversity : selectUniversities){ + if(selectUniversity.getUniversity().getUniversityId() == university.getUniversityId()){ + status = true; + } } + selectUniversityResponseDTOS.add(SelectUniversityResponseDTO.of(university.getUniversityId(), university.getUniversityName(), university.getUniversityCollege(), status)); - }); + return selectUniversityResponseDTOS; } From 97ef9cca4e5de1c299fc7ad9f9043a29416e7ac5 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 22:10:42 +0900 Subject: [PATCH 300/465] =?UTF-8?q?[FIX]=20=EC=BD=94=EB=93=9C=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/SelectUniversityRepository.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java index a8bfe4e..dd1bb09 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/repository/SelectUniversityRepository.java @@ -5,6 +5,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.entity.SelectUniversity; import com.nonsoolmate.nonsoolmateServer.domain.university.entity.University; import java.util.List; +import java.util.Optional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.transaction.annotation.Transactional; @@ -16,6 +17,8 @@ public interface SelectUniversityRepository extends JpaRepository findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc(Member member); + Optional findByMemberAndUniversity(Member member, University university); + @Transactional void deleteByMemberAndUniversity(Member member, University university); From dd08c6d78177845b3ad8255a1f1e3d8340d060c0 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 22:11:05 +0900 Subject: [PATCH 301/465] =?UTF-8?q?[FIX]=20=EC=9D=98=EB=AF=B8=EC=97=86?= =?UTF-8?q?=EB=8A=94=20for=EB=AC=B8=20=EC=82=AD=EC=A0=9C(=EC=BD=94?= =?UTF-8?q?=EB=93=9C=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 2193b4c..38f6ee0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -32,17 +32,16 @@ public class SelectUniversityService { public List getSelectUniversities(Member member) { - List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc( - member); List selectUniversityResponseDTOS = new ArrayList<>(); - universityRepository.findAll().stream().forEach(university -> { - boolean status = false; + universityRepository.findAllByOrderByUniversityNameAscUniversityCollegeAsc().stream().forEach(university -> { + boolean status = true; - for(SelectUniversity selectUniversity : selectUniversities){ - if(selectUniversity.getUniversity().getUniversityId() == university.getUniversityId()){ - status = true; - } + SelectUniversity curUniv = selectUniversityRepository.findByMemberAndUniversity(member, university) + .orElse(null); + + if(curUniv == null){ + status = false; } selectUniversityResponseDTOS.add(SelectUniversityResponseDTO.of(university.getUniversityId(), @@ -50,7 +49,6 @@ public List getSelectUniversities(Member member) { status)); }); - return selectUniversityResponseDTOS; } From 1d71b00c900a5cc47daa0e8235124751d1572cbe Mon Sep 17 00:00:00 2001 From: mikekks Date: Sat, 13 Jan 2024 22:11:25 +0900 Subject: [PATCH 302/465] =?UTF-8?q?[ADD]=20=EB=AA=A8=EB=93=A0=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EC=A1=B0=ED=9A=8C=20=EB=A9=94=EC=86=8C=EB=93=9C=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/university/repository/UniversityRepository.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java index c6b3d59..d916c83 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityRepository.java @@ -13,6 +13,8 @@ public interface UniversityRepository extends JpaRepository { Optional findByUniversityId(Long universityId); + List findAllByOrderByUniversityNameAscUniversityCollegeAsc(); + default University findByUniversityIdOrElseThrowException(Long universityId){ return findByUniversityId(universityId).orElseThrow( ()-> new SelectUniversityException(INVALID_SELECTED_UNIVERSITY)); From 0a21bd5a01a9280a8015464a57dd7fdc01e8670b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sun, 14 Jan 2024 11:29:42 +0900 Subject: [PATCH 303/465] =?UTF-8?q?[FIX]=20=EB=8C=80=ED=95=99=20=EC=8B=9C?= =?UTF-8?q?=ED=97=98=20=EC=9D=B4=EB=A6=84=EC=97=90=20=EB=8C=80=ED=95=99?= =?UTF-8?q?=EA=B5=90=20=EC=9D=B4=EB=A6=84=20+=20=EC=8B=9C=ED=97=98=20?= =?UTF-8?q?=EB=85=84=EB=8F=84=20=ED=8F=AC=ED=95=A8=EB=90=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/service/UniversityExamService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 5fba00e..406f629 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -35,11 +35,16 @@ public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); + String universityExamName = getUniversityExamName(universityExam); return UniversityExamInfoResponseDTO.of(universityExam.getUniversityExamId(), - universityExam.getUniversityExamName(), + universityExamName, universityExam.getUniversityExamTimeLimit()); } + private String getUniversityExamName(UniversityExam universityExam) { + return universityExam.getUniversity().getUniversityName() + " - " + universityExam.getUniversityExamYear() + " " + universityExam.getUniversityExamName(); + } + public Page getUniversityExamImages(Long id, Pageable pageable) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(id) .orElseThrow(() -> new UniversityExamException( From ad7379d0647beddd91c7b4fc453d008788a95525 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 21:35:37 +0900 Subject: [PATCH 304/465] =?UTF-8?q?[ADD]=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EB=A6=AC=ED=84=B4=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B3=80?= =?UTF-8?q?=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/service/UniversityExamService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 406f629..315ff44 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -79,7 +79,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L return UniversityExamImageAndAnswerResponseDTO.of( universityExam.getUniversity().getUniversityName(), - universityExam.getUniversity().getUniversityCollege(), examImageUrls, examAnswerUrl); + universityExam.getUniversityExamName(), universityExam.getUniversityExamYear(), examImageUrls, examAnswerUrl); } } \ No newline at end of file From 422a440a38543ea95c573a6c2c8ac026ce6a34d8 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 21:36:02 +0900 Subject: [PATCH 305/465] =?UTF-8?q?[ADD]=20DTO=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EB=B3=80=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/UniversityExamImageAndAnswerResponseDTO.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java index 776dd72..80aab3e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java @@ -3,12 +3,12 @@ import java.util.List; public record UniversityExamImageAndAnswerResponseDTO( - String university, String college, List examQuestionList, String examAnswerUrl + String university, String universityExamName, int universityExamYear, List examQuestionList, String examAnswerUrl ) { - static public UniversityExamImageAndAnswerResponseDTO of(String university, String college, + static public UniversityExamImageAndAnswerResponseDTO of(String university, String universityExamName, int universityExamYear, List examQuestionList, String examAnswerUrl) { - return new UniversityExamImageAndAnswerResponseDTO(university, college, examQuestionList, examAnswerUrl); + return new UniversityExamImageAndAnswerResponseDTO(university, universityExamName, universityExamYear, examQuestionList, examAnswerUrl); } } From b52708190e2162912eb79be3bd772c757c0a70ae Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 21:58:47 +0900 Subject: [PATCH 306/465] =?UTF-8?q?[ADD]=20DTO=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EB=B3=80=ED=99=98=20(=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response/UniversityExamImageAndAnswerResponseDTO.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java index 80aab3e..a41e7fb 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java @@ -3,12 +3,12 @@ import java.util.List; public record UniversityExamImageAndAnswerResponseDTO( - String university, String universityExamName, int universityExamYear, List examQuestionList, String examAnswerUrl + String universityExamName, List examQuestionList, String examAnswerUrl ) { - static public UniversityExamImageAndAnswerResponseDTO of(String university, String universityExamName, int universityExamYear, + static public UniversityExamImageAndAnswerResponseDTO of(String universityExamName, List examQuestionList, String examAnswerUrl) { - return new UniversityExamImageAndAnswerResponseDTO(university, universityExamName, universityExamYear, examQuestionList, examAnswerUrl); + return new UniversityExamImageAndAnswerResponseDTO(universityExamName, examQuestionList, examAnswerUrl); } } From 522117c174176f37ecf9457c7e33a7c1f33bc5e9 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 21:59:07 +0900 Subject: [PATCH 307/465] =?UTF-8?q?[ADD]=20service=EB=8B=A8=20=EB=A6=AC?= =?UTF-8?q?=ED=84=B4=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=B3=80=ED=99=98=20?= =?UTF-8?q?(=EC=BD=94=EB=93=9C=20=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/service/UniversityExamService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 315ff44..fd1ea82 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -42,7 +42,8 @@ public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { } private String getUniversityExamName(UniversityExam universityExam) { - return universityExam.getUniversity().getUniversityName() + " - " + universityExam.getUniversityExamYear() + " " + universityExam.getUniversityExamName(); + return universityExam.getUniversity().getUniversityName() + " - " + universityExam.getUniversityExamYear() + " " + + universityExam.getUniversityExamName(); } public Page getUniversityExamImages(Long id, Pageable pageable) { @@ -78,8 +79,8 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L }); return UniversityExamImageAndAnswerResponseDTO.of( - universityExam.getUniversity().getUniversityName(), - universityExam.getUniversityExamName(), universityExam.getUniversityExamYear(), examImageUrls, examAnswerUrl); + universityExam.getUniversity().getUniversityName() + " - " + universityExam.getUniversityExamYear() + " " + universityExam.getUniversityExamName() + , examImageUrls, examAnswerUrl); } } \ No newline at end of file From e7b2dfd5661251f95c55405740bf1ac91eae05f5 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 22:03:34 +0900 Subject: [PATCH 308/465] =?UTF-8?q?[REFACTOR]=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=ED=86=B5=EC=9D=BC=20(=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/service/UniversityExamService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index fd1ea82..c2088e9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -79,7 +79,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L }); return UniversityExamImageAndAnswerResponseDTO.of( - universityExam.getUniversity().getUniversityName() + " - " + universityExam.getUniversityExamYear() + " " + universityExam.getUniversityExamName() + getUniversityExamName(universityExam) , examImageUrls, examAnswerUrl); } From 595ec686bf58024d159da80b9f0040e0e8be17f0 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 22:24:09 +0900 Subject: [PATCH 309/465] =?UTF-8?q?[ADD]=20DTO=EC=97=90=20universityExamNa?= =?UTF-8?q?me=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/UniversityExamRecordResponseDTO.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java index 12b20ab..5a049f9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java @@ -1,10 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; public record UniversityExamRecordResponseDTO( + String universityExamName, String examAnswerUrl, String examResultUrl ) { - public static UniversityExamRecordResponseDTO of(String examAnswerUrl, String examResultUrl) { - return new UniversityExamRecordResponseDTO(examAnswerUrl, examResultUrl); + public static UniversityExamRecordResponseDTO of(String universityExamName, String examAnswerUrl, String examResultUrl) { + return new UniversityExamRecordResponseDTO(universityExamName, examAnswerUrl, examResultUrl); } } From 0badcfc84e749b62e44ae6d7bcd0aca926040e8f Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 22:24:24 +0900 Subject: [PATCH 310/465] =?UTF-8?q?[ADD]=20=EB=A6=AC=ED=84=B4=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index e6ee2e6..84c7d9c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -47,7 +47,7 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); - return UniversityExamRecordResponseDTO.of(answerUrl, resultUrl); + return UniversityExamRecordResponseDTO.of(getUniversityExamName(universityExam), answerUrl, resultUrl); } public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long universityExamId, Member member) { @@ -108,6 +108,11 @@ private UniversityExam getUniversityExam(Long universityExamId) { .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); } + private String getUniversityExamName(UniversityExam universityExam) { + return universityExam.getUniversity().getUniversityName() + " - " + universityExam.getUniversityExamYear() + " " + + universityExam.getUniversityExamName(); + } + private UniversityExamRecord getUniversityExamByUniversityExamAndMember(UniversityExam universityExam, Member member) { return universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( From 5d6ea43b9929f946ad60e6cd56460f7773c9d78f Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 22:59:28 +0900 Subject: [PATCH 311/465] =?UTF-8?q?[REFACTOR]=20entity=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=20=EB=82=B4=20=EA=B3=B5=ED=86=B5=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/entity/UniversityExam.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java index 6f93651..803d2e9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java @@ -38,4 +38,8 @@ public class UniversityExam { @NotNull private int universityExamTimeLimit; + + public String getUniversityAndUniversityExamName(){ + return this.getUniversity().getUniversityName() + " - " + this.getUniversityExamYear() + " " + this.getUniversityExamName(); + } } \ No newline at end of file From 5a0de9095f989d8f8e6cc16b017f64d35f3c09cc Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 22:59:38 +0900 Subject: [PATCH 312/465] =?UTF-8?q?[REFACTOR]=20entity=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=20=EB=82=B4=20=EA=B3=B5=ED=86=B5=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 84c7d9c..3258b98 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -47,7 +47,7 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); - return UniversityExamRecordResponseDTO.of(getUniversityExamName(universityExam), answerUrl, resultUrl); + return UniversityExamRecordResponseDTO.of(universityExam.getUniversityAndUniversityExamName(), answerUrl, resultUrl); } public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long universityExamId, Member member) { @@ -108,11 +108,6 @@ private UniversityExam getUniversityExam(Long universityExamId) { .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); } - private String getUniversityExamName(UniversityExam universityExam) { - return universityExam.getUniversity().getUniversityName() + " - " + universityExam.getUniversityExamYear() + " " - + universityExam.getUniversityExamName(); - } - private UniversityExamRecord getUniversityExamByUniversityExamAndMember(UniversityExam universityExam, Member member) { return universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( From 6ebe37d73539bd34300cc596051df48b3a7c3334 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 23:00:05 +0900 Subject: [PATCH 313/465] =?UTF-8?q?[REFACTOR]=20entity=20=EA=B0=9D?= =?UTF-8?q?=EC=B2=B4=20=EB=82=B4=20=EA=B3=B5=ED=86=B5=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=A0=81=EC=9A=A9=20=EB=B0=8F=20=EA=B8=B0=EC=A1=B4?= =?UTF-8?q?=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 --- .../domain/university/service/UniversityExamService.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index c2088e9..89fc45d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -35,17 +35,12 @@ public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); - String universityExamName = getUniversityExamName(universityExam); + String universityExamName = universityExam.getUniversityAndUniversityExamName(); return UniversityExamInfoResponseDTO.of(universityExam.getUniversityExamId(), universityExamName, universityExam.getUniversityExamTimeLimit()); } - private String getUniversityExamName(UniversityExam universityExam) { - return universityExam.getUniversity().getUniversityName() + " - " + universityExam.getUniversityExamYear() + " " - + universityExam.getUniversityExamName(); - } - public Page getUniversityExamImages(Long id, Pageable pageable) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(id) .orElseThrow(() -> new UniversityExamException( @@ -79,7 +74,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L }); return UniversityExamImageAndAnswerResponseDTO.of( - getUniversityExamName(universityExam) + universityExam.getUniversityAndUniversityExamName() , examImageUrls, examAnswerUrl); } From e51c643c75a429ed3e2174af27c06733da4bf517 Mon Sep 17 00:00:00 2001 From: mikekks Date: Sun, 14 Jan 2024 23:25:05 +0900 Subject: [PATCH 314/465] =?UTF-8?q?[REFACTOR]=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/entity/UniversityExam.java | 2 +- .../domain/university/service/UniversityExamService.java | 5 ++--- .../service/UniversityExamRecordService.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java index 803d2e9..843f3bb 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java @@ -39,7 +39,7 @@ public class UniversityExam { @NotNull private int universityExamTimeLimit; - public String getUniversityAndUniversityExamName(){ + public String getUniversityExamFullName(){ return this.getUniversity().getUniversityName() + " - " + this.getUniversityExamYear() + " " + this.getUniversityExamName(); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 89fc45d..890b920 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -2,7 +2,6 @@ import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_ANSWER_FOLDER_NAME; import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_IMAGE_FOLDER_NAME; -import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_RESULT_FOLDER_NAME; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageAndAnswerResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageResponseDTO; @@ -35,7 +34,7 @@ public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); - String universityExamName = universityExam.getUniversityAndUniversityExamName(); + String universityExamName = universityExam.getUniversityExamFullName(); return UniversityExamInfoResponseDTO.of(universityExam.getUniversityExamId(), universityExamName, universityExam.getUniversityExamTimeLimit()); @@ -74,7 +73,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L }); return UniversityExamImageAndAnswerResponseDTO.of( - universityExam.getUniversityAndUniversityExamName() + universityExam.getUniversityExamFullName() , examImageUrls, examAnswerUrl); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 3258b98..240f57a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -47,7 +47,7 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); - return UniversityExamRecordResponseDTO.of(universityExam.getUniversityAndUniversityExamName(), answerUrl, resultUrl); + return UniversityExamRecordResponseDTO.of(universityExam.getUniversityExamFullName(), answerUrl, resultUrl); } public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long universityExamId, Member member) { From 6c58702a8524a1b22861bb7b6a50b672663a9cd5 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 14:53:08 +0900 Subject: [PATCH 315/465] =?UTF-8?q?[FEAT]=20AuthController=20=EC=8A=A4?= =?UTF-8?q?=EC=9B=A8=EA=B1=B0=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 4b1077e..f48734f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -9,6 +9,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSuccessType; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; @@ -28,6 +30,7 @@ @RequiredArgsConstructor @RequestMapping("/auth") @Slf4j +@Tag(name = "auth", description = "์ธ์ฆ ๊ด€๋ จ API") public class AuthController { private final AuthServiceProvider authServiceProvider; private final JwtService jwtService; @@ -37,6 +40,7 @@ public class AuthController { @Value("${spring.security.oauth2.client.naver.redirect-uri}") private String redirectUri; + @Operation(summary = "์†Œ์…œ ๋กœ๊ทธ์ธ", description = "๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค.") @PostMapping("/social/login") public ResponseEntity> login( @RequestHeader(value = "authorization-code") final String authorizationCode, @@ -52,6 +56,7 @@ public ResponseEntity> login( return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.LOGIN_SUCCESS, responseDTO)); } + @Operation(summary = "์•ก์„ธ์Šค ํ† ํฐ & ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰", description = "์•ก์„ธ์Šค ํ† ํฐ ๋ฐ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ ๋ฐ›์Šต๋‹ˆ๋‹ค.") @PostMapping("/reissue") public ResponseEntity> reissue(HttpServletRequest request, HttpServletResponse response) { From 919dcf07c5b48fec8436b70564a98d536560b1c2 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 14:53:23 +0900 Subject: [PATCH 316/465] =?UTF-8?q?[FEAT]=20MyController=20=EC=8A=A4?= =?UTF-8?q?=EC=9B=A8=EA=B1=B0=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 70bdfd1..17d29ea 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -7,6 +7,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -16,9 +18,11 @@ @RestController @RequestMapping("/my") @RequiredArgsConstructor +@Tag(name = "my", description = "๋ฉค๋ฒ„์™€ ๊ด€๋ จ๋œ API") public class MyController { private final MemberService memberService; + @Operation(summary = "๋งˆ์ดํŽ˜์ด์ง€: ์ด๋ฆ„", description = "๋‚ด ์ด๋ฆ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/name") public ResponseEntity> getName(@AuthUser Member member) { return ResponseEntity.ok() @@ -26,6 +30,7 @@ public ResponseEntity> getName(@AuthUser Member mem memberService.getNickname(member))); } + @Operation(summary = "๋‚ด ์ •๋ณด ํ™•์ธ: ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", description = "๋‚ด ์ฒจ์‚ญ๊ถŒ ๊ฐฏ์ˆ˜๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/ticket") public ResponseEntity> getTicket(@AuthUser Member member) { return ResponseEntity.ok() From 994944819f5a3a109e51ac7d0d53f3c2a26bfc90 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 14:53:31 +0900 Subject: [PATCH 317/465] =?UTF-8?q?[FEAT]=20SelectUniversityController=20?= =?UTF-8?q?=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SelectUniversityController.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java index cf982ba..be0a87f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java @@ -12,6 +12,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.service.SelectUniversityService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import java.util.List; import lombok.RequiredArgsConstructor; @@ -25,10 +27,12 @@ @RestController @RequiredArgsConstructor @RequestMapping("/select-university") +@Tag(name = "SelectUniversity", description = "๋ชฉํ‘œ ๋Œ€ํ•™๊ณผ ๊ด€๋ จ๋œ API") public class SelectUniversityController { private final SelectUniversityService selectUniversityService; + @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping public ResponseEntity>> getSelectUniversities( @AuthUser Member member) { @@ -37,6 +41,7 @@ public ResponseEntity>> getSelectU selectUniversityService.getSelectUniversities(member))); } + @Operation(summary = "๋งˆ์ด ํŽ˜์ด์ง€: ๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค์˜ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/exam") public ResponseEntity>> getSelectUniversityExams( @AuthUser Member member) { @@ -44,6 +49,7 @@ public ResponseEntity>> getSe selectUniversityService.getSelectUniversityExams(member))); } + @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์„ ํƒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธ(์ˆ˜์ •) ํ•ฉ๋‹ˆ๋‹ค.") @PatchMapping public ResponseEntity> patchSelectUniversities( @AuthUser Member member, From 4eeb7b9fb37fbccba564cc295806e567f560204a Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 14:53:43 +0900 Subject: [PATCH 318/465] =?UTF-8?q?[FEAT]=20UniversityExamController=20?= =?UTF-8?q?=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/controller/UniversityExamController.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index 4fa8ede..5c5aef5 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -8,6 +8,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.university.service.UniversityExamService; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -22,9 +24,11 @@ @RestController @RequestMapping("/university/exam") @RequiredArgsConstructor +@Tag(name = "UniversityExam", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ •๋ณด์™€ ๊ด€๋ จ๋œ API") public class UniversityExamController { private final UniversityExamService universityExamService; + @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ์‹œํ—˜ ์ด๋ฆ„ & ์ œํ•œ ์‹œ๊ฐ„", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ์ด๋ฆ„ ๋ฐ ์ œํ•œ ์‹œ๊ฐ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/{id}/info") public ResponseEntity> getUniversityExam( @PathVariable("id") Long universityExamId) { @@ -32,6 +36,7 @@ public ResponseEntity> getUniversityE universityExamService.getUniversityExam(universityExamId))); } + @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ๋ฌธ์ œ์ง€ [ํŽ˜์ด์ง€๋„ค์ด์…˜]", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ๋ฌธ์ œ์ง€๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("{id}/image") public ResponseEntity>> getUniversityExamImages( @PathVariable("id") Long id, @RequestParam(defaultValue = "0") int page, Pageable pageable) { @@ -41,7 +46,7 @@ public ResponseEntity>> getUniv .body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_SUCCESS, images)); } - + @Operation(summary = "ํ•ด์ œ: ๋ฌธ์ œ์ด๋ฏธ์ง€_ํ•ด์ œPDF", description = "๋ฌธ์ œ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("{id}/answer") public ResponseEntity> getUniversityExamImageAndAnswer( @PathVariable("id") Long universityExamId From 4e5d1409430e58e49d591abb43d99b50bb248aca Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 14:53:49 +0900 Subject: [PATCH 319/465] =?UTF-8?q?[FEAT]=20UniversityExamRecordController?= =?UTF-8?q?=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamRecordController.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index e1b4e83..3aa5698 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -15,6 +15,8 @@ import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @@ -29,11 +31,14 @@ @RestController @RequestMapping("/university/exam-record") @RequiredArgsConstructor +@Tag(name = "UniversityExamRecord", description = "์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก๊ณผ ๊ด€๋ จ๋œ API") public class UniversityExamRecordController { private final UniversityExamRecordService universityExamRecordService; private final UniversityExamRecordSheetService universityExamRecordSheetService; + + @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF_ํ•ด์ œPDF", description = "์ฒจ์‚ญ pdf ๋ฐ ํ•ด์ œ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/{id}") public ResponseEntity> getUniversityExamRecord( @PathVariable("id") Long universityExamId, @AuthUser Member member) { @@ -41,6 +46,7 @@ public ResponseEntity> getUniversit universityExamRecordService.getUniversityExamRecord(universityExamId, member))); } + @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF ์ €์žฅ", description = "์ฒจ์‚ญ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/result/{id}") public ResponseEntity> getUniversityExamRecordResult( @PathVariable("id") Long universityExamId, @AuthUser Member member) { @@ -48,6 +54,7 @@ public ResponseEntity> getUni universityExamRecordService.getUniversityExamRecordResult(universityExamId, member))); } + @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: [1] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ์กฐํšŒ API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ PresignedUrl๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/sheet/presigned") public ResponseEntity> getUniversityExamSheetPreSignedUrl() { PreSignedUrlVO universityExamRecordSheetPreSignedUrlVO = universityExamRecordSheetService.getUniversityExamRecordSheetPreSignedUrl(); @@ -57,6 +64,7 @@ public ResponseEntity> g universityExamRecordSheetPreSignedUrlVO.getUrl()))); } + @Operation(summary = "์‹œํ—˜๋ณด๊ธฐ: [3] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ํ›„ ์‹œํ—˜ ๊ธฐ๋ก API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ ํ›„ ์„œ๋ฒ„์— ๊ธฐ๋กํ•˜๊ธฐ ์œ„ํ•ด ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.") @PostMapping("/sheet") public ResponseEntity> createUniversityExamRecord( @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, From a23380f6498cd9c004eb55edd9285b0fcdbd5046 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 15:23:46 +0900 Subject: [PATCH 320/465] =?UTF-8?q?[FEAT]=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20?= =?UTF-8?q?security=20schema=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../swagger/config/SwaggerConfig.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java index d595fa1..7605ef1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java @@ -1,13 +1,35 @@ package com.nonsoolmate.nonsoolmateServer.external.swagger.config; import io.swagger.v3.oas.annotations.OpenAPIDefinition; +import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn; +import io.swagger.v3.oas.annotations.enums.SecuritySchemeType; import io.swagger.v3.oas.annotations.info.Info; +import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.security.SecurityScheme; +import io.swagger.v3.oas.annotations.security.SecuritySchemes; import org.springframework.context.annotation.Configuration; @OpenAPIDefinition( info = @Info(title = "NONSOOLMATE", description = "NONSOOLMATE SERVER API Documentation", - version = "v1")) + version = "v1"), + security = { + @SecurityRequirement(name = "Authorization"), + @SecurityRequirement(name = "Authorization-refresh") + }) +@SecuritySchemes({ + @SecurityScheme(name = "Authorization", + type = SecuritySchemeType.HTTP, + description = "access token", + in = SecuritySchemeIn.HEADER, + paramName = "Authorization"), + @SecurityScheme(name = "Authorization-refresh", + type = SecuritySchemeType.APIKEY, + description = "refresh token", + in = SecuritySchemeIn.HEADER, + paramName = "Authorization-refresh"), +}) @Configuration public class SwaggerConfig { + } From 176a6e350cd7e7cade3b7e22ec806a69d50a32ae Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:24:21 +0900 Subject: [PATCH 321/465] =?UTF-8?q?[REFACTOR]=20AuthController=20=EC=8A=A4?= =?UTF-8?q?=EC=9B=A8=EA=B1=B0=20=EC=9D=B8=ED=84=B0=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthApi.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java new file mode 100644 index 0000000..78059db --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java @@ -0,0 +1,37 @@ +package com.nonsoolmate.nonsoolmateServer.domain.auth.controller; + +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberReissueResponseDTO; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.http.ResponseEntity; + + +@Tag(name = "auth", description = "์ธ์ฆ ๊ด€๋ จ API") +public interface AuthApi { + + @ApiResponses( + value = { + @ApiResponse(responseCode = "200"), + @ApiResponse(responseCode = "404", content = @Content) + } + ) + + @Operation(summary = "์†Œ์…œ ๋กœ๊ทธ์ธ", description = "๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> login( + @Parameter(description = "์ธ๊ฐ€ ์ฝ”๋“œ", required = true) final String authorizationCode, + @Parameter(description = "ํ”Œ๋žซํผ ํƒ€์ž…(ex.'NAVER')", required = true) final MemberRequestDTO request, + HttpServletResponse response); + + @Operation(summary = "์•ก์„ธ์Šค ํ† ํฐ & ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰", description = "์•ก์„ธ์Šค ํ† ํฐ ๋ฐ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ ๋ฐ›์Šต๋‹ˆ๋‹ค.") + ResponseEntity> reissue( + HttpServletRequest request, + HttpServletResponse response); +} From 0d69a3ab568859558f3ec1395fe3b807ab97cf69 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:24:53 +0900 Subject: [PATCH 322/465] =?UTF-8?q?[REFACTOR]=20MyController=20=EC=8A=A4?= =?UTF-8?q?=EC=9B=A8=EA=B1=B0=20=EC=9D=B8=ED=84=B0=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MemberApi.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java new file mode 100644 index 0000000..b2ce0f9 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java @@ -0,0 +1,29 @@ +package com.nonsoolmate.nonsoolmateServer.domain.member.controller; + +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; + +@Tag(name = "my", description = "๋ฉค๋ฒ„์™€ ๊ด€๋ จ๋œ API") +public interface MemberApi { + @ApiResponses( + value = { + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) + } + ) + + @Operation(summary = "๋งˆ์ดํŽ˜์ด์ง€: ์ด๋ฆ„", description = "๋‚ด ์ด๋ฆ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> getName( + Member member); + + @Operation(summary = "๋‚ด ์ •๋ณด ํ™•์ธ: ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", description = "๋‚ด ์ฒจ์‚ญ๊ถŒ ๊ฐฏ์ˆ˜๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> getTicket(Member member); + +} From 905f1b8628f254e0d823b377a887b8faface1c51 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:25:13 +0900 Subject: [PATCH 323/465] =?UTF-8?q?[REFACTOR]=20SelectUniversityController?= =?UTF-8?q?=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=9D=B8=ED=84=B0=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SelectUniversityApi.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java new file mode 100644 index 0000000..c271382 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java @@ -0,0 +1,41 @@ +package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.request.SelectUniversityRequestDTO; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamsResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityUpdateResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import java.util.List; +import org.springframework.http.ResponseEntity; + + +@Tag(name = "SelectUniversity", description = "๋ชฉํ‘œ ๋Œ€ํ•™๊ณผ ๊ด€๋ จ๋œ API") +public interface SelectUniversityApi { + + @ApiResponses( + value = { + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) + } + ) + + @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity>> getSelectUniversities( + @AuthUser Member member); + + @Operation(summary = "๋งˆ์ด ํŽ˜์ด์ง€: ๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค์˜ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity>> getSelectUniversityExams( + @AuthUser Member member); + + @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์„ ํƒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธ(์ˆ˜์ •) ํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> patchSelectUniversities( + @AuthUser Member member, + @Parameter(description = "์„ ํƒ ๋Œ€ํ•™๊ต Id", required = true) List request); +} From ce3d24908951531e6737482539f95dc18dde8358 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:25:33 +0900 Subject: [PATCH 324/465] =?UTF-8?q?[REFACTOR]=20UniversityExamController?= =?UTF-8?q?=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=9D=B8=ED=84=B0=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/controller/UniversityApi.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java new file mode 100644 index 0000000..c3c363b --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java @@ -0,0 +1,36 @@ +package com.nonsoolmate.nonsoolmateServer.domain.university.controller; + +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamInfoResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestParam; + + +@Tag(name = "UniversityExam", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ •๋ณด์™€ ๊ด€๋ จ๋œ API") +public interface UniversityApi { + + @ApiResponses( + value = { + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) + } + ) + + @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ์‹œํ—˜ ์ด๋ฆ„ & ์ œํ•œ ์‹œ๊ฐ„", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ์ด๋ฆ„ ๋ฐ ์ œํ•œ ์‹œ๊ฐ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> getUniversityExam( + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) Long universityExamId); + + @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ๋ฌธ์ œ์ง€ [ํŽ˜์ด์ง€๋„ค์ด์…˜]", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ๋ฌธ์ œ์ง€๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity>> getUniversityExamImages( + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) Long id, + @RequestParam(defaultValue = "0") int page, + Pageable pageable); +} From 0990048954c881f01b367588cfc9fb19d3e251f5 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:25:46 +0900 Subject: [PATCH 325/465] =?UTF-8?q?[REFACTOR]=20UniversityExamRecordContro?= =?UTF-8?q?ller=20=EC=8A=A4=EC=9B=A8=EA=B1=B0=20=EC=9D=B8=ED=84=B0?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamRecordApi.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java new file mode 100644 index 0000000..ca592c3 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java @@ -0,0 +1,46 @@ +package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller; + +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.request.CreateUniversityExamRequestDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordIdResponse; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResultResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamSheetPreSignedUrlResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; + + +@Tag(name = "UniversityExamRecord", description = "์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก๊ณผ ๊ด€๋ จ๋œ API") +public interface UniversityExamRecordApi { + + @ApiResponses( + value = { + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) + } + ) + + @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF_ํ•ด์ œPDF", description = "์ฒจ์‚ญ pdf ๋ฐ ํ•ด์ œ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> getUniversityExamRecord( + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) Long universityExamId, + @AuthUser Member member); + + @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF ์ €์žฅ", description = "์ฒจ์‚ญ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> getUniversityExamRecordResult( + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) Long universityExamId, + @AuthUser Member member); + + @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: [1] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ์กฐํšŒ API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ PresignedUrl๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> getUniversityExamSheetPreSignedUrl(); + + @Operation(summary = "์‹œํ—˜๋ณด๊ธฐ: [3] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ํ›„ ์‹œํ—˜ ๊ธฐ๋ก API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ ํ›„ ์„œ๋ฒ„์— ๊ธฐ๋กํ•˜๊ธฐ ์œ„ํ•ด ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> createUniversityExamRecord( + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId), ์‹œํ—˜ ์‘์‹œ ์†Œ์š” ์‹œ๊ฐ„, ๋‹ต์•ˆ์ง€(์‘์‹œ ๊ธฐ๋ก) ํŒŒ์ผ ์ด๋ฆ„", required = true) CreateUniversityExamRequestDTO createUniversityExamRequestDTO, + @AuthUser Member member); +} From 3c10705d1309e87d264842263a52d02490c7bb33 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:26:08 +0900 Subject: [PATCH 326/465] =?UTF-8?q?[DEL]=20AuthController=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=EC=97=86=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index f48734f..32d86b2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -30,8 +30,7 @@ @RequiredArgsConstructor @RequestMapping("/auth") @Slf4j -@Tag(name = "auth", description = "์ธ์ฆ ๊ด€๋ จ API") -public class AuthController { +public class AuthController implements AuthApi{ private final AuthServiceProvider authServiceProvider; private final JwtService jwtService; @@ -40,7 +39,6 @@ public class AuthController { @Value("${spring.security.oauth2.client.naver.redirect-uri}") private String redirectUri; - @Operation(summary = "์†Œ์…œ ๋กœ๊ทธ์ธ", description = "๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค.") @PostMapping("/social/login") public ResponseEntity> login( @RequestHeader(value = "authorization-code") final String authorizationCode, @@ -56,7 +54,6 @@ public ResponseEntity> login( return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.LOGIN_SUCCESS, responseDTO)); } - @Operation(summary = "์•ก์„ธ์Šค ํ† ํฐ & ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰", description = "์•ก์„ธ์Šค ํ† ํฐ ๋ฐ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ ๋ฐ›์Šต๋‹ˆ๋‹ค.") @PostMapping("/reissue") public ResponseEntity> reissue(HttpServletRequest request, HttpServletResponse response) { From a2803c1a18caae52ca838cfd94f53aebe48c0dc4 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:26:16 +0900 Subject: [PATCH 327/465] =?UTF-8?q?[DEL]=20MyController=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=EC=97=86=EB=8A=94=20=EC=BD=94=EB=93=9C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 17d29ea..6a66b15 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -18,11 +18,9 @@ @RestController @RequestMapping("/my") @RequiredArgsConstructor -@Tag(name = "my", description = "๋ฉค๋ฒ„์™€ ๊ด€๋ จ๋œ API") -public class MyController { +public class MyController implements MemberApi{ private final MemberService memberService; - @Operation(summary = "๋งˆ์ดํŽ˜์ด์ง€: ์ด๋ฆ„", description = "๋‚ด ์ด๋ฆ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/name") public ResponseEntity> getName(@AuthUser Member member) { return ResponseEntity.ok() @@ -30,7 +28,6 @@ public ResponseEntity> getName(@AuthUser Member mem memberService.getNickname(member))); } - @Operation(summary = "๋‚ด ์ •๋ณด ํ™•์ธ: ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", description = "๋‚ด ์ฒจ์‚ญ๊ถŒ ๊ฐฏ์ˆ˜๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/ticket") public ResponseEntity> getTicket(@AuthUser Member member) { return ResponseEntity.ok() From 5a168fe8958f257a7166e2a28148e493fc363de5 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:26:24 +0900 Subject: [PATCH 328/465] =?UTF-8?q?[DEL]=20SelectUniversityController=20?= =?UTF-8?q?=ED=95=84=EC=9A=94=EC=97=86=EB=8A=94=20=EC=BD=94=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 --- .../controller/SelectUniversityController.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java index be0a87f..2effcc3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java @@ -27,12 +27,10 @@ @RestController @RequiredArgsConstructor @RequestMapping("/select-university") -@Tag(name = "SelectUniversity", description = "๋ชฉํ‘œ ๋Œ€ํ•™๊ณผ ๊ด€๋ จ๋œ API") -public class SelectUniversityController { +public class SelectUniversityController implements SelectUniversityApi { private final SelectUniversityService selectUniversityService; - @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping public ResponseEntity>> getSelectUniversities( @AuthUser Member member) { @@ -41,7 +39,6 @@ public ResponseEntity>> getSelectU selectUniversityService.getSelectUniversities(member))); } - @Operation(summary = "๋งˆ์ด ํŽ˜์ด์ง€: ๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค์˜ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/exam") public ResponseEntity>> getSelectUniversityExams( @AuthUser Member member) { @@ -49,7 +46,6 @@ public ResponseEntity>> getSe selectUniversityService.getSelectUniversityExams(member))); } - @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์„ ํƒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธ(์ˆ˜์ •) ํ•ฉ๋‹ˆ๋‹ค.") @PatchMapping public ResponseEntity> patchSelectUniversities( @AuthUser Member member, From 4fdd17e16235e9d0a0ae2d9410c0d670ff9e0b55 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:26:46 +0900 Subject: [PATCH 329/465] =?UTF-8?q?[DEL]=20UniversityExamController=20?= =?UTF-8?q?=ED=95=84=EC=9A=94=EC=97=86=EB=8A=94=20=EC=BD=94=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 --- .../university/controller/UniversityExamController.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index 5c5aef5..3a81c2e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -24,11 +24,9 @@ @RestController @RequestMapping("/university/exam") @RequiredArgsConstructor -@Tag(name = "UniversityExam", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ •๋ณด์™€ ๊ด€๋ จ๋œ API") -public class UniversityExamController { +public class UniversityExamController implements UniversityApi{ private final UniversityExamService universityExamService; - @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ์‹œํ—˜ ์ด๋ฆ„ & ์ œํ•œ ์‹œ๊ฐ„", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ์ด๋ฆ„ ๋ฐ ์ œํ•œ ์‹œ๊ฐ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/{id}/info") public ResponseEntity> getUniversityExam( @PathVariable("id") Long universityExamId) { @@ -36,7 +34,6 @@ public ResponseEntity> getUniversityE universityExamService.getUniversityExam(universityExamId))); } - @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ๋ฌธ์ œ์ง€ [ํŽ˜์ด์ง€๋„ค์ด์…˜]", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ๋ฌธ์ œ์ง€๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("{id}/image") public ResponseEntity>> getUniversityExamImages( @PathVariable("id") Long id, @RequestParam(defaultValue = "0") int page, Pageable pageable) { @@ -46,7 +43,6 @@ public ResponseEntity>> getUniv .body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_SUCCESS, images)); } - @Operation(summary = "ํ•ด์ œ: ๋ฌธ์ œ์ด๋ฏธ์ง€_ํ•ด์ œPDF", description = "๋ฌธ์ œ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("{id}/answer") public ResponseEntity> getUniversityExamImageAndAnswer( @PathVariable("id") Long universityExamId From f45d8e8114e53cfac5c7fb3b8d33dc500e2c74b8 Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:26:54 +0900 Subject: [PATCH 330/465] =?UTF-8?q?[DEL]=20UniversityExamRecordController?= =?UTF-8?q?=20=ED=95=84=EC=9A=94=EC=97=86=EB=8A=94=20=EC=BD=94=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 --- .../controller/UniversityExamRecordController.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index 3aa5698..bc73e05 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -31,14 +31,12 @@ @RestController @RequestMapping("/university/exam-record") @RequiredArgsConstructor -@Tag(name = "UniversityExamRecord", description = "์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก๊ณผ ๊ด€๋ จ๋œ API") -public class UniversityExamRecordController { +public class UniversityExamRecordController implements UniversityExamRecordApi { private final UniversityExamRecordService universityExamRecordService; private final UniversityExamRecordSheetService universityExamRecordSheetService; - @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF_ํ•ด์ œPDF", description = "์ฒจ์‚ญ pdf ๋ฐ ํ•ด์ œ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/{id}") public ResponseEntity> getUniversityExamRecord( @PathVariable("id") Long universityExamId, @AuthUser Member member) { @@ -46,7 +44,6 @@ public ResponseEntity> getUniversit universityExamRecordService.getUniversityExamRecord(universityExamId, member))); } - @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF ์ €์žฅ", description = "์ฒจ์‚ญ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/result/{id}") public ResponseEntity> getUniversityExamRecordResult( @PathVariable("id") Long universityExamId, @AuthUser Member member) { @@ -54,7 +51,6 @@ public ResponseEntity> getUni universityExamRecordService.getUniversityExamRecordResult(universityExamId, member))); } - @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: [1] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ์กฐํšŒ API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ PresignedUrl๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @GetMapping("/sheet/presigned") public ResponseEntity> getUniversityExamSheetPreSignedUrl() { PreSignedUrlVO universityExamRecordSheetPreSignedUrlVO = universityExamRecordSheetService.getUniversityExamRecordSheetPreSignedUrl(); @@ -64,7 +60,6 @@ public ResponseEntity> g universityExamRecordSheetPreSignedUrlVO.getUrl()))); } - @Operation(summary = "์‹œํ—˜๋ณด๊ธฐ: [3] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ํ›„ ์‹œํ—˜ ๊ธฐ๋ก API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ ํ›„ ์„œ๋ฒ„์— ๊ธฐ๋กํ•˜๊ธฐ ์œ„ํ•ด ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.") @PostMapping("/sheet") public ResponseEntity> createUniversityExamRecord( @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, From 3292136def99f611c6f7d4f64811da9454aaad6e Mon Sep 17 00:00:00 2001 From: mikekks Date: Mon, 15 Jan 2024 21:27:05 +0900 Subject: [PATCH 331/465] =?UTF-8?q?[FIX]=20type=20=EC=98=A4=EB=A5=98=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 --- .../external/swagger/config/SwaggerConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java index 7605ef1..508bda6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java @@ -19,7 +19,7 @@ }) @SecuritySchemes({ @SecurityScheme(name = "Authorization", - type = SecuritySchemeType.HTTP, + type = SecuritySchemeType.APIKEY, description = "access token", in = SecuritySchemeIn.HEADER, paramName = "Authorization"), From 9b2d446a43cbfb848e510ef0cca2302912dde765 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 15 Jan 2024 23:09:23 +0900 Subject: [PATCH 332/465] =?UTF-8?q?[FIX]=20selectUniversity=20swagger=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=EC=97=90=EC=84=9C=20=EC=98=A4=EB=B2=84?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=93=9C=20=EB=B0=8F=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=9D=B8=EC=9E=90=20=EC=95=9E=20=EC=96=B4=EB=85=B8?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectUniversity/controller/SelectUniversityApi.java | 5 ++++- .../controller/SelectUniversityController.java | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java index c271382..887243a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java @@ -13,7 +13,10 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.List; + +import jakarta.validation.Valid; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; @Tag(name = "SelectUniversity", description = "๋ชฉํ‘œ ๋Œ€ํ•™๊ณผ ๊ด€๋ จ๋œ API") @@ -37,5 +40,5 @@ ResponseEntity>> getSelectUni @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์„ ํƒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธ(์ˆ˜์ •) ํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> patchSelectUniversities( @AuthUser Member member, - @Parameter(description = "์„ ํƒ ๋Œ€ํ•™๊ต Id", required = true) List request); + @Parameter(description = "์„ ํƒ ๋Œ€ํ•™๊ต Id", required = true) @RequestBody @Valid List request); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java index 2effcc3..599aa3a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java @@ -31,6 +31,7 @@ public class SelectUniversityController implements SelectUniversityApi { private final SelectUniversityService selectUniversityService; + @Override @GetMapping public ResponseEntity>> getSelectUniversities( @AuthUser Member member) { @@ -39,6 +40,7 @@ public ResponseEntity>> getSelectU selectUniversityService.getSelectUniversities(member))); } + @Override @GetMapping("/exam") public ResponseEntity>> getSelectUniversityExams( @AuthUser Member member) { @@ -46,6 +48,7 @@ public ResponseEntity>> getSe selectUniversityService.getSelectUniversityExams(member))); } + @Override @PatchMapping public ResponseEntity> patchSelectUniversities( @AuthUser Member member, From 2836d34e30d3adc14b9c55704d2f75a72aa84b43 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 15 Jan 2024 23:12:40 +0900 Subject: [PATCH 333/465] =?UTF-8?q?[FIX]=20auth=20swagger=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=EC=97=90=EC=84=9C=20=EC=98=A4=EB=B2=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=93=9C=20=EB=B0=8F=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EC=9D=B8=EC=9E=90=20=EC=95=9E=20=EC=96=B4=EB=85=B8=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/auth/controller/AuthApi.java | 7 +++++-- .../domain/auth/controller/AuthController.java | 2 ++ .../selectUniversity/controller/SelectUniversityApi.java | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java index 78059db..6675956 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java @@ -11,7 +11,10 @@ import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; @Tag(name = "auth", description = "์ธ์ฆ ๊ด€๋ จ API") @@ -26,8 +29,8 @@ public interface AuthApi { @Operation(summary = "์†Œ์…œ ๋กœ๊ทธ์ธ", description = "๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> login( - @Parameter(description = "์ธ๊ฐ€ ์ฝ”๋“œ", required = true) final String authorizationCode, - @Parameter(description = "ํ”Œ๋žซํผ ํƒ€์ž…(ex.'NAVER')", required = true) final MemberRequestDTO request, + @Parameter(description = "์ธ๊ฐ€ ์ฝ”๋“œ", required = true) @RequestHeader(value = "authorization-code") final String authorizationCode, + @Parameter(description = "ํ”Œ๋žซํผ ํƒ€์ž…(ex.'NAVER')", required = true) @RequestBody @Valid final MemberRequestDTO request, HttpServletResponse response); @Operation(summary = "์•ก์„ธ์Šค ํ† ํฐ & ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰", description = "์•ก์„ธ์Šค ํ† ํฐ ๋ฐ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ ๋ฐ›์Šต๋‹ˆ๋‹ค.") diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 32d86b2..945919c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -39,6 +39,7 @@ public class AuthController implements AuthApi{ @Value("${spring.security.oauth2.client.naver.redirect-uri}") private String redirectUri; + @Override @PostMapping("/social/login") public ResponseEntity> login( @RequestHeader(value = "authorization-code") final String authorizationCode, @@ -54,6 +55,7 @@ public ResponseEntity> login( return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.LOGIN_SUCCESS, responseDTO)); } + @Override @PostMapping("/reissue") public ResponseEntity> reissue(HttpServletRequest request, HttpServletResponse response) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java index 887243a..ba071c4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java @@ -22,6 +22,7 @@ @Tag(name = "SelectUniversity", description = "๋ชฉํ‘œ ๋Œ€ํ•™๊ณผ ๊ด€๋ จ๋œ API") public interface SelectUniversityApi { + @ApiResponses( value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), From 391e967be0b4e0e6583d8043d83af1166ede2eba Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 15 Jan 2024 23:14:34 +0900 Subject: [PATCH 334/465] =?UTF-8?q?[FIX]=20member=20swagger=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9=EC=97=90=EC=84=9C=20=EC=98=A4=EB=B2=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=93=9C=20=EB=B0=8F=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EC=9D=B8=EC=9E=90=20=EC=95=9E=20=EC=96=B4=EB=85=B8=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MemberApi.java | 5 +++-- .../domain/member/controller/MyController.java | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java index b2ce0f9..d19268e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java @@ -4,6 +4,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.responses.ApiResponses; @@ -21,9 +22,9 @@ public interface MemberApi { @Operation(summary = "๋งˆ์ดํŽ˜์ด์ง€: ์ด๋ฆ„", description = "๋‚ด ์ด๋ฆ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getName( - Member member); + @AuthUser Member member); @Operation(summary = "๋‚ด ์ •๋ณด ํ™•์ธ: ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", description = "๋‚ด ์ฒจ์‚ญ๊ถŒ ๊ฐฏ์ˆ˜๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> getTicket(Member member); + ResponseEntity> getTicket(@AuthUser Member member); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 6a66b15..9fbe0ac 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -21,6 +21,7 @@ public class MyController implements MemberApi{ private final MemberService memberService; + @Override @GetMapping("/name") public ResponseEntity> getName(@AuthUser Member member) { return ResponseEntity.ok() @@ -28,6 +29,7 @@ public ResponseEntity> getName(@AuthUser Member mem memberService.getNickname(member))); } + @Override @GetMapping("/ticket") public ResponseEntity> getTicket(@AuthUser Member member) { return ResponseEntity.ok() From 3b5dd4ffcd0251647a3048053b00807ec2ca23e3 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 15 Jan 2024 23:18:21 +0900 Subject: [PATCH 335/465] =?UTF-8?q?[FIX]=20=ED=95=9C=EA=B8=80=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/auth/controller/AuthController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 945919c..5980a20 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -42,7 +42,7 @@ public class AuthController implements AuthApi{ @Override @PostMapping("/social/login") public ResponseEntity> login( - @RequestHeader(value = "authorization-code") final String authorizationCode, + final String authorizationCode, @RequestBody @Valid final MemberRequestDTO request, HttpServletResponse response) { MemberSignUpVO vo = authServiceProvider.getAuthService(request.platformType()) From 3cc6bc2a5b6d7dbedeccc2108dc0a86983d4e6cd Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 15 Jan 2024 23:19:06 +0900 Subject: [PATCH 336/465] =?UTF-8?q?[FIX]=20UniversityExam=20swagger=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=EC=97=90=EC=84=9C=20=EC=98=A4=EB=B2=84?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=93=9C=20=EB=B0=8F=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=9D=B8=EC=9E=90=20=EC=95=9E=20=EC=96=B4=EB=85=B8?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/controller/UniversityApi.java | 10 ++++++++-- .../controller/UniversityExamController.java | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java index c3c363b..438748a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java @@ -1,5 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.controller; +import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageAndAnswerResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamInfoResponseDTO; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; @@ -11,6 +12,7 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; @@ -26,11 +28,15 @@ public interface UniversityApi { @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ์‹œํ—˜ ์ด๋ฆ„ & ์ œํ•œ ์‹œ๊ฐ„", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ์ด๋ฆ„ ๋ฐ ์ œํ•œ ์‹œ๊ฐ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getUniversityExam( - @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) Long universityExamId); + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId); @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ๋ฌธ์ œ์ง€ [ํŽ˜์ด์ง€๋„ค์ด์…˜]", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ๋ฌธ์ œ์ง€๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity>> getUniversityExamImages( - @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) Long id, + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long id, @RequestParam(defaultValue = "0") int page, Pageable pageable); + + @Operation(summary= "ํ•ด์ œ: ๋ฌธ์ œ์ด๋ฏธ์ง€_ํ•ด์ œPDF", description = "์‹œํ—˜ ๋ฌธ์ œ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ PDF๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") + ResponseEntity> getUniversityExamImageAndAnswer( + @PathVariable("id") Long universityExamId); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index 3a81c2e..b361dd3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -27,6 +27,7 @@ public class UniversityExamController implements UniversityApi{ private final UniversityExamService universityExamService; + @Override @GetMapping("/{id}/info") public ResponseEntity> getUniversityExam( @PathVariable("id") Long universityExamId) { @@ -34,6 +35,7 @@ public ResponseEntity> getUniversityE universityExamService.getUniversityExam(universityExamId))); } + @Override @GetMapping("{id}/image") public ResponseEntity>> getUniversityExamImages( @PathVariable("id") Long id, @RequestParam(defaultValue = "0") int page, Pageable pageable) { @@ -43,6 +45,7 @@ public ResponseEntity>> getUniv .body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_SUCCESS, images)); } + @Override @GetMapping("{id}/answer") public ResponseEntity> getUniversityExamImageAndAnswer( @PathVariable("id") Long universityExamId From 52150961a1e044b7e525d3317cb4af6e2090be5a Mon Sep 17 00:00:00 2001 From: sung-silver Date: Mon, 15 Jan 2024 23:22:20 +0900 Subject: [PATCH 337/465] =?UTF-8?q?[FIX]=20UniversityExamRecord=20swagger?= =?UTF-8?q?=20=EC=A0=81=EC=9A=A9=EC=97=90=EC=84=9C=20=EC=98=A4=EB=B2=84?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=93=9C=20=EB=B0=8F=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=9D=B8=EC=9E=90=20=EC=95=9E=20=EC=96=B4=EB=85=B8?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UniversityExamRecordApi.java | 9 ++++++--- .../controller/UniversityExamRecordController.java | 5 ++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java index ca592c3..9a58bbd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java @@ -13,7 +13,10 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; @Tag(name = "UniversityExamRecord", description = "์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก๊ณผ ๊ด€๋ จ๋œ API") @@ -28,12 +31,12 @@ public interface UniversityExamRecordApi { @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF_ํ•ด์ œPDF", description = "์ฒจ์‚ญ pdf ๋ฐ ํ•ด์ œ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getUniversityExamRecord( - @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) Long universityExamId, + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId, @AuthUser Member member); @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF ์ €์žฅ", description = "์ฒจ์‚ญ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getUniversityExamRecordResult( - @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) Long universityExamId, + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId, @AuthUser Member member); @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: [1] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ์กฐํšŒ API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ PresignedUrl๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") @@ -41,6 +44,6 @@ ResponseEntity> getUniversity @Operation(summary = "์‹œํ—˜๋ณด๊ธฐ: [3] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ํ›„ ์‹œํ—˜ ๊ธฐ๋ก API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ ํ›„ ์„œ๋ฒ„์— ๊ธฐ๋กํ•˜๊ธฐ ์œ„ํ•ด ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> createUniversityExamRecord( - @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId), ์‹œํ—˜ ์‘์‹œ ์†Œ์š” ์‹œ๊ฐ„, ๋‹ต์•ˆ์ง€(์‘์‹œ ๊ธฐ๋ก) ํŒŒ์ผ ์ด๋ฆ„", required = true) CreateUniversityExamRequestDTO createUniversityExamRequestDTO, + @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId), ์‹œํ—˜ ์‘์‹œ ์†Œ์š” ์‹œ๊ฐ„, ๋‹ต์•ˆ์ง€(์‘์‹œ ๊ธฐ๋ก) ํŒŒ์ผ ์ด๋ฆ„", required = true) @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, @AuthUser Member member); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index bc73e05..5356d47 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -36,7 +36,7 @@ public class UniversityExamRecordController implements UniversityExamRecordApi { private final UniversityExamRecordService universityExamRecordService; private final UniversityExamRecordSheetService universityExamRecordSheetService; - + @Override @GetMapping("/{id}") public ResponseEntity> getUniversityExamRecord( @PathVariable("id") Long universityExamId, @AuthUser Member member) { @@ -44,6 +44,7 @@ public ResponseEntity> getUniversit universityExamRecordService.getUniversityExamRecord(universityExamId, member))); } + @Override @GetMapping("/result/{id}") public ResponseEntity> getUniversityExamRecordResult( @PathVariable("id") Long universityExamId, @AuthUser Member member) { @@ -51,6 +52,7 @@ public ResponseEntity> getUni universityExamRecordService.getUniversityExamRecordResult(universityExamId, member))); } + @Override @GetMapping("/sheet/presigned") public ResponseEntity> getUniversityExamSheetPreSignedUrl() { PreSignedUrlVO universityExamRecordSheetPreSignedUrlVO = universityExamRecordSheetService.getUniversityExamRecordSheetPreSignedUrl(); @@ -60,6 +62,7 @@ public ResponseEntity> g universityExamRecordSheetPreSignedUrlVO.getUrl()))); } + @Override @PostMapping("/sheet") public ResponseEntity> createUniversityExamRecord( @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, From e1f4f00e9505dd7724563b321ef5dd3149108bdf Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 00:16:32 +0900 Subject: [PATCH 338/465] =?UTF-8?q?[FIX]=20=EC=B2=A8=EC=82=AD,=20=ED=95=B4?= =?UTF-8?q?=EC=A0=9C=20PDF=20=EC=A1=B0=ED=9A=8C=20API=EC=97=90=EC=84=9C=20?= =?UTF-8?q?PreSignedUrl=20=EC=9C=A0=ED=9A=A8=EC=8B=9C=EA=B0=84=EC=9D=84=20?= =?UTF-8?q?2=EB=B6=84=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 240f57a..e9175fd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -45,7 +45,7 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); + universityExamRecord.getExamRecordResultFileName(), 2); return UniversityExamRecordResponseDTO.of(universityExam.getUniversityExamFullName(), answerUrl, resultUrl); } From 5067a5637ca50c2100a2c4d8abe654c25fc4a81e Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 00:57:33 +0900 Subject: [PATCH 339/465] =?UTF-8?q?[REFACTOR]=20=EB=AA=A9=ED=91=9C?= =?UTF-8?q?=EB=8C=80=ED=95=99=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=EB=A1=9C=EC=A7=81=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 38f6ee0..d8a8ef4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -40,7 +40,7 @@ public List getSelectUniversities(Member member) { SelectUniversity curUniv = selectUniversityRepository.findByMemberAndUniversity(member, university) .orElse(null); - if(curUniv == null){ + if (curUniv == null) { status = false; } @@ -104,44 +104,50 @@ public SelectUniversityUpdateResponseDTO patchSelectUniversities( .toList(); List curUniversityIds = request.stream().map(req -> req.universityId()).toList(); - Map universityMap = new HashMap<>(); + deleteSelectUniversity(member, prevUniversityIds, curUniversityIds); + addSelectUniversity(member, prevUniversityIds, curUniversityIds); - curUniversityIds.stream().forEach(curUniversityId -> { - universityMap.put(curUniversityId, - universityRepository.findByUniversityIdOrElseThrowException(curUniversityId)); + return SelectUniversityUpdateResponseDTO.of(true); + } + + private void deleteSelectUniversity(Member member, List prevUniversityIds, List curUniversityIds) { + + prevUniversityIds.stream().forEach(prevUniversityId -> { + University foundUniversity = universityRepository.findByUniversityIdOrElseThrowException(prevUniversityId); boolean isPresent = false; - for (Long prevUniversityId : prevUniversityIds) { + for (Long curUniversityId : curUniversityIds) { if (prevUniversityId == curUniversityId) { isPresent = true; } } if (!isPresent) { - selectUniversityRepository.save(SelectUniversity - .builder() - .member(member) - .university(universityMap.get(curUniversityId)) - .build()); + selectUniversityRepository.deleteByMemberAndUniversity(member, foundUniversity); } }); + } - prevUniversityIds.stream().forEach(prevUniversityId -> { - universityMap.put(prevUniversityId, - universityRepository.findByUniversityIdOrElseThrowException(prevUniversityId)); + private void addSelectUniversity(Member member, List prevUniversityIds, List curUniversityIds) { + + curUniversityIds.stream().forEach(curUniversityId -> { + University foundUniversity = universityRepository.findByUniversityIdOrElseThrowException( + curUniversityId); boolean isPresent = false; - for (Long curUniversityId : curUniversityIds) { + for (Long prevUniversityId : prevUniversityIds) { if (prevUniversityId == curUniversityId) { isPresent = true; } } if (!isPresent) { - selectUniversityRepository.deleteByMemberAndUniversity(member, universityMap.get(prevUniversityId)); + selectUniversityRepository.save(SelectUniversity + .builder() + .member(member) + .university(foundUniversity) + .build()); } }); - - return SelectUniversityUpdateResponseDTO.of(true); } } From ff663952d09ed4484296b43c9ed838b041c2c2bb Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 02:02:49 +0900 Subject: [PATCH 340/465] =?UTF-8?q?[REFACTOR]=20for-if=EB=AC=B8=20->=20Map?= =?UTF-8?q?=20=EC=82=AC=EC=9A=A9=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20?= =?UTF-8?q?=EB=93=A4=EC=97=AC=EC=93=B0=EA=B8=B0=20=EC=B5=9C=EC=86=8C?= =?UTF-8?q?=ED=99=94=20=EB=B0=8F=20=EA=B0=80=EB=8F=85=EC=84=B1=20=EA=B3=A0?= =?UTF-8?q?=EB=A0=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/SelectUniversityService.java | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index d8a8ef4..180653b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -104,44 +104,37 @@ public SelectUniversityUpdateResponseDTO patchSelectUniversities( .toList(); List curUniversityIds = request.stream().map(req -> req.universityId()).toList(); - deleteSelectUniversity(member, prevUniversityIds, curUniversityIds); - addSelectUniversity(member, prevUniversityIds, curUniversityIds); + Map universityMap = addSelectUniversity(member, curUniversityIds); + deleteSelectUniversity(member, prevUniversityIds, universityMap); return SelectUniversityUpdateResponseDTO.of(true); } - private void deleteSelectUniversity(Member member, List prevUniversityIds, List curUniversityIds) { + private void deleteSelectUniversity(Member member, List prevUniversityIds, + Map universityMap) { - prevUniversityIds.stream().forEach(prevUniversityId -> { - University foundUniversity = universityRepository.findByUniversityIdOrElseThrowException(prevUniversityId); - - boolean isPresent = false; - for (Long curUniversityId : curUniversityIds) { - if (prevUniversityId == curUniversityId) { - isPresent = true; - } - } - - if (!isPresent) { - selectUniversityRepository.deleteByMemberAndUniversity(member, foundUniversity); - } - }); + prevUniversityIds.stream() + .filter(prevUniversityId -> !universityMap.containsKey(prevUniversityId)) + .forEach(prevUniversityId -> { + University foundUniversity = universityRepository.findByUniversityIdOrElseThrowException( + prevUniversityId); + selectUniversityRepository.deleteByMemberAndUniversity(member, foundUniversity); + }); } - private void addSelectUniversity(Member member, List prevUniversityIds, List curUniversityIds) { + private Map addSelectUniversity(Member member, List curUniversityIds) { + + Map universityMap = new HashMap<>(); curUniversityIds.stream().forEach(curUniversityId -> { University foundUniversity = universityRepository.findByUniversityIdOrElseThrowException( curUniversityId); + universityMap.put(curUniversityId, foundUniversity); - boolean isPresent = false; - for (Long prevUniversityId : prevUniversityIds) { - if (prevUniversityId == curUniversityId) { - isPresent = true; - } - } + SelectUniversity curSelectedUniversity = selectUniversityRepository.findByMemberAndUniversity(member, + foundUniversity).orElse(null); - if (!isPresent) { + if (curSelectedUniversity == null) { selectUniversityRepository.save(SelectUniversity .builder() .member(member) @@ -149,5 +142,7 @@ private void addSelectUniversity(Member member, List prevUniversityIds, Li .build()); } }); + + return universityMap; } } From 6fd8ef9422efd573905ff5c796c913e0c62ec66a Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 14:50:50 +0900 Subject: [PATCH 341/465] =?UTF-8?q?[FIX]=20@Transactional=20=EC=96=B4?= =?UTF-8?q?=EB=85=B8=ED=85=8C=EC=9D=B4=EC=85=98=20=EB=B6=99=EC=9D=B4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectUniversity/service/SelectUniversityService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 180653b..ff2876c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -20,9 +20,11 @@ import java.util.Map; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor +@Transactional(readOnly = true) public class SelectUniversityService { private final SelectUniversityRepository selectUniversityRepository; private final UniversityRepository universityRepository; @@ -95,6 +97,7 @@ private List getSelectUniversityExamResponseDTO return selectUniversityExamResponseDTOS; } + @Transactional public SelectUniversityUpdateResponseDTO patchSelectUniversities( Member member, List request) { From d4248394c9f1933c37942a449d55e5f1bb276ebf Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 16:00:10 +0900 Subject: [PATCH 342/465] =?UTF-8?q?[ADD]=20=EC=9D=B4=EB=AF=B8=20=EC=9D=91?= =?UTF-8?q?=EC=8B=9C=ED=95=9C=20=EB=8C=80=ED=95=99=20=EA=B8=B0=EB=A1=9D=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/UniversityExamRecordExceptionType.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java index 263754e..d45d346 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java @@ -8,7 +8,8 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum UniversityExamRecordExceptionType implements BusinessExceptionType { NOT_FOUND_UNIVERSITY_EXAM_RECORD(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก์ž…๋‹ˆ๋‹ค."), - CREATE_UNIVERSITY_EXAM_RECORD_FAIL(HttpStatus.BAD_REQUEST, "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก ์ƒ์„ฑ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค."); + CREATE_UNIVERSITY_EXAM_RECORD_FAIL(HttpStatus.BAD_REQUEST, "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก ์ƒ์„ฑ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค."), + ALREADY_CREATE_EXAM_RECORD(HttpStatus.BAD_REQUEST, "์ด๋ฏธ ์‘์‹œํ•œ ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค"); private final HttpStatus status; private final String message; From 74feabaa0f4aeaebf4dd4a604afc9275b6c6452c Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 16:04:49 +0900 Subject: [PATCH 343/465] =?UTF-8?q?[FEAT]=20UniversityExamRecordService=20?= =?UTF-8?q?=EB=8C=80=ED=95=99=20=EA=B8=B0=EB=A1=9D=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?API=EC=97=90=20=EC=97=90=EB=9F=AC=20=ED=95=B8=EB=93=A4=EB=A7=81?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index e9175fd..cfc805b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -1,9 +1,8 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service; import static com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM; -import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_ANSWER_FOLDER_NAME; -import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_RESULT_FOLDER_NAME; -import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_SHEET_FOLDER_NAME; +import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordExceptionType.*; +import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.*; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberException; @@ -18,7 +17,6 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.UniversityExamRecord; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.enums.ExamResultStatus; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordException; -import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; @@ -65,6 +63,7 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long public UniversityExamRecordIdResponse createUniversityExamRecord( CreateUniversityExamRequestDTO request, Member member) { UniversityExam universityExam = getUniversityExam(request.universityExamId()); + validateUniversityExam(universityExam, member); try { String fileName = s3Service.validateURL(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); UniversityExamRecord universityexamRecord = createUniversityExamRecord(universityExam, member, @@ -78,8 +77,14 @@ public UniversityExamRecordIdResponse createUniversityExamRecord( throw e; } catch (RuntimeException e) { s3Service.deleteFile(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); - throw new UniversityExamRecordException( - UniversityExamRecordExceptionType.CREATE_UNIVERSITY_EXAM_RECORD_FAIL); + throw new UniversityExamRecordException(CREATE_UNIVERSITY_EXAM_RECORD_FAIL); + } + } + + private void validateUniversityExam(UniversityExam universityExam, Member member){ + UniversityExamRecord existUniversityExamRecord = universityExamRecordRepository.findByUniversityExamAndMember(universityExam, member).orElse(null); + if (existUniversityExamRecord != null) { + throw new UniversityExamRecordException(ALREADY_CREATE_EXAM_RECORD); } } From 34adfdf55966ee4bcb59a23b2d2f6982373c2486 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 16:16:55 +0900 Subject: [PATCH 344/465] =?UTF-8?q?[ADD]=20UniversityExamRecordApi?= =?UTF-8?q?=EC=97=90=20=EC=97=90=EB=9F=AC=20=EC=BD=94=EB=93=9C=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 --- .../universityExamRecord/controller/UniversityExamRecordApi.java | 1 + 1 file changed, 1 insertion(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java index 9a58bbd..b753673 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java @@ -25,6 +25,7 @@ public interface UniversityExamRecordApi { @ApiResponses( value = { @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), + @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", content = @Content), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) } ) From 67c01dd1081fde84cf7fd471d42a2393b1acca84 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:33:24 +0900 Subject: [PATCH 345/465] =?UTF-8?q?[FEAT]=20=EC=98=AC=EB=B0=94=EB=A5=B4?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=86=8C=EC=85=9C=20=ED=94=8C?= =?UTF-8?q?=EB=9E=AB=ED=8F=BC=20=ED=83=80=EC=9E=85=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 5980a20..0ce3c9a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -3,14 +3,13 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberReissueResponseDTO; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthServiceProvider; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSuccessType; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; @@ -45,7 +44,9 @@ public ResponseEntity> login( final String authorizationCode, @RequestBody @Valid final MemberRequestDTO request, HttpServletResponse response) { - MemberSignUpVO vo = authServiceProvider.getAuthService(request.platformType()) + PlatformType platformType = PlatformType.of(request.platformType()); + + MemberSignUpVO vo = authServiceProvider.getAuthService(platformType) .saveMemberOrLogin(authorizationCode, request); MemberAuthResponseDTO responseDTO = jwtService.issueToken(vo, response); if (responseDTO.authType().equals(AuthType.SIGN_UP)) { From 1a969c545204bf11da6fea143a35704a5dfa51ca Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:33:42 +0900 Subject: [PATCH 346/465] =?UTF-8?q?[FEAT]=20=EC=98=AC=EB=B0=94=EB=A5=B4?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=86=8C=EC=85=9C=20=ED=94=8C?= =?UTF-8?q?=EB=9E=AB=ED=8F=BC=20=EC=9C=A0=ED=98=95=20=EC=97=90=EB=9F=AC=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/auth/exception/AuthExceptionType.java | 1 + 1 file changed, 1 insertion(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index 7743495..ce0fa12 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -13,6 +13,7 @@ public enum AuthExceptionType implements BusinessExceptionType { * 400 Bad Request */ INVALID_MEMBER_PLATFORM_AUTHORIZATION_CODE(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ํ”Œ๋žซํผ ์ธ๊ฐ€์ฝ”๋“œ์ž…๋‹ˆ๋‹ค."), + INVALID_PLATFORM_TYPE(HttpStatus.BAD_REQUEST, "์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์€ ํ”Œ๋žซํผ ์œ ํ˜•์ž…๋‹ˆ๋‹ค."), INVALID_ACCESS_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), From a72da6db14566051070bbf68112314ea7257489f Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:34:00 +0900 Subject: [PATCH 347/465] =?UTF-8?q?[ADD]=20of=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/auth/service/AuthService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index 6ad8ba0..4246da4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -25,7 +25,7 @@ protected Member getMember(PlatformType platformType, String email) { protected Member saveUser(MemberRequestDTO request, String email, String name, String birthday, String gender, String phoneNumber) { - Member newMember = createSocialMember(email, name, request.platformType(), birthday, gender, phoneNumber); + Member newMember = createSocialMember(email, name, PlatformType.of(request.platformType()), birthday, gender, phoneNumber); return memberRepository.saveAndFlush(newMember); } From baebed04ffda0d0af63bac2c9a66e7791b3b7b30 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:34:24 +0900 Subject: [PATCH 348/465] =?UTF-8?q?[ADD]=20UNSUPPORTED=5FMEDIA=5FTYPE=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 --- .../global/error/exception/CommonErrorType.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java index a50e8b7..87c3b40 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java @@ -20,6 +20,8 @@ public enum CommonErrorType implements BusinessExceptionType { // 400 Bad Request INVALID_INPUT_VALUE(HttpStatus.BAD_REQUEST, "์ž…๋ ฅ๊ฐ’์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค"), + // 415 UNSUPPORTED_MEDIA_TYPE + INVALID_JSON_TYPE(HttpStatus.UNSUPPORTED_MEDIA_TYPE, "์˜ฌ๋ฐ”๋ฅธ ์š”์ฒญ ํ˜•์‹์ด ์•„๋‹™๋‹ˆ๋‹ค") ; private final HttpStatus status; From 6d0402b714d478f44ac48cddc8718424f3f35b0c Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:34:47 +0900 Subject: [PATCH 349/465] =?UTF-8?q?[ADD]=20UNSUPPORTED=5FMEDIA=5FTYPE=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B8=EB=93=A4=EB=A7=81=EC=9D=84=20?= =?UTF-8?q?=EC=9C=84=ED=95=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/GlobalExceptionHandler.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index db64b4d..fa8c7c7 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -5,8 +5,10 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; +import org.springframework.web.HttpMediaTypeNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -54,4 +56,11 @@ public ResponseEntity> handleValidationError(MethodArgumentN return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(ApiResponse.error(CommonErrorType.INVALID_INPUT_VALUE, builder.toString())); } + + @ExceptionHandler(HttpMediaTypeNotSupportedException.class) + public ResponseEntity handleValidationExceptions(HttpMediaTypeNotSupportedException ex){ + HashMap infoMap = new HashMap<>(); + infoMap.put("info", "JSON ํ˜•์‹์œผ๋กœ ์š”์ฒญํ•ด์ฃผ์„ธ์š”"); + return ResponseEntity.status(HttpStatus.UNSUPPORTED_MEDIA_TYPE).body(ApiResponse.error(CommonErrorType.INVALID_JSON_TYPE, infoMap)); + } } From a7126e7964eecadd52046995e30d284f737e22da Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:35:09 +0900 Subject: [PATCH 350/465] =?UTF-8?q?[ADD]=20=EC=9E=85=EB=A0=A5=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=B2=98=EB=A6=AC=EB=A5=BC=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?String=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 --- .../auth/controller/dto/request/MemberRequestDTO.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java index cdb3941..7bb1f47 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java @@ -1,7 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request; -import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; + import jakarta.validation.constraints.NotNull; -public record MemberRequestDTO(@NotNull PlatformType platformType) { + +public record MemberRequestDTO( + @NotNull + String platformType) { + } \ No newline at end of file From c0c0de2e38a04cec722d1c8fcb8d91124ab3b183 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:35:27 +0900 Subject: [PATCH 351/465] =?UTF-8?q?[ADD]=20of=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80=EB=A1=9C=20=EC=9D=B8=ED=95=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 --- .../external/oauth/service/NaverAuthService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index c4fe7d7..b9c5d53 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -4,6 +4,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthService; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import com.nonsoolmate.nonsoolmateServer.domain.member.repository.MemberRepository; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; @@ -40,17 +41,17 @@ public NaverAuthService(MemberRepository memberRepository) { public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); - Member foundMember = getMember(request.platformType(), naverMemberInfo.getResponse().getEmail()); + Member foundMember = getMember(PlatformType.of(request.platformType()), naverMemberInfo.getResponse().getEmail()); if (foundMember != null) { - return MemberSignUpVO.of(foundMember, request.platformType(), AuthType.LOGIN); + return MemberSignUpVO.of(foundMember, PlatformType.of(request.platformType()), AuthType.LOGIN); } Member savedMember = saveUser(request, naverMemberInfo.getResponse().getEmail(), naverMemberInfo.getResponse().getName(), naverMemberInfo.getResponse().getBirthyear(), naverMemberInfo.getResponse().getGender(), naverMemberInfo.getResponse().getMobile()); - return MemberSignUpVO.of(savedMember, request.platformType(), AuthType.SIGN_UP); + return MemberSignUpVO.of(savedMember, PlatformType.of(request.platformType()), AuthType.SIGN_UP); } From a14a1eb762424a6cf4c32c5cc3c41df1828d5c47 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:35:48 +0900 Subject: [PATCH 352/465] =?UTF-8?q?[FEAT]=20=EC=98=88=EC=99=B8=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=EB=A5=BC=20=EC=9C=84=ED=95=9C=20of=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/entity/enums/PlatformType.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java index 1d30135..af5b5ad 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java @@ -1,5 +1,15 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums; +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_PLATFORM_TYPE; + +import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; +import java.util.Arrays; + public enum PlatformType { - NAVER, NONE + NAVER, NONE; + + public static PlatformType of(String platformType) { + return Arrays.stream(PlatformType.values()).filter(type -> type.equals(platformType)).findAny() + .orElseThrow(() -> new AuthException(INVALID_PLATFORM_TYPE)); + } } From 7d0590bf9b5c4c3ee3dde288a4b0806f873ba7b2 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:05:28 +0900 Subject: [PATCH 353/465] =?UTF-8?q?[FIX]=20=ED=94=8C=EB=9E=AB=ED=8F=BC=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EA=B2=80=EC=A6=9D=20=EC=98=A4=EB=A5=98=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 --- .../domain/member/entity/enums/PlatformType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java index af5b5ad..d121b06 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/enums/PlatformType.java @@ -9,7 +9,7 @@ public enum PlatformType { NAVER, NONE; public static PlatformType of(String platformType) { - return Arrays.stream(PlatformType.values()).filter(type -> type.equals(platformType)).findAny() + return Arrays.stream(PlatformType.values()).filter(type -> type.toString().equals(platformType)).findAny() .orElseThrow(() -> new AuthException(INVALID_PLATFORM_TYPE)); } } From f87709b53fa4488025e8ada3ff0553aae9045dab Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:45:51 +0900 Subject: [PATCH 354/465] =?UTF-8?q?[FIX]=20=EC=97=90=EB=9F=AC=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/exception/AuthExceptionType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index ce0fa12..2cf1296 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -14,8 +14,8 @@ public enum AuthExceptionType implements BusinessExceptionType { */ INVALID_MEMBER_PLATFORM_AUTHORIZATION_CODE(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ํ”Œ๋žซํผ ์ธ๊ฐ€์ฝ”๋“œ์ž…๋‹ˆ๋‹ค."), INVALID_PLATFORM_TYPE(HttpStatus.BAD_REQUEST, "์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์€ ํ”Œ๋žซํผ ์œ ํ˜•์ž…๋‹ˆ๋‹ค."), - INVALID_ACCESS_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), - INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + INVALID_ACCESS_TOKEN(HttpStatus.BAD_REQUEST, "์„œ๋น„์Šค์—์„œ ๋ฐœ๊ธ‰๋˜์ง€ ์•Š์€ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "์„œ๋น„์Šค์—์„œ ๋ฐœ๊ธ‰๋˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), /** * 401 Unauthorized From eb52e79101a77f6c1c6e4b73655a719eda87441b Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:55:39 +0900 Subject: [PATCH 355/465] =?UTF-8?q?[FIX]=20=EB=A9=A4=EB=B2=84=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=97=90=EB=9F=AC=20=EB=A9=94=EC=84=B8=EC=A7=80=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 --- .../domain/member/repository/MemberRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java index c0a03ed..e3d7221 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/repository/MemberRepository.java @@ -1,7 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.repository; -import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.NOT_FOUND_REFRESH_TOKEN; +import static com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberExceptionType.NOT_FOUND_MEMBER; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; @@ -18,6 +18,6 @@ public interface MemberRepository extends JpaRepository { default Member findByMemberIdOrElseThrowException(Long memberId){ return findByMemberId(memberId).orElseThrow( - () -> new AuthException(NOT_FOUND_REFRESH_TOKEN)); + () -> new AuthException(NOT_FOUND_MEMBER)); } } From 933aa5fdcf49c4104b06b02dfab743385deeec3d Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 17:55:54 +0900 Subject: [PATCH 356/465] =?UTF-8?q?[DEL]=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=97=90=EB=9F=AC=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/exception/AuthExceptionType.java | 1 - 1 file changed, 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index 2cf1296..669cc68 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -27,7 +27,6 @@ public enum AuthExceptionType implements BusinessExceptionType { * 404 Not Found */ - NOT_FOUND_MEMBER(HttpStatus.NOT_FOUND, "์œ ํšจํ•œ ๋ฉค๋ฒ„๋ฅผ ์ฐพ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค."), NOT_FOUND_REFRESH_TOKEN(HttpStatus.NOT_FOUND, "์œ ํšจํ•œ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์ฐพ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; From 209c74940e4ca0b428685c6d4cf4d59ddd282dcf Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 18:00:39 +0900 Subject: [PATCH 357/465] =?UTF-8?q?[FIX]=20=EC=84=9C=EB=B2=84=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EB=A9=94=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/exception/CommonErrorType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java index 87c3b40..a1a863d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java @@ -16,7 +16,7 @@ public enum CommonErrorType implements BusinessExceptionType { /** * 500 Internal Server Error */ - INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์•Œ ์ˆ˜ ์—†๋Š” ์„œ๋ฒ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"), + INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์„œ๋ฒ„ ๋‚ด๋ถ€ ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค."), // 400 Bad Request INVALID_INPUT_VALUE(HttpStatus.BAD_REQUEST, "์ž…๋ ฅ๊ฐ’์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค"), From eb09d68cb4ac710944d7c09d4765011b23c0827f Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 18:15:53 +0900 Subject: [PATCH 358/465] =?UTF-8?q?[DEL]=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=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 --- .../selectUniversity/service/SelectUniversityService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index ff2876c..eefff9f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -36,7 +36,7 @@ public class SelectUniversityService { public List getSelectUniversities(Member member) { List selectUniversityResponseDTOS = new ArrayList<>(); - universityRepository.findAllByOrderByUniversityNameAscUniversityCollegeAsc().stream().forEach(university -> { + universityRepository.findAllByOrderByUniversityNameAscUniversityCollegeAsc().forEach(university -> { boolean status = true; SelectUniversity curUniv = selectUniversityRepository.findByMemberAndUniversity(member, university) From 2b7f84f2840bc26ad9657bc5021829490a7400f5 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 18:35:08 +0900 Subject: [PATCH 359/465] =?UTF-8?q?[FIX]=20=EC=97=90=EB=9F=AC=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/error/AWSExceptionType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java index 6130228..aaa692b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java @@ -7,8 +7,8 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum AWSExceptionType implements BusinessExceptionType { - DELETE_FILE_AWS_S3_FAIL(HttpStatus.BAD_REQUEST, "S3 ํŒŒ์ผ ์‚ญ์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), - NOT_FOUND_FILE_AWS_S3(HttpStatus.NOT_FOUND, "S3์—์„œ ํŒŒ์ผ์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), + DELETE_FILE_AWS_S3_FAIL(HttpStatus.BAD_REQUEST, "์˜ฌ๋ฐ”๋ฅธ ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์ด ์•„๋‹™๋‹ˆ๋‹ค."), + NOT_FOUND_SHEET_FILE_AWS_S3(HttpStatus.NOT_FOUND, "์˜ฌ๋ฐ”๋ฅธ ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PresignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"); private final HttpStatus status; From 6520bc35f7f742905371533707aa5227234363ce Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 18:35:26 +0900 Subject: [PATCH 360/465] =?UTF-8?q?[FIX]=20=EC=88=98=EC=A0=95=EB=90=9C=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EB=A9=94=EC=84=B8=EC=A7=80=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 --- .../nonsoolmateServer/external/aws/service/S3Service.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index 22815d6..f9ebd4a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -67,11 +67,11 @@ public String validateURL(final String prefix, final String fileName) { HeadObjectResponse response = s3Client.headObject(request); if (response == null) { - throw new AWSException(AWSExceptionType.NOT_FOUND_FILE_AWS_S3); + throw new AWSException(AWSExceptionType.NOT_FOUND_SHEET_FILE_AWS_S3); } return fileName; } catch (S3Exception e) { - throw new AWSException(AWSExceptionType.NOT_FOUND_FILE_AWS_S3); + throw new AWSException(AWSExceptionType.NOT_FOUND_SHEET_FILE_AWS_S3); } } From e89e5540fce0920cb7ea50c0c966a76e91de4570 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:01:39 +0900 Subject: [PATCH 361/465] =?UTF-8?q?[FIX]=20=EC=97=90=EB=9F=AC=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/error/AWSExceptionType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java index aaa692b..1f4c965 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java @@ -7,8 +7,8 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum AWSExceptionType implements BusinessExceptionType { - DELETE_FILE_AWS_S3_FAIL(HttpStatus.BAD_REQUEST, "์˜ฌ๋ฐ”๋ฅธ ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์ด ์•„๋‹™๋‹ˆ๋‹ค."), - NOT_FOUND_SHEET_FILE_AWS_S3(HttpStatus.NOT_FOUND, "์˜ฌ๋ฐ”๋ฅธ ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), + DELETE_FILE_AWS_S3_FAIL(HttpStatus.BAD_REQUEST, "s3์— ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค."), + NOT_FOUND_SHEET_FILE_AWS_S3(HttpStatus.NOT_FOUND, "ํ•ด๋‹น ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PresignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"); private final HttpStatus status; From 909d9dcfc6bee21408566e025d188f0a6ce22511 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:01:45 +0900 Subject: [PATCH 362/465] =?UTF-8?q?[FIX]=20=EC=97=90=EB=9F=AC=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exception/UniversityExamRecordExceptionType.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java index d45d346..a1d0a52 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java @@ -9,6 +9,8 @@ public enum UniversityExamRecordExceptionType implements BusinessExceptionType { NOT_FOUND_UNIVERSITY_EXAM_RECORD(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก์ž…๋‹ˆ๋‹ค."), CREATE_UNIVERSITY_EXAM_RECORD_FAIL(HttpStatus.BAD_REQUEST, "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก ์ƒ์„ฑ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค."), + INVALID_UNIVERSITY_EXAM_RECORD_RESULT_FILE_NAME(HttpStatus.BAD_REQUEST, "์ฒจ์‚ญ์ด ์™„๋ฃŒ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค."), + ALREADY_CREATE_EXAM_RECORD(HttpStatus.BAD_REQUEST, "์ด๋ฏธ ์‘์‹œํ•œ ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค"); private final HttpStatus status; From 8040b91ca98a7bf0de35f7b81fb6eb88522057da Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:02:02 +0900 Subject: [PATCH 363/465] =?UTF-8?q?[FEAT]=20=EC=B2=A8=EC=82=AD=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C=EB=90=98=EC=A7=80=20=EC=95=8A=EC=9D=80=20=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EB=B6=84=EA=B8=B0=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index cfc805b..c3abb44 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -40,6 +40,10 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx UniversityExam universityExam = getUniversityExam(universityExamId); UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); + if(universityExamRecord.getExamRecordResultFileName() == null){ + throw new UniversityExamRecordException(INVALID_UNIVERSITY_EXAM_RECORD_RESULT_FILE_NAME); + } + String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, From 3a85df9aa2ee482e4ca6715df82e6010788700e1 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:27:10 +0900 Subject: [PATCH 364/465] =?UTF-8?q?[DEL]=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=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 --- .../nonsoolmateServer/domain/auth/controller/AuthApi.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java index 6675956..c049e84 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java @@ -30,11 +30,9 @@ public interface AuthApi { @Operation(summary = "์†Œ์…œ ๋กœ๊ทธ์ธ", description = "๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> login( @Parameter(description = "์ธ๊ฐ€ ์ฝ”๋“œ", required = true) @RequestHeader(value = "authorization-code") final String authorizationCode, - @Parameter(description = "ํ”Œ๋žซํผ ํƒ€์ž…(ex.'NAVER')", required = true) @RequestBody @Valid final MemberRequestDTO request, - HttpServletResponse response); + @Parameter(description = "ํ”Œ๋žซํผ ํƒ€์ž…(ex.'NAVER')", required = true) @RequestBody @Valid final MemberRequestDTO request); @Operation(summary = "์•ก์„ธ์Šค ํ† ํฐ & ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰", description = "์•ก์„ธ์Šค ํ† ํฐ ๋ฐ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ ๋ฐ›์Šต๋‹ˆ๋‹ค.") ResponseEntity> reissue( - HttpServletRequest request, - HttpServletResponse response); + HttpServletRequest request); } From 4ca4ed95927114e31772d3e8ae6990ca104ed982 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:27:19 +0900 Subject: [PATCH 365/465] =?UTF-8?q?[DEL]=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=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 --- .../domain/auth/controller/AuthController.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 0ce3c9a..9d306fc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -43,12 +43,12 @@ public class AuthController implements AuthApi{ public ResponseEntity> login( final String authorizationCode, @RequestBody @Valid final - MemberRequestDTO request, HttpServletResponse response) { + MemberRequestDTO request) { PlatformType platformType = PlatformType.of(request.platformType()); MemberSignUpVO vo = authServiceProvider.getAuthService(platformType) .saveMemberOrLogin(authorizationCode, request); - MemberAuthResponseDTO responseDTO = jwtService.issueToken(vo, response); + MemberAuthResponseDTO responseDTO = jwtService.issueToken(vo); if (responseDTO.authType().equals(AuthType.SIGN_UP)) { return ResponseEntity.status(HttpStatus.CREATED) .body(ApiResponse.success(AuthSuccessType.SIGN_UP_SUCCESS, responseDTO)); @@ -58,9 +58,8 @@ public ResponseEntity> login( @Override @PostMapping("/reissue") - public ResponseEntity> reissue(HttpServletRequest request, - HttpServletResponse response) { - MemberReissueResponseDTO memberReissueResponseDTO = jwtService.reissueToken(request, response); + public ResponseEntity> reissue(HttpServletRequest request) { + MemberReissueResponseDTO memberReissueResponseDTO = jwtService.reissueToken(request); return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.REISSUE_SUCCESS, memberReissueResponseDTO)); } From 8ef90ec7224c5305edcb3bae33064fe0f794b794 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:27:34 +0900 Subject: [PATCH 366/465] =?UTF-8?q?[ADD]=20=EC=98=88=EC=99=B8=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/exception/AuthExceptionType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index 669cc68..93d32a0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -22,13 +22,13 @@ public enum AuthExceptionType implements BusinessExceptionType { */ UNAUTHORIZED_MEMBER_LOGIN(HttpStatus.UNAUTHORIZED, "๋กœ๊ทธ์ธ์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค."), UNAUTHORIZED_ACCESS_TOKEN(HttpStatus.UNAUTHORIZED, "๊ธฐํ•œ์ด ๋งŒ๋ฃŒ๋œ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + UNAUTHORIZED_REFRESH_TOKEN(HttpStatus.UNAUTHORIZED, "๊ธฐํ•œ์ด ๋งŒ๋ฃŒ๋œ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค."); + /** * 404 Not Found */ - NOT_FOUND_REFRESH_TOKEN(HttpStatus.NOT_FOUND, "์œ ํšจํ•œ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์ฐพ์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค."); - private final HttpStatus status; private final String message; From 722a8ba31d5814353710f202dcf73da696339d9c Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:28:01 +0900 Subject: [PATCH 367/465] =?UTF-8?q?[DEL]=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=BD=94=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 --- .../nonsoolmateServer/global/jwt/service/JwtService.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 9d55bfe..00cb8cd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -3,7 +3,7 @@ import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_ACCESS_TOKEN; import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_REFRESH_TOKEN; -import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.UNAUTHORIZED_ACCESS_TOKEN; +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.UNAUTHORIZED_REFRESH_TOKEN; import com.fasterxml.jackson.core.JsonProcessingException; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; @@ -19,7 +19,6 @@ import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.MalformedJwtException; import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; import java.util.Date; import java.util.Optional; import lombok.Getter; @@ -58,7 +57,7 @@ public class JwtService { private final RedisTokenRepository redisTokenRepository; @Transactional - public MemberAuthResponseDTO issueToken(MemberSignUpVO vo, HttpServletResponse response) { + public MemberAuthResponseDTO issueToken(MemberSignUpVO vo) { String accessToken = jwtTokenProvider.createAccessToken(vo.email(), vo.memberId(), accessTokenExpirationPeriod); if (vo.role().equals(Role.USER)) { @@ -70,7 +69,7 @@ public MemberAuthResponseDTO issueToken(MemberSignUpVO vo, HttpServletResponse r throw new AuthException(AuthExceptionType.UNAUTHORIZED_MEMBER_LOGIN); } - public MemberReissueResponseDTO reissueToken(HttpServletRequest request, HttpServletResponse response) { + public MemberReissueResponseDTO reissueToken(HttpServletRequest request) { String refreshToken = extractRefreshToken(request); String accessToken = extractAccessToken(request); @@ -111,7 +110,7 @@ public Boolean validateToken(final String atk) { } catch (MalformedJwtException e) { throw new AuthException(INVALID_ACCESS_TOKEN); } catch (ExpiredJwtException e){ - throw new AuthException(UNAUTHORIZED_ACCESS_TOKEN); + throw new AuthException(UNAUTHORIZED_REFRESH_TOKEN); } } From dcbf82fba22957793771c034d2238e9b9df8814a Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:28:12 +0900 Subject: [PATCH 368/465] =?UTF-8?q?[FIX]=20=EC=97=90=EB=9F=AC=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/redis/repository/RedisTokenRepository.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java index 1570ca8..eb63b50 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java @@ -1,7 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.external.redis.repository; -import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.NOT_FOUND_REFRESH_TOKEN; +import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.UNAUTHORIZED_REFRESH_TOKEN; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; @@ -19,6 +19,6 @@ default RefreshTokenVO findByMemberIdOrElseThrowException(String memberId) { return findByMemberId(memberId) .filter(refreshTokenVO -> !refreshTokenVO.isBlack()) .orElseThrow( - () -> new AuthException(NOT_FOUND_REFRESH_TOKEN)); + () -> new AuthException(UNAUTHORIZED_REFRESH_TOKEN)); } } From d395ba707070fe8a89402dd8992842ea55d72d20 Mon Sep 17 00:00:00 2001 From: mikekks Date: Tue, 16 Jan 2024 19:28:46 +0900 Subject: [PATCH 369/465] =?UTF-8?q?[FEAT]=20=EC=B2=A8=EC=82=AD=20=EC=9C=A0?= =?UTF-8?q?=EB=AC=B4=20=EA=B2=80=EC=A6=9D=20=EB=A9=94=EC=84=9C=EB=93=9C=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index c3abb44..2fd053e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -40,9 +40,7 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx UniversityExam universityExam = getUniversityExam(universityExamId); UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); - if(universityExamRecord.getExamRecordResultFileName() == null){ - throw new UniversityExamRecordException(INVALID_UNIVERSITY_EXAM_RECORD_RESULT_FILE_NAME); - } + validateCorrection(universityExamRecord); String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); @@ -57,12 +55,20 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long UniversityExam universityExam = getUniversityExam(universityExamId); UniversityExamRecord universityExamRecord = getUniversityExamByUniversityExamAndMember(universityExam, member); + validateCorrection(universityExamRecord); + String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); return UniversityExamRecordResultResponseDTO.of(resultUrl); } + private void validateCorrection(UniversityExamRecord universityExamRecord) { + if(universityExamRecord.getExamRecordResultFileName() == null){ + throw new UniversityExamRecordException(INVALID_UNIVERSITY_EXAM_RECORD_RESULT_FILE_NAME); + } + } + @Transactional public UniversityExamRecordIdResponse createUniversityExamRecord( CreateUniversityExamRequestDTO request, Member member) { From edbc97548355328d651d7d410b1dcf7779fd7e53 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 22:52:46 +0900 Subject: [PATCH 370/465] =?UTF-8?q?[FIX]=20=EC=9C=A0=ED=9A=A8=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=2030=EC=B4=88=EB=A1=9C=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/CloudFrontService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index e3ed8d9..ee89a8f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -30,11 +30,11 @@ public class CloudFrontService { @Value("${aws-property.key-pair-id}") private String keyPairId; - public String createPreSignedGetUrl(String path, String fileName, int expireTime) { + public String createPreSignedGetUrl(String path, String fileName) { try { String resourcePath = getEncodedResourcePath(path, fileName); String cloudFrontUrl = "https://" + distributionDomain + "/" + resourcePath; - Instant expirationTime = Instant.now().plus(expireTime, ChronoUnit.MINUTES); + Instant expirationTime = Instant.now().plus(30, ChronoUnit.SECONDS); Path keyPath = Paths.get(privateKeyFilePath); CloudFrontUtilities cloudFrontUtilities = CloudFrontUtilities.create(); From ac3c9eb34a7441ca1a51a5c061a756fd059dfddc Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 23:03:06 +0900 Subject: [PATCH 371/465] =?UTF-8?q?[FIX]=20Service=20=EB=8B=A8=EC=97=90?= =?UTF-8?q?=EC=84=9C=20CloudFrontService=20=ED=95=A8=EC=88=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=BD=94=EB=93=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 --- .../domain/university/service/UniversityExamService.java | 7 +++---- .../service/UniversityExamRecordService.java | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 890b920..1da2513 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -49,8 +49,7 @@ public Page getUniversityExamImages(Long id, Pag pageable); return universityExamImages.map(image -> UniversityExamImageResponseDTO.of(cloudFrontService.createPreSignedGetUrl(EXAM_IMAGE_FOLDER_NAME, - image.getUniversityExamImageFileName(), - image.getUniversityExam().getUniversityExamTimeLimit()))); + image.getUniversityExamImageFileName()))); } public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(Long universityExamId) { @@ -59,7 +58,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); String examAnswerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, - universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); + universityExam.getUniversityExamAnswerFileName()); List examImageUrls = new ArrayList<>(); List UniversityExamImages = universityExamImageRepository.findAllByUniversityExamOrderByPageAsc( @@ -67,7 +66,7 @@ public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(L UniversityExamImages.stream().forEach(universityExamImage -> { String preSignedGetUrl = cloudFrontService.createPreSignedGetUrl(EXAM_IMAGE_FOLDER_NAME, - universityExamImage.getUniversityExamImageFileName(), universityExam.getUniversityExamTimeLimit()); + universityExamImage.getUniversityExamImageFileName()); examImageUrls.add( UniversityExamImageResponseDTO.of(preSignedGetUrl)); }); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 2fd053e..f1a49fd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -43,9 +43,9 @@ public UniversityExamRecordResponseDTO getUniversityExamRecord(Long universityEx validateCorrection(universityExamRecord); String answerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, - universityExam.getUniversityExamAnswerFileName(), universityExam.getUniversityExamTimeLimit()); + universityExam.getUniversityExamAnswerFileName()); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamRecord.getExamRecordResultFileName(), 2); + universityExamRecord.getExamRecordResultFileName()); return UniversityExamRecordResponseDTO.of(universityExam.getUniversityExamFullName(), answerUrl, resultUrl); } @@ -58,7 +58,7 @@ public UniversityExamRecordResultResponseDTO getUniversityExamRecordResult(Long validateCorrection(universityExamRecord); String resultUrl = cloudFrontService.createPreSignedGetUrl(EXAM_RESULT_FOLDER_NAME, - universityExamRecord.getExamRecordResultFileName(), universityExam.getUniversityExamTimeLimit()); + universityExamRecord.getExamRecordResultFileName()); return UniversityExamRecordResultResponseDTO.of(resultUrl); } From f100ae1865ef6bd609aad5fd8a5163a0c95447af Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 23:32:57 +0900 Subject: [PATCH 372/465] =?UTF-8?q?[REFACTOR]=20ClientException=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F?= =?UTF-8?q?=20=EA=B7=B8=EC=99=80=20=EA=B4=80=EB=A0=A8=EB=90=9C=20=EC=BD=94?= =?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 --- .../domain/auth/exception/AuthException.java | 8 ++++---- .../domain/auth/exception/AuthExceptionType.java | 5 ++--- .../domain/auth/exception/AuthSuccessType.java | 4 ++-- .../domain/member/exception/MemberException.java | 8 ++++---- .../domain/member/exception/MemberExceptionType.java | 4 ++-- .../domain/member/exception/MemberSuccessType.java | 4 ++-- .../exception/SelectUniversityException.java | 8 ++++---- .../exception/SelectUniversityExceptionType.java | 4 ++-- .../exception/SelectUniversitySuccessType.java | 4 ++-- .../exception/UniversityExamException.java | 8 ++++---- .../exception/UniversityExamExceptionType.java | 4 ++-- .../exception/UniversityExamSuccessType.java | 4 ++-- .../exception/UniversityExamRecordException.java | 8 ++++---- .../exception/UniversityExamRecordExceptionType.java | 4 ++-- .../exception/UniversityExamRecordSuccessType.java | 4 ++-- .../external/aws/error/AWSException.java | 4 ++-- .../external/aws/error/AWSExceptionType.java | 4 ++-- .../global/error/GlobalExceptionHandler.java | 5 ++--- .../{BusinessException.java => ClientException.java} | 6 +++--- .../global/error/exception/CommonErrorType.java | 2 +- .../global/error/exception/CommonSuccessType.java | 2 +- .../{BusinessSucessType.java => ExceptionType.java} | 2 +- .../{BusinessExceptionType.java => SuccessType.java} | 2 +- .../global/response/ApiResponse.java | 12 ++++++------ 24 files changed, 59 insertions(+), 61 deletions(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/{BusinessException.java => ClientException.java} (51%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/{BusinessSucessType.java => ExceptionType.java} (86%) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/{BusinessExceptionType.java => SuccessType.java} (85%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthException.java index 9b4d1d4..208e38c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthException.java @@ -1,10 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.domain.auth.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ClientException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; -public class AuthException extends BusinessException { - public AuthException(BusinessExceptionType exceptionType) { +public class AuthException extends ClientException { + public AuthException(ExceptionType exceptionType) { super(exceptionType); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index 93d32a0..98ab852 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -1,13 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.auth.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; import lombok.AccessLevel; -import lombok.Getter; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum AuthExceptionType implements BusinessExceptionType { +public enum AuthExceptionType implements ExceptionType { /** * 400 Bad Request diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java index b8b7579..6cde17e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthSuccessType.java @@ -1,11 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.auth.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor -public enum AuthSuccessType implements BusinessSucessType { +public enum AuthSuccessType implements SuccessType { SIGN_UP_SUCCESS(HttpStatus.CREATED, "ํšŒ์›๊ฐ€์ž…์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), LOGIN_SUCCESS(HttpStatus.OK, "๋กœ๊ทธ์ธ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), REISSUE_SUCCESS(HttpStatus.OK, "๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberException.java index c295e81..6c247bd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberException.java @@ -1,10 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ClientException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; -public class MemberException extends BusinessException { - public MemberException(BusinessExceptionType exceptionType) { +public class MemberException extends ClientException { + public MemberException(ExceptionType exceptionType) { super(exceptionType); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java index b232b67..27a676a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberExceptionType.java @@ -1,12 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum MemberExceptionType implements BusinessExceptionType { +public enum MemberExceptionType implements ExceptionType { /** * 404 Not Found diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java index 45e5256..38eca00 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/exception/MemberSuccessType.java @@ -1,11 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor -public enum MemberSuccessType implements BusinessSucessType { +public enum MemberSuccessType implements SuccessType { GET_MEMBER_NAME_SUCCESS(HttpStatus.OK, "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), GET_MEMBER_TICKET_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityException.java index 859eae5..c0655a8 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityException.java @@ -1,8 +1,8 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ClientException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; -public class SelectUniversityException extends BusinessException { - public SelectUniversityException(BusinessExceptionType exceptionType) {super(exceptionType);} +public class SelectUniversityException extends ClientException { + public SelectUniversityException(ExceptionType exceptionType) {super(exceptionType);} } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java index ae8a7b2..c6db0a6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversityExceptionType.java @@ -1,13 +1,13 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum SelectUniversityExceptionType implements BusinessExceptionType { +public enum SelectUniversityExceptionType implements ExceptionType { INVALID_SELECTED_UNIVERSITY(HttpStatus.BAD_REQUEST, "์œ ํšจํ•œ ๋ชฉํ‘œ ๋Œ€ํ•™๊ต๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค"); private final HttpStatus status; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java index 981234d..147975a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java @@ -1,11 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor -public enum SelectUniversitySuccessType implements BusinessSucessType { +public enum SelectUniversitySuccessType implements SuccessType { GET_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), GET_SELECT_UNIVERSITY_EXAMS_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), PATCH_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.CREATED, "๋ชฉํ‘œ ๋Œ€ํ•™ ์ˆ˜์ •์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamException.java index 8a05c6e..932e726 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamException.java @@ -1,10 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ClientException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; -public class UniversityExamException extends BusinessException { - public UniversityExamException(BusinessExceptionType exceptionType) { +public class UniversityExamException extends ClientException { + public UniversityExamException(ExceptionType exceptionType) { super(exceptionType); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java index a435d90..61db65f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java @@ -1,12 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum UniversityExamExceptionType implements BusinessExceptionType { +public enum UniversityExamExceptionType implements ExceptionType { /** * 404 Not Found diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java index 20a5683..e102a35 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamSuccessType.java @@ -1,12 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum UniversityExamSuccessType implements BusinessSucessType { +public enum UniversityExamSuccessType implements SuccessType { /** * 200 OK */ diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordException.java index 4b95f5b..22d12e0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordException.java @@ -1,11 +1,11 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ClientException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; -public class UniversityExamRecordException extends BusinessException { +public class UniversityExamRecordException extends ClientException { public UniversityExamRecordException( - BusinessExceptionType exceptionType) { + ExceptionType exceptionType) { super(exceptionType); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java index a1d0a52..ce0ef45 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordExceptionType.java @@ -1,12 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum UniversityExamRecordExceptionType implements BusinessExceptionType { +public enum UniversityExamRecordExceptionType implements ExceptionType { NOT_FOUND_UNIVERSITY_EXAM_RECORD(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก์ž…๋‹ˆ๋‹ค."), CREATE_UNIVERSITY_EXAM_RECORD_FAIL(HttpStatus.BAD_REQUEST, "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก ์ƒ์„ฑ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค."), INVALID_UNIVERSITY_EXAM_RECORD_RESULT_FILE_NAME(HttpStatus.BAD_REQUEST, "์ฒจ์‚ญ์ด ์™„๋ฃŒ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค."), diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java index f8b0dbc..2ed682b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/exception/UniversityExamRecordSuccessType.java @@ -1,12 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum UniversityExamRecordSuccessType implements BusinessSucessType { +public enum UniversityExamRecordSuccessType implements SuccessType { GET_UNIVERSITY_EXAM_RECORD_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF, ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS(HttpStatus.OK, "์ฒจ์‚ญ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), GET_UNIVERSITY_EXAM_RECORD_SHEET_PRESIGNED_SUCCESS(HttpStatus.OK, "๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java index 60a4ee7..994ab11 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java @@ -1,8 +1,8 @@ package com.nonsoolmate.nonsoolmateServer.external.aws.error; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ClientException; -public class AWSException extends BusinessException { +public class AWSException extends ClientException { public AWSException( AWSExceptionType exceptionType) { super(exceptionType); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java index 1f4c965..aedbfbe 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java @@ -1,12 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.external.aws.error; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum AWSExceptionType implements BusinessExceptionType { +public enum AWSExceptionType implements ExceptionType { DELETE_FILE_AWS_S3_FAIL(HttpStatus.BAD_REQUEST, "s3์— ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค."), NOT_FOUND_SHEET_FILE_AWS_S3(HttpStatus.NOT_FOUND, "ํ•ด๋‹น ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PresignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index fa8c7c7..092bedd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -5,7 +5,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.BindingResult; import org.springframework.validation.FieldError; import org.springframework.web.HttpMediaTypeNotSupportedException; @@ -19,8 +18,8 @@ @RestControllerAdvice @Slf4j public class GlobalExceptionHandler { - @ExceptionHandler({BusinessException.class}) - protected ResponseEntity handleCustomException(BusinessException ex) { + @ExceptionHandler({ClientException.class}) + protected ResponseEntity handleCustomException(ClientException ex) { log.error("๐Ÿšจ BusinessException occured: {} ๐Ÿšจ", ex.getMessage()); return ResponseEntity.status(ex.getExceptionType().status()).body(ApiResponse.error(ex.getExceptionType())); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ClientException.java similarity index 51% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ClientException.java index 82e9c15..27f9679 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ClientException.java @@ -3,10 +3,10 @@ import lombok.Getter; @Getter -public class BusinessException extends RuntimeException { - private final BusinessExceptionType exceptionType; +public class ClientException extends RuntimeException { + private final ExceptionType exceptionType; - public BusinessException(BusinessExceptionType exceptionType) { + public ClientException(ExceptionType exceptionType) { super(exceptionType.message()); this.exceptionType = exceptionType; } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java index a1a863d..0dc897f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonErrorType.java @@ -7,7 +7,7 @@ @Getter @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum CommonErrorType implements BusinessExceptionType { +public enum CommonErrorType implements ExceptionType { /** * 404 Not Found */ diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java index df195f0..a4f7f92 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/CommonSuccessType.java @@ -5,7 +5,7 @@ import org.springframework.http.HttpStatus; @AllArgsConstructor(access = AccessLevel.PRIVATE) -public enum CommonSuccessType implements BusinessSucessType { +public enum CommonSuccessType implements SuccessType { // 200 OK GET_SERVER_PROFILE(HttpStatus.OK, "์„œ๋ฒ„ ํ”„๋กœํ•„ ํ™•์ธ ์™„๋ฃŒ"); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessSucessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ExceptionType.java similarity index 86% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessSucessType.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ExceptionType.java index 1695cf1..699e37a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessSucessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/ExceptionType.java @@ -2,7 +2,7 @@ import org.springframework.http.HttpStatus; -public interface BusinessSucessType { +public interface ExceptionType { HttpStatus status(); String message(); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/SuccessType.java similarity index 85% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessExceptionType.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/SuccessType.java index 41fbc27..2caf288 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/SuccessType.java @@ -2,7 +2,7 @@ import org.springframework.http.HttpStatus; -public interface BusinessExceptionType { +public interface SuccessType { HttpStatus status(); String message(); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java index 70fe41e..e5443f7 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java @@ -1,7 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.global.response; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessSucessType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Getter; @@ -15,19 +15,19 @@ public class ApiResponse { private final String message; private T data; - public static ApiResponse success(BusinessSucessType successType) { + public static ApiResponse success(SuccessType successType) { return new ApiResponse<>(successType.getHttpStatusCode(), successType.message()); } - public static ApiResponse success(BusinessSucessType successType, T data) { + public static ApiResponse success(SuccessType successType, T data) { return new ApiResponse(successType.getHttpStatusCode(), successType.message(), data); } - public static ApiResponse error(BusinessExceptionType exceptionType) { + public static ApiResponse error(ExceptionType exceptionType) { return new ApiResponse<>(exceptionType.getHttpStatusCode(), exceptionType.message()); } - public static ApiResponse error(BusinessExceptionType exceptionType, T data) { + public static ApiResponse error(ExceptionType exceptionType, T data) { return new ApiResponse(exceptionType.getHttpStatusCode(), exceptionType.message(), data); } } \ No newline at end of file From 377c7516f352e6d73b337d2416912db3aabfd5c6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 23:34:37 +0900 Subject: [PATCH 373/465] [ADD] BusinessException.java --- .../global/error/exception/BusinessException.java | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java new file mode 100644 index 0000000..8b19582 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.global.error.exception; + +public class BusinessException extends RuntimeException { + private final ExceptionType exceptionType; + + public BusinessException(ExceptionType exceptionType) { + super(exceptionType.message()); + this.exceptionType = exceptionType; + } +} From 7cf5ab340e035b0a7e53f1f26761f4599d6511ef Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 23:35:37 +0900 Subject: [PATCH 374/465] =?UTF-8?q?[DEL]=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=ED=8C=8C=EC=9D=BC=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/external/redis/service/dummy.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/service/dummy.txt diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/service/dummy.txt b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/service/dummy.txt deleted file mode 100644 index bf24627..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/service/dummy.txt +++ /dev/null @@ -1 +0,0 @@ -ํ”„๋กœ์ ํŠธ ์ง„ํ–‰ ์‹œ ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค \ No newline at end of file From 834cb444a09578c3f840fee39502137f5071e364 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 23:50:43 +0900 Subject: [PATCH 375/465] =?UTF-8?q?[FEAT]=20SuccessResponse,=20ErrorRespon?= =?UTF-8?q?se=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthApi.java | 6 ++-- .../auth/controller/AuthController.java | 13 ++++---- .../domain/member/controller/MemberApi.java | 6 ++-- .../member/controller/MyController.java | 12 +++---- .../controller/SelectUniversityApi.java | 8 ++--- .../SelectUniversityController.java | 16 ++++----- .../university/controller/UniversityApi.java | 8 ++--- .../controller/UniversityExamController.java | 16 ++++----- .../controller/UniversityExamRecordApi.java | 10 +++--- .../UniversityExamRecordController.java | 20 +++++------ .../controller/ServerProfileController.java | 6 ++-- .../global/error/GlobalExceptionHandler.java | 28 +++++++--------- .../error/exception/BusinessException.java | 10 ------ .../global/jwt/utils/RequestUtils.java | 7 ++-- .../global/response/ApiResponse.java | 33 ------------------- .../global/response/ErrorResponse.java | 24 ++++++++++++++ .../global/response/SuccessResponse.java | 25 ++++++++++++++ .../security/filter/JwtExceptionFilter.java | 5 +-- 18 files changed, 123 insertions(+), 130 deletions(-) delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java delete mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ErrorResponse.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/SuccessResponse.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java index c049e84..d9e2181 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java @@ -3,6 +3,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberReissueResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -10,7 +11,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; import jakarta.validation.Valid; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; @@ -28,11 +28,11 @@ public interface AuthApi { ) @Operation(summary = "์†Œ์…œ ๋กœ๊ทธ์ธ", description = "๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> login( + ResponseEntity> login( @Parameter(description = "์ธ๊ฐ€ ์ฝ”๋“œ", required = true) @RequestHeader(value = "authorization-code") final String authorizationCode, @Parameter(description = "ํ”Œ๋žซํผ ํƒ€์ž…(ex.'NAVER')", required = true) @RequestBody @Valid final MemberRequestDTO request); @Operation(summary = "์•ก์„ธ์Šค ํ† ํฐ & ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰", description = "์•ก์„ธ์Šค ํ† ํฐ ๋ฐ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ ๋ฐ›์Šต๋‹ˆ๋‹ค.") - ResponseEntity> reissue( + ResponseEntity> reissue( HttpServletRequest request); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index 9d306fc..fc01d50 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -8,7 +8,7 @@ import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthServiceProvider; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSuccessType; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -21,7 +21,6 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -40,7 +39,7 @@ public class AuthController implements AuthApi{ @Override @PostMapping("/social/login") - public ResponseEntity> login( + public ResponseEntity> login( final String authorizationCode, @RequestBody @Valid final MemberRequestDTO request) { @@ -51,16 +50,16 @@ public ResponseEntity> login( MemberAuthResponseDTO responseDTO = jwtService.issueToken(vo); if (responseDTO.authType().equals(AuthType.SIGN_UP)) { return ResponseEntity.status(HttpStatus.CREATED) - .body(ApiResponse.success(AuthSuccessType.SIGN_UP_SUCCESS, responseDTO)); + .body(SuccessResponse.of(AuthSuccessType.SIGN_UP_SUCCESS, responseDTO)); } - return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.LOGIN_SUCCESS, responseDTO)); + return ResponseEntity.ok().body(SuccessResponse.of(AuthSuccessType.LOGIN_SUCCESS, responseDTO)); } @Override @PostMapping("/reissue") - public ResponseEntity> reissue(HttpServletRequest request) { + public ResponseEntity> reissue(HttpServletRequest request) { MemberReissueResponseDTO memberReissueResponseDTO = jwtService.reissueToken(request); - return ResponseEntity.ok().body(ApiResponse.success(AuthSuccessType.REISSUE_SUCCESS, memberReissueResponseDTO)); + return ResponseEntity.ok().body(SuccessResponse.of(AuthSuccessType.REISSUE_SUCCESS, memberReissueResponseDTO)); } @GetMapping("/authTest") diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java index d19268e..3b93be4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java @@ -3,7 +3,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; @@ -21,10 +21,10 @@ public interface MemberApi { ) @Operation(summary = "๋งˆ์ดํŽ˜์ด์ง€: ์ด๋ฆ„", description = "๋‚ด ์ด๋ฆ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> getName( + ResponseEntity> getName( @AuthUser Member member); @Operation(summary = "๋‚ด ์ •๋ณด ํ™•์ธ: ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", description = "๋‚ด ์ฒจ์‚ญ๊ถŒ ๊ฐฏ์ˆ˜๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> getTicket(@AuthUser Member member); + ResponseEntity> getTicket(@AuthUser Member member); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 9fbe0ac..4f3f0c4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -5,10 +5,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; import com.nonsoolmate.nonsoolmateServer.domain.member.exception.MemberSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.member.service.MemberService; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -23,17 +21,17 @@ public class MyController implements MemberApi{ @Override @GetMapping("/name") - public ResponseEntity> getName(@AuthUser Member member) { + public ResponseEntity> getName(@AuthUser Member member) { return ResponseEntity.ok() - .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, + .body(SuccessResponse.of(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname(member))); } @Override @GetMapping("/ticket") - public ResponseEntity> getTicket(@AuthUser Member member) { + public ResponseEntity> getTicket(@AuthUser Member member) { return ResponseEntity.ok() - .body(ApiResponse.success(MemberSuccessType.GET_MEMBER_TICKET_SUCCESS, + .body(SuccessResponse.of(MemberSuccessType.GET_MEMBER_TICKET_SUCCESS, memberService.getTicket(member))); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java index ba071c4..b9f5345 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java @@ -5,7 +5,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamsResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityUpdateResponseDTO; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -31,15 +31,15 @@ public interface SelectUniversityApi { ) @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity>> getSelectUniversities( + ResponseEntity>> getSelectUniversities( @AuthUser Member member); @Operation(summary = "๋งˆ์ด ํŽ˜์ด์ง€: ๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค์˜ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity>> getSelectUniversityExams( + ResponseEntity>> getSelectUniversityExams( @AuthUser Member member); @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์„ ํƒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธ(์ˆ˜์ •) ํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> patchSelectUniversities( + ResponseEntity> patchSelectUniversities( @AuthUser Member member, @Parameter(description = "์„ ํƒ ๋Œ€ํ•™๊ต Id", required = true) @RequestBody @Valid List request); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java index 599aa3a..a8d739b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java @@ -10,10 +10,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityUpdateResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.service.SelectUniversityService; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import java.util.List; import lombok.RequiredArgsConstructor; @@ -33,28 +31,28 @@ public class SelectUniversityController implements SelectUniversityApi { @Override @GetMapping - public ResponseEntity>> getSelectUniversities( + public ResponseEntity>> getSelectUniversities( @AuthUser Member member) { - return ResponseEntity.ok().body(ApiResponse.success(GET_SELECT_UNIVERSITIES_SUCCESS, + return ResponseEntity.ok().body(SuccessResponse.of(GET_SELECT_UNIVERSITIES_SUCCESS, selectUniversityService.getSelectUniversities(member))); } @Override @GetMapping("/exam") - public ResponseEntity>> getSelectUniversityExams( + public ResponseEntity>> getSelectUniversityExams( @AuthUser Member member) { - return ResponseEntity.ok().body(ApiResponse.success(GET_SELECT_UNIVERSITY_EXAMS_SUCCESS, + return ResponseEntity.ok().body(SuccessResponse.of(GET_SELECT_UNIVERSITY_EXAMS_SUCCESS, selectUniversityService.getSelectUniversityExams(member))); } @Override @PatchMapping - public ResponseEntity> patchSelectUniversities( + public ResponseEntity> patchSelectUniversities( @AuthUser Member member, @RequestBody @Valid final List request) { - return ResponseEntity.ok().body(ApiResponse.success(PATCH_SELECT_UNIVERSITIES_SUCCESS, + return ResponseEntity.ok().body(SuccessResponse.of(PATCH_SELECT_UNIVERSITIES_SUCCESS, selectUniversityService.patchSelectUniversities(member, request))); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java index 438748a..4acc5b0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java @@ -3,7 +3,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageAndAnswerResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamInfoResponseDTO; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -27,16 +27,16 @@ public interface UniversityApi { ) @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ์‹œํ—˜ ์ด๋ฆ„ & ์ œํ•œ ์‹œ๊ฐ„", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ์ด๋ฆ„ ๋ฐ ์ œํ•œ ์‹œ๊ฐ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> getUniversityExam( + ResponseEntity> getUniversityExam( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId); @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ๋ฌธ์ œ์ง€ [ํŽ˜์ด์ง€๋„ค์ด์…˜]", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ๋ฌธ์ œ์ง€๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity>> getUniversityExamImages( + ResponseEntity>> getUniversityExamImages( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long id, @RequestParam(defaultValue = "0") int page, Pageable pageable); @Operation(summary= "ํ•ด์ œ: ๋ฌธ์ œ์ด๋ฏธ์ง€_ํ•ด์ œPDF", description = "์‹œํ—˜ ๋ฌธ์ œ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ PDF๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> getUniversityExamImageAndAnswer( + ResponseEntity> getUniversityExamImageAndAnswer( @PathVariable("id") Long universityExamId); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index b361dd3..e7666e5 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -7,9 +7,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamInfoResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamSuccessType; import com.nonsoolmate.nonsoolmateServer.domain.university.service.UniversityExamService; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -29,28 +27,28 @@ public class UniversityExamController implements UniversityApi{ @Override @GetMapping("/{id}/info") - public ResponseEntity> getUniversityExam( + public ResponseEntity> getUniversityExam( @PathVariable("id") Long universityExamId) { - return ResponseEntity.ok().body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_SUCCESS, + return ResponseEntity.ok().body(SuccessResponse.of(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_SUCCESS, universityExamService.getUniversityExam(universityExamId))); } @Override @GetMapping("{id}/image") - public ResponseEntity>> getUniversityExamImages( + public ResponseEntity>> getUniversityExamImages( @PathVariable("id") Long id, @RequestParam(defaultValue = "0") int page, Pageable pageable) { PageRequest pageRequest = PageRequest.of(page, 1); Page images = universityExamService.getUniversityExamImages(id, pageRequest); return ResponseEntity.ok() - .body(ApiResponse.success(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_SUCCESS, images)); + .body(SuccessResponse.of(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_IMAGE_SUCCESS, images)); } @Override @GetMapping("{id}/answer") - public ResponseEntity> getUniversityExamImageAndAnswer( + public ResponseEntity> getUniversityExamImageAndAnswer( @PathVariable("id") Long universityExamId ) { - return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_IMAGE_AND_ANSWER_SUCCESS, + return ResponseEntity.ok().body(SuccessResponse.of(GET_UNIVERSITY_EXAM_IMAGE_AND_ANSWER_SUCCESS, universityExamService.getUniversityExamImageAndAnswer(universityExamId))); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java index b753673..9d406c9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java @@ -6,7 +6,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResultResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamSheetPreSignedUrlResponseDTO; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -31,20 +31,20 @@ public interface UniversityExamRecordApi { ) @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF_ํ•ด์ œPDF", description = "์ฒจ์‚ญ pdf ๋ฐ ํ•ด์ œ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> getUniversityExamRecord( + ResponseEntity> getUniversityExamRecord( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId, @AuthUser Member member); @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF ์ €์žฅ", description = "์ฒจ์‚ญ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> getUniversityExamRecordResult( + ResponseEntity> getUniversityExamRecordResult( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId, @AuthUser Member member); @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: [1] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ์กฐํšŒ API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ PresignedUrl๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> getUniversityExamSheetPreSignedUrl(); + ResponseEntity> getUniversityExamSheetPreSignedUrl(); @Operation(summary = "์‹œํ—˜๋ณด๊ธฐ: [3] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ํ›„ ์‹œํ—˜ ๊ธฐ๋ก API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ ํ›„ ์„œ๋ฒ„์— ๊ธฐ๋กํ•˜๊ธฐ ์œ„ํ•ด ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.") - ResponseEntity> createUniversityExamRecord( + ResponseEntity> createUniversityExamRecord( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId), ์‹œํ—˜ ์‘์‹œ ์†Œ์š” ์‹œ๊ฐ„, ๋‹ต์•ˆ์ง€(์‘์‹œ ๊ธฐ๋ก) ํŒŒ์ผ ์ด๋ฆ„", required = true) @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, @AuthUser Member member); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index 5356d47..958c46c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -13,10 +13,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordService; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service.UniversityExamRecordSheetService; import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @@ -38,25 +36,25 @@ public class UniversityExamRecordController implements UniversityExamRecordApi { @Override @GetMapping("/{id}") - public ResponseEntity> getUniversityExamRecord( + public ResponseEntity> getUniversityExamRecord( @PathVariable("id") Long universityExamId, @AuthUser Member member) { - return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_RECORD_SUCCESS, + return ResponseEntity.ok().body(SuccessResponse.of(GET_UNIVERSITY_EXAM_RECORD_SUCCESS, universityExamRecordService.getUniversityExamRecord(universityExamId, member))); } @Override @GetMapping("/result/{id}") - public ResponseEntity> getUniversityExamRecordResult( + public ResponseEntity> getUniversityExamRecordResult( @PathVariable("id") Long universityExamId, @AuthUser Member member) { - return ResponseEntity.ok().body(ApiResponse.success(GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS, + return ResponseEntity.ok().body(SuccessResponse.of(GET_UNIVERSITY_EXAM_RECORD_RESULT_SUCCESS, universityExamRecordService.getUniversityExamRecordResult(universityExamId, member))); } @Override @GetMapping("/sheet/presigned") - public ResponseEntity> getUniversityExamSheetPreSignedUrl() { + public ResponseEntity> getUniversityExamSheetPreSignedUrl() { PreSignedUrlVO universityExamRecordSheetPreSignedUrlVO = universityExamRecordSheetService.getUniversityExamRecordSheetPreSignedUrl(); - return ResponseEntity.ok().body(ApiResponse.success( + return ResponseEntity.ok().body(SuccessResponse.of( UniversityExamRecordSuccessType.GET_UNIVERSITY_EXAM_RECORD_SHEET_PRESIGNED_SUCCESS, UniversityExamSheetPreSignedUrlResponseDTO.of(universityExamRecordSheetPreSignedUrlVO.getFileName(), universityExamRecordSheetPreSignedUrlVO.getUrl()))); @@ -64,10 +62,10 @@ public ResponseEntity> g @Override @PostMapping("/sheet") - public ResponseEntity> createUniversityExamRecord( + public ResponseEntity> createUniversityExamRecord( @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, @AuthUser Member member) { - return ResponseEntity.status(HttpStatus.CREATED).body(ApiResponse.success( + return ResponseEntity.status(HttpStatus.CREATED).body(SuccessResponse.of( UniversityExamRecordSuccessType.CREATE_UNIVERSITY_EXAM_RECORD_SUCCESS, universityExamRecordService.createUniversityExamRecord( createUniversityExamRequestDTO, member))); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java index 6218328..e0d0316 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.global.controller; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.error.exception.CommonSuccessType; import lombok.RequiredArgsConstructor; import org.springframework.core.env.Environment; @@ -15,8 +15,8 @@ public class ServerProfileController { private final Environment env; @GetMapping("/profile") - public ResponseEntity> getProfile() { + public ResponseEntity> getProfile() { return ResponseEntity.ok() - .body(ApiResponse.success(CommonSuccessType.GET_SERVER_PROFILE, env.getActiveProfiles()[0])); + .body(SuccessResponse.of(CommonSuccessType.GET_SERVER_PROFILE, env.getActiveProfiles()[0])); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index 092bedd..dd4a61d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.global.error; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; import com.nonsoolmate.nonsoolmateServer.global.error.exception.*; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; @@ -13,34 +13,30 @@ import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.servlet.NoHandlerFoundException; -import java.util.HashMap; - @RestControllerAdvice @Slf4j public class GlobalExceptionHandler { @ExceptionHandler({ClientException.class}) - protected ResponseEntity handleCustomException(ClientException ex) { + protected ResponseEntity handleCustomException(ClientException ex) { log.error("๐Ÿšจ BusinessException occured: {} ๐Ÿšจ", ex.getMessage()); - return ResponseEntity.status(ex.getExceptionType().status()).body(ApiResponse.error(ex.getExceptionType())); + return ResponseEntity.status(ex.getExceptionType().status()).body(ErrorResponse.of(ex.getExceptionType())); } @ExceptionHandler({Exception.class}) - protected ResponseEntity handleServerException(Exception ex) { + protected ResponseEntity handleServerException(Exception ex) { log.error(ex.getMessage()); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) - .body(ApiResponse.error(CommonErrorType.INTERNAL_SERVER_ERROR)); + .body(ErrorResponse.of(CommonErrorType.INTERNAL_SERVER_ERROR)); } @ExceptionHandler(NoHandlerFoundException.class) - protected ResponseEntity handleNotFoundException(final NoHandlerFoundException ex) { - HashMap pathMap = new HashMap<>(); - pathMap.put("path", ex.getRequestURL()); + protected ResponseEntity handleNotFoundException(final NoHandlerFoundException ex) { return ResponseEntity.status(HttpStatus.NOT_FOUND) - .body(ApiResponse.error(CommonErrorType.NOT_FOUND_PATH, pathMap)); + .body(ErrorResponse.of(CommonErrorType.NOT_FOUND_PATH, ex.getRequestURL())); } @ExceptionHandler(MethodArgumentNotValidException.class) - public ResponseEntity> handleValidationError(MethodArgumentNotValidException exception) { + public ResponseEntity handleValidationError(MethodArgumentNotValidException exception) { BindingResult bindingResult = exception.getBindingResult(); StringBuilder builder = new StringBuilder(); for (FieldError fieldError : bindingResult.getFieldErrors()) { @@ -53,13 +49,11 @@ public ResponseEntity> handleValidationError(MethodArgumentN builder.append("]"); } return ResponseEntity.status(HttpStatus.BAD_REQUEST) - .body(ApiResponse.error(CommonErrorType.INVALID_INPUT_VALUE, builder.toString())); + .body(ErrorResponse.of(CommonErrorType.INVALID_INPUT_VALUE, builder.toString())); } @ExceptionHandler(HttpMediaTypeNotSupportedException.class) - public ResponseEntity handleValidationExceptions(HttpMediaTypeNotSupportedException ex){ - HashMap infoMap = new HashMap<>(); - infoMap.put("info", "JSON ํ˜•์‹์œผ๋กœ ์š”์ฒญํ•ด์ฃผ์„ธ์š”"); - return ResponseEntity.status(HttpStatus.UNSUPPORTED_MEDIA_TYPE).body(ApiResponse.error(CommonErrorType.INVALID_JSON_TYPE, infoMap)); + public ResponseEntity handleValidationExceptions(HttpMediaTypeNotSupportedException ex){ + return ResponseEntity.status(HttpStatus.UNSUPPORTED_MEDIA_TYPE).body(ErrorResponse.of(CommonErrorType.INVALID_JSON_TYPE, ex.getMessage())); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java deleted file mode 100644 index 8b19582..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.error.exception; - -public class BusinessException extends RuntimeException { - private final ExceptionType exceptionType; - - public BusinessException(ExceptionType exceptionType) { - super(exceptionType.message()); - this.exceptionType = exceptionType; - } -} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/RequestUtils.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/RequestUtils.java index d384476..3b59f1c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/RequestUtils.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/utils/RequestUtils.java @@ -8,7 +8,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthSuccessType; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; @@ -40,7 +41,7 @@ public static void setBodyOnResponse(HttpServletResponse response, AuthSuccessTy response.setContentType("application/json"); response.setCharacterEncoding("utf-8"); try { - String body = objectMapper.writeValueAsString(ApiResponse.success(success, bodyData)); + String body = objectMapper.writeValueAsString(SuccessResponse.of(success, bodyData)); response.getWriter().write(body); } catch (IOException e) { e.printStackTrace(); @@ -53,7 +54,7 @@ public static void setErrorBodyOnResponse(HttpServletResponse response, AuthExce response.setContentType("application/json"); response.setCharacterEncoding("utf-8"); try { - String body = objectMapper.writeValueAsString(ApiResponse.error(error)); + String body = objectMapper.writeValueAsString(ErrorResponse.of(error)); response.getWriter().write(body); } catch (IOException e) { e.printStackTrace(); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java deleted file mode 100644 index e5443f7..0000000 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ApiResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.nonsoolmate.nonsoolmateServer.global.response; - -import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor(access = AccessLevel.PRIVATE) -@AllArgsConstructor -public class ApiResponse { - private final int code; - private final String message; - private T data; - - public static ApiResponse success(SuccessType successType) { - return new ApiResponse<>(successType.getHttpStatusCode(), successType.message()); - } - - public static ApiResponse success(SuccessType successType, T data) { - return new ApiResponse(successType.getHttpStatusCode(), successType.message(), data); - } - - public static ApiResponse error(ExceptionType exceptionType) { - return new ApiResponse<>(exceptionType.getHttpStatusCode(), exceptionType.message()); - } - - public static ApiResponse error(ExceptionType exceptionType, T data) { - return new ApiResponse(exceptionType.getHttpStatusCode(), exceptionType.message(), data); - } -} \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ErrorResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ErrorResponse.java new file mode 100644 index 0000000..fa2bfe9 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/ErrorResponse.java @@ -0,0 +1,24 @@ +package com.nonsoolmate.nonsoolmateServer.global.response; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.CommonErrorType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public class ErrorResponse { + private final int code; + private final String message; + + public static ErrorResponse of(ExceptionType exceptionType) { + return new ErrorResponse(exceptionType.getHttpStatusCode(), exceptionType.message()); + } + + public static ErrorResponse of(ExceptionType exceptionType, String addMessage){ + return new ErrorResponse(exceptionType.getHttpStatusCode(), exceptionType.message() +": " + addMessage); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/SuccessResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/SuccessResponse.java new file mode 100644 index 0000000..b735cb8 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/response/SuccessResponse.java @@ -0,0 +1,25 @@ +package com.nonsoolmate.nonsoolmateServer.global.response; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.SuccessType; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +@AllArgsConstructor +public class SuccessResponse { + private final int code; + private final String message; + private T data; + + public static SuccessResponse of(SuccessType successType) { + return new SuccessResponse<>(successType.getHttpStatusCode(), successType.message()); + } + + public static SuccessResponse of(SuccessType successType, T data) { + return new SuccessResponse(successType.getHttpStatusCode(), successType.message(), data); + } +} \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java index b83d406..e183ef2 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java @@ -2,7 +2,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; -import com.nonsoolmate.nonsoolmateServer.global.response.ApiResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; +import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; @@ -28,7 +29,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response.setStatus(HttpStatus.UNAUTHORIZED.value()); response.setContentType(MediaType.APPLICATION_JSON_VALUE); response.setCharacterEncoding("UTF-8"); - String error = objectMapper.writeValueAsString(ApiResponse.error(e.getExceptionType())); + String error = objectMapper.writeValueAsString(ErrorResponse.of(e.getExceptionType())); response.getWriter().write(error); } } From 99dde27a5dc3a2005c504afede326ab187139c17 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Tue, 16 Jan 2024 23:52:03 +0900 Subject: [PATCH 376/465] =?UTF-8?q?[DEL]=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20import=EB=AC=B8=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/filter/JwtExceptionFilter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java index e183ef2..a3b1113 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtExceptionFilter.java @@ -3,7 +3,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; -import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; From 50f5912f40047fda2ebc24f79c7b76730f17b095 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 00:23:38 +0900 Subject: [PATCH 377/465] =?UTF-8?q?[FEAT]=20=EC=84=9C=EB=B2=84=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=EC=83=81=EC=9D=98=20=EC=97=90=EB=9F=AC=20->=20Busines?= =?UTF-8?q?sException=EC=9C=BC=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/GlobalExceptionHandler.java | 19 +++++++++++++++++-- .../error/exception/BusinessException.java | 13 +++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index dd4a61d..ed9dc56 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -18,13 +18,28 @@ public class GlobalExceptionHandler { @ExceptionHandler({ClientException.class}) protected ResponseEntity handleCustomException(ClientException ex) { - log.error("๐Ÿšจ BusinessException occured: {} ๐Ÿšจ", ex.getMessage()); return ResponseEntity.status(ex.getExceptionType().status()).body(ErrorResponse.of(ex.getExceptionType())); } + @ExceptionHandler({BusinessException.class}) + protected ResponseEntity handleServerException(BusinessException ex) { + log.error("๐ŸšจBusinessException occurred: {} ๐Ÿšจ", ex.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) + .body(ErrorResponse.of(CommonErrorType.INTERNAL_SERVER_ERROR)); + } + + /* 500 ๋ฒˆ๋Œ€ ์—๋Ÿฌ์—๋„ ์ข…๋ฅ˜๊ฐ€์žˆ๋Š”๋ฐ ๋ฒ”์ฃผ๊ฐ€ ๋‚˜๋‰  ์ˆ˜ ์žˆ์Œ + ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ๋–จ์–ด์ง -> ์š”์ฒญ์ด ์•ˆ๋“ค์–ด๊ฐ€ -> ์ด๋Ÿฐ๊ฑด ์„œ๋ฒ„๊ฐ€ ์ฃฝ์€๊ฑฐ๋‹ˆ๊นŒ ํด๋ผ๊ฐ€ ์ฒ˜๋ฆฌ๊ฐ€ ํ•ด์ฃผ์–ด์•ผํ•จ + ์ด๊ฑฐ์— ๋”ฐ๋ผ์„œ 503์ด๋Ÿฐ๊ฑฐ๋ฅผ ๋‚ด๋ ค์ค˜์„œ ์„œ๋ฒ„๊ฐ€ ์ง€๊ธˆ ์•ˆ๋œ๋‹ค๋ผ๋Š” ํŽ˜์ด์ง€๋ฅผ ๋„์šฐ๊ฑฐ๋‚˜ ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ค˜์•ผํ•จ + Service Unavailable + */ + /* ์„œ๋ฒ„ ์ž์ฒด๊ฐ€ ์ฃฝ์–ด๋ฒ„๋ฆฐ ๊ฒฝ์šฐ์—๋Š” Service Unavailable, ์„œ๋ฒ„์™€ ํ†ต์‹ ํ•˜๋Š” ์™ธ๋ถ€ ์„œ๋น„์Šค์— ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ์—๋Š” 500 + S3์—์„œ ์žฅ์• ๊ฐ€ ๋‚œ ๊ฒฝ์šฐ์—๋Š” 500์„ ๋‚ด๋ ค์ฃผ๊ณ , ์„œ๋ฒ„ ์ž์ฒด๊ฐ€ ์ฃฝ์—ˆ์„ ๋•Œ์— ๋Œ€ํ•ด์„œ๋Š” nginx์—์„œ ์ฒ˜๋ฆฌ + */ + @ExceptionHandler({Exception.class}) protected ResponseEntity handleServerException(Exception ex) { - log.error(ex.getMessage()); + log.error("๐Ÿšจ InternalException occurred: {} ๐Ÿšจ", ex.getMessage()); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(ErrorResponse.of(CommonErrorType.INTERNAL_SERVER_ERROR)); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java new file mode 100644 index 0000000..13bc049 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/exception/BusinessException.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.global.error.exception; + +import lombok.Getter; + +@Getter +public class BusinessException extends RuntimeException { + private final ExceptionType exceptionType; + + public BusinessException(ExceptionType exceptionType) { + super(exceptionType.message()); + this.exceptionType = exceptionType; + } +} From 15f0cc51363018aeac1911f72df7bbf11b2a7217 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 00:31:45 +0900 Subject: [PATCH 378/465] =?UTF-8?q?[FIX]=20=EC=9C=A0=ED=9A=A8=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=20=EB=B3=80=EC=88=98=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/CloudFrontService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index ee89a8f..c5cea3c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -30,11 +30,13 @@ public class CloudFrontService { @Value("${aws-property.key-pair-id}") private String keyPairId; + private static final Long PRE_SIGNED_URL_EXPIRE_SECONDS = 30L; + public String createPreSignedGetUrl(String path, String fileName) { try { String resourcePath = getEncodedResourcePath(path, fileName); String cloudFrontUrl = "https://" + distributionDomain + "/" + resourcePath; - Instant expirationTime = Instant.now().plus(30, ChronoUnit.SECONDS); + Instant expirationTime = Instant.now().plus(PRE_SIGNED_URL_EXPIRE_SECONDS, ChronoUnit.SECONDS); Path keyPath = Paths.get(privateKeyFilePath); CloudFrontUtilities cloudFrontUtilities = CloudFrontUtilities.create(); From 7c4cb7591e4d33acab8ae8820ac68b46fa96cda7 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 00:49:14 +0900 Subject: [PATCH 379/465] =?UTF-8?q?[FIX]=20AWS=EC=97=90=EC=84=9C=20ClientE?= =?UTF-8?q?xception,=20BusinessException=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 4 ++-- .../external/aws/error/AWSBusinessException.java | 10 ++++++++++ .../{AWSException.java => AWSClientException.java} | 5 +++-- .../external/aws/error/AWSExceptionType.java | 4 +++- .../external/aws/service/CloudFrontService.java | 7 ++++--- .../external/aws/service/S3Service.java | 10 ++++------ 6 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSBusinessException.java rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/{AWSException.java => AWSClientException.java} (71%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index f1a49fd..d86cd5f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -18,7 +18,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.enums.ExamResultStatus; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordException; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; -import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSBusinessException; import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; import lombok.RequiredArgsConstructor; @@ -83,7 +83,7 @@ public UniversityExamRecordIdResponse createUniversityExamRecord( universityexamRecord); decreaseMemberTicketCount(member); return UniversityExamRecordIdResponse.of(saveUniversityUniversityExamRecord.getUniversityExamRecordId()); - } catch (AWSException | MemberException e) { + } catch (AWSBusinessException | MemberException e) { throw e; } catch (RuntimeException e) { s3Service.deleteFile(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSBusinessException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSBusinessException.java new file mode 100644 index 0000000..6b39255 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSBusinessException.java @@ -0,0 +1,10 @@ +package com.nonsoolmate.nonsoolmateServer.external.aws.error; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; + +public class AWSBusinessException extends BusinessException { + public AWSBusinessException( + AWSExceptionType exceptionType) { + super(exceptionType); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSClientException.java similarity index 71% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSClientException.java index 994ab11..f739ade 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSClientException.java @@ -2,8 +2,9 @@ import com.nonsoolmate.nonsoolmateServer.global.error.exception.ClientException; -public class AWSException extends ClientException { - public AWSException( +public class AWSClientException extends ClientException { + + public AWSClientException( AWSExceptionType exceptionType) { super(exceptionType); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java index aedbfbe..445e12b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java @@ -8,8 +8,10 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum AWSExceptionType implements ExceptionType { DELETE_FILE_AWS_S3_FAIL(HttpStatus.BAD_REQUEST, "s3์— ํ•ด๋‹น ํŒŒ์ผ ์‚ญ์ œ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค."), + NOT_FOUND_AWS_PRIVATE_KEY(HttpStatus.NOT_FOUND, "ํ•ด๋‹น AWS Private Key๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), NOT_FOUND_SHEET_FILE_AWS_S3(HttpStatus.NOT_FOUND, "ํ•ด๋‹น ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), - GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PresignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"); + GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PreSignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), + AWS_S3_SERVICE_ERROR(HttpStatus.SERVICE_UNAVAILABLE, "S3 ์„œ๋น„์Šค ์—๋Ÿฌ"); private final HttpStatus status; private final String message; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index c5cea3c..3bf5675 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.external.aws.service; -import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSBusinessException; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSExceptionType; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -48,9 +48,10 @@ public String createPreSignedGetUrl(String path, String fileName) { .build(); SignedUrl signedUrl = cloudFrontUtilities.getSignedUrlWithCannedPolicy(cannedSignerRequest); return signedUrl.url(); + } catch(AWSBusinessException e){ + throw new AWSBusinessException(AWSExceptionType.GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL); } catch (Exception e) { - log.info("createPreSignedGetUrl = {}", e); - throw new AWSException(AWSExceptionType.GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL); + throw new AWSBusinessException(AWSExceptionType.NOT_FOUND_AWS_PRIVATE_KEY); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index f9ebd4a..622b5d8 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -1,8 +1,7 @@ package com.nonsoolmate.nonsoolmateServer.external.aws.service; import com.nonsoolmate.nonsoolmateServer.external.aws.config.AWSConfig; -import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSException; -import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSExceptionType; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.*; import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; import java.time.Duration; import java.util.UUID; @@ -12,7 +11,6 @@ import org.springframework.stereotype.Service; import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.DeleteObjectRequest; -import software.amazon.awssdk.services.s3.model.GetUrlRequest; import software.amazon.awssdk.services.s3.model.HeadObjectRequest; import software.amazon.awssdk.services.s3.model.HeadObjectResponse; import software.amazon.awssdk.services.s3.model.S3Exception; @@ -67,11 +65,11 @@ public String validateURL(final String prefix, final String fileName) { HeadObjectResponse response = s3Client.headObject(request); if (response == null) { - throw new AWSException(AWSExceptionType.NOT_FOUND_SHEET_FILE_AWS_S3); + throw new AWSClientException(AWSExceptionType.NOT_FOUND_SHEET_FILE_AWS_S3); } return fileName; } catch (S3Exception e) { - throw new AWSException(AWSExceptionType.NOT_FOUND_SHEET_FILE_AWS_S3); + throw new AWSBusinessException(AWSExceptionType.AWS_S3_SERVICE_ERROR); } } @@ -85,7 +83,7 @@ public void deleteFile(final String prefix, final String fileName) { .build() ); } catch (S3Exception e) { - throw new AWSException(AWSExceptionType.DELETE_FILE_AWS_S3_FAIL); + throw new AWSBusinessException(AWSExceptionType.DELETE_FILE_AWS_S3_FAIL); } } } From b04766d112286a07f4bb89a3a6aa834ede3876ba Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 00:49:36 +0900 Subject: [PATCH 380/465] =?UTF-8?q?[DEL]=20=EC=A3=BC=EC=84=9D=20=ED=95=84?= =?UTF-8?q?=EA=B8=B0=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/GlobalExceptionHandler.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index ed9dc56..c9ddd3e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -28,15 +28,6 @@ protected ResponseEntity handleServerException(BusinessException .body(ErrorResponse.of(CommonErrorType.INTERNAL_SERVER_ERROR)); } - /* 500 ๋ฒˆ๋Œ€ ์—๋Ÿฌ์—๋„ ์ข…๋ฅ˜๊ฐ€์žˆ๋Š”๋ฐ ๋ฒ”์ฃผ๊ฐ€ ๋‚˜๋‰  ์ˆ˜ ์žˆ์Œ - ์ปจํ…Œ์ด๋„ˆ๊ฐ€ ๋–จ์–ด์ง -> ์š”์ฒญ์ด ์•ˆ๋“ค์–ด๊ฐ€ -> ์ด๋Ÿฐ๊ฑด ์„œ๋ฒ„๊ฐ€ ์ฃฝ์€๊ฑฐ๋‹ˆ๊นŒ ํด๋ผ๊ฐ€ ์ฒ˜๋ฆฌ๊ฐ€ ํ•ด์ฃผ์–ด์•ผํ•จ - ์ด๊ฑฐ์— ๋”ฐ๋ผ์„œ 503์ด๋Ÿฐ๊ฑฐ๋ฅผ ๋‚ด๋ ค์ค˜์„œ ์„œ๋ฒ„๊ฐ€ ์ง€๊ธˆ ์•ˆ๋œ๋‹ค๋ผ๋Š” ํŽ˜์ด์ง€๋ฅผ ๋„์šฐ๊ฑฐ๋‚˜ ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ค˜์•ผํ•จ - Service Unavailable - */ - /* ์„œ๋ฒ„ ์ž์ฒด๊ฐ€ ์ฃฝ์–ด๋ฒ„๋ฆฐ ๊ฒฝ์šฐ์—๋Š” Service Unavailable, ์„œ๋ฒ„์™€ ํ†ต์‹ ํ•˜๋Š” ์™ธ๋ถ€ ์„œ๋น„์Šค์— ๋ฌธ์ œ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ์—๋Š” 500 - S3์—์„œ ์žฅ์• ๊ฐ€ ๋‚œ ๊ฒฝ์šฐ์—๋Š” 500์„ ๋‚ด๋ ค์ฃผ๊ณ , ์„œ๋ฒ„ ์ž์ฒด๊ฐ€ ์ฃฝ์—ˆ์„ ๋•Œ์— ๋Œ€ํ•ด์„œ๋Š” nginx์—์„œ ์ฒ˜๋ฆฌ - */ - @ExceptionHandler({Exception.class}) protected ResponseEntity handleServerException(Exception ex) { log.error("๐Ÿšจ InternalException occurred: {} ๐Ÿšจ", ex.getMessage()); From f6511a8f1a9c1782d087f23854dac795c64b5094 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 00:53:26 +0900 Subject: [PATCH 381/465] =?UTF-8?q?[DEL]=20=EA=B3=B5=EB=B0=B1=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 --- .../nonsoolmateServer/global/error/GlobalExceptionHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index c9ddd3e..11754f1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -30,7 +30,7 @@ protected ResponseEntity handleServerException(BusinessException @ExceptionHandler({Exception.class}) protected ResponseEntity handleServerException(Exception ex) { - log.error("๐Ÿšจ InternalException occurred: {} ๐Ÿšจ", ex.getMessage()); + log.error("๐ŸšจInternalException occurred: {} ๐Ÿšจ", ex.getMessage()); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(ErrorResponse.of(CommonErrorType.INTERNAL_SERVER_ERROR)); } From 5e4bbf3840fdfe328aaddbe56d49c536924818de Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 01:26:25 +0900 Subject: [PATCH 382/465] =?UTF-8?q?[FIX]=20S3Service=EC=97=90=EC=84=9C=20C?= =?UTF-8?q?lientException=20=EC=B2=98=EB=A6=AC=ED=95=98=EB=8F=84=EB=A1=9D?= =?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 --- .../service/UniversityExamRecordService.java | 3 ++- .../nonsoolmateServer/external/aws/service/S3Service.java | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index d86cd5f..9066738 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -19,6 +19,7 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordException; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSBusinessException; +import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSClientException; import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; import lombok.RequiredArgsConstructor; @@ -83,7 +84,7 @@ public UniversityExamRecordIdResponse createUniversityExamRecord( universityexamRecord); decreaseMemberTicketCount(member); return UniversityExamRecordIdResponse.of(saveUniversityUniversityExamRecord.getUniversityExamRecordId()); - } catch (AWSBusinessException | MemberException e) { + } catch (AWSClientException | MemberException e) { throw e; } catch (RuntimeException e) { s3Service.deleteFile(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index 622b5d8..66c751c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -62,14 +62,10 @@ public String validateURL(final String prefix, final String fileName) { .bucket(bucketName) .key(zipUrl) .build(); - - HeadObjectResponse response = s3Client.headObject(request); - if (response == null) { - throw new AWSClientException(AWSExceptionType.NOT_FOUND_SHEET_FILE_AWS_S3); - } + s3Client.headObject(request); return fileName; } catch (S3Exception e) { - throw new AWSBusinessException(AWSExceptionType.AWS_S3_SERVICE_ERROR); + throw new AWSClientException(AWSExceptionType.NOT_FOUND_SHEET_FILE_AWS_S3); } } From 43a39ddc63b42a7a95cdc5981a4a6fe4019fcf08 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 03:18:21 +0900 Subject: [PATCH 383/465] =?UTF-8?q?[FIX]=20SwaggerConfig=EC=97=90=20https?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/swagger/config/SwaggerConfig.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java index 508bda6..5b753c0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java @@ -7,6 +7,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement; import io.swagger.v3.oas.annotations.security.SecurityScheme; import io.swagger.v3.oas.annotations.security.SecuritySchemes; +import io.swagger.v3.oas.annotations.servers.Server; import org.springframework.context.annotation.Configuration; @OpenAPIDefinition( @@ -16,6 +17,10 @@ security = { @SecurityRequirement(name = "Authorization"), @SecurityRequirement(name = "Authorization-refresh") + }, + servers = { + @Server(url = "http://localhost:8080", description = "local server"), + @Server(url = "https://api.nonsoolmate.com", description = "prd server") }) @SecuritySchemes({ @SecurityScheme(name = "Authorization", From 1ad59dd02a78aae921a85b45a4b6eb265585fedc Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:19:11 +0900 Subject: [PATCH 384/465] =?UTF-8?q?[ADD]=20xml=20ignore=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 --- nonsoolmateServer/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/.gitignore b/nonsoolmateServer/.gitignore index a50f4aa..510ce35 100644 --- a/nonsoolmateServer/.gitignore +++ b/nonsoolmateServer/.gitignore @@ -40,4 +40,5 @@ out/ *.yml *.yaml *.sql -*.pem \ No newline at end of file +*.pem +*.xml \ No newline at end of file From 0b52a6855ab64ad2411c5eab9be0db0b5a2e6c29 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:20:03 +0900 Subject: [PATCH 385/465] =?UTF-8?q?[FEAT]=20API=20Call=20util=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 --- .../global/util/ApiCallUtil.java | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/ApiCallUtil.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/ApiCallUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/ApiCallUtil.java new file mode 100644 index 0000000..a52d833 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/ApiCallUtil.java @@ -0,0 +1,35 @@ +package com.nonsoolmate.nonsoolmateServer.global.util; + +import com.nonsoolmate.nonsoolmateServer.external.discord.model.JsonObject; +import java.io.IOException; +import java.io.OutputStream; +import java.net.URL; +import javax.net.ssl.HttpsURLConnection; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class ApiCallUtil { + + public static void callDiscordAppenderPostAPI(String urlString, JsonObject json) throws IOException { + URL url = new URL(urlString); + HttpsURLConnection connection = (HttpsURLConnection)url.openConnection(); + connection.addRequestProperty("Content-Type", "application/json"); + connection.addRequestProperty("User-Agent", "Java-DiscordWebhook-BY-Gelox_"); + connection.setDoOutput(true); + connection.setRequestMethod("POST"); + + try (OutputStream stream = connection.getOutputStream()) { + stream.write(json.toString().getBytes()); + stream.flush(); + + connection.getInputStream().close(); + connection.disconnect(); + + } catch (IOException ioException) { + throw ioException; + } + } +} From dde5d9997e09db53d88b0de58ad974cc87b753eb Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:21:02 +0900 Subject: [PATCH 386/465] =?UTF-8?q?[FEAT]=20=EB=94=94=EC=8A=A4=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=A9=94=EC=84=B8=EC=A7=80=EB=A1=9C=20=EB=B3=B4?= =?UTF-8?q?=EB=82=BC=20=EA=B0=9D=EC=B2=B4=EB=93=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/discord/model/Author.java | 13 +++++ .../external/discord/model/Field.java | 13 +++++ .../external/discord/model/Footer.java | 12 ++++ .../external/discord/model/Image.java | 11 ++++ .../external/discord/model/JsonObject.java | 55 +++++++++++++++++++ .../external/discord/model/Thumbnail.java | 11 ++++ 6 files changed, 115 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Author.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Field.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Footer.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Image.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/JsonObject.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Thumbnail.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Author.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Author.java new file mode 100644 index 0000000..01e5157 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Author.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.model; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class Author { + + private final String name; + private final String url; + private final String iconUrl; +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Field.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Field.java new file mode 100644 index 0000000..7396b76 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Field.java @@ -0,0 +1,13 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.model; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class Field { + + private final String name; + private final String value; + private final boolean inline; +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Footer.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Footer.java new file mode 100644 index 0000000..d353acb --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Footer.java @@ -0,0 +1,12 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.model; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class Footer { + + private final String text; + private final String iconUrl; +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Image.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Image.java new file mode 100644 index 0000000..4851c94 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Image.java @@ -0,0 +1,11 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.model; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class Image { + + private final String url; +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/JsonObject.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/JsonObject.java new file mode 100644 index 0000000..9522978 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/JsonObject.java @@ -0,0 +1,55 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.model; + +import java.lang.reflect.Array; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.Set; + +public class JsonObject { + + private final HashMap discordMessageMap = new HashMap<>(); + + public void put(String key, Object value) { + if (value != null) { + discordMessageMap.put(key, value); + } + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + Set> entrySet = discordMessageMap.entrySet(); + builder.append("{"); + + int iter = 0; + for (Entry entry : entrySet) { + Object val = entry.getValue(); + builder.append(quote(entry.getKey())).append(":"); + + if (val instanceof String) { + builder.append(quote(String.valueOf(val))); + } else if (val instanceof Integer) { + builder.append(Integer.valueOf(String.valueOf(val))); + } else if (val instanceof Boolean) { + builder.append(val); + } else if (val instanceof JsonObject) { + builder.append(val); + } else if (val.getClass().isArray()) { + builder.append("["); + int len = Array.getLength(val); + for (int j = 0; j < len; j++) { + builder.append(Array.get(val, j).toString()).append(j != len - 1 ? "," : ""); + } + builder.append("]"); + } + + builder.append(++iter == entrySet.size() ? "}" : ","); + } + + return builder.toString(); + } + + private String quote(String string) { + return "\"" + string + "\""; + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Thumbnail.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Thumbnail.java new file mode 100644 index 0000000..aa9a8fb --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/Thumbnail.java @@ -0,0 +1,11 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.model; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public class Thumbnail { + + private final String url; +} From 67b7af3db4e8b4605032e01afb24b0ecc2a9afa4 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:21:23 +0900 Subject: [PATCH 387/465] =?UTF-8?q?[FEAT]=20StringUtil=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/util/StringUtil.java | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/StringUtil.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/StringUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/StringUtil.java new file mode 100644 index 0000000..0208b2d --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/StringUtil.java @@ -0,0 +1,85 @@ +package com.nonsoolmate.nonsoolmateServer.global.util; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class StringUtil { + + public static String translateEscapes(String str) { + if (str.isEmpty()) { + return ""; + } + char[] chars = str.toCharArray(); + int length = chars.length; + int from = 0; + int to = 0; + while (from < length) { + char ch = chars[from++]; + if (ch == '\\') { + ch = from < length ? chars[from++] : '\0'; + switch (ch) { + case 'b': + ch = '\b'; + break; + case 'f': + ch = '\f'; + break; + case 'n': + ch = '\n'; + break; + case 'r': + ch = '\r'; + break; + case 's': + ch = ' '; + break; + case 't': + ch = '\t'; + break; + case '\'': + case '\"': + case '\\': + // as is + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + int limit = Integer.min(from + (ch <= '3' ? 2 : 1), length); + int code = ch - '0'; + while (from < limit) { + ch = chars[from]; + if (ch < '0' || '7' < ch) { + break; + } + from++; + code = (code << 3) | (ch - '0'); + } + ch = (char)code; + break; + case '\n': + continue; + case '\r': + if (from < length && chars[from] == '\n') { + from++; + } + continue; + default: { + String msg = String.format( + "Invalid escape sequence: \\%c \\\\u%04X", + ch, (int)ch); + throw new IllegalArgumentException(msg); + } + } + } + + chars[to++] = ch; + } + return new String(chars, 0, to); + } +} From 54a6b63a68e2102ab5a4f7ecad708eea808b003d Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:22:35 +0900 Subject: [PATCH 388/465] =?UTF-8?q?[ADD]=20=EB=94=94=EC=8A=A4=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EA=B4=80=EB=A0=A8=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 --- nonsoolmateServer/build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/build.gradle b/nonsoolmateServer/build.gradle index e2a4c9a..c443c47 100644 --- a/nonsoolmateServer/build.gradle +++ b/nonsoolmateServer/build.gradle @@ -13,6 +13,7 @@ java { repositories { mavenCentral() + maven { url 'https://jitpack.io' } } dependencies { @@ -62,6 +63,9 @@ dependencies { // Health Check implementation 'org.springframework.boot:spring-boot-starter-actuator' + // discord + implementation('com.github.napstr:logback-discord-appender:1.0.0') + // test testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' From 0e54c7347e7d2673324b2f859f483bcf1b865d33 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:24:28 +0900 Subject: [PATCH 389/465] =?UTF-8?q?[FEAT]=20Body=20=EC=B6=94=EC=B6=9C?= =?UTF-8?q?=EC=9D=84=20=EC=9C=84=ED=95=9C=20Filter=20=EB=B0=8F=20=ED=81=B4?= =?UTF-8?q?=EB=9E=98=EC=8A=A4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filter/CachedBodyRequestWrapper.java | 36 +++++++++++++++ .../filter/CachedBodyServletInputStream.java | 44 +++++++++++++++++++ .../logging/filter/ServletWrappingFilter.java | 20 +++++++++ 3 files changed, 100 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/CachedBodyRequestWrapper.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/CachedBodyServletInputStream.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/ServletWrappingFilter.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/CachedBodyRequestWrapper.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/CachedBodyRequestWrapper.java new file mode 100644 index 0000000..e91a6d8 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/CachedBodyRequestWrapper.java @@ -0,0 +1,36 @@ +package com.nonsoolmate.nonsoolmateServer.global.logging.filter; + +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import org.springframework.util.StreamUtils; + +public class CachedBodyRequestWrapper extends HttpServletRequestWrapper { + + private final byte[] cachedBody; + + public CachedBodyRequestWrapper(HttpServletRequest request) throws IOException { + super(request); + this.cachedBody = StreamUtils.copyToByteArray(request.getInputStream()); + } + + @Override + public ServletInputStream getInputStream() { + return new CachedBodyServletInputStream(this.cachedBody); + } + + @Override + public BufferedReader getReader() { + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(this.cachedBody); + return new BufferedReader(new InputStreamReader(byteArrayInputStream)); + } + + + public String getBody() { + return new String(cachedBody); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/CachedBodyServletInputStream.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/CachedBodyServletInputStream.java new file mode 100644 index 0000000..7cec327 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/CachedBodyServletInputStream.java @@ -0,0 +1,44 @@ +package com.nonsoolmate.nonsoolmateServer.global.logging.filter; + +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class CachedBodyServletInputStream extends ServletInputStream { + + private final InputStream cachedBodyInputStream; + + public CachedBodyServletInputStream(byte[] cachedBody) { + this.cachedBodyInputStream = new ByteArrayInputStream(cachedBody); + } + + @Override + public boolean isFinished() { + // ํ˜„์žฌ ์ฝ์„ ์ˆ˜ ์žˆ๋Š” Byte ์ˆ˜๊ฐ€ 0์ด๋ผ๋ฉด True๋ฅผ ๋ฐ˜ํ™˜ + try { + return cachedBodyInputStream.available() == 0; + } catch (IOException e) { + log.error("cachedBodyInputStream.available ์‹คํŒจ"); + } + return false; + } + + @Override + public boolean isReady() { + return true; + } + + @Override + public void setReadListener(ReadListener listener) { + throw new UnsupportedOperationException(); + } + + @Override + public int read() throws IOException { + return cachedBodyInputStream.read(); + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/ServletWrappingFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/ServletWrappingFilter.java new file mode 100644 index 0000000..266d84f --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/ServletWrappingFilter.java @@ -0,0 +1,20 @@ +package com.nonsoolmate.nonsoolmateServer.global.logging.filter; + +import com.nonsoolmate.nonsoolmateServer.global.logging.filter.CachedBodyRequestWrapper; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.filter.OncePerRequestFilter; + +@Slf4j +public class ServletWrappingFilter extends OncePerRequestFilter { + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws ServletException, IOException { + CachedBodyRequestWrapper cachedBodyRequestWrapper = new CachedBodyRequestWrapper(request); + filterChain.doFilter(cachedBodyRequestWrapper, response); + } +} From e93c8c8c59104fbad2e6fac14e7a90243b1f3a05 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:24:46 +0900 Subject: [PATCH 390/465] =?UTF-8?q?[FEAT]=20=EB=94=94=EC=8A=A4=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=9B=B9=ED=9B=85=20=EA=B0=9D=EC=B2=B4=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/discord/DiscordWebHook.java | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordWebHook.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordWebHook.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordWebHook.java new file mode 100644 index 0000000..16d346e --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordWebHook.java @@ -0,0 +1,150 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord; + +import static com.nonsoolmate.nonsoolmateServer.external.discord.exception.ErrorLogAppenderExceptionType.DISCORD_LOG_APPENDER_ERROR; + +import com.nonsoolmate.nonsoolmateServer.external.discord.exception.ErrorLogAppenderException; +import com.nonsoolmate.nonsoolmateServer.external.discord.model.Author; +import com.nonsoolmate.nonsoolmateServer.external.discord.model.EmbedObject; +import com.nonsoolmate.nonsoolmateServer.external.discord.model.Field; +import com.nonsoolmate.nonsoolmateServer.external.discord.model.Footer; +import com.nonsoolmate.nonsoolmateServer.external.discord.model.Image; +import com.nonsoolmate.nonsoolmateServer.external.discord.model.JsonObject; +import com.nonsoolmate.nonsoolmateServer.external.discord.model.Thumbnail; +import com.nonsoolmate.nonsoolmateServer.global.util.ApiCallUtil; +import java.awt.Color; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class DiscordWebHook { + + private final String urlString; + private final List embeds = new ArrayList<>(); + private String username; + private String avatarUrl; + private boolean tts; + + public DiscordWebHook(String urlString, String username, String avatarUrl, boolean tts) { + this.urlString = urlString; + this.username = username; + this.avatarUrl = avatarUrl; + this.tts = tts; + } + + public void addEmbed(EmbedObject embed) { + this.embeds.add(embed); + } + + public void execute() throws IOException { + if (this.embeds.isEmpty()) { + throw new RuntimeException("์ปจํ…์ธ ๋ฅผ ์„ค์ •ํ•˜๊ฑฐ๋‚˜ ํ•˜๋‚˜ ์ด์ƒ์˜ Embed Object๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค."); + } + + try { + ApiCallUtil.callDiscordAppenderPostAPI( + this.urlString, createDiscordEmbedObject( + this.embeds, initializerDiscordSendForJsonObject(new JsonObject()) + )); + + } catch (IOException ioException) { + throw ioException; + } + } + + private JsonObject initializerDiscordSendForJsonObject(JsonObject json) { + json.put("username", this.username); + json.put("avatar_url", this.avatarUrl); + json.put("tts", this.tts); + return json; + } + + private JsonObject createDiscordEmbedObject(List embeds, JsonObject json) { + if (embeds.isEmpty()) { + throw new ErrorLogAppenderException(DISCORD_LOG_APPENDER_ERROR); + } + + List embedObjects = new ArrayList<>(); + + for (EmbedObject embed : embeds) { + JsonObject jsonEmbed = new JsonObject(); + + jsonEmbed.put("title", embed.getTitle()); + jsonEmbed.put("description", embed.getDescription()); + jsonEmbed.put("url", embed.getUrl()); + + processDiscordEmbedColor(embed, jsonEmbed); + processDiscordEmbedFooter(embed.getFooter(), jsonEmbed); + processDiscordEmbedImage(embed.getImage(), jsonEmbed); + processDiscordEmbedThumbnail(embed.getThumbnail(), jsonEmbed); + processDiscordEmbedAuthor(embed.getAuthor(), jsonEmbed); + processDiscordEmbedMessageFields(embed.getFields(), jsonEmbed); + + embedObjects.add(jsonEmbed); + } + json.put("embeds", embedObjects.toArray()); + + return json; + } + + private void processDiscordEmbedColor(EmbedObject embed, JsonObject jsonEmbed) { + if (embed.getColor() != null) { + Color color = embed.getColor(); + int rgb = color.getRed(); + rgb = (rgb << 8) + color.getGreen(); + rgb = (rgb << 8) + color.getBlue(); + + jsonEmbed.put("color", rgb); + } + } + + private void processDiscordEmbedFooter(Footer footer, JsonObject jsonEmbed) { + if (footer != null) { + JsonObject jsonFooter = new JsonObject(); + jsonFooter.put("text", footer.getText()); + jsonFooter.put("icon_url", footer.getIconUrl()); + jsonEmbed.put("footer", jsonFooter); + } + } + + private void processDiscordEmbedImage(Image image, JsonObject jsonEmbed) { + if (image != null) { + JsonObject jsonImage = new JsonObject(); + jsonImage.put("url", image.getUrl()); + jsonEmbed.put("image", jsonImage); + } + } + + private void processDiscordEmbedThumbnail(Thumbnail thumbnail, JsonObject jsonEmbed) { + if (thumbnail != null) { + JsonObject jsonThumbnail = new JsonObject(); + jsonThumbnail.put("url", thumbnail.getUrl()); + jsonEmbed.put("thumbnail", jsonThumbnail); + } + } + + private void processDiscordEmbedAuthor(Author author, JsonObject jsonEmbed) { + if (author != null) { + JsonObject jsonAuthor = new JsonObject(); + jsonAuthor.put("name", author.getName()); + jsonAuthor.put("url", author.getUrl()); + jsonAuthor.put("icon_url", author.getIconUrl()); + jsonEmbed.put("author", jsonAuthor); + } + } + + private void processDiscordEmbedMessageFields(List fields, JsonObject jsonEmbed) { + List jsonFields = new ArrayList<>(); + + for (Field field : fields) { + JsonObject jsonField = new JsonObject(); + + jsonField.put("name", field.getName()); + jsonField.put("value", field.getValue()); + jsonField.put("inline", field.isInline()); + + jsonFields.add(jsonField); + } + + jsonEmbed.put("fields", jsonFields.toArray()); + } +} From 1e29db34b711a5a91432e3359af3c8748ee2701e Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:25:31 +0900 Subject: [PATCH 391/465] =?UTF-8?q?[FEAT]=20=EB=94=94=EC=8A=A4=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20appender=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/discord/DiscordAppender.java | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordAppender.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordAppender.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordAppender.java new file mode 100644 index 0000000..0f9e67b --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordAppender.java @@ -0,0 +1,116 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord; + +import static com.nonsoolmate.nonsoolmateServer.external.discord.exception.ErrorLogAppenderExceptionType.DISCORD_LOG_APPENDER_ERROR; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.classic.spi.IThrowableProxy; +import ch.qos.logback.classic.spi.ThrowableProxyUtil; +import ch.qos.logback.core.UnsynchronizedAppenderBase; +import com.nonsoolmate.nonsoolmateServer.external.discord.exception.ErrorLogAppenderException; +import com.nonsoolmate.nonsoolmateServer.global.util.MDCUtil; +import com.nonsoolmate.nonsoolmateServer.global.util.StringUtil; +import io.micrometer.core.instrument.util.StringEscapeUtils; +import com.nonsoolmate.nonsoolmateServer.external.discord.model.EmbedObject; +import java.awt.Color; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Map; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Setter +public class DiscordAppender extends UnsynchronizedAppenderBase { + + private String discordWebhookUrl; + private String username; + private String avatarUrl; + + private static Color getLevelColor(ILoggingEvent eventObject) { + String level = eventObject.getLevel().levelStr; + if (level.equals("WARN")) { + return Color.yellow; + } else if (level.equals("ERROR")) { + return Color.red; + } + + return Color.blue; + } + + @Override + protected void append(ILoggingEvent eventObject) { + DiscordWebHook discordWebhook = new DiscordWebHook(discordWebhookUrl, username, avatarUrl, false); + Map mdcPropertyMap = eventObject.getMDCPropertyMap(); + Color messageColor = getLevelColor(eventObject); + + String level = eventObject.getLevel().levelStr; + String exceptionBrief = ""; + String exceptionDetail = ""; + IThrowableProxy throwable = eventObject.getThrowableProxy(); + + log.info("{}", eventObject.getMessage()); + + if (throwable != null) { + exceptionBrief = throwable.getClassName() + ": " + throwable.getMessage(); + } + + if (exceptionBrief.equals("")) { + exceptionBrief = "EXCEPTION ์ •๋ณด๊ฐ€ ๋‚จ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค."; + } + + discordWebhook.addEmbed(new EmbedObject() + .setTitle("[" + level + " - ๋ฌธ์ œ ๊ฐ„๋žต ๋‚ด์šฉ]") + .setColor(messageColor) + .setDescription(exceptionBrief) + .addField("[" + "Exception Level" + "]", + StringEscapeUtils.escapeJson(level), + true) + .addField("[๋ฌธ์ œ ๋ฐœ์ƒ ์‹œ๊ฐ]", + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), + false) + .addField( + "[" + MDCUtil.REQUEST_URI_MDC + "]", + StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.REQUEST_URI_MDC)), + false) + .addField( + "[" + MDCUtil.USER_IP_MDC + "]", + StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.USER_IP_MDC)), + false) + .addField( + "[" + MDCUtil.HEADER_MAP_MDC + "]", + StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.HEADER_MAP_MDC).replaceAll("[\\{\\{\\}]", "")), + true) + .addField( + "[" + MDCUtil.USER_REQUEST_COOKIES + "]", + StringEscapeUtils.escapeJson( + mdcPropertyMap.get(MDCUtil.USER_REQUEST_COOKIES).replaceAll("[\\{\\{\\}]", "")), + false) + .addField( + "[" + MDCUtil.PARAMETER_MAP_MDC + "]", + StringEscapeUtils.escapeJson( + mdcPropertyMap.get(MDCUtil.PARAMETER_MAP_MDC).replaceAll("[\\{\\{\\}]", "")), + false) + .addField("[" + MDCUtil.BODY_MDC + "]", + StringEscapeUtils.escapeJson(StringUtil.translateEscapes(mdcPropertyMap.get(MDCUtil.BODY_MDC))), + false) + ); + + if (throwable != null) { + exceptionDetail = ThrowableProxyUtil.asString(throwable); + String exception = exceptionDetail.substring(0, 4000); + discordWebhook.addEmbed( + new EmbedObject() + .setTitle("[Exception ์ƒ์„ธ ๋‚ด์šฉ]") + .setColor(messageColor) + .setDescription(StringEscapeUtils.escapeJson(exception)) + ); + } + + try { + discordWebhook.execute(); + } catch (IOException ioException) { + throw new ErrorLogAppenderException(DISCORD_LOG_APPENDER_ERROR); + } + } +} \ No newline at end of file From 4215362fc498f48769c73f558697e569a3a2e087 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:25:47 +0900 Subject: [PATCH 392/465] =?UTF-8?q?[FEAT]=20=EB=94=94=EC=8A=A4=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=A9=94=EC=84=B8=EC=A7=80=EC=97=90=20=EB=93=A4?= =?UTF-8?q?=EC=96=B4=EA=B0=88=20=EA=B0=9D=EC=B2=B4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/discord/model/EmbedObject.java | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/EmbedObject.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/EmbedObject.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/EmbedObject.java new file mode 100644 index 0000000..3a86962 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/model/EmbedObject.java @@ -0,0 +1,133 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.model; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; + +public class EmbedObject { + /** + * Discord Embed Message์— ๋“ค์–ด๊ฐˆ Message ๋‚ด์šฉ List + */ + private final List fields = new ArrayList<>(); + + /** + * Discord Embed Message ์ œ๋ชฉ + */ + private String title; + + /** + * Discord Embed Message ์ƒ์„ธ ๋‚ด์šฉ + */ + private String description; + + /** + * Discord Embed Message URL ํ˜•์‹ + */ + private String url; + + /** + * Discord Embed Message ๊ฒ‰ ์ƒ‰๊น” + */ + private Color color; + + /** + * Discord Embed Message ๋ฐ”๋‹ฅ๊ธ€ + */ + private Footer footer; + + /** + * Discord Embed Message ์ธ๋„ค์ผ + */ + private Thumbnail thumbnail; + + /** + * Discord Embed Message ์‚ฌ์ง„ + */ + private Image image; + + /** + * Discord Embed Message ์ž‘์„ฑ์ž + */ + private Author author; + + public String getTitle() { + return title; + } + + public EmbedObject setTitle(String title) { + this.title = title; + return this; + } + + public String getDescription() { + return description; + } + + public EmbedObject setDescription(String description) { + this.description = description; + return this; + } + + public String getUrl() { + return url; + } + + public EmbedObject setUrl(String url) { + this.url = url; + return this; + } + + public Color getColor() { + return color; + } + + public EmbedObject setColor(Color color) { + this.color = color; + return this; + } + + public Footer getFooter() { + return footer; + } + + public Thumbnail getThumbnail() { + return thumbnail; + } + + public EmbedObject setThumbnail(String url) { + this.thumbnail = new Thumbnail(url); + return this; + } + + public Image getImage() { + return image; + } + + public EmbedObject setImage(String url) { + this.image = new Image(url); + return this; + } + + public Author getAuthor() { + return author; + } + + public List getFields() { + return fields; + } + + public EmbedObject setFooter(String text, String icon) { + this.footer = new Footer(text, icon); + return this; + } + + public EmbedObject setAuthor(String name, String url, String icon) { + this.author = new Author(name, url, icon); + return this; + } + + public EmbedObject addField(String name, String value, boolean inline) { + this.fields.add(new Field(name, value, inline)); + return this; + } +} From a2cf846520991aa3fea43d2717ba45d55d6292f8 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:26:14 +0900 Subject: [PATCH 393/465] =?UTF-8?q?[FEAT]=20=EB=A1=9C=EA=B9=85=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=EB=90=9C=20=ED=95=84=ED=84=B0=20config=EC=97=90=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 --- .../global/logging/FilterConfig.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/FilterConfig.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/FilterConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/FilterConfig.java new file mode 100644 index 0000000..b8c90f5 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/FilterConfig.java @@ -0,0 +1,28 @@ +package com.nonsoolmate.nonsoolmateServer.global.logging; + +import com.nonsoolmate.nonsoolmateServer.global.logging.filter.MDCFilter; +import com.nonsoolmate.nonsoolmateServer.global.logging.filter.ServletWrappingFilter; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; + +@Profile("!local") +@Configuration +public class FilterConfig { + @Bean + public FilterRegistrationBean secondFilter() { + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean<>( + new ServletWrappingFilter()); + filterRegistrationBean.setOrder(0); + return filterRegistrationBean; + } + + @Bean + public FilterRegistrationBean thirdFilter() { + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean<>( + new MDCFilter()); + filterRegistrationBean.setOrder(1); + return filterRegistrationBean; + } +} From 35138abb854d33cb3e5f15f5b86a2c80a9b4a2e7 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:26:35 +0900 Subject: [PATCH 394/465] =?UTF-8?q?[FEAT]=20Appender=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=20=ED=81=B4=EB=9E=98=EC=8A=A4=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 --- .../discord/exception/ErrorLogAppenderException.java | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderException.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderException.java new file mode 100644 index 0000000..e561e3f --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderException.java @@ -0,0 +1,11 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.exception; + + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; + +public class ErrorLogAppenderException extends BusinessException { + public ErrorLogAppenderException(BusinessExceptionType exceptionType) { + super(exceptionType); + } +} From 5431ccae3a00011cfb70c9dac275d409899ab405 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:26:45 +0900 Subject: [PATCH 395/465] =?UTF-8?q?[FEAT]=20Appender=20=EC=98=88=EC=99=B8?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=20enum=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ErrorLogAppenderExceptionType.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderExceptionType.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderExceptionType.java new file mode 100644 index 0000000..1c4c4a9 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderExceptionType.java @@ -0,0 +1,26 @@ +package com.nonsoolmate.nonsoolmateServer.external.discord.exception; + +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; + +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) +public enum ErrorLogAppenderExceptionType implements BusinessExceptionType { + INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์•Œ ์ˆ˜ ์—†๋Š” ์„œ๋ฒ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"), + DISCORD_LOG_APPENDER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "๋””์Šค์ฝ”๋“œ ๋กœ๊ทธ ์ „์†ก์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค"), + API_CALL_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์™ธ๋ถ€ API CALL์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + + private final HttpStatus status; + private final String message; + + @Override + public HttpStatus status() { + return this.status; + } + + @Override + public String message() { + return this.message; + } +} From 34fc981b23a4eba4a66f7fa389d7d8ea7aa36c03 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:27:07 +0900 Subject: [PATCH 396/465] =?UTF-8?q?[FEAT]=20request=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=20=EC=B6=94=EC=B6=9C=ED=95=98=EB=8A=94=20util=20=ED=81=B4?= =?UTF-8?q?=EB=9E=98=EC=8A=A4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/util/HttpRequestUtil.java | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/HttpRequestUtil.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/HttpRequestUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/HttpRequestUtil.java new file mode 100644 index 0000000..edfa860 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/HttpRequestUtil.java @@ -0,0 +1,87 @@ +package com.nonsoolmate.nonsoolmateServer.global.util; + +import com.nonsoolmate.nonsoolmateServer.global.logging.filter.CachedBodyRequestWrapper; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.WebUtils; + +@Slf4j +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class HttpRequestUtil { + + public static String getRequestUri(HttpServletRequest request) { + return request.getRequestURI(); + } + + public static Map getHeaderMap(HttpServletRequest request) { + Map headerMap = new HashMap<>(); + request.getHeaderNames().asIterator() + .forEachRemaining(name -> { + if (!name.equals("user-agent")) { + headerMap.put(name, request.getHeader(name)); + } + }); + return headerMap; + } + + public static Map getParamMap(HttpServletRequest request) { + Map paramMap = new HashMap<>(); + request.getParameterNames().asIterator() + .forEachRemaining(name -> paramMap.put(name, request.getParameter(name))); + + return paramMap; + } + + public static String getBody(HttpServletRequest httpReq) { + CachedBodyRequestWrapper nativeRequest = WebUtils.getNativeRequest(httpReq, CachedBodyRequestWrapper.class); + + if (nativeRequest != null) { + return nativeRequest.getBody(); + } + return "requestBody ์ •๋ณด ์—†์Œ"; + } + + public static String getUserIP(HttpServletRequest httpReq) { + String ip = httpReq.getHeader("X-Forwarded-For"); + if (ip == null) + ip = httpReq.getRemoteAddr(); + + return ip; + } + + public static Map getUserLocation(HttpServletRequest request) { + Map locationMap = new HashMap<>(); + String userIP = getUserIP(request); + + String locationFindAPIUrl = "https://ipapi.co/" + userIP + "/json/"; + + RestTemplate restTemplate = new RestTemplate(); + String response = restTemplate.getForObject(locationFindAPIUrl, String.class); + + String[] locationEntity = Objects.requireNonNull(response).split(","); + + for (String entity : locationEntity) { + String[] element = entity.split(":"); + if (element.length == 2) { + locationMap.put( + element[0].replace(" ", "").replace("\n", "").replace("{", "").replace("}", "").replace("\"", ""), + element[1].replace(" ", "").replace("\"", "")); + } else { + locationMap.put("languages", entity); + } + } + + return locationMap; + } + + public static Cookie[] getUserCookies(HttpServletRequest httpReq) { + return httpReq.getCookies(); + } +} From 48ebf2942b91c945fa92147e373065fa2b9ce478 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 02:28:25 +0900 Subject: [PATCH 397/465] =?UTF-8?q?[FEAT]=20=EB=A9=94=EC=84=B8=EC=A7=80=20?= =?UTF-8?q?=EB=A7=A4=ED=95=91=EC=9D=84=20=EC=9C=84=ED=95=9C=20MDC=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/logging/filter/MDCFilter.java | 38 ++++++++++++++++ .../global/util/MDCUtil.java | 43 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/MDCFilter.java create mode 100644 nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/MDCUtil.java diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/MDCFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/MDCFilter.java new file mode 100644 index 0000000..571d3da --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/MDCFilter.java @@ -0,0 +1,38 @@ +package com.nonsoolmate.nonsoolmateServer.global.logging.filter; + +import com.nonsoolmate.nonsoolmateServer.global.util.HttpRequestUtil; +import com.nonsoolmate.nonsoolmateServer.global.util.MDCUtil; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Objects; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; +import org.springframework.web.filter.OncePerRequestFilter; +import org.springframework.web.util.WebUtils; + +@Slf4j +@RequiredArgsConstructor +@Component +public class MDCFilter extends OncePerRequestFilter { + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) + throws ServletException, IOException { + + HttpServletRequest httpReq = WebUtils.getNativeRequest(request, HttpServletRequest.class); + + MDCUtil.setJsonValue(MDCUtil.REQUEST_URI_MDC, HttpRequestUtil.getRequestUri(Objects.requireNonNull(httpReq))); + MDCUtil.setJsonValue(MDCUtil.USER_IP_MDC, HttpRequestUtil.getUserIP(Objects.requireNonNull(httpReq))); + MDCUtil.setJsonValue(MDCUtil.HEADER_MAP_MDC, HttpRequestUtil.getHeaderMap(httpReq)); + MDCUtil.setJsonValue(MDCUtil.USER_REQUEST_COOKIES, HttpRequestUtil.getUserCookies(httpReq)); + MDCUtil.setJsonValue(MDCUtil.PARAMETER_MAP_MDC, HttpRequestUtil.getParamMap(httpReq)); + MDCUtil.setJsonValue(MDCUtil.BODY_MDC, HttpRequestUtil.getBody(httpReq)); + + filterChain.doFilter(request, response); + + } +} diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/MDCUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/MDCUtil.java new file mode 100644 index 0000000..a2804a8 --- /dev/null +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/MDCUtil.java @@ -0,0 +1,43 @@ +package com.nonsoolmate.nonsoolmateServer.global.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.slf4j.MDC; +import org.slf4j.spi.MDCAdapter; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class MDCUtil { + + public static final String REQUEST_URI_MDC = "์ด์šฉ์ž ์š”์ฒญ URI ์ •๋ณด"; + public static final String USER_IP_MDC = "์ด์šฉ์ž IP ์ •๋ณด"; + public static final String USER_REQUEST_COOKIES = "์ด์šฉ์ž Cookie ์ •๋ณด"; + public static final String HEADER_MAP_MDC = "HTTP ํ—ค๋” ์ •๋ณด"; + public static final String PARAMETER_MAP_MDC = "Parameter ์ •๋ณด"; + public static final String BODY_MDC = "HTTP Body ์ •๋ณด"; + private static final ObjectMapper objectMapper = new ObjectMapper(); + private static final MDCAdapter mdc = MDC.getMDCAdapter(); + + public static void set(String key, String value) { + mdc.put(key, value); + } + + public static void setJsonValue(String key, Object value) throws JsonProcessingException { + try { + if (value != null) { + String json = objectMapper.writerWithDefaultPrettyPrinter() + .writeValueAsString(value); + mdc.put(key, json); + } else { + mdc.put(key, "๋‚ด์šฉ ์—†์Œ"); + } + } catch (JsonProcessingException ex) { + throw ex; + } + } + + public static void clear() { + MDC.clear(); + } +} From ba81675fce27241c0b46b916b49c603a33f44938 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 03:24:28 +0900 Subject: [PATCH 398/465] =?UTF-8?q?[CHORE]=20=EC=98=88=EC=99=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B8=ED=95=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/discord/exception/ErrorLogAppenderException.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderException.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderException.java index e561e3f..f554952 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderException.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderException.java @@ -2,10 +2,10 @@ import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; public class ErrorLogAppenderException extends BusinessException { - public ErrorLogAppenderException(BusinessExceptionType exceptionType) { + public ErrorLogAppenderException(ExceptionType exceptionType) { super(exceptionType); } } From e00fcd2c9d8ea7021924ad12972c0a8a5b98298f Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 03:25:19 +0900 Subject: [PATCH 399/465] =?UTF-8?q?[CHORE]=20=EC=98=88=EC=99=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B8=ED=95=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../discord/exception/ErrorLogAppenderExceptionType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderExceptionType.java index 1c4c4a9..cf5d391 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/exception/ErrorLogAppenderExceptionType.java @@ -1,12 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.external.discord.exception; -import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessExceptionType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.ExceptionType; import lombok.AccessLevel; import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; @RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public enum ErrorLogAppenderExceptionType implements BusinessExceptionType { +public enum ErrorLogAppenderExceptionType implements ExceptionType { INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์•Œ ์ˆ˜ ์—†๋Š” ์„œ๋ฒ„ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค"), DISCORD_LOG_APPENDER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "๋””์Šค์ฝ”๋“œ ๋กœ๊ทธ ์ „์†ก์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค"), API_CALL_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, "์™ธ๋ถ€ API CALL์— ์‹คํŒจํ•˜์˜€์Šต๋‹ˆ๋‹ค."); From 6be047e111d8b01b2106d2fa53dc836277c4f1f2 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 03:25:35 +0900 Subject: [PATCH 400/465] =?UTF-8?q?[CHORE]=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EC=B6=94=EC=B6=9C=EC=9D=84=20=EC=9C=84=ED=95=9C=20=EC=9E=91?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/GlobalExceptionHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index 11754f1..6f2e78d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -23,14 +23,14 @@ protected ResponseEntity handleCustomException(ClientException ex @ExceptionHandler({BusinessException.class}) protected ResponseEntity handleServerException(BusinessException ex) { - log.error("๐ŸšจBusinessException occurred: {} ๐Ÿšจ", ex.getMessage()); + log.error("๐ŸšจBusinessException occurred: {} ๐Ÿšจ", ex); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(ErrorResponse.of(CommonErrorType.INTERNAL_SERVER_ERROR)); } @ExceptionHandler({Exception.class}) protected ResponseEntity handleServerException(Exception ex) { - log.error("๐ŸšจInternalException occurred: {} ๐Ÿšจ", ex.getMessage()); + log.error("๐ŸšจInternalException occurred: {} ๐Ÿšจ", ex); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) .body(ErrorResponse.of(CommonErrorType.INTERNAL_SERVER_ERROR)); } From 360508716d37844dd661e6c0d18008296c360859 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 05:04:51 +0900 Subject: [PATCH 401/465] =?UTF-8?q?[FIX]=20corsFilter=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index f92912e..67a7936 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -15,6 +15,9 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -72,6 +75,20 @@ public void addCorsMappings(CorsRegistry registry) { }; } + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + config.addAllowedOrigin("*"); + config.addAllowedHeader("*"); + config.addAllowedMethod("*"); + + source.registerCorsConfiguration("/v3/api-docs", config); + return new CorsFilter(source); + } + @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { From 2483e49e0777f335bf670a5c28444fc7be7ef5fc Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 05:09:35 +0900 Subject: [PATCH 402/465] =?UTF-8?q?[DEL]=20=EC=A3=BC=EC=84=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 67a7936..0928a3f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -29,16 +29,13 @@ public class SecurityConfig { private static final String[] AUTH_WHITELIST = { "/", "/error", "/webjars/**", - // Swagger "/swagger-resources/**", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**", - // Authentication "/auth/**", "/login/**","/authTest", - // client "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**", "/actuator/health" }; @@ -54,8 +51,6 @@ public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthenticationFilter; private final JwtExceptionFilter jwtExceptionFilter; - - //cors ์—๋Ÿฌ๋ฅผ ๋Œ€์‘ํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”์†Œ๋“œ @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @@ -104,15 +99,12 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { frameOptionsConfig.disable() ) ) - // .userDetailsService(memberAuthService) ; - //== URL๋ณ„ ๊ถŒํ•œ ๊ด€๋ฆฌ ์˜ต์…˜ ==// http.authorizeHttpRequests(auth -> { auth.requestMatchers(AUTH_WHITELIST).permitAll(); auth.anyRequest().authenticated(); }) - // ์›๋ž˜ ์Šคํ”„๋ง ์‹œํ๋ฆฌํ‹ฐ ํ•„ํ„ฐ ์ˆœ์„œ๊ฐ€ LogoutFilter ์ดํ›„์— ๋กœ๊ทธ์ธ ํ•„ํ„ฐ ๋™์ž‘ .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); From 23bdb368901c911005954e42763d15c50e1ae3f8 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 05:51:15 +0900 Subject: [PATCH 403/465] =?UTF-8?q?[DEL]=20corsFilter=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 0928a3f..ca1e1c0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -16,11 +16,15 @@ import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import java.util.Arrays; +import java.util.List; + @Configuration @EnableWebSecurity @RequiredArgsConstructor @@ -70,20 +74,6 @@ public void addCorsMappings(CorsRegistry registry) { }; } - @Bean - public CorsFilter corsFilter() { - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - - CorsConfiguration config = new CorsConfiguration(); - config.setAllowCredentials(true); - config.addAllowedOrigin("*"); - config.addAllowedHeader("*"); - config.addAllowedMethod("*"); - - source.registerCorsConfiguration("/v3/api-docs", config); - return new CorsFilter(source); - } - @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { From cb787b55c88ecafd355910e17ab43708eed8baf2 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 15:19:20 +0900 Subject: [PATCH 404/465] =?UTF-8?q?[CHORE]=20xml=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/.gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nonsoolmateServer/.gitignore b/nonsoolmateServer/.gitignore index 510ce35..a50f4aa 100644 --- a/nonsoolmateServer/.gitignore +++ b/nonsoolmateServer/.gitignore @@ -40,5 +40,4 @@ out/ *.yml *.yaml *.sql -*.pem -*.xml \ No newline at end of file +*.pem \ No newline at end of file From c4edc20f01ed4cb15d00a507afca38fafb02048c Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 15:19:58 +0900 Subject: [PATCH 405/465] =?UTF-8?q?[ADD]=20appender=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/console-appender.xml | 8 ++++++++ .../src/main/resources/discord-appender.xml | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 nonsoolmateServer/src/main/resources/console-appender.xml create mode 100644 nonsoolmateServer/src/main/resources/discord-appender.xml diff --git a/nonsoolmateServer/src/main/resources/console-appender.xml b/nonsoolmateServer/src/main/resources/console-appender.xml new file mode 100644 index 0000000..62a0a15 --- /dev/null +++ b/nonsoolmateServer/src/main/resources/console-appender.xml @@ -0,0 +1,8 @@ + + + + ${LOG_PATTERN} + + + \ No newline at end of file diff --git a/nonsoolmateServer/src/main/resources/discord-appender.xml b/nonsoolmateServer/src/main/resources/discord-appender.xml new file mode 100644 index 0000000..b22afe9 --- /dev/null +++ b/nonsoolmateServer/src/main/resources/discord-appender.xml @@ -0,0 +1,14 @@ + + + ${DISCORD_WEBHOOK_URI} + Error Log + https://www.greenart.co.kr/upimage/new_editor/20212/20210201112021.jpg + + + + + ERROR + + + \ No newline at end of file From 63573ccd6845b6f3faa9f3856c93a2c328159207 Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 15:20:21 +0900 Subject: [PATCH 406/465] =?UTF-8?q?[ADD]=20logback=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonsoolmateServer/src/main/resources/logback-dev.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 nonsoolmateServer/src/main/resources/logback-dev.xml diff --git a/nonsoolmateServer/src/main/resources/logback-dev.xml b/nonsoolmateServer/src/main/resources/logback-dev.xml new file mode 100644 index 0000000..1603958 --- /dev/null +++ b/nonsoolmateServer/src/main/resources/logback-dev.xml @@ -0,0 +1,11 @@ + + + + + + + + + + \ No newline at end of file From 6a602f9398bd6f1ce5c122bf78c27cfb0e7a2619 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 15:01:00 +0900 Subject: [PATCH 407/465] [FIX] Server Profile Check --- .../global/controller/ServerProfileController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java index e0d0316..b94a69c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java @@ -14,7 +14,7 @@ public class ServerProfileController { private final Environment env; - @GetMapping("/profile") + @GetMapping("/check/profile") public ResponseEntity> getProfile() { return ResponseEntity.ok() .body(SuccessResponse.of(CommonSuccessType.GET_SERVER_PROFILE, env.getActiveProfiles()[0])); From c4a2543f2b3da457a434f66cdbbfb6f5883b41ba Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 15:01:39 +0900 Subject: [PATCH 408/465] =?UTF-8?q?[FIX]=20SecurityConfig=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=20=ED=94=84=EB=A1=9C=ED=95=84=20=ED=99=95=EC=9D=B8=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index ca1e1c0..1f145fc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -15,16 +15,9 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.CorsConfigurationSource; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import java.util.Arrays; -import java.util.List; - @Configuration @EnableWebSecurity @RequiredArgsConstructor @@ -38,9 +31,9 @@ public class SecurityConfig { "/v3/api-docs/**", "/webjars/**", - "/auth/**", "/login/**","/authTest", + "/auth/**", "/login/**", "/authTest", - "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**", "/actuator/health" + "/", "/css/**", "/images/**", "/js/**", "/favicon.ico", "/h2-console/**", "/actuator/health", "/check/profile" }; @Value("${spring.web.domain.server}") @@ -98,7 +91,6 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); - return http.build(); } @@ -106,6 +98,4 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); } - - } From 257a46788471624c240284238c5cd1d43e8b4c53 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 05:04:51 +0900 Subject: [PATCH 409/465] =?UTF-8?q?[FIX]=20corsFilter=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index f92912e..67a7936 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -15,6 +15,9 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -72,6 +75,20 @@ public void addCorsMappings(CorsRegistry registry) { }; } + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + + CorsConfiguration config = new CorsConfiguration(); + config.setAllowCredentials(true); + config.addAllowedOrigin("*"); + config.addAllowedHeader("*"); + config.addAllowedMethod("*"); + + source.registerCorsConfiguration("/v3/api-docs", config); + return new CorsFilter(source); + } + @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { From f604a98ddb71874c1582a4d6a36a5456665d6748 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 05:09:35 +0900 Subject: [PATCH 410/465] =?UTF-8?q?[DEL]=20=EC=A3=BC=EC=84=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 67a7936..0928a3f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -29,16 +29,13 @@ public class SecurityConfig { private static final String[] AUTH_WHITELIST = { "/", "/error", "/webjars/**", - // Swagger "/swagger-resources/**", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**", - // Authentication "/auth/**", "/login/**","/authTest", - // client "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**", "/actuator/health" }; @@ -54,8 +51,6 @@ public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthenticationFilter; private final JwtExceptionFilter jwtExceptionFilter; - - //cors ์—๋Ÿฌ๋ฅผ ๋Œ€์‘ํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”์†Œ๋“œ @Bean public WebMvcConfigurer corsConfigurer() { return new WebMvcConfigurer() { @@ -104,15 +99,12 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { frameOptionsConfig.disable() ) ) - // .userDetailsService(memberAuthService) ; - //== URL๋ณ„ ๊ถŒํ•œ ๊ด€๋ฆฌ ์˜ต์…˜ ==// http.authorizeHttpRequests(auth -> { auth.requestMatchers(AUTH_WHITELIST).permitAll(); auth.anyRequest().authenticated(); }) - // ์›๋ž˜ ์Šคํ”„๋ง ์‹œํ๋ฆฌํ‹ฐ ํ•„ํ„ฐ ์ˆœ์„œ๊ฐ€ LogoutFilter ์ดํ›„์— ๋กœ๊ทธ์ธ ํ•„ํ„ฐ ๋™์ž‘ .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); From 98fdd520ce81ce430273efdb9a5458b07555e8da Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 05:51:15 +0900 Subject: [PATCH 411/465] =?UTF-8?q?[DEL]=20corsFilter=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 0928a3f..ca1e1c0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -16,11 +16,15 @@ import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.CorsConfigurationSource; import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import java.util.Arrays; +import java.util.List; + @Configuration @EnableWebSecurity @RequiredArgsConstructor @@ -70,20 +74,6 @@ public void addCorsMappings(CorsRegistry registry) { }; } - @Bean - public CorsFilter corsFilter() { - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - - CorsConfiguration config = new CorsConfiguration(); - config.setAllowCredentials(true); - config.addAllowedOrigin("*"); - config.addAllowedHeader("*"); - config.addAllowedMethod("*"); - - source.registerCorsConfiguration("/v3/api-docs", config); - return new CorsFilter(source); - } - @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { From 3ec65e3ff9866b37fb451799038a0fd4f08293c5 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 15:01:00 +0900 Subject: [PATCH 412/465] [FIX] Server Profile Check --- .../global/controller/ServerProfileController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java index e0d0316..b94a69c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/controller/ServerProfileController.java @@ -14,7 +14,7 @@ public class ServerProfileController { private final Environment env; - @GetMapping("/profile") + @GetMapping("/check/profile") public ResponseEntity> getProfile() { return ResponseEntity.ok() .body(SuccessResponse.of(CommonSuccessType.GET_SERVER_PROFILE, env.getActiveProfiles()[0])); From dfa0d67744d12aefb01108fecb786343bb01c700 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 15:01:39 +0900 Subject: [PATCH 413/465] =?UTF-8?q?[FIX]=20SecurityConfig=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EC=A3=BC?= =?UTF-8?q?=EC=84=9D=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20=EC=84=9C=EB=B2=84?= =?UTF-8?q?=20=ED=94=84=EB=A1=9C=ED=95=84=20=ED=99=95=EC=9D=B8=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index ca1e1c0..1f145fc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -15,16 +15,9 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.CorsConfigurationSource; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.filter.CorsFilter; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import java.util.Arrays; -import java.util.List; - @Configuration @EnableWebSecurity @RequiredArgsConstructor @@ -38,9 +31,9 @@ public class SecurityConfig { "/v3/api-docs/**", "/webjars/**", - "/auth/**", "/login/**","/authTest", + "/auth/**", "/login/**", "/authTest", - "/","/css/**","/images/**","/js/**","/favicon.ico","/h2-console/**", "/actuator/health" + "/", "/css/**", "/images/**", "/js/**", "/favicon.ico", "/h2-console/**", "/actuator/health", "/check/profile" }; @Value("${spring.web.domain.server}") @@ -98,7 +91,6 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) .addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class); - return http.build(); } @@ -106,6 +98,4 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { public PasswordEncoder passwordEncoder() { return PasswordEncoderFactories.createDelegatingPasswordEncoder(); } - - } From 12c0fea207ae14adc2183e38d4c6e053cfd061b0 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 16:03:59 +0900 Subject: [PATCH 414/465] =?UTF-8?q?[FEAT]=20error=20=EC=BB=A8=ED=8A=B8?= =?UTF-8?q?=EB=A1=A4=EB=9F=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthController.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java index fc01d50..d7626c1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthController.java @@ -5,6 +5,8 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberReissueResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.enums.PlatformType; import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.BusinessException; +import com.nonsoolmate.nonsoolmateServer.global.error.exception.CommonErrorType; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.AuthServiceProvider; import com.nonsoolmate.nonsoolmateServer.domain.auth.service.vo.MemberSignUpVO; @@ -75,4 +77,9 @@ public String authTest(HttpServletRequest request, HttpServletResponse response) return "SUCCESS"; } + + @GetMapping("/error") + public String error(){ + throw new BusinessException(CommonErrorType.INTERNAL_SERVER_ERROR); + } } From c2f3f8545ec0f53491209701b239dd942386879a Mon Sep 17 00:00:00 2001 From: mikekks Date: Wed, 17 Jan 2024 16:18:39 +0900 Subject: [PATCH 415/465] =?UTF-8?q?[FIX]=20xml=20dev=EB=A1=9C=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 --- nonsoolmateServer/src/main/resources/logback-dev.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nonsoolmateServer/src/main/resources/logback-dev.xml b/nonsoolmateServer/src/main/resources/logback-dev.xml index 1603958..50b1dcd 100644 --- a/nonsoolmateServer/src/main/resources/logback-dev.xml +++ b/nonsoolmateServer/src/main/resources/logback-dev.xml @@ -2,10 +2,12 @@ + + \ No newline at end of file From 1139fa111dedcf234113d0251e08949c855abf55 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 18:23:24 +0900 Subject: [PATCH 416/465] =?UTF-8?q?[FIX]=20AuthApi=20Error=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 --- .../domain/auth/controller/AuthApi.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java index d9e2181..3210575 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java @@ -3,10 +3,12 @@ import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request.MemberRequestDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberAuthResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response.MemberReissueResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; @@ -22,16 +24,23 @@ public interface AuthApi { @ApiResponses( value = { - @ApiResponse(responseCode = "200"), - @ApiResponse(responseCode = "404", content = @Content) + @ApiResponse(responseCode = "200", description = "๋กœ๊ทธ์ธ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค"), + @ApiResponse(responseCode = "201", description = "ํšŒ์›๊ฐ€์ž…์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค"), + @ApiResponse(responseCode = "400", description = "์œ ํšจํ•˜์ง€ ์•Š์€ ํ”Œ๋žซํผ ์ธ๊ฐ€์ฝ”๋“œ์ž…๋‹ˆ๋‹ค, ์ž…๋ ฅ๊ฐ’์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค, ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์€ ํ”Œ๋žซํผ ์œ ํ˜•์ž…๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) } ) - @Operation(summary = "์†Œ์…œ ๋กœ๊ทธ์ธ", description = "๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> login( - @Parameter(description = "์ธ๊ฐ€ ์ฝ”๋“œ", required = true) @RequestHeader(value = "authorization-code") final String authorizationCode, - @Parameter(description = "ํ”Œ๋žซํผ ํƒ€์ž…(ex.'NAVER')", required = true) @RequestBody @Valid final MemberRequestDTO request); + @Parameter(description = "๋„ค์ด๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐœ๊ธ‰๋ฐ›์€ ์ธ๊ฐ€ ์ฝ”๋“œ", required = true) @RequestHeader(value = "authorization-code") final String authorizationCode, + @Parameter(description = "์†Œ์…œ ํ”Œ๋žซํผ ํƒ€์ž… (ex.'NAVER')", required = true) @RequestBody @Valid final MemberRequestDTO request); + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + @ApiResponse(responseCode = "400", description = "์„œ๋น„์Šค์—์„œ ๋ฐœ๊ธ‰๋˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse(responseCode = "401", description = "๊ธฐํ•œ์ด ๋งŒ๋ฃŒ๋œ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) + } + ) @Operation(summary = "์•ก์„ธ์Šค ํ† ํฐ & ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰", description = "์•ก์„ธ์Šค ํ† ํฐ ๋ฐ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์„ ์žฌ๋ฐœ๊ธ‰ ๋ฐ›์Šต๋‹ˆ๋‹ค.") ResponseEntity> reissue( HttpServletRequest request); From 1b1e7b8ea1a53b93121bae9f13ef0a4924564b30 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 18:43:58 +0900 Subject: [PATCH 417/465] =?UTF-8?q?[FEAT]=20auth=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EB=82=B4=20DTO=EC=97=90=20=EC=8A=A4=EC=9B=A8?= =?UTF-8?q?=EA=B1=B0=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/controller/AuthApi.java | 2 +- .../auth/controller/dto/request/MemberRequestDTO.java | 5 +++-- .../controller/dto/response/MemberAuthResponseDTO.java | 9 +++++++-- .../dto/response/MemberReissueResponseDTO.java | 8 ++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java index 3210575..7901806 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java @@ -32,7 +32,7 @@ public interface AuthApi { @Operation(summary = "์†Œ์…œ ๋กœ๊ทธ์ธ", description = "๋„ค์ด๋ฒ„ ์†Œ์…œ ๋กœ๊ทธ์ธ์„ ํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> login( @Parameter(description = "๋„ค์ด๋ฒ„๋กœ๋ถ€ํ„ฐ ๋ฐœ๊ธ‰๋ฐ›์€ ์ธ๊ฐ€ ์ฝ”๋“œ", required = true) @RequestHeader(value = "authorization-code") final String authorizationCode, - @Parameter(description = "์†Œ์…œ ํ”Œ๋žซํผ ํƒ€์ž… (ex.'NAVER')", required = true) @RequestBody @Valid final MemberRequestDTO request); + @RequestBody @Valid final MemberRequestDTO request); @ApiResponses( value = { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java index 7bb1f47..4a4489a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/request/MemberRequestDTO.java @@ -1,11 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.request; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; - +@Schema(name = "MemberRequestDTO", description = "์†Œ์…œ ๋กœ๊ทธ์ธ ์š”์ฒญ DTO") public record MemberRequestDTO( @NotNull + @Schema(description = "์†Œ์…œ ํ”Œ๋žซํผ ํƒ€์ž…", example = "NAVER") String platformType) { - } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java index 2c3fd98..51170f5 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberAuthResponseDTO.java @@ -1,10 +1,15 @@ package com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response; import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; -public record MemberAuthResponseDTO(@NotNull Long memberId, @NotNull AuthType authType, @NotNull String memberName, - @NotNull String accessToken, @NotNull String refreshToken) { +@Schema(name = "MemberAuthResponseDTO", description = "์†Œ์…œ ๋กœ๊ทธ์ธ ์‘๋‹ต DTO") +public record MemberAuthResponseDTO(@NotNull @Schema(description = "์‚ฌ์šฉ์ž id", example = "1") Long memberId, + @NotNull @Schema(description = "ํšŒ์›๊ฐ€์ž…/๋กœ๊ทธ์ธ ์—ฌ๋ถ€", example = "LOGIN ๋˜๋Š” SIGN_UP") AuthType authType, + @NotNull @Schema(description = "์‚ฌ์šฉ์ž ์ด๋ฆ„", example = "๋ฅ˜๊ฐ€์€") String memberName, + @NotNull @Schema(description = "์•ก์„ธ์Šค ํ† ํฐ") String accessToken, + @NotNull @Schema(description = "๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ") String refreshToken) { public static MemberAuthResponseDTO of(Long memberId, AuthType authType, String memberName, String accessToken, String refreshToken) { return new MemberAuthResponseDTO(memberId, authType, memberName, accessToken, refreshToken); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java index fa1a8f3..75c8701 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java @@ -1,11 +1,15 @@ package com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response; import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; -public record MemberReissueResponseDTO(@NotNull Long memberId, @NotNull String accessToken, @NotNull String refreshToken) { +@Schema(name = "MemberReissueResponseDTO", description = "๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰ ์‘๋‹ต DTO") +public record MemberReissueResponseDTO(@NotNull @Schema(description = "์‚ฌ์šฉ์ž id", example = "1") Long memberId, + @NotNull @Schema(description = "์•ก์„ธ์Šค ํ† ํฐ") String accessToken, + @NotNull @Schema(description = "๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ") String refreshToken) { public static MemberReissueResponseDTO of(Long memberId, String accessToken, - String refreshToken) { + String refreshToken) { return new MemberReissueResponseDTO(memberId, accessToken, refreshToken); } } From 319b2d1b8756d93ae2a0e5b8cb4f85ef20b25a75 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 18:44:35 +0900 Subject: [PATCH 418/465] =?UTF-8?q?[DEL]=20=EC=95=88=EC=93=B0=EB=8A=94=20i?= =?UTF-8?q?mport=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/dto/response/MemberReissueResponseDTO.java | 1 - 1 file changed, 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java index 75c8701..d552da6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/dto/response/MemberReissueResponseDTO.java @@ -1,6 +1,5 @@ package com.nonsoolmate.nonsoolmateServer.domain.auth.controller.dto.response; -import com.nonsoolmate.nonsoolmateServer.external.oauth.service.vo.enums.AuthType; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; From 0461976174cd88392b4b5930b096e0baa9cc5023 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 18:59:39 +0900 Subject: [PATCH 419/465] =?UTF-8?q?[FEAT]=20MemberApi=20Swagger=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=9D=91=EB=8B=B5=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20dto=EC=97=90=20Swagger=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MemberApi.java | 12 +++++++++--- .../controller/dto/response/NameResponseDTO.java | 5 ++++- .../controller/dto/response/TicketResponseDTO.java | 6 +++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java index 3b93be4..15b4799 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MemberApi.java @@ -3,10 +3,13 @@ import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.NameResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response.TicketResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.member.entity.Member; +import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.http.ResponseEntity; @@ -15,15 +18,18 @@ public interface MemberApi { @ApiResponses( value = { - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) + @ApiResponse(responseCode = "200", description = "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.") } ) - @Operation(summary = "๋งˆ์ดํŽ˜์ด์ง€: ์ด๋ฆ„", description = "๋‚ด ์ด๋ฆ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getName( @AuthUser Member member); + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "์ด๋ฆ„ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค.") + } + ) @Operation(summary = "๋‚ด ์ •๋ณด ํ™•์ธ: ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", description = "๋‚ด ์ฒจ์‚ญ๊ถŒ ๊ฐฏ์ˆ˜๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getTicket(@AuthUser Member member); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java index 70f2a93..1b6d635 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java @@ -1,6 +1,9 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; -public record NameResponseDTO(String memberName) { +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "NameResponseDTO", description = "๋ฉค๋ฒ„ ์ด๋ฆ„ ์‘๋‹ต DTO") +public record NameResponseDTO(@Schema(description = "๋ฉค๋ฒ„ ์ด๋ฆ„", example = "๋ฅ˜๊ฐ€์€") String memberName) { static public NameResponseDTO of(String memberName) { return new NameResponseDTO(memberName); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java index ccd6060..0196d2c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java @@ -1,6 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.domain.member.controller.dto.response; -public record TicketResponseDTO(String memberName, int ticketCount) { +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "TicketResponseDTO", description = "๋ฉค๋ฒ„ ์ฒจ์‚ญ๊ถŒ ์‘๋‹ต DTO") +public record TicketResponseDTO(@Schema(description = "๋ฉค๋ฒ„ ์ด๋ฆ„", example = "๋ฅ˜๊ฐ€์€") String memberName, + @Schema(description = "์‚ฌ์šฉ์ž ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", example = "5") int ticketCount) { static public TicketResponseDTO of(String memberName, int ticketCount) { return new TicketResponseDTO(memberName, ticketCount); } From 520e433f460bec7ab89a4d83d5bfd37db00aa5b6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 20:46:39 +0900 Subject: [PATCH 420/465] =?UTF-8?q?[DEL]=20@AllArgsConstruct=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/entity/UniversityExam.java | 1 - .../domain/university/entity/UniversityExamImage.java | 1 - 2 files changed, 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java index 843f3bb..656a589 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java @@ -17,7 +17,6 @@ @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor public class UniversityExam { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java index d54d074..f1f47c7 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExamImage.java @@ -16,7 +16,6 @@ @Entity @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) -@AllArgsConstructor public class UniversityExamImage { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) From 809054c290b8c0f8f1aebfd5b0270089c59e710a Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 21:20:43 +0900 Subject: [PATCH 421/465] =?UTF-8?q?[FEAT]=20selectUniversity=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=EC=97=90=20Swagger=20(=EC=97=90=EB=9F=AC,=20?= =?UTF-8?q?DTO)=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SelectUniversityApi.java | 21 ++++++++++++++----- .../request/SelectUniversityRequestDTO.java | 3 ++- .../SelectUniversityExamResponseDTO.java | 9 ++++++-- .../SelectUniversityExamsResponseDTO.java | 8 +++++-- .../response/SelectUniversityResponseDTO.java | 9 ++++++-- .../SelectUniversityUpdateResponseDTO.java | 7 +++++-- 6 files changed, 43 insertions(+), 14 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java index b9f5345..d45f35b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityApi.java @@ -5,11 +5,14 @@ import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityExamsResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response.SelectUniversityUpdateResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import java.util.List; @@ -22,24 +25,32 @@ @Tag(name = "SelectUniversity", description = "๋ชฉํ‘œ ๋Œ€ํ•™๊ณผ ๊ด€๋ จ๋œ API") public interface SelectUniversityApi { - @ApiResponses( value = { - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) + @ApiResponse(responseCode = "200", description = "๋ชฉํ‘œ ๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), } ) - @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity>> getSelectUniversities( @AuthUser Member member); + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "๋ชฉํ‘œ ๋Œ€ํ•™ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + } + ) @Operation(summary = "๋งˆ์ด ํŽ˜์ด์ง€: ๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค์˜ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity>> getSelectUniversityExams( @AuthUser Member member); + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "๋ชฉํ‘œ ๋Œ€ํ•™ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), + @ApiResponse(responseCode = "400", description = "์œ ํšจํ•œ ๋ชฉํ‘œ ๋Œ€ํ•™๊ต๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) + } + ) @Operation(summary = "๋ชฉํ‘œ๋Œ€ํ•™ ์„ค์ •: ๋ฆฌ์ŠคํŠธ ์„ ํƒ", description = "๋‚ด ๋ชฉํ‘œ ๋Œ€ํ•™๋“ค ๋ฆฌ์ŠคํŠธ๋ฅผ ์—…๋ฐ์ดํŠธ(์ˆ˜์ •) ํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> patchSelectUniversities( @AuthUser Member member, - @Parameter(description = "์„ ํƒ ๋Œ€ํ•™๊ต Id", required = true) @RequestBody @Valid List request); + @RequestBody @Valid List request); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java index a814b37..409e32b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java @@ -1,8 +1,9 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.request; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; public record SelectUniversityRequestDTO( - @NotNull Long universityId + @NotNull @Schema(name="์‚ฌ์šฉ์ž๊ฐ€ ์„ ํƒํ•œ ๋Œ€ํ•™ id", example="1") Long universityId ) { } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java index c452e63..f060477 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java @@ -1,7 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; -public record SelectUniversityExamResponseDTO(Long examId, String examName, int examTimeLimit, - String examStatus) { +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "SelectUniversityExamResponseDTO", description = "๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ์กฐํšŒ ์š”์ฒญ DTO") +public record SelectUniversityExamResponseDTO(@Schema(name = "์‹œํ—˜ id", example = "1") Long examId, + @Schema(name = "์‹œํ—˜ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ1") String examName, + @Schema(name = "์‹œํ—˜ ์ œํ•œ ์‹œ๊ฐ„(์ดˆ)", example = "3600") int examTimeLimit, + @Schema(name = "์‹œํ—˜ ์‘์‹œ ์ƒํƒœ", example = "์‹œํ—˜ ์‘์‹œ ์ „") String examStatus) { public static SelectUniversityExamResponseDTO of(Long examId, String examName, int examTimeLimit, String examStatus) { return new SelectUniversityExamResponseDTO(examId, examName, examTimeLimit, examStatus); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java index 6794002..9b785c4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java @@ -1,9 +1,13 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; -public record SelectUniversityExamsResponseDTO(Long universityId, String universityName, String universityCollege, - List examList) { +@Schema(name = "SelectUniversityExamsResponseDTO", description = "๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ ์š”์ฒญ DTO") +public record SelectUniversityExamsResponseDTO(@Schema(name = "๋Œ€ํ•™ id", example = "๋Œ€ํ•™ ์ด๋ฆ„") Long universityId, + @Schema(name = "๋Œ€ํ•™ ์ด๋ฆ„", example = "์ค‘์•™๋Œ€ํ•™๊ต") String universityName, + @Schema(name = "๋‹จ๊ณผ๋Œ€ํ•™ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ") String universityCollege, + @Schema(name = "์‹œํ—˜ ๋ฆฌ์ŠคํŠธ") List examList) { public static SelectUniversityExamsResponseDTO of(Long universityId, String universityName, String universityCollege, List examList) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java index 6d1d444..d06fef4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java @@ -1,10 +1,15 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; +@Schema(name = "SelectUniversityResponseDTO", description = "์„ ํƒ ๋Œ€ํ•™ ์กฐํšŒ ์‘๋‹ต DTO") public record SelectUniversityResponseDTO( - Long universityId, String universityName, String collegeName, boolean memberStatus + @Schema(name = "๋Œ€ํ•™ id", example = "1") Long universityId, + @Schema(name = "๋Œ€ํ•™ ์ด๋ฆ„", example = "์ค‘์•™๋Œ€ํ•™๊ต") String universityName, + @Schema(name = "๋‹จ๊ณผ๋Œ€ํ•™ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ") String collegeName, + @Schema(name = "๋Œ€ํ•™ ์„ ํƒ ์—ฌ๋ถ€", example = "true") boolean memberStatus ) { - static public SelectUniversityResponseDTO of(Long universityId, String universityName, String collegeName, boolean memberStatus) { + public static SelectUniversityResponseDTO of(Long universityId, String universityName, String collegeName, boolean memberStatus) { return new SelectUniversityResponseDTO(universityId, universityName, collegeName, memberStatus); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java index 38cd1a6..5e51aad 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java @@ -1,9 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.selectUniversity.controller.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "SelectUniversityUpdateResponseDTO", description = "๋ชฉํ‘œ ๋Œ€ํ•™ ๋ฆฌ์ŠคํŠธ ์„ ํƒ ์‘๋‹ต DTO") public record SelectUniversityUpdateResponseDTO( - boolean isSelected + @Schema(name="์„ ํƒ ์™„๋ฃŒ ์—ฌ๋ถ€", example="true") boolean isSelected ) { - static public SelectUniversityUpdateResponseDTO of(boolean isSelected) { + public static SelectUniversityUpdateResponseDTO of(boolean isSelected) { return new SelectUniversityUpdateResponseDTO(isSelected); } } From 49d118da5d0c5e18c77ab3f6902435e02ccf2b98 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 21:26:16 +0900 Subject: [PATCH 422/465] =?UTF-8?q?[FIX]=20public=20static=20=EC=BB=A8?= =?UTF-8?q?=EB=B2=A4=EC=85=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/dto/response/NameResponseDTO.java | 2 +- .../member/controller/dto/response/TicketResponseDTO.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java index 1b6d635..7428ac4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java @@ -4,7 +4,7 @@ @Schema(name = "NameResponseDTO", description = "๋ฉค๋ฒ„ ์ด๋ฆ„ ์‘๋‹ต DTO") public record NameResponseDTO(@Schema(description = "๋ฉค๋ฒ„ ์ด๋ฆ„", example = "๋ฅ˜๊ฐ€์€") String memberName) { - static public NameResponseDTO of(String memberName) { + public static NameResponseDTO of(String memberName) { return new NameResponseDTO(memberName); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java index 0196d2c..a24f250 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java @@ -5,7 +5,7 @@ @Schema(name = "TicketResponseDTO", description = "๋ฉค๋ฒ„ ์ฒจ์‚ญ๊ถŒ ์‘๋‹ต DTO") public record TicketResponseDTO(@Schema(description = "๋ฉค๋ฒ„ ์ด๋ฆ„", example = "๋ฅ˜๊ฐ€์€") String memberName, @Schema(description = "์‚ฌ์šฉ์ž ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", example = "5") int ticketCount) { - static public TicketResponseDTO of(String memberName, int ticketCount) { + public static TicketResponseDTO of(String memberName, int ticketCount) { return new TicketResponseDTO(memberName, ticketCount); } } From 693dbcd5bcf20bbcf87fc25095c59772d6187475 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 21:26:39 +0900 Subject: [PATCH 423/465] =?UTF-8?q?[FIX]=20name=20=EC=86=8D=EC=84=B1?= =?UTF-8?q?=EC=9D=84=20description=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 --- .../dto/request/SelectUniversityRequestDTO.java | 2 +- .../dto/response/SelectUniversityExamResponseDTO.java | 8 ++++---- .../dto/response/SelectUniversityExamsResponseDTO.java | 8 ++++---- .../dto/response/SelectUniversityResponseDTO.java | 8 ++++---- .../dto/response/SelectUniversityUpdateResponseDTO.java | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java index 409e32b..c008aac 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/request/SelectUniversityRequestDTO.java @@ -4,6 +4,6 @@ import jakarta.validation.constraints.NotNull; public record SelectUniversityRequestDTO( - @NotNull @Schema(name="์‚ฌ์šฉ์ž๊ฐ€ ์„ ํƒํ•œ ๋Œ€ํ•™ id", example="1") Long universityId + @NotNull @Schema(description="์‚ฌ์šฉ์ž๊ฐ€ ์„ ํƒํ•œ ๋Œ€ํ•™ id", example="1") Long universityId ) { } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java index f060477..a4ca8f9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java @@ -3,10 +3,10 @@ import io.swagger.v3.oas.annotations.media.Schema; @Schema(name = "SelectUniversityExamResponseDTO", description = "๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ์กฐํšŒ ์š”์ฒญ DTO") -public record SelectUniversityExamResponseDTO(@Schema(name = "์‹œํ—˜ id", example = "1") Long examId, - @Schema(name = "์‹œํ—˜ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ1") String examName, - @Schema(name = "์‹œํ—˜ ์ œํ•œ ์‹œ๊ฐ„(์ดˆ)", example = "3600") int examTimeLimit, - @Schema(name = "์‹œํ—˜ ์‘์‹œ ์ƒํƒœ", example = "์‹œํ—˜ ์‘์‹œ ์ „") String examStatus) { +public record SelectUniversityExamResponseDTO(@Schema(description = "์‹œํ—˜ id", example = "1") Long examId, + @Schema(description = "์‹œํ—˜ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ1") String examName, + @Schema(description = "์‹œํ—˜ ์ œํ•œ ์‹œ๊ฐ„(์ดˆ)", example = "3600") int examTimeLimit, + @Schema(description = "์‹œํ—˜ ์‘์‹œ ์ƒํƒœ", example = "์‹œํ—˜ ์‘์‹œ ์ „") String examStatus) { public static SelectUniversityExamResponseDTO of(Long examId, String examName, int examTimeLimit, String examStatus) { return new SelectUniversityExamResponseDTO(examId, examName, examTimeLimit, examStatus); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java index 9b785c4..7ed0f7f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java @@ -4,10 +4,10 @@ import java.util.List; @Schema(name = "SelectUniversityExamsResponseDTO", description = "๋Œ€ํ•™๋ณ„ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ ์š”์ฒญ DTO") -public record SelectUniversityExamsResponseDTO(@Schema(name = "๋Œ€ํ•™ id", example = "๋Œ€ํ•™ ์ด๋ฆ„") Long universityId, - @Schema(name = "๋Œ€ํ•™ ์ด๋ฆ„", example = "์ค‘์•™๋Œ€ํ•™๊ต") String universityName, - @Schema(name = "๋‹จ๊ณผ๋Œ€ํ•™ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ") String universityCollege, - @Schema(name = "์‹œํ—˜ ๋ฆฌ์ŠคํŠธ") List examList) { +public record SelectUniversityExamsResponseDTO(@Schema(description = "๋Œ€ํ•™ id", example = "๋Œ€ํ•™ ์ด๋ฆ„") Long universityId, + @Schema(description = "๋Œ€ํ•™ ์ด๋ฆ„", example = "์ค‘์•™๋Œ€ํ•™๊ต") String universityName, + @Schema(description = "๋‹จ๊ณผ๋Œ€ํ•™ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ") String universityCollege, + @Schema(description = "์‹œํ—˜ ๋ฆฌ์ŠคํŠธ") List examList) { public static SelectUniversityExamsResponseDTO of(Long universityId, String universityName, String universityCollege, List examList) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java index d06fef4..aec3a92 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java @@ -4,10 +4,10 @@ @Schema(name = "SelectUniversityResponseDTO", description = "์„ ํƒ ๋Œ€ํ•™ ์กฐํšŒ ์‘๋‹ต DTO") public record SelectUniversityResponseDTO( - @Schema(name = "๋Œ€ํ•™ id", example = "1") Long universityId, - @Schema(name = "๋Œ€ํ•™ ์ด๋ฆ„", example = "์ค‘์•™๋Œ€ํ•™๊ต") String universityName, - @Schema(name = "๋‹จ๊ณผ๋Œ€ํ•™ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ") String collegeName, - @Schema(name = "๋Œ€ํ•™ ์„ ํƒ ์—ฌ๋ถ€", example = "true") boolean memberStatus + @Schema(description = "๋Œ€ํ•™ id", example = "1") Long universityId, + @Schema(description = "๋Œ€ํ•™ ์ด๋ฆ„", example = "์ค‘์•™๋Œ€ํ•™๊ต") String universityName, + @Schema(description = "๋‹จ๊ณผ๋Œ€ํ•™ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ") String collegeName, + @Schema(description = "๋Œ€ํ•™ ์„ ํƒ ์—ฌ๋ถ€", example = "true") boolean memberStatus ) { public static SelectUniversityResponseDTO of(Long universityId, String universityName, String collegeName, boolean memberStatus) { return new SelectUniversityResponseDTO(universityId, universityName, collegeName, memberStatus); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java index 5e51aad..80d006f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java @@ -4,7 +4,7 @@ @Schema(name = "SelectUniversityUpdateResponseDTO", description = "๋ชฉํ‘œ ๋Œ€ํ•™ ๋ฆฌ์ŠคํŠธ ์„ ํƒ ์‘๋‹ต DTO") public record SelectUniversityUpdateResponseDTO( - @Schema(name="์„ ํƒ ์™„๋ฃŒ ์—ฌ๋ถ€", example="true") boolean isSelected + @Schema(description="์„ ํƒ ์™„๋ฃŒ ์—ฌ๋ถ€", example="true") boolean isSelected ) { public static SelectUniversityUpdateResponseDTO of(boolean isSelected) { return new SelectUniversityUpdateResponseDTO(isSelected); From 22d04df53001a0265a6f647b464f5b311d92f622 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 22:25:55 +0900 Subject: [PATCH 424/465] =?UTF-8?q?[FIX]=20UniversityExamExceptionType?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=97=90=EB=9F=AC=20=ED=83=80=EC=9E=85=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 --- .../university/exception/UniversityExamExceptionType.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java index 61db65f..5f541dc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java @@ -8,10 +8,7 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum UniversityExamExceptionType implements ExceptionType { - /** - * 404 Not Found - */ - NOT_FOUND_UNIVERSITY_EXAM(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค."), + INVALID_UNIVERSITY_EXAM(HttpStatus.BAD_REQUEST, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค."), NOT_FOUND_UNIVERSITY_EXAM_IMAGE(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜ ์ž…๋‹ˆ๋‹ค."); private final HttpStatus status; From 0594dc91589633d2e45140d01863c98b7e3fb2ed Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 22:27:06 +0900 Subject: [PATCH 425/465] =?UTF-8?q?[FIX]=20UniversityExamExceptionType?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EA=B0=99=EC=9D=80=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/exception/UniversityExamExceptionType.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java index 5f541dc..449e042 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/exception/UniversityExamExceptionType.java @@ -8,8 +8,11 @@ @RequiredArgsConstructor(access = AccessLevel.PRIVATE) public enum UniversityExamExceptionType implements ExceptionType { + /** + * 404 Not Found + */ INVALID_UNIVERSITY_EXAM(HttpStatus.BAD_REQUEST, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค."), - NOT_FOUND_UNIVERSITY_EXAM_IMAGE(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜ ์ž…๋‹ˆ๋‹ค."); + NOT_FOUND_UNIVERSITY_EXAM_IMAGE(HttpStatus.NOT_FOUND, "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ์ž…๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From 22e0c207afcc86f4c3f6996ce85416102d1ddcda Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 22:31:38 +0900 Subject: [PATCH 426/465] =?UTF-8?q?[FEAT]=20university=20=ED=8C=A8?= =?UTF-8?q?=ED=82=A4=EC=A7=80=20swagger=20=EC=97=90=EB=9F=AC=20=EB=B0=8F?= =?UTF-8?q?=20DTO=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/controller/UniversityApi.java | 23 +++++++++++++++---- ...iversityExamImageAndAnswerResponseDTO.java | 7 +++++- .../UniversityExamImageResponseDTO.java | 5 +++- .../UniversityExamInfoResponseDTO.java | 6 ++++- .../service/UniversityExamService.java | 6 ++--- 5 files changed, 36 insertions(+), 11 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java index 4acc5b0..35bac1d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java @@ -3,10 +3,13 @@ import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageAndAnswerResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamImageResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response.UniversityExamInfoResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.data.domain.Page; @@ -18,24 +21,34 @@ @Tag(name = "UniversityExam", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ •๋ณด์™€ ๊ด€๋ จ๋œ API") public interface UniversityApi { - @ApiResponses( value = { - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) + @ApiResponse(responseCode = "200", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ •๋ณด ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), + @ApiResponse(responseCode = "400", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) } ) - @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ์‹œํ—˜ ์ด๋ฆ„ & ์ œํ•œ ์‹œ๊ฐ„", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ์ด๋ฆ„ ๋ฐ ์ œํ•œ ์‹œ๊ฐ„์„ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getUniversityExam( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId); + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), + @ApiResponse(responseCode = "400", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) + } + ) @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: ๋ฌธ์ œ์ง€ [ํŽ˜์ด์ง€๋„ค์ด์…˜]", description = "์‹œํ—˜ ์‘์‹œ ํ™”๋ฉด์˜ ๋ฌธ์ œ์ง€๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity>> getUniversityExamImages( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long id, - @RequestParam(defaultValue = "0") int page, + @Parameter(description = "๋ฌธ์ œ ์ด๋ฏธ์ง€ ํŽ˜์ด์ง€ ๋ฒˆํ˜ธ -1") @RequestParam(defaultValue = "0") int page, Pageable pageable); + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), + @ApiResponse(responseCode = "400", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) + } + ) @Operation(summary= "ํ•ด์ œ: ๋ฌธ์ œ์ด๋ฏธ์ง€_ํ•ด์ œPDF", description = "์‹œํ—˜ ๋ฌธ์ œ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ PDF๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getUniversityExamImageAndAnswer( @PathVariable("id") Long universityExamId); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java index a41e7fb..3dffee1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java @@ -1,9 +1,14 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; + import java.util.List; +@Schema(name = "UniversityExamImageAndAnswerResponseDTO", description = "๋Œ€ํ•™์‹œํ—˜ ๋ฌธ์ œ์ด๋ฏธ์ง€_ํ•ด์ œPDF ์กฐํšŒ ์š”์ฒญ DTO") public record UniversityExamImageAndAnswerResponseDTO( - String universityExamName, List examQuestionList, String examAnswerUrl + @Schema(description = "์‹œํ—˜ ์ด๋ฆ„(๋Œ€ํ•™ + ์‹œํ—˜ ๋…„๋„ + ์‹œํ—˜ ์ด๋ฆ„)", example = "2023 ์ค‘์•™๋Œ€ํ•™๊ต ๊ฒฝ์˜๊ฒฝ์ œ 1") String universityExamName, + @Schema(description = "์‹œํ—˜ ๋ฌธ์ œ ์ด๋ฏธ์ง€ ๋ฆฌ์ŠคํŠธ") List examQuestionList, + @Schema(description = "์ด๋ฏธ์ง€ ํ•ด์ œ PDF URL") String examAnswerUrl ) { static public UniversityExamImageAndAnswerResponseDTO of(String universityExamName, List examQuestionList, diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java index 4e328ee..c8f21c5 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java @@ -1,6 +1,9 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response; -public record UniversityExamImageResponseDTO(String examImgUrl) { +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "UniversityExamImageResponseDTO", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ์กฐํšŒ ์š”์ฒญ DTO") +public record UniversityExamImageResponseDTO(@Schema(description = "์‹œํ—˜ ๋ฌธ์ œ ์ด๋ฏธ์ง€ URL") String examImgUrl) { static public UniversityExamImageResponseDTO of(String examImgUrl) { return new UniversityExamImageResponseDTO(examImgUrl); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java index 9ba7c16..3bd7ee0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java @@ -1,6 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.domain.university.controller.dto.response; -public record UniversityExamInfoResponseDTO(Long examId, String examName, int examTimeLimit) { +import io.swagger.v3.oas.annotations.media.Schema; + +public record UniversityExamInfoResponseDTO(@Schema(description = "์‹œํ—˜ id", example = "1") Long examId, + @Schema(description = "์‹œํ—˜ ์ด๋ฆ„(๋Œ€ํ•™ + ์‹œํ—˜ ๋…„๋„ + ์‹œํ—˜ ์ด๋ฆ„)", example = "๊ฑด๊ตญ๋Œ€ํ•™๊ต - 2021 ์ธ๋ฌธ์‚ฌํšŒ 1") String examName, + @Schema(description = "์‹œํ—˜ ์ œํ•œ ์‹œ๊ฐ„ (์ดˆ)", example = "6000") int examTimeLimit) { public static UniversityExamInfoResponseDTO of(Long examId, String examName, int examTimeLimit) { return new UniversityExamInfoResponseDTO(examId, examName, examTimeLimit); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 1da2513..5febe81 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -33,7 +33,7 @@ public class UniversityExamService { public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException( - UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); + UniversityExamExceptionType.INVALID_UNIVERSITY_EXAM)); String universityExamName = universityExam.getUniversityExamFullName(); return UniversityExamInfoResponseDTO.of(universityExam.getUniversityExamId(), universityExamName, @@ -43,7 +43,7 @@ public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { public Page getUniversityExamImages(Long id, Pageable pageable) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(id) .orElseThrow(() -> new UniversityExamException( - UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); + UniversityExamExceptionType.INVALID_UNIVERSITY_EXAM)); Page universityExamImages = universityExamImageRepository.findAllByUniversityExamOrderByPageAsc( universityExam, pageable); @@ -55,7 +55,7 @@ public Page getUniversityExamImages(Long id, Pag public UniversityExamImageAndAnswerResponseDTO getUniversityExamImageAndAnswer(Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException( - UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM)); + UniversityExamExceptionType.INVALID_UNIVERSITY_EXAM)); String examAnswerUrl = cloudFrontService.createPreSignedGetUrl(EXAM_ANSWER_FOLDER_NAME, universityExam.getUniversityExamAnswerFileName()); From d64565adaa686c67e72a0029ee1a059baf95f389 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 23:34:50 +0900 Subject: [PATCH 427/465] =?UTF-8?q?[FEAT]=20universityExamRecord=20?= =?UTF-8?q?=ED=8C=A8=ED=82=A4=EC=A7=80=20=EC=95=84=EB=9E=98=20Swagger(?= =?UTF-8?q?=EC=97=90=EB=9F=AC,=20DTO)=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/controller/UniversityApi.java | 2 +- .../controller/UniversityExamRecordApi.java | 32 ++++++++++++++++--- .../CreateUniversityExamRequestDTO.java | 8 +++-- .../UniversityExamRecordIdResponse.java | 6 +++- .../UniversityExamRecordResponseDTO.java | 9 ++++-- ...UniversityExamRecordResultResponseDTO.java | 5 ++- ...rsityExamSheetPreSignedUrlResponseDTO.java | 9 ++++-- 7 files changed, 55 insertions(+), 16 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java index 35bac1d..ccb2de8 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityApi.java @@ -45,7 +45,7 @@ ResponseEntity>> getUnivers @ApiResponses( value = { - @ApiResponse(responseCode = "200", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), + @ApiResponse(responseCode = "201", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ๋ฐ ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค"), @ApiResponse(responseCode = "400", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) } ) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java index 9d406c9..4c37500 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordApi.java @@ -6,11 +6,14 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamRecordResultResponseDTO; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response.UniversityExamSheetPreSignedUrlResponseDTO; +import com.nonsoolmate.nonsoolmateServer.global.response.ErrorResponse; import com.nonsoolmate.nonsoolmateServer.global.response.SuccessResponse; import com.nonsoolmate.nonsoolmateServer.global.security.AuthUser; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; @@ -24,27 +27,46 @@ public interface UniversityExamRecordApi { @ApiResponses( value = { - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200"), - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", content = @Content), - @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", content = @Content) + @ApiResponse(responseCode = "200", description = "์ฒจ์‚ญ PDF, ํ•ด์ œ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), + @ApiResponse(responseCode = "400", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค, ์ฒจ์‚ญ์ด ์™„๋ฃŒ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse(responseCode = "404", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก์ž…๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) } ) - @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF_ํ•ด์ œPDF", description = "์ฒจ์‚ญ pdf ๋ฐ ํ•ด์ œ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getUniversityExamRecord( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId, @AuthUser Member member); + + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "์ฒจ์‚ญ PDF ์กฐํšŒ์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), + @ApiResponse(responseCode = "400", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค, ์ฒจ์‚ญ์ด ์™„๋ฃŒ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse(responseCode = "404", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ์‹œํ—˜ ์‘์‹œ ๊ธฐ๋ก์ž…๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) + } + ) @Operation(summary = "์ฒจ์‚ญ: ์ฒจ์‚ญ PDF ์ €์žฅ", description = "์ฒจ์‚ญ pdf๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getUniversityExamRecordResult( @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId)", required = true) @PathVariable("id") Long universityExamId, @AuthUser Member member); + @ApiResponses( + value = { + @ApiResponse(responseCode = "200", description = "๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค.") + } + ) @Operation(summary = "์‹œํ—˜ ๋ณด๊ธฐ: [1] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ์กฐํšŒ API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ๋ฅผ ์œ„ํ•œ PresignedUrl๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> getUniversityExamSheetPreSignedUrl(); + @ApiResponses( + value = { + @ApiResponse(responseCode = "201", description = "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก์— ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค."), + @ApiResponse(responseCode = "400", description = "์กด์žฌํ•˜์ง€ ์•Š๋Š” ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค, ์ด๋ฏธ ์‘์‹œํ•œ ๋Œ€ํ•™ ์‹œํ—˜์ž…๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse(responseCode = "404", description = "ํ•ด๋‹น ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) + } + ) @Operation(summary = "์‹œํ—˜๋ณด๊ธฐ: [3] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ํ›„ ์‹œํ—˜ ๊ธฐ๋ก API", description = "๋‹ต์•ˆ์ง€(์‹œํ—˜์‘์‹œ๊ธฐ๋ก) ์—…๋กœ๋“œ ํ›„ ์„œ๋ฒ„์— ๊ธฐ๋กํ•˜๊ธฐ ์œ„ํ•ด ํ˜ธ์ถœํ•ฉ๋‹ˆ๋‹ค.") ResponseEntity> createUniversityExamRecord( - @Parameter(description = "ํ•ด๋‹น ๋Œ€ํ•™๊ต ์‹œํ—˜ Id (examId), ์‹œํ—˜ ์‘์‹œ ์†Œ์š” ์‹œ๊ฐ„, ๋‹ต์•ˆ์ง€(์‘์‹œ ๊ธฐ๋ก) ํŒŒ์ผ ์ด๋ฆ„", required = true) @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, + @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, @AuthUser Member member); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java index 21aa770..a60b6a1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/request/CreateUniversityExamRequestDTO.java @@ -1,11 +1,13 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.request; +import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; -public record CreateUniversityExamRequestDTO(@NotNull Long universityExamId, - @Positive int memberTakeTimeExam, - @NotNull String memberSheetFileName) { +@Schema(name = "CreateUniversityExamRequestDTO", description = "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก ์ƒ์„ฑ ์š”์ฒญ DTO") +public record CreateUniversityExamRequestDTO(@NotNull @Schema(description = "๋Œ€ํ•™ ์‹œํ—˜ id", example="1") Long universityExamId, + @Positive @Schema(description = "์‚ฌ์šฉ์ž๊ฐ€ ํ•ด๋‹น ์‹œํ—˜์„ ๋ณด๋Š”๋ฐ ๊ฑธ๋ฆฐ ์‹œ๊ฐ„(์ดˆ ๋‹จ์œ„)") int memberTakeTimeExam, + @NotNull @Schema(description="PreSingedUrl ๋ฐœ๊ธ‰ ์‹œ ์ „๋‹ฌ ๋ฐ›์€ ํŒŒ์ผ ์ด๋ฆ„") String memberSheetFileName) { public static CreateUniversityExamRequestDTO of(Long universityExamId, int memberTakeTimeExam, String memberSheetFileName) { return new CreateUniversityExamRequestDTO(universityExamId, memberTakeTimeExam, memberSheetFileName); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java index a3f9afa..1be83a3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java @@ -1,6 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; -public record UniversityExamRecordIdResponse(Long universityExamRecordId) { +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "UniversityExamRecordIdResponse", description = "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก ์ƒ์„ฑ ์‘๋‹ต DTO") +public record UniversityExamRecordIdResponse( + @Schema(description = "๊ธฐ๋ก๋œ ๋Œ€ํ•™ ์‹œํ—˜ ๋‹ต์•ˆ id", example = "1") Long universityExamRecordId) { public static UniversityExamRecordIdResponse of(Long universityExamRecordId) { return new UniversityExamRecordIdResponse(universityExamRecordId); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java index 5a049f9..bccb46a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java @@ -1,9 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "UniversityExamRecordResponseDTO", description = "์ฒจ์‚ญ PDF_ํ•ด์ œPDF ์กฐํšŒ ์‘๋‹ต DTO") public record UniversityExamRecordResponseDTO( - String universityExamName, - String examAnswerUrl, - String examResultUrl + @Schema(description = "์‹œํ—˜ ์ด๋ฆ„(๋Œ€ํ•™์ด๋ฆ„+์‹œํ—˜๋…„๋„+์‹œํ—˜์ด๋ฆ„)", example = "๊ฑด๊ตญ๋Œ€ํ•™๊ต - 2021 ์ธ๋ฌธ์‚ฌํšŒ 2") String universityExamName, + @Schema(description = "์‹œํ—˜ ํ•ด์ œ PDF URL", example = "1") String examAnswerUrl, + @Schema(description = "์‹œํ—˜ ์ฒจ์‚ญ ๊ฒฐ๊ณผ PDF URL", example = "1") String examResultUrl ) { public static UniversityExamRecordResponseDTO of(String universityExamName, String examAnswerUrl, String examResultUrl) { return new UniversityExamRecordResponseDTO(universityExamName, examAnswerUrl, examResultUrl); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java index 6613d0b..5a64c86 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java @@ -1,7 +1,10 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "UniversityExamRecordResultResponseDTO", description = "์ฒจ์‚ญ PDF ์ €์žฅ ์‘๋‹ต DTO") public record UniversityExamRecordResultResponseDTO( - String examResultUrl + @Schema(description = "์ฒจ์‚ญ ๊ฒฐ๊ณผ PDF URL") String examResultUrl ) { public static UniversityExamRecordResultResponseDTO of(String examResultUrl) { return new UniversityExamRecordResultResponseDTO(examResultUrl); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java index b29f560..d01a8f4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java @@ -1,7 +1,12 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.controller.dto.response; -public record UniversityExamSheetPreSignedUrlResponseDTO(String resultFileName, String preSignedUrl) { - static public UniversityExamSheetPreSignedUrlResponseDTO of(String resultFileName, String preSignedUrl) { +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "UniversityExamSheetPreSignedUrlResponseDTO", description = "๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ PresignedUrl ์กฐํšŒ ์‘๋‹ต DTO") +public record UniversityExamSheetPreSignedUrlResponseDTO( + @Schema(description = "์‹œํ—˜๋ณด๊ธฐ: [3] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ํ›„ ์‹œํ—˜ ๊ธฐ๋ก API ์—์„œ ๋‹ค์‹œ ์„œ๋ฒ„๋กœ ๋ณด๋‚ด์•ผํ•˜๋Š” ํŒŒ์ผ ์ด๋ฆ„") String resultFileName, + @Schema(description = "์‹œํ—˜๋ณด๊ธฐ: [2] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ API๋ฅผ ์š”์ฒญํ•  URL") String preSignedUrl) { + public static UniversityExamSheetPreSignedUrlResponseDTO of(String resultFileName, String preSignedUrl) { return new UniversityExamSheetPreSignedUrlResponseDTO(resultFileName, preSignedUrl); } } From 6ee64be0b6be5a929fb09cdccc879a2aada4a3f6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Wed, 17 Jan 2024 23:39:30 +0900 Subject: [PATCH 428/465] =?UTF-8?q?[FIX]=20UniversityExamRecordService?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=88=98=EC=A0=95=EB=90=9C=20ExceptionTyp?= =?UTF-8?q?e=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/UniversityExamRecordService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 9066738..491efe9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -1,6 +1,6 @@ package com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.service; -import static com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType.NOT_FOUND_UNIVERSITY_EXAM; +import static com.nonsoolmate.nonsoolmateServer.domain.university.exception.UniversityExamExceptionType.INVALID_UNIVERSITY_EXAM; import static com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordExceptionType.*; import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.*; @@ -18,7 +18,6 @@ import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.entity.enums.ExamResultStatus; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.exception.UniversityExamRecordException; import com.nonsoolmate.nonsoolmateServer.domain.universityExamRecord.repository.UniversityExamRecordRepository; -import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSBusinessException; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSClientException; import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; @@ -121,7 +120,7 @@ private UniversityExamRecord createUniversityExamRecord(UniversityExam universit private UniversityExam getUniversityExam(Long universityExamId) { return universityExamRepository.findByUniversityExamId(universityExamId) - .orElseThrow(() -> new UniversityExamException(NOT_FOUND_UNIVERSITY_EXAM)); + .orElseThrow(() -> new UniversityExamException(INVALID_UNIVERSITY_EXAM)); } private UniversityExamRecord getUniversityExamByUniversityExamAndMember(UniversityExam universityExam, From 76f507a20300c92193d7a564b32417bf5bf7df6a Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 04:34:24 +0900 Subject: [PATCH 429/465] =?UTF-8?q?[FIX]=20WhiteList=20=ED=95=84=ED=84=B0?= =?UTF-8?q?=20=EB=8B=A8=EC=97=90=EC=84=9C=20=EC=B2=98=EB=A6=AC=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filter/JwtAuthenticationFilter.java | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java index 2f9355e..6741a8c 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java @@ -3,18 +3,22 @@ import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.INVALID_ACCESS_TOKEN; import static com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthExceptionType.UNAUTHORIZED_ACCESS_TOKEN; +import static com.nonsoolmate.nonsoolmateServer.global.security.config.SecurityConfig.AUTH_WHITELIST; +import static com.nonsoolmate.nonsoolmateServer.global.security.config.SecurityConfig.AUTH_WHITELIST_WILDCARD; import com.fasterxml.jackson.core.JsonProcessingException; import com.nonsoolmate.nonsoolmateServer.domain.auth.exception.AuthException; import com.nonsoolmate.nonsoolmateServer.global.jwt.service.JwtService; import com.nonsoolmate.nonsoolmateServer.global.security.service.MemberAuthService; import com.nonsoolmate.nonsoolmateServer.global.jwt.utils.RequestUtils; +import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.MalformedJwtException; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; +import java.util.Arrays; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -36,17 +40,28 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter { protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { + if (Arrays.stream(AUTH_WHITELIST) + .anyMatch(whiteUrl -> request.getRequestURI().equals(whiteUrl))) { + filterChain.doFilter(request, response); + return; + } + + if (Arrays.stream(AUTH_WHITELIST_WILDCARD) + .anyMatch( + whiteUrl -> request.getRequestURI().startsWith(whiteUrl.substring(0, whiteUrl.length() - 3)))) { + filterChain.doFilter(request, response); + return; + } + if (!RequestUtils.isContainsAccessToken(request)) { filterChain.doFilter(request, response); return; } - String authorizationAccessToken = RequestUtils.getAuthorizationAccessToken((HttpServletRequest) request); + String authorizationAccessToken = RequestUtils.getAuthorizationAccessToken(request); try { - if (!jwtService.validateToken(authorizationAccessToken)) { - throw new AuthException(UNAUTHORIZED_ACCESS_TOKEN); - } + jwtService.validateToken(authorizationAccessToken); Long memberId = jwtService.extractMemberIdFromAccessToken(authorizationAccessToken); UserDetails userDetails = memberAuthService.loadUserByUsername(String.valueOf(memberId)); @@ -56,9 +71,12 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse log.info("Authentication Principal : {}", authentication.getPrincipal().toString()); SecurityContextHolder.getContext().setAuthentication(authentication); - } catch (JsonProcessingException e) { + } catch (JsonProcessingException | MalformedJwtException e) { throw new AuthException(INVALID_ACCESS_TOKEN); - } catch (AuthException e) { + } catch (ExpiredJwtException e){ + throw new AuthException(UNAUTHORIZED_ACCESS_TOKEN); + } + catch (AuthException e) { throw new AuthException(e.getExceptionType()); } From afde739ed1b28710bde3c290767df83fbc023498 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 04:34:52 +0900 Subject: [PATCH 430/465] =?UTF-8?q?[FIX]=20WhiteList,=20WildCard=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/security/config/SecurityConfig.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java index 1f145fc..0191b3d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/config/SecurityConfig.java @@ -23,17 +23,26 @@ @RequiredArgsConstructor public class SecurityConfig { - private static final String[] AUTH_WHITELIST = { - "/", "/error", "/webjars/**", + public static final String[] AUTH_WHITELIST = { + "/", "/error", + + "/favicon.ico", + + "/actuator/health", "/check/profile" + }; + + public static final String[] AUTH_WHITELIST_WILDCARD = { + "/webjars/**", "/swagger-resources/**", "/swagger-ui/**", "/v3/api-docs/**", "/webjars/**", + "/auth/**", "/login/**", - "/auth/**", "/login/**", "/authTest", + "/css/**", "/images/**", "/js/**", - "/", "/css/**", "/images/**", "/js/**", "/favicon.ico", "/h2-console/**", "/actuator/health", "/check/profile" + "/h2-console/**", }; @Value("${spring.web.domain.server}") @@ -86,6 +95,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { http.authorizeHttpRequests(auth -> { auth.requestMatchers(AUTH_WHITELIST).permitAll(); + auth.requestMatchers(AUTH_WHITELIST_WILDCARD).permitAll(); auth.anyRequest().authenticated(); }) .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class) From 880774121d014ecc558ec4694688566d17d38655 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 04:35:14 +0900 Subject: [PATCH 431/465] =?UTF-8?q?[FIX]=20=EB=A6=AC=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=8B=9C=20=ED=86=A0=ED=81=B0=EC=97=90=20memberId=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 --- .../nonsoolmateServer/global/jwt/service/JwtTokenProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java index f95d2cd..48da3db 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtTokenProvider.java @@ -45,11 +45,12 @@ public String createAccessToken(String email, Long memberId, Long expirationTime .compact(); } - public String createRefreshToken(Long expirationTime) { + public String createRefreshToken(Long memberId, Long expirationTime) { Date now = new Date(); return Jwts.builder() .setSubject(REFRESH_TOKEN_SUBJECT) + .claim(MEMBER_ID_CLAIM, memberId) .setIssuedAt(now) //ํ† ํฐ ๋ฐœํ–‰ ์‹œ๊ฐ„ ์ •๋ณด .setExpiration(new Date(now.getTime() + expirationTime)) //ํ† ํฐ ๋งŒ๋ฃŒ ์‹œ๊ฐ„ ์„ค์ • .signWith(key, SignatureAlgorithm.HS256) From bf82d7d61cc09581514ffee1e0bed2a8aacc50be Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 04:36:23 +0900 Subject: [PATCH 432/465] =?UTF-8?q?[FIX]=20=EA=B3=B5=ED=86=B5=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=EC=9D=B8=20validateToken=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EC=B2=98=EB=A6=AC=20=EC=B1=85=EC=9E=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/jwt/service/JwtService.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 00cb8cd..3a38961 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -61,7 +61,7 @@ public MemberAuthResponseDTO issueToken(MemberSignUpVO vo) { String accessToken = jwtTokenProvider.createAccessToken(vo.email(), vo.memberId(), accessTokenExpirationPeriod); if (vo.role().equals(Role.USER)) { - String refreshToken = jwtTokenProvider.createRefreshToken(refreshTokenExpirationPeriod); + String refreshToken = jwtTokenProvider.createRefreshToken(vo.memberId(), refreshTokenExpirationPeriod); updateRefreshTokenByMemberId(vo.memberId(), refreshToken); return MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name(), accessToken, refreshToken); } @@ -71,13 +71,16 @@ public MemberAuthResponseDTO issueToken(MemberSignUpVO vo) { public MemberReissueResponseDTO reissueToken(HttpServletRequest request) { String refreshToken = extractRefreshToken(request); - String accessToken = extractAccessToken(request); - if (!validateToken(refreshToken)) { + try { + validateToken(refreshToken); + } catch (MalformedJwtException e) { throw new AuthException(INVALID_REFRESH_TOKEN); + } catch (ExpiredJwtException e){ + throw new AuthException(UNAUTHORIZED_REFRESH_TOKEN); } - Claims tokenClaims = jwtTokenProvider.getTokenClaims(accessToken); + Claims tokenClaims = jwtTokenProvider.getTokenClaims(refreshToken); RefreshTokenVO foundRefreshToken = redisTokenRepository.findByMemberIdOrElseThrowException( String.valueOf(tokenClaims.get(MEMBER_ID_CLAIM))); @@ -90,7 +93,7 @@ public MemberReissueResponseDTO reissueToken(HttpServletRequest request) { String email = (String) tokenClaims.get(EMAIL_CLAIM); String newAccessToken = jwtTokenProvider.createAccessToken(email, memberId, accessTokenExpirationPeriod); - String newRefreshToken = jwtTokenProvider.createRefreshToken(refreshTokenExpirationPeriod); + String newRefreshToken = jwtTokenProvider.createRefreshToken(memberId, refreshTokenExpirationPeriod); updateRefreshTokenByMemberId(memberId, newRefreshToken); @@ -103,15 +106,9 @@ public Long extractMemberIdFromAccessToken(final String atk) throws JsonProcessi return jwtTokenProvider.getMemberIdFromClaim(tokenClaims, AUTH_USER); } - public Boolean validateToken(final String atk) { - try { - Claims tokenClaims = jwtTokenProvider.getTokenClaims(atk); - return !tokenClaims.getExpiration().before(new Date()); - } catch (MalformedJwtException e) { - throw new AuthException(INVALID_ACCESS_TOKEN); - } catch (ExpiredJwtException e){ - throw new AuthException(UNAUTHORIZED_REFRESH_TOKEN); - } + public Boolean validateToken(final String atk) throws ExpiredJwtException, MalformedJwtException { + Claims tokenClaims = jwtTokenProvider.getTokenClaims(atk); + return !tokenClaims.getExpiration().before(new Date()); } private String extractRefreshToken(HttpServletRequest request) { From cdff23f979163b9876719fe8606ef324eb53ff4d Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 04:53:12 +0900 Subject: [PATCH 433/465] =?UTF-8?q?[FIX]=20=EC=9D=91=EB=8B=B5=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95=20201=20->=20200=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 --- .../selectUniversity/exception/SelectUniversitySuccessType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java index 147975a..9b23483 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/exception/SelectUniversitySuccessType.java @@ -8,7 +8,7 @@ public enum SelectUniversitySuccessType implements SuccessType { GET_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), GET_SELECT_UNIVERSITY_EXAMS_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์‹œํ—˜ ๋ฆฌ์ŠคํŠธ ์กฐํšŒ์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), - PATCH_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.CREATED, "๋ชฉํ‘œ ๋Œ€ํ•™ ์ˆ˜์ •์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); + PATCH_SELECT_UNIVERSITIES_SUCCESS(HttpStatus.OK, "๋ชฉํ‘œ ๋Œ€ํ•™ ์ˆ˜์ •์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."); private final HttpStatus status; private final String message; From 21c9c5b86fc5ac3ca413a3094c134e27833308af Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 15:02:07 +0900 Subject: [PATCH 434/465] =?UTF-8?q?[FIX]=20=EC=9D=91=EB=8B=B5=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/exception/AuthExceptionType.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java index 98ab852..3213bd9 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/exception/AuthExceptionType.java @@ -14,7 +14,7 @@ public enum AuthExceptionType implements ExceptionType { INVALID_MEMBER_PLATFORM_AUTHORIZATION_CODE(HttpStatus.BAD_REQUEST, "์œ ํšจํ•˜์ง€ ์•Š์€ ํ”Œ๋žซํผ ์ธ๊ฐ€์ฝ”๋“œ์ž…๋‹ˆ๋‹ค."), INVALID_PLATFORM_TYPE(HttpStatus.BAD_REQUEST, "์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์€ ํ”Œ๋žซํผ ์œ ํ˜•์ž…๋‹ˆ๋‹ค."), INVALID_ACCESS_TOKEN(HttpStatus.BAD_REQUEST, "์„œ๋น„์Šค์—์„œ ๋ฐœ๊ธ‰๋˜์ง€ ์•Š์€ ์•ก์„ธ์Šค ํ† ํฐ์ž…๋‹ˆ๋‹ค."), - INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "์„œ๋น„์Šค์—์„œ ๋ฐœ๊ธ‰๋˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), + INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "์„œ๋น„์Šค์—์„œ ๋ฐœ๊ธ‰๋˜์ง€ ์•Š๊ฑฐ๋‚˜ ์ด๋ฏธ ์‚ฌ์šฉ๋œ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค."), /** * 401 Unauthorized From afbb62d7e97224c5b8c15b8dd3c5c4b3c71c0b63 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 15:03:09 +0900 Subject: [PATCH 435/465] =?UTF-8?q?[REFACTOR]=20=EB=A9=94=EC=84=9C?= =?UTF-8?q?=EB=93=9C=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F?= =?UTF-8?q?=20=EB=B6=88=ED=95=84=EC=9A=94=20=EC=BD=94=EB=93=9C=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/jwt/service/JwtService.java | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 3a38961..4f7acdd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -62,7 +62,7 @@ public MemberAuthResponseDTO issueToken(MemberSignUpVO vo) { if (vo.role().equals(Role.USER)) { String refreshToken = jwtTokenProvider.createRefreshToken(vo.memberId(), refreshTokenExpirationPeriod); - updateRefreshTokenByMemberId(vo.memberId(), refreshToken); + updateRefreshToken(vo.memberId(), refreshToken); return MemberAuthResponseDTO.of(vo.memberId(), vo.authType(), vo.name(), accessToken, refreshToken); } @@ -95,7 +95,7 @@ public MemberReissueResponseDTO reissueToken(HttpServletRequest request) { String newAccessToken = jwtTokenProvider.createAccessToken(email, memberId, accessTokenExpirationPeriod); String newRefreshToken = jwtTokenProvider.createRefreshToken(memberId, refreshTokenExpirationPeriod); - updateRefreshTokenByMemberId(memberId, newRefreshToken); + updateRefreshToken(memberId, newRefreshToken); return MemberReissueResponseDTO.of(memberId, newAccessToken, newRefreshToken); } @@ -118,24 +118,18 @@ private String extractRefreshToken(HttpServletRequest request) { .orElseThrow(() -> new AuthException(INVALID_REFRESH_TOKEN)); } - private String extractAccessToken(HttpServletRequest request) { - return Optional.ofNullable(request.getHeader(accessHeader)) - .filter(refreshToken -> refreshToken.startsWith(BEARER)) - .map(refreshToken -> refreshToken.replace(BEARER, "")) - .orElseThrow(() -> new AuthException(INVALID_ACCESS_TOKEN)); - } + @Transactional + public void updateRefreshToken(Long memberId, String newRefreshToken) { + RefreshTokenVO refreshTokenVO = redisTokenRepository.findByMemberId(String.valueOf(memberId)).orElse(null); + if(refreshTokenVO != null){ + refreshTokenVO.updateRefreshToken(newRefreshToken); + redisTokenRepository.save(refreshTokenVO); + return; + } - @Transactional - public void updateRefreshTokenByMemberId(Long memberId, String newRefreshToken) { - redisTokenRepository.findByMemberId(String.valueOf(memberId)) - .ifPresent(refreshToken -> { - refreshToken.updateBlack(true); - }); - log.info("newRefreshToken = {}", newRefreshToken); redisTokenRepository.save(RefreshTokenVO.builder() .memberId(String.valueOf(memberId)) - .black(false) .refreshToken(newRefreshToken) .build()); } From 1761ffe6f4c79dff8513a2aec80d6fe3cbdf750f Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 15:03:21 +0900 Subject: [PATCH 436/465] =?UTF-8?q?[DEL]=20=EB=B6=88=ED=95=84=EC=9A=94=20?= =?UTF-8?q?=EC=BD=94=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 --- .../external/redis/repository/RedisTokenRepository.java | 1 - 1 file changed, 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java index eb63b50..e9cbc27 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/redis/repository/RedisTokenRepository.java @@ -17,7 +17,6 @@ public interface RedisTokenRepository extends CrudRepository !refreshTokenVO.isBlack()) .orElseThrow( () -> new AuthException(UNAUTHORIZED_REFRESH_TOKEN)); } From a9d3672e04634385e3b7b0e1902b18cd9aa7d835 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 15:03:46 +0900 Subject: [PATCH 437/465] =?UTF-8?q?[DEL]=20=EB=B6=88=ED=95=84=EC=9A=94=20?= =?UTF-8?q?=EC=BD=94=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 --- .../global/jwt/service/vo/RefreshTokenVO.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/vo/RefreshTokenVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/vo/RefreshTokenVO.java index 1a86bc3..cad2383 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/vo/RefreshTokenVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/vo/RefreshTokenVO.java @@ -17,8 +17,6 @@ public class RefreshTokenVO { @Indexed private String memberId; - private boolean black; - private String refreshToken; @@ -26,14 +24,9 @@ public void updateRefreshToken(String refreshToken) { this.refreshToken = refreshToken; } - public void updateBlack(boolean black) { - this.black = black; - } - @Builder - public RefreshTokenVO(String memberId, boolean black, String refreshToken) { + public RefreshTokenVO(String memberId, String refreshToken) { this.memberId = memberId; - this.black = black; this.refreshToken = refreshToken; } } From 71c735023e86173bb8e96c6a4554a6cb867a30a3 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 15:05:19 +0900 Subject: [PATCH 438/465] =?UTF-8?q?[FIX]=20=EC=97=90=EB=9F=AC=20=EB=A9=94?= =?UTF-8?q?=EC=84=B8=EC=A7=80=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/auth/controller/AuthApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java index 7901806..649458a 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/controller/AuthApi.java @@ -37,7 +37,7 @@ ResponseEntity> login( @ApiResponses( value = { @ApiResponse(responseCode = "200", description = "๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ ์žฌ๋ฐœ๊ธ‰์— ์„ฑ๊ณตํ•˜์˜€์Šต๋‹ˆ๋‹ค."), - @ApiResponse(responseCode = "400", description = "์„œ๋น„์Šค์—์„œ ๋ฐœ๊ธ‰๋˜์ง€ ์•Š์€ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), + @ApiResponse(responseCode = "400", description = "์„œ๋น„์Šค์—์„œ ๋ฐœ๊ธ‰๋˜์ง€ ์•Š๊ฑฐ๋‚˜ ์ด๋ฏธ ์‚ฌ์šฉ๋œ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))), @ApiResponse(responseCode = "401", description = "๊ธฐํ•œ์ด ๋งŒ๋ฃŒ๋œ ๋ฆฌํ”„๋ ˆ์‹œ ํ† ํฐ์ž…๋‹ˆ๋‹ค.", content = @Content(schema = @Schema(implementation = ErrorResponse.class))) } ) From 209c8cc62d0e30bb2c66300eef69a7dd14a7e1b7 Mon Sep 17 00:00:00 2001 From: Mingyu Song <100754581+mikekks@users.noreply.github.com> Date: Thu, 18 Jan 2024 15:55:49 +0900 Subject: [PATCH 439/465] =?UTF-8?q?[=08CHORE]=20=EB=A6=AC=EB=93=9C?= =?UTF-8?q?=EB=AF=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 8f41057..3465644 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@
-๋…ผ์ˆ ๋ฉ”์ดํŠธ_์„œ๋น„์Šค์„ค๋ช… - +๋…ผ์ˆ ๋ฉ”์ดํŠธ_์„œ๋น„์Šค์„ค๋ช…
@@ -102,12 +101,10 @@ โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service โ”‚ โ”œโ”€ ๐Ÿ“‚ oauth โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service -โ”‚ โ”œโ”€ ๐Ÿ“‚ redis -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ config -โ”‚ โ”‚ โ”œโ”€ ๐Ÿ“‚ repository -โ”‚ โ”‚ โ””โ”€ ๐Ÿ“‚ service -โ”‚ โ””โ”€ ๐Ÿ“‚ swagger -โ”‚ โ””โ”€ ๐Ÿ“‚ config +โ”‚ โ””โ”€ ๐Ÿ“‚ redis +โ”‚ โ”œโ”€ ๐Ÿ“‚ config +โ”‚ โ”œโ”€ ๐Ÿ“‚ repository +โ”‚ โ””โ”€ ๐Ÿ“‚ service โ””โ”€ ๐Ÿ“‚ global โ”œโ”€ ๐Ÿ“‚ controller โ”œโ”€ ๐Ÿ“‚ response @@ -120,6 +117,8 @@ โ”‚ โ”œโ”€ ๐Ÿ“‚ service โ”‚ โ”œโ”€ ๐Ÿ“‚ filter โ”‚ โ””โ”€ ๐Ÿ“‚ config + โ”œโ”€ ๐Ÿ“‚ swagger + โ”‚ โ””โ”€ ๐Ÿ“‚ config โ””โ”€ ๐Ÿ“‚ util โ””โ”€ ๐Ÿ“‚ mapper ~~~ From 63e0f9383d1b43a8e55a0f0171b17e6f83717038 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 15:59:12 +0900 Subject: [PATCH 440/465] =?UTF-8?q?[MOVE]=20=EC=8A=A4=EC=9B=A8=EC=96=B4=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=20=EC=9C=84=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{external => global}/swagger/config/SwaggerConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/{external => global}/swagger/config/SwaggerConfig.java (96%) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/swagger/config/SwaggerConfig.java similarity index 96% rename from nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java rename to nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/swagger/config/SwaggerConfig.java index 5b753c0..f690dd6 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/swagger/config/SwaggerConfig.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/swagger/config/SwaggerConfig.java @@ -1,4 +1,4 @@ -package com.nonsoolmate.nonsoolmateServer.external.swagger.config; +package com.nonsoolmate.nonsoolmateServer.global.swagger.config; import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.enums.SecuritySchemeIn; From 42c64ae409d85446372b969e3cbfbca77fc84435 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 18 Jan 2024 16:51:43 +0900 Subject: [PATCH 441/465] =?UTF-8?q?[FEAT]=20Bearer=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EB=82=B4=EC=9A=A9=20=EC=98=A4=EB=A5=98=20=EC=98=88=EC=99=B8=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/global/jwt/service/JwtService.java | 5 +++-- .../global/security/filter/JwtAuthenticationFilter.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java index 4f7acdd..b9e11d4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/jwt/service/JwtService.java @@ -18,6 +18,7 @@ import io.jsonwebtoken.Claims; import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.MalformedJwtException; +import io.jsonwebtoken.security.SignatureException; import jakarta.servlet.http.HttpServletRequest; import java.util.Date; import java.util.Optional; @@ -74,7 +75,7 @@ public MemberReissueResponseDTO reissueToken(HttpServletRequest request) { try { validateToken(refreshToken); - } catch (MalformedJwtException e) { + } catch (MalformedJwtException | SignatureException e) { throw new AuthException(INVALID_REFRESH_TOKEN); } catch (ExpiredJwtException e){ throw new AuthException(UNAUTHORIZED_REFRESH_TOKEN); @@ -106,7 +107,7 @@ public Long extractMemberIdFromAccessToken(final String atk) throws JsonProcessi return jwtTokenProvider.getMemberIdFromClaim(tokenClaims, AUTH_USER); } - public Boolean validateToken(final String atk) throws ExpiredJwtException, MalformedJwtException { + public Boolean validateToken(final String atk) throws ExpiredJwtException, MalformedJwtException, SignatureException { Claims tokenClaims = jwtTokenProvider.getTokenClaims(atk); return !tokenClaims.getExpiration().before(new Date()); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java index 6741a8c..0d19cc5 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/security/filter/JwtAuthenticationFilter.java @@ -13,6 +13,7 @@ import com.nonsoolmate.nonsoolmateServer.global.jwt.utils.RequestUtils; import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.MalformedJwtException; +import io.jsonwebtoken.security.SignatureException; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; @@ -71,7 +72,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse log.info("Authentication Principal : {}", authentication.getPrincipal().toString()); SecurityContextHolder.getContext().setAuthentication(authentication); - } catch (JsonProcessingException | MalformedJwtException e) { + } catch (JsonProcessingException | MalformedJwtException | SignatureException e) { throw new AuthException(INVALID_ACCESS_TOKEN); } catch (ExpiredJwtException e){ throw new AuthException(UNAUTHORIZED_ACCESS_TOKEN); From dde7854a4171abf2354e67b6d61e6991cf095ddf Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Thu, 18 Jan 2024 17:03:53 +0900 Subject: [PATCH 442/465] =?UTF-8?q?[DOCS]=203=EC=B0=A8=20=EA=B3=BC?= =?UTF-8?q?=EC=A0=9C=20=EC=A0=9C=EC=B6=9C=20=EC=A0=84=20README=20=EC=82=AC?= =?UTF-8?q?=EC=A7=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3465644..b659d3c 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ ๊น€์„ฑ์€ @sung-silver ์†ก๋ฏผ๊ทœ @mikekks - ์„ฑ์€ + ์„ฑ์€ - ๋ฏผ๊ทœ + ๋ฏผ๊ทœ ์—ญํ•  From 28983fd22cb2630be1e5600e63150943e6e66757 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 18 Jan 2024 23:50:06 +0900 Subject: [PATCH 443/465] =?UTF-8?q?[ADD]=20MethodArgumentTypeMismatchExcep?= =?UTF-8?q?tion=20=ED=95=B8=EB=93=A4=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/error/GlobalExceptionHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java index 6f2e78d..1a3f19b 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/error/GlobalExceptionHandler.java @@ -11,6 +11,7 @@ import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.RestControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; import org.springframework.web.servlet.NoHandlerFoundException; @RestControllerAdvice @@ -58,6 +59,11 @@ public ResponseEntity handleValidationError(MethodArgumentNotVali .body(ErrorResponse.of(CommonErrorType.INVALID_INPUT_VALUE, builder.toString())); } + @ExceptionHandler(MethodArgumentTypeMismatchException.class) + public ResponseEntity handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException ex){ + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(ErrorResponse.of(CommonErrorType.INVALID_INPUT_VALUE, ex.getMessage())); + } + @ExceptionHandler(HttpMediaTypeNotSupportedException.class) public ResponseEntity handleValidationExceptions(HttpMediaTypeNotSupportedException ex){ return ResponseEntity.status(HttpStatus.UNSUPPORTED_MEDIA_TYPE).body(ErrorResponse.of(CommonErrorType.INVALID_JSON_TYPE, ex.getMessage())); From e1ab548b2d9cfb9ae2b406254d932db363a7fb79 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 18 Jan 2024 23:52:34 +0900 Subject: [PATCH 444/465] =?UTF-8?q?[FIX]=20HttpUrlConnection=20->=20WebCli?= =?UTF-8?q?ent=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 --- .../external/discord/DiscordWebHook.java | 14 +++---- .../global/util/ApiCallUtil.java | 41 +++++++++---------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordWebHook.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordWebHook.java index 16d346e..506c4cd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordWebHook.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordWebHook.java @@ -40,15 +40,11 @@ public void execute() throws IOException { throw new RuntimeException("์ปจํ…์ธ ๋ฅผ ์„ค์ •ํ•˜๊ฑฐ๋‚˜ ํ•˜๋‚˜ ์ด์ƒ์˜ Embed Object๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค."); } - try { - ApiCallUtil.callDiscordAppenderPostAPI( - this.urlString, createDiscordEmbedObject( - this.embeds, initializerDiscordSendForJsonObject(new JsonObject()) - )); - - } catch (IOException ioException) { - throw ioException; - } + ApiCallUtil.callDiscordAppenderPostAPI( + this.urlString, createDiscordEmbedObject( + this.embeds, initializerDiscordSendForJsonObject(new JsonObject()) + )); + } private JsonObject initializerDiscordSendForJsonObject(JsonObject json) { diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/ApiCallUtil.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/ApiCallUtil.java index a52d833..578dd56 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/ApiCallUtil.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/util/ApiCallUtil.java @@ -1,35 +1,34 @@ package com.nonsoolmate.nonsoolmateServer.global.util; import com.nonsoolmate.nonsoolmateServer.external.discord.model.JsonObject; -import java.io.IOException; -import java.io.OutputStream; -import java.net.URL; -import javax.net.ssl.HttpsURLConnection; + +import io.jsonwebtoken.io.IOException; import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.MediaType; +import org.springframework.web.reactive.function.client.WebClient; +import reactor.core.publisher.Mono; @Slf4j @NoArgsConstructor(access = AccessLevel.PRIVATE) public class ApiCallUtil { - public static void callDiscordAppenderPostAPI(String urlString, JsonObject json) throws IOException { - URL url = new URL(urlString); - HttpsURLConnection connection = (HttpsURLConnection)url.openConnection(); - connection.addRequestProperty("Content-Type", "application/json"); - connection.addRequestProperty("User-Agent", "Java-DiscordWebhook-BY-Gelox_"); - connection.setDoOutput(true); - connection.setRequestMethod("POST"); - - try (OutputStream stream = connection.getOutputStream()) { - stream.write(json.toString().getBytes()); - stream.flush(); - - connection.getInputStream().close(); - connection.disconnect(); - - } catch (IOException ioException) { - throw ioException; + public static void callDiscordAppenderPostAPI(String urlString, JsonObject json) { + WebClient webClient = WebClient.create(); + try { + webClient.post() + .uri(urlString) + .contentType(MediaType.APPLICATION_JSON) + .header("User-Agent", "Java-DiscordWebhook-BY-Gelox_") + .body(Mono.just(json.toString()), String.class) + .retrieve() + .bodyToMono(Void.class) + .block(); + } catch (IOException e) { + log.error("Discord Appender API ํ˜ธ์ถœ ์‹คํŒจ", e.getMessage()); + throw e; } } } + From c9c1d9935ca59599ab1be65421d46d25e830637b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 18 Jan 2024 23:53:05 +0900 Subject: [PATCH 445/465] =?UTF-8?q?[DEL]=20=EC=95=88=EC=93=B0=EB=8A=94=20i?= =?UTF-8?q?mport=EB=AC=B8=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../global/logging/filter/ServletWrappingFilter.java | 1 - 1 file changed, 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/ServletWrappingFilter.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/ServletWrappingFilter.java index 266d84f..061fcd0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/ServletWrappingFilter.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/global/logging/filter/ServletWrappingFilter.java @@ -1,6 +1,5 @@ package com.nonsoolmate.nonsoolmateServer.global.logging.filter; -import com.nonsoolmate.nonsoolmateServer.global.logging.filter.CachedBodyRequestWrapper; import jakarta.servlet.FilterChain; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; From 24555afae6bdae3d2adbbec4892f3f0e9e20e12e Mon Sep 17 00:00:00 2001 From: sung-silver Date: Thu, 18 Jan 2024 23:54:01 +0900 Subject: [PATCH 446/465] =?UTF-8?q?[FIX]=20exceptionBrief=EA=B0=80=20183?= =?UTF-8?q?=EC=9D=B4=20=EB=84=98=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20substring?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9E=98=EB=9D=BC=EC=84=9C=20=EC=A0=84?= =?UTF-8?q?=EB=8B=AC=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/discord/DiscordAppender.java | 50 +++---------------- 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordAppender.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordAppender.java index 0f9e67b..9478fb0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordAppender.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/discord/DiscordAppender.java @@ -11,11 +11,13 @@ import com.nonsoolmate.nonsoolmateServer.global.util.StringUtil; import io.micrometer.core.instrument.util.StringEscapeUtils; import com.nonsoolmate.nonsoolmateServer.external.discord.model.EmbedObject; + import java.awt.Color; import java.io.IOException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Map; + import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -59,52 +61,16 @@ protected void append(ILoggingEvent eventObject) { exceptionBrief = "EXCEPTION ์ •๋ณด๊ฐ€ ๋‚จ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค."; } - discordWebhook.addEmbed(new EmbedObject() - .setTitle("[" + level + " - ๋ฌธ์ œ ๊ฐ„๋žต ๋‚ด์šฉ]") - .setColor(messageColor) - .setDescription(exceptionBrief) - .addField("[" + "Exception Level" + "]", - StringEscapeUtils.escapeJson(level), - true) - .addField("[๋ฌธ์ œ ๋ฐœ์ƒ ์‹œ๊ฐ]", - LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), - false) - .addField( - "[" + MDCUtil.REQUEST_URI_MDC + "]", - StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.REQUEST_URI_MDC)), - false) - .addField( - "[" + MDCUtil.USER_IP_MDC + "]", - StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.USER_IP_MDC)), - false) - .addField( - "[" + MDCUtil.HEADER_MAP_MDC + "]", - StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.HEADER_MAP_MDC).replaceAll("[\\{\\{\\}]", "")), - true) - .addField( - "[" + MDCUtil.USER_REQUEST_COOKIES + "]", - StringEscapeUtils.escapeJson( - mdcPropertyMap.get(MDCUtil.USER_REQUEST_COOKIES).replaceAll("[\\{\\{\\}]", "")), - false) - .addField( - "[" + MDCUtil.PARAMETER_MAP_MDC + "]", - StringEscapeUtils.escapeJson( - mdcPropertyMap.get(MDCUtil.PARAMETER_MAP_MDC).replaceAll("[\\{\\{\\}]", "")), - false) - .addField("[" + MDCUtil.BODY_MDC + "]", - StringEscapeUtils.escapeJson(StringUtil.translateEscapes(mdcPropertyMap.get(MDCUtil.BODY_MDC))), - false) - ); + if (exceptionBrief.length() > 183) { + exceptionBrief = exceptionBrief.substring(0, 183); + } + + discordWebhook.addEmbed(new EmbedObject().setTitle("[" + level + " - ๋ฌธ์ œ ๊ฐ„๋žต ๋‚ด์šฉ]").setColor(messageColor).setDescription(exceptionBrief).addField("[" + "Exception Level" + "]", StringEscapeUtils.escapeJson(level), true).addField("[๋ฌธ์ œ ๋ฐœ์ƒ ์‹œ๊ฐ]", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), false).addField("[" + MDCUtil.REQUEST_URI_MDC + "]", StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.REQUEST_URI_MDC)), false).addField("[" + MDCUtil.USER_IP_MDC + "]", StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.USER_IP_MDC)), false).addField("[" + MDCUtil.HEADER_MAP_MDC + "]", StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.HEADER_MAP_MDC).replaceAll("[\\{\\{\\}]", "")), true).addField("[" + MDCUtil.USER_REQUEST_COOKIES + "]", StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.USER_REQUEST_COOKIES).replaceAll("[\\{\\{\\}]", "")), false).addField("[" + MDCUtil.PARAMETER_MAP_MDC + "]", StringEscapeUtils.escapeJson(mdcPropertyMap.get(MDCUtil.PARAMETER_MAP_MDC).replaceAll("[\\{\\{\\}]", "")), false).addField("[" + MDCUtil.BODY_MDC + "]", StringEscapeUtils.escapeJson(StringUtil.translateEscapes(mdcPropertyMap.get(MDCUtil.BODY_MDC))), false)); if (throwable != null) { exceptionDetail = ThrowableProxyUtil.asString(throwable); String exception = exceptionDetail.substring(0, 4000); - discordWebhook.addEmbed( - new EmbedObject() - .setTitle("[Exception ์ƒ์„ธ ๋‚ด์šฉ]") - .setColor(messageColor) - .setDescription(StringEscapeUtils.escapeJson(exception)) - ); + discordWebhook.addEmbed(new EmbedObject().setTitle("[Exception ์ƒ์„ธ ๋‚ด์šฉ]").setColor(messageColor).setDescription(StringEscapeUtils.escapeJson(exception))); } try { From 3fa243c0c08b74a10d16d8c70406d142f0d4d5ac Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 02:51:02 +0900 Subject: [PATCH 447/465] =?UTF-8?q?[FIX]=20getUniversityExamName=20->=20ge?= =?UTF-8?q?tUniversityExamFullName=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectUniversity/service/SelectUniversityService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index eefff9f..2cd41ab 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -91,7 +91,7 @@ private List getSelectUniversityExamResponseDTO universityExamRecord == null ? BEFORE_EXAM : universityExamRecord.getExamResultStatus().getStatus(); selectUniversityExamResponseDTOS.add( SelectUniversityExamResponseDTO.of(universityExam.getUniversityExamId(), - universityExam.getUniversityExamName(), universityExam.getUniversityExamTimeLimit(), + universityExam.getUniversityExamFullName(), universityExam.getUniversityExamTimeLimit(), status)); } return selectUniversityExamResponseDTOS; From b91ecb44f75b9c144970865216e9b58c76e23e04 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 03:07:29 +0900 Subject: [PATCH 448/465] =?UTF-8?q?[ADD]=20UnviersityExam=20=EC=97=94?= =?UTF-8?q?=ED=8B=B0=ED=8B=B0=EC=97=90=20=EB=AA=A9=ED=91=9C=20=EB=8C=80?= =?UTF-8?q?=ED=95=99=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=82=AC=EC=9A=A9=EB=90=98=EB=8A=94=20=EC=8B=9C=ED=97=98=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=EC=9D=84=20=EB=B0=98=ED=99=98=ED=95=98?= =?UTF-8?q?=EB=8A=94=20getUnviersityExamListName()=20=ED=95=A8=EC=88=98=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/university/entity/UniversityExam.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java index 656a589..5d750ff 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/entity/UniversityExam.java @@ -41,4 +41,8 @@ public class UniversityExam { public String getUniversityExamFullName(){ return this.getUniversity().getUniversityName() + " - " + this.getUniversityExamYear() + " " + this.getUniversityExamName(); } + + public String getUniversityExamListName(){ + return this.getUniversityExamYear() + " " + this.getUniversityExamName(); + } } \ No newline at end of file From af0159ac17fb8dde423faa2532cf013d6067f0d0 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 03:07:48 +0900 Subject: [PATCH 449/465] =?UTF-8?q?[FIX]=20getUnviersityExamListName()?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../selectUniversity/service/SelectUniversityService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 2cd41ab..2c91613 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -91,7 +91,7 @@ private List getSelectUniversityExamResponseDTO universityExamRecord == null ? BEFORE_EXAM : universityExamRecord.getExamResultStatus().getStatus(); selectUniversityExamResponseDTOS.add( SelectUniversityExamResponseDTO.of(universityExam.getUniversityExamId(), - universityExam.getUniversityExamFullName(), universityExam.getUniversityExamTimeLimit(), + universityExam.getUniversityExamListName(), universityExam.getUniversityExamTimeLimit(), status)); } return selectUniversityExamResponseDTOS; From 40b328b8a554baf426d5731c5530eb43985368ae Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 03:22:36 +0900 Subject: [PATCH 450/465] =?UTF-8?q?[FIX]=20=EB=8C=80=ED=95=99=20=EC=8B=9C?= =?UTF-8?q?=ED=97=98=20=EB=A0=88=ED=8F=AC=EC=A7=80=ED=86=A0=EB=A6=AC?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EB=8C=80=ED=95=99=20=EC=8B=9C=ED=97=98=20?= =?UTF-8?q?=EB=85=84=EB=8F=84=EB=A5=BC=20=EB=82=B4=EB=A6=BC=EC=B0=A8?= =?UTF-8?q?=EC=88=9C=EC=9C=BC=EB=A1=9C=20=EC=A0=95=EB=A0=AC=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/university/repository/UniversityExamRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java index 753ff10..d59a2dc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/repository/UniversityExamRepository.java @@ -9,5 +9,5 @@ public interface UniversityExamRepository extends JpaRepository { Optional findByUniversityExamId(Long universityId); - List findAllByUniversity(University university); + List findAllByUniversityOrderByUniversityExamYearDesc(University university); } From 96b85ef403d7e148028cddb53f7bde633e7880a8 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 03:23:16 +0900 Subject: [PATCH 451/465] =?UTF-8?q?[FIX]=20SelectUniversityService?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=ED=95=A8=EC=88=98=20=EC=9D=B4=EB=A6=84=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 --- .../selectUniversity/service/SelectUniversityService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index 2c91613..b9864ea 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -70,7 +70,7 @@ private SelectUniversityExamsResponseDTO getSelectUniversityExamsResponseDTO(Sel Member member) { List selectUniversityExamResponseDTOS; - List universityExams = universityExamRepository.findAllByUniversity( + List universityExams = universityExamRepository.findAllByUniversityOrderByUniversityExamYearDesc( selectUniversity.getUniversity()); selectUniversityExamResponseDTOS = getSelectUniversityExamResponseDTOS(universityExams, member); From 4aeebdce3a93e72049500f4de2bffb5cb892b05c Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Fri, 19 Jan 2024 03:31:22 +0900 Subject: [PATCH 452/465] =?UTF-8?q?[DOCS]=20=EC=9A=B0=EC=A0=95=EC=96=B8?= =?UTF-8?q?=EB=8B=88=20=EC=9A=94=EC=B2=AD=EC=9C=BC=EB=A1=9C=20README=20?= =?UTF-8?q?=EC=82=AC=EC=A7=84=20=EC=82=AC=EC=9D=B4=EC=A6=88=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 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b659d3c..6d32cef 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ ๊น€์„ฑ์€ @sung-silver ์†ก๋ฏผ๊ทœ @mikekks - ์„ฑ์€ + ์„ฑ์€ - ๋ฏผ๊ทœ + ๋ฏผ๊ทœ ์—ญํ•  From 9404c8b34e1e5b4586f923eeab3ce4b24403758b Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 05:28:28 +0900 Subject: [PATCH 453/465] =?UTF-8?q?[DEL]=20S3Service=EC=97=90=EC=84=9C=20P?= =?UTF-8?q?reSignedUrl=20=EB=A1=9C=EC=A7=81=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/aws/service/S3Service.java | 35 +------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java index 66c751c..ea869a0 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/S3Service.java @@ -2,9 +2,7 @@ import com.nonsoolmate.nonsoolmateServer.external.aws.config.AWSConfig; import com.nonsoolmate.nonsoolmateServer.external.aws.error.*; -import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; -import java.time.Duration; -import java.util.UUID; + import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -12,12 +10,7 @@ import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.services.s3.model.DeleteObjectRequest; import software.amazon.awssdk.services.s3.model.HeadObjectRequest; -import software.amazon.awssdk.services.s3.model.HeadObjectResponse; import software.amazon.awssdk.services.s3.model.S3Exception; -import software.amazon.awssdk.services.s3.presigner.S3Presigner; -import software.amazon.awssdk.services.s3.model.PutObjectRequest; -import software.amazon.awssdk.services.s3.presigner.model.PutObjectPresignRequest; -import java.net.URL; @Service @RequiredArgsConstructor @@ -26,32 +19,6 @@ public class S3Service { @Value("${aws-property.s3-bucket-name}") private String bucketName; private final AWSConfig awsConfig; - private static final Long PRE_SIGNED_URL_EXPIRE_MINUTE = 1L; - - public PreSignedUrlVO getUploadPreSignedUrl(final String prefix) { - String uuidFileName = generateZipFileName(); - String key = prefix + uuidFileName; - - S3Presigner preSigner = awsConfig.getS3Presigner(); - - PutObjectRequest putObjectRequest = PutObjectRequest.builder() - .bucket(bucketName) - .key(key) - .build(); - - PutObjectPresignRequest preSignedUrlRequest = PutObjectPresignRequest.builder() - .signatureDuration(Duration.ofMinutes(PRE_SIGNED_URL_EXPIRE_MINUTE)) - .putObjectRequest(putObjectRequest) - .build(); - - URL url = preSigner.presignPutObject(preSignedUrlRequest).url(); - - return PreSignedUrlVO.of(uuidFileName, url.toString()); - } - - private String generateZipFileName() { - return UUID.randomUUID() + ".zip"; - } public String validateURL(final String prefix, final String fileName) { try { From e984c68bdb29ebeada322c4d03dd4b55e8cee2ca Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 05:29:15 +0900 Subject: [PATCH 454/465] =?UTF-8?q?[ADD]=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EC=9D=B8=EC=BD=94=EB=94=A9=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/external/aws/error/AWSExceptionType.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java index 445e12b..e10b787 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/error/AWSExceptionType.java @@ -11,6 +11,8 @@ public enum AWSExceptionType implements ExceptionType { NOT_FOUND_AWS_PRIVATE_KEY(HttpStatus.NOT_FOUND, "ํ•ด๋‹น AWS Private Key๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), NOT_FOUND_SHEET_FILE_AWS_S3(HttpStatus.NOT_FOUND, "ํ•ด๋‹น ๋‹ต์•ˆ์ง€ ํŒŒ์ผ ์ด๋ฆ„์„ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค"), GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL(HttpStatus.BAD_REQUEST, "Cloud PreSignedUrl ๋ฐœ๊ธ‰์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), + + FAIL_ENCODING_FILE_NAME(HttpStatus.BAD_REQUEST, "ํŒŒ์ผ ์ด๋ฆ„ ์ธ์ฝ”๋”ฉ์— ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค"), AWS_S3_SERVICE_ERROR(HttpStatus.SERVICE_UNAVAILABLE, "S3 ์„œ๋น„์Šค ์—๋Ÿฌ"); private final HttpStatus status; From e5ca7dbc7acf5fe3a100dd17b9fd60217fbbacf6 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 05:29:54 +0900 Subject: [PATCH 455/465] =?UTF-8?q?[FEAT]=20CloudFront=20PreSignedUrl?= =?UTF-8?q?=EC=97=90=EC=84=9C=20upload=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aws/service/CloudFrontService.java | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java index 3bf5675..625d579 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/CloudFrontService.java @@ -2,12 +2,16 @@ import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSBusinessException; import com.nonsoolmate.nonsoolmateServer.external.aws.error.AWSExceptionType; + import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.file.Path; import java.nio.file.Paths; import java.time.Instant; import java.time.temporal.ChronoUnit; +import java.util.UUID; + +import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -32,9 +36,22 @@ public class CloudFrontService { private static final Long PRE_SIGNED_URL_EXPIRE_SECONDS = 30L; + public PreSignedUrlVO createPreSignedPutUrl(String path) { + String fileName = generateZipFileName(); + return PreSignedUrlVO.of(fileName, createPreSignedUrl(path + fileName)); + } + + private String generateZipFileName() { + return UUID.randomUUID() + ".zip"; + } + public String createPreSignedGetUrl(String path, String fileName) { + String resourcePath = getEncodedResourcePath(path, fileName); + return createPreSignedUrl(resourcePath); + } + + private String createPreSignedUrl(String resourcePath) { try { - String resourcePath = getEncodedResourcePath(path, fileName); String cloudFrontUrl = "https://" + distributionDomain + "/" + resourcePath; Instant expirationTime = Instant.now().plus(PRE_SIGNED_URL_EXPIRE_SECONDS, ChronoUnit.SECONDS); Path keyPath = Paths.get(privateKeyFilePath); @@ -48,15 +65,19 @@ public String createPreSignedGetUrl(String path, String fileName) { .build(); SignedUrl signedUrl = cloudFrontUtilities.getSignedUrlWithCannedPolicy(cannedSignerRequest); return signedUrl.url(); - } catch(AWSBusinessException e){ + } catch (AWSBusinessException e) { throw new AWSBusinessException(AWSExceptionType.GET_PRESIGNED_URL_AWS_CLOUDFRONT_FAIL); } catch (Exception e) { throw new AWSBusinessException(AWSExceptionType.NOT_FOUND_AWS_PRIVATE_KEY); } } - private String getEncodedResourcePath(String path, String fileName) throws UnsupportedEncodingException { - String encodedFileName = URLEncoder.encode(fileName, "UTF-8"); - return path + encodedFileName; + private String getEncodedResourcePath(String path, String fileName) { + try { + String encodedFileName = URLEncoder.encode(fileName, "UTF-8"); + return path + encodedFileName; + } catch (UnsupportedEncodingException e) { + throw new AWSBusinessException(AWSExceptionType.FAIL_ENCODING_FILE_NAME); + } } } From c3c787c916dab1ed93278bc7a02a06aefc808452 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Fri, 19 Jan 2024 05:31:00 +0900 Subject: [PATCH 456/465] =?UTF-8?q?[FIX]=20UniversityExamRecordSheetServic?= =?UTF-8?q?e=20=EB=82=B4=20getUniversityExamRecordSheetPreSignedUrl()?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=82=AC=EC=9A=A9=20=EC=84=9C=EB=B9=84?= =?UTF-8?q?=EC=8A=A4=20=EB=B0=8F=20=EB=A9=94=EC=84=9C=EB=93=9C=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 --- .../service/UniversityExamRecordSheetService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordSheetService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordSheetService.java index 8592fae..4b84266 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordSheetService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordSheetService.java @@ -2,7 +2,7 @@ import static com.nonsoolmate.nonsoolmateServer.external.aws.FolderName.EXAM_SHEET_FOLDER_NAME; -import com.nonsoolmate.nonsoolmateServer.external.aws.service.S3Service; +import com.nonsoolmate.nonsoolmateServer.external.aws.service.CloudFrontService; import com.nonsoolmate.nonsoolmateServer.external.aws.service.vo.PreSignedUrlVO; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; @@ -12,10 +12,10 @@ @Transactional(readOnly = true) @RequiredArgsConstructor public class UniversityExamRecordSheetService { - private final S3Service s3Service; + private final CloudFrontService cloudFrontService; public PreSignedUrlVO getUniversityExamRecordSheetPreSignedUrl() { - return s3Service.getUploadPreSignedUrl(EXAM_SHEET_FOLDER_NAME); + return cloudFrontService.createPreSignedPutUrl(EXAM_SHEET_FOLDER_NAME); } } From 5130de43124c3f13acc2436904ce9e279766484a Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 20 Jan 2024 02:32:11 +0900 Subject: [PATCH 457/465] =?UTF-8?q?[REFACTOR]=20Auth=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=20=EC=84=9C=EB=B9=84=EC=8A=A4=EC=97=90=20final=20=ED=82=A4?= =?UTF-8?q?=EC=9B=8C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/auth/service/AuthService.java | 12 ++++++------ .../domain/auth/service/AuthServiceProvider.java | 2 +- .../external/oauth/service/NaverAuthService.java | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java index 4246da4..ae23cca 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthService.java @@ -16,21 +16,21 @@ public abstract class AuthService { private final MemberRepository memberRepository; @Transactional - public abstract MemberSignUpVO saveMemberOrLogin(String platformType, MemberRequestDTO request); + public abstract MemberSignUpVO saveMemberOrLogin(final String platformType, final MemberRequestDTO request); - protected Member getMember(PlatformType platformType, String email) { + protected Member getMember(final PlatformType platformType, final String email) { return memberRepository.findByPlatformTypeAndEmail(platformType, email) .orElse(null); } - protected Member saveUser(MemberRequestDTO request, String email, String name, String birthday, String gender, - String phoneNumber) { + protected Member saveUser(final MemberRequestDTO request, final String email, final String name, final String birthday, final String gender, + final String phoneNumber) { Member newMember = createSocialMember(email, name, PlatformType.of(request.platformType()), birthday, gender, phoneNumber); return memberRepository.saveAndFlush(newMember); } - private static Member createSocialMember(String email, String name, PlatformType platformType, String birthYear, - String gender, String phoneNumber) { + private static Member createSocialMember(final String email, final String name, final PlatformType platformType, final String birthYear, + final String gender, final String phoneNumber) { return Member.builder().email(email).name(name).platformType(platformType).role(Role.USER) .birthYear(birthYear) .gender(gender).phoneNumber(phoneNumber).build(); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthServiceProvider.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthServiceProvider.java index ad238eb..88e7764 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthServiceProvider.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/auth/service/AuthServiceProvider.java @@ -20,7 +20,7 @@ void init() { authServiceMap.put(PlatformType.NAVER, naverAuthService); } - public AuthService getAuthService(PlatformType platformType) { + public AuthService getAuthService(final PlatformType platformType) { return authServiceMap.get(platformType); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java index b9c5d53..b6cedbe 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/oauth/service/NaverAuthService.java @@ -38,7 +38,7 @@ public NaverAuthService(MemberRepository memberRepository) { } @Override - public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestDTO request) { + public MemberSignUpVO saveMemberOrLogin(final String authorizationCode, final MemberRequestDTO request) { String accessToken = getAccessToken(authorizationCode, clientId, clientSecret, state).getAccess_token(); NaverMemberVO naverMemberInfo = getNaverMemberInfo(accessToken); Member foundMember = getMember(PlatformType.of(request.platformType()), naverMemberInfo.getResponse().getEmail()); @@ -55,7 +55,7 @@ public MemberSignUpVO saveMemberOrLogin(String authorizationCode, MemberRequestD } - public NaverMemberVO getNaverMemberInfo(String accessToken) { + public NaverMemberVO getNaverMemberInfo(final String accessToken) { WebClient webClient = WebClient.builder().build(); try { return webClient.post() From b87cf1b543871110fd86428e4d4c4aa7bf503bd4 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 20 Jan 2024 03:25:31 +0900 Subject: [PATCH 458/465] =?UTF-8?q?[REFACTOR]=20Member=20=EA=B4=80?= =?UTF-8?q?=EB=A0=A8=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC,=20=EC=84=9C?= =?UTF-8?q?=EB=B9=84=EC=8A=A4=EC=97=90=20final=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 4 ++-- .../domain/member/service/MemberService.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 4f3f0c4..17c4cdd 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -21,7 +21,7 @@ public class MyController implements MemberApi{ @Override @GetMapping("/name") - public ResponseEntity> getName(@AuthUser Member member) { + public ResponseEntity> getName(final @AuthUser Member member) { return ResponseEntity.ok() .body(SuccessResponse.of(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname(member))); @@ -29,7 +29,7 @@ public ResponseEntity> getName(@AuthUser Member @Override @GetMapping("/ticket") - public ResponseEntity> getTicket(@AuthUser Member member) { + public ResponseEntity> getTicket(final @AuthUser Member member) { return ResponseEntity.ok() .body(SuccessResponse.of(MemberSuccessType.GET_MEMBER_TICKET_SUCCESS, memberService.getTicket(member))); diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java index e00cd93..754c9da 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/service/MemberService.java @@ -15,11 +15,11 @@ public class MemberService { private final MemberRepository memberRepository; - public NameResponseDTO getNickname(Member member) { + public NameResponseDTO getNickname(final Member member) { return NameResponseDTO.of(member.getName()); } - public TicketResponseDTO getTicket(Member member) { + public TicketResponseDTO getTicket(final Member member) { return TicketResponseDTO.of(member.getName(), member.getTicketCount()); } } From e26cb5cd2c81ffd010b0bbbe6aef9bdc1b93fbe8 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 20 Jan 2024 03:28:14 +0900 Subject: [PATCH 459/465] =?UTF-8?q?[REFACTOR]=20UniversityExamController?= =?UTF-8?q?=20=EA=B4=80=EB=A0=A8=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC,?= =?UTF-8?q?=20=EC=84=9C=EB=B9=84=EC=8A=A4=EC=97=90(=EC=84=B1=EC=9D=80=20AP?= =?UTF-8?q?I)=20final=20=ED=82=A4=EC=9B=8C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../university/controller/UniversityExamController.java | 4 ++-- .../domain/university/service/UniversityExamService.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java index e7666e5..2c5dc58 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/UniversityExamController.java @@ -28,7 +28,7 @@ public class UniversityExamController implements UniversityApi{ @Override @GetMapping("/{id}/info") public ResponseEntity> getUniversityExam( - @PathVariable("id") Long universityExamId) { + @PathVariable("id") final Long universityExamId) { return ResponseEntity.ok().body(SuccessResponse.of(UniversityExamSuccessType.GET_UNIVERSITY_EXAM_SUCCESS, universityExamService.getUniversityExam(universityExamId))); } @@ -36,7 +36,7 @@ public ResponseEntity> getUnivers @Override @GetMapping("{id}/image") public ResponseEntity>> getUniversityExamImages( - @PathVariable("id") Long id, @RequestParam(defaultValue = "0") int page, Pageable pageable) { + @PathVariable("id") final Long id, @RequestParam(defaultValue = "0") final int page, final Pageable pageable) { PageRequest pageRequest = PageRequest.of(page, 1); Page images = universityExamService.getUniversityExamImages(id, pageRequest); return ResponseEntity.ok() diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java index 5febe81..52ca2d1 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/service/UniversityExamService.java @@ -30,7 +30,7 @@ public class UniversityExamService { private final CloudFrontService cloudFrontService; - public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { + public UniversityExamInfoResponseDTO getUniversityExam(final Long universityExamId) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.INVALID_UNIVERSITY_EXAM)); @@ -40,7 +40,7 @@ public UniversityExamInfoResponseDTO getUniversityExam(Long universityExamId) { universityExam.getUniversityExamTimeLimit()); } - public Page getUniversityExamImages(Long id, Pageable pageable) { + public Page getUniversityExamImages(final Long id, final Pageable pageable) { UniversityExam universityExam = universityExamRepository.findByUniversityExamId(id) .orElseThrow(() -> new UniversityExamException( UniversityExamExceptionType.INVALID_UNIVERSITY_EXAM)); From aff81e3573aeb7b247f3c9073535a04d47ecc6e7 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 20 Jan 2024 03:29:29 +0900 Subject: [PATCH 460/465] =?UTF-8?q?[REFACTOR]=20MyController=20final=20?= =?UTF-8?q?=ED=82=A4=EC=9B=8C=EB=93=9C=20=EC=9C=84=EC=B9=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/controller/MyController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java index 17c4cdd..e1f5afc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/MyController.java @@ -21,7 +21,7 @@ public class MyController implements MemberApi{ @Override @GetMapping("/name") - public ResponseEntity> getName(final @AuthUser Member member) { + public ResponseEntity> getName(@AuthUser final Member member) { return ResponseEntity.ok() .body(SuccessResponse.of(MemberSuccessType.GET_MEMBER_NAME_SUCCESS, memberService.getNickname(member))); @@ -29,7 +29,7 @@ public ResponseEntity> getName(final @AuthUser @Override @GetMapping("/ticket") - public ResponseEntity> getTicket(final @AuthUser Member member) { + public ResponseEntity> getTicket(@AuthUser final Member member) { return ResponseEntity.ok() .body(SuccessResponse.of(MemberSuccessType.GET_MEMBER_TICKET_SUCCESS, memberService.getTicket(member))); From b422b4a924477af7063711b46c1c1d237b11e0b2 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 20 Jan 2024 03:54:56 +0900 Subject: [PATCH 461/465] =?UTF-8?q?[REFACTOR]=20UniversityExamRecordContro?= =?UTF-8?q?ller=20=EA=B4=80=EB=A0=A8=20=EC=BB=A8=ED=8A=B8=EB=A1=A4?= =?UTF-8?q?=EB=9F=AC,=20=EC=84=9C=EB=B9=84=EC=8A=A4=EC=97=90(=EC=84=B1?= =?UTF-8?q?=EC=9D=80=20API)=20final=20=ED=82=A4=EC=9B=8C=EB=93=9C=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 --- .../UniversityExamRecordController.java | 4 +-- .../service/UniversityExamRecordService.java | 26 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java index 958c46c..e6aa287 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/UniversityExamRecordController.java @@ -63,8 +63,8 @@ public ResponseEntity> createUniversityExamRecord( - @Valid @RequestBody CreateUniversityExamRequestDTO createUniversityExamRequestDTO, - @AuthUser Member member) { + @Valid @RequestBody final CreateUniversityExamRequestDTO createUniversityExamRequestDTO, + @AuthUser final Member member) { return ResponseEntity.status(HttpStatus.CREATED).body(SuccessResponse.of( UniversityExamRecordSuccessType.CREATE_UNIVERSITY_EXAM_RECORD_SUCCESS, universityExamRecordService.createUniversityExamRecord( diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java index 491efe9..8af3ce4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/service/UniversityExamRecordService.java @@ -71,15 +71,15 @@ private void validateCorrection(UniversityExamRecord universityExamRecord) { @Transactional public UniversityExamRecordIdResponse createUniversityExamRecord( - CreateUniversityExamRequestDTO request, Member member) { - UniversityExam universityExam = getUniversityExam(request.universityExamId()); + final CreateUniversityExamRequestDTO request, final Member member) { + final UniversityExam universityExam = getUniversityExam(request.universityExamId()); validateUniversityExam(universityExam, member); try { - String fileName = s3Service.validateURL(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); - UniversityExamRecord universityexamRecord = createUniversityExamRecord(universityExam, member, + final String fileName = s3Service.validateURL(EXAM_SHEET_FOLDER_NAME, request.memberSheetFileName()); + final UniversityExamRecord universityexamRecord = createUniversityExamRecord(universityExam, member, request.memberTakeTimeExam(), fileName); - UniversityExamRecord saveUniversityUniversityExamRecord = universityExamRecordRepository.save( + final UniversityExamRecord saveUniversityUniversityExamRecord = universityExamRecordRepository.save( universityexamRecord); decreaseMemberTicketCount(member); return UniversityExamRecordIdResponse.of(saveUniversityUniversityExamRecord.getUniversityExamRecordId()); @@ -91,14 +91,14 @@ public UniversityExamRecordIdResponse createUniversityExamRecord( } } - private void validateUniversityExam(UniversityExam universityExam, Member member){ - UniversityExamRecord existUniversityExamRecord = universityExamRecordRepository.findByUniversityExamAndMember(universityExam, member).orElse(null); + private void validateUniversityExam(final UniversityExam universityExam, final Member member){ + final UniversityExamRecord existUniversityExamRecord = universityExamRecordRepository.findByUniversityExamAndMember(universityExam, member).orElse(null); if (existUniversityExamRecord != null) { throw new UniversityExamRecordException(ALREADY_CREATE_EXAM_RECORD); } } - private void decreaseMemberTicketCount(Member member) { + private void decreaseMemberTicketCount(final Member member) { try { member.decreaseTicket(); memberRepository.save(member); @@ -107,8 +107,8 @@ private void decreaseMemberTicketCount(Member member) { } } - private UniversityExamRecord createUniversityExamRecord(UniversityExam universityExam, Member member, - int takeTimeExam, String sheetFileName) { + private UniversityExamRecord createUniversityExamRecord(final UniversityExam universityExam, final Member member, + final int takeTimeExam, final String sheetFileName) { return UniversityExamRecord.builder() .universityExam(universityExam) .examResultStatus(ExamResultStatus.ONGOING) @@ -118,13 +118,13 @@ private UniversityExamRecord createUniversityExamRecord(UniversityExam universit .build(); } - private UniversityExam getUniversityExam(Long universityExamId) { + private UniversityExam getUniversityExam(final Long universityExamId) { return universityExamRepository.findByUniversityExamId(universityExamId) .orElseThrow(() -> new UniversityExamException(INVALID_UNIVERSITY_EXAM)); } - private UniversityExamRecord getUniversityExamByUniversityExamAndMember(UniversityExam universityExam, - Member member) { + private UniversityExamRecord getUniversityExamByUniversityExamAndMember(final UniversityExam universityExam, + final Member member) { return universityExamRecordRepository.findByUniversityExamAndMemberOrElseThrowException( universityExam, member); } From de2fc03b45366b0a1f6d8374401a87f310855e16 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 20 Jan 2024 03:58:39 +0900 Subject: [PATCH 462/465] =?UTF-8?q?[REFACTOR]=20SelectUniversity=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC,=20?= =?UTF-8?q?=EC=84=9C=EB=B9=84=EC=8A=A4=EC=97=90(=EC=84=B1=EC=9D=80=20API)?= =?UTF-8?q?=20final=20=ED=82=A4=EC=9B=8C=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SelectUniversityController.java | 2 +- .../service/SelectUniversityService.java | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java index a8d739b..d20e210 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/SelectUniversityController.java @@ -41,7 +41,7 @@ public ResponseEntity>> getSel @Override @GetMapping("/exam") public ResponseEntity>> getSelectUniversityExams( - @AuthUser Member member) { + @AuthUser final Member member) { return ResponseEntity.ok().body(SuccessResponse.of(GET_SELECT_UNIVERSITY_EXAMS_SUCCESS, selectUniversityService.getSelectUniversityExams(member))); } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java index b9864ea..7441179 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/service/SelectUniversityService.java @@ -54,9 +54,9 @@ public List getSelectUniversities(Member member) { return selectUniversityResponseDTOS; } - public List getSelectUniversityExams(Member member) { + public List getSelectUniversityExams(final Member member) { List selectUniversityExamsResponseDTOS = new ArrayList<>(); - List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc( + final List selectUniversities = selectUniversityRepository.findAllByMemberOrderByUniversityNameASCUniversityCollegeAsc( member); for (SelectUniversity selectUniversity : selectUniversities) { @@ -66,14 +66,13 @@ public List getSelectUniversityExams(Member me return selectUniversityExamsResponseDTOS; } - private SelectUniversityExamsResponseDTO getSelectUniversityExamsResponseDTO(SelectUniversity selectUniversity, - Member member) { - List selectUniversityExamResponseDTOS; + private SelectUniversityExamsResponseDTO getSelectUniversityExamsResponseDTO(final SelectUniversity selectUniversity, + final Member member) { - List universityExams = universityExamRepository.findAllByUniversityOrderByUniversityExamYearDesc( + final List universityExams = universityExamRepository.findAllByUniversityOrderByUniversityExamYearDesc( selectUniversity.getUniversity()); - selectUniversityExamResponseDTOS = getSelectUniversityExamResponseDTOS(universityExams, member); + final List selectUniversityExamResponseDTOS = getSelectUniversityExamResponseDTOS(universityExams, member); return SelectUniversityExamsResponseDTO.of(selectUniversity.getUniversity().getUniversityId(), selectUniversity.getUniversity().getUniversityName(), @@ -81,7 +80,7 @@ private SelectUniversityExamsResponseDTO getSelectUniversityExamsResponseDTO(Sel } private List getSelectUniversityExamResponseDTOS( - List universityExams, Member member) { + final List universityExams, final Member member) { UniversityExamRecord universityExamRecord; List selectUniversityExamResponseDTOS = new ArrayList<>(); for (UniversityExam universityExam : universityExams) { From 74e9cafa3b96efa13a3d480fb89cb09ad1f30a93 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 20 Jan 2024 04:21:03 +0900 Subject: [PATCH 463/465] =?UTF-8?q?[REFACTOR]=20=EB=B9=8C=EB=8D=94=20?= =?UTF-8?q?=ED=8C=A8=ED=84=B4=EC=9C=BC=EB=A1=9C=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=EB=90=98=EB=8A=94=20=EC=97=94=ED=8B=B0=ED=8B=B0=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EC=9E=90=EC=97=90=20final=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nonsoolmateServer/domain/member/entity/Member.java | 4 ++-- .../domain/selectUniversity/entity/SelectUniversity.java | 2 +- .../universityExamRecord/entity/UniversityExamRecord.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java index ecfaeb0..7e8d718 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/entity/Member.java @@ -55,8 +55,8 @@ public class Member { private LocalDateTime ticketPreviousPublicationTime; @Builder - public Member(String email, String name, PlatformType platformType, Role role, String birthYear, - String gender, String phoneNumber) { + public Member(final String email, final String name, final PlatformType platformType, final Role role, final String birthYear, + final String gender, final String phoneNumber) { this.email = email; this.name = name; this.platformType = platformType; diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java index e20dcf4..d00e477 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/entity/SelectUniversity.java @@ -31,7 +31,7 @@ public class SelectUniversity { private University university; @Builder - public SelectUniversity(Member member, University university) { + public SelectUniversity(final Member member, final University university) { this.member = member; this.university = university; } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java index d92d1f6..b84d72e 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/entity/UniversityExamRecord.java @@ -48,8 +48,8 @@ public class UniversityExamRecord { private String examRecordResultFileName; // ์ฒจ์‚ญ @Builder - public UniversityExamRecord(UniversityExam universityExam, Member member, ExamResultStatus examResultStatus, - int timeTakeExam, String examRecordSheetFileName) { + public UniversityExamRecord(final UniversityExam universityExam, final Member member, final ExamResultStatus examResultStatus, + final int timeTakeExam, final String examRecordSheetFileName) { this.universityExam = universityExam; this.member = member; this.examResultStatus = examResultStatus; From 71e797b26ded68aa499e57dc67dd86ca7b2ba9a7 Mon Sep 17 00:00:00 2001 From: sung-silver Date: Sat, 20 Jan 2024 04:24:46 +0900 Subject: [PATCH 464/465] =?UTF-8?q?[REFACTOR]=20of=20=EC=97=B0=EC=82=B0?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=83=9D=EC=84=B1=EB=90=98=EB=8A=94=20Res?= =?UTF-8?q?ponseDTO=EC=97=90=20final=20=ED=82=A4=EC=9B=8C=EB=93=9C=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 --- .../member/controller/dto/response/NameResponseDTO.java | 2 +- .../member/controller/dto/response/TicketResponseDTO.java | 2 +- .../dto/response/SelectUniversityExamResponseDTO.java | 4 ++-- .../dto/response/SelectUniversityExamsResponseDTO.java | 6 +++--- .../dto/response/SelectUniversityResponseDTO.java | 2 +- .../dto/response/SelectUniversityUpdateResponseDTO.java | 2 +- .../response/UniversityExamImageAndAnswerResponseDTO.java | 6 +++--- .../dto/response/UniversityExamImageResponseDTO.java | 2 +- .../dto/response/UniversityExamInfoResponseDTO.java | 2 +- .../dto/response/UniversityExamRecordIdResponse.java | 2 +- .../dto/response/UniversityExamRecordResponseDTO.java | 2 +- .../dto/response/UniversityExamRecordResultResponseDTO.java | 2 +- .../UniversityExamSheetPreSignedUrlResponseDTO.java | 2 +- .../external/aws/service/vo/PreSignedUrlVO.java | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java index 7428ac4..6f062e3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/NameResponseDTO.java @@ -4,7 +4,7 @@ @Schema(name = "NameResponseDTO", description = "๋ฉค๋ฒ„ ์ด๋ฆ„ ์‘๋‹ต DTO") public record NameResponseDTO(@Schema(description = "๋ฉค๋ฒ„ ์ด๋ฆ„", example = "๋ฅ˜๊ฐ€์€") String memberName) { - public static NameResponseDTO of(String memberName) { + public static NameResponseDTO of(final String memberName) { return new NameResponseDTO(memberName); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java index a24f250..a6c1129 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/member/controller/dto/response/TicketResponseDTO.java @@ -5,7 +5,7 @@ @Schema(name = "TicketResponseDTO", description = "๋ฉค๋ฒ„ ์ฒจ์‚ญ๊ถŒ ์‘๋‹ต DTO") public record TicketResponseDTO(@Schema(description = "๋ฉค๋ฒ„ ์ด๋ฆ„", example = "๋ฅ˜๊ฐ€์€") String memberName, @Schema(description = "์‚ฌ์šฉ์ž ์ฒจ์‚ญ๊ถŒ ๊ฐœ์ˆ˜", example = "5") int ticketCount) { - public static TicketResponseDTO of(String memberName, int ticketCount) { + public static TicketResponseDTO of(final String memberName, final int ticketCount) { return new TicketResponseDTO(memberName, ticketCount); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java index a4ca8f9..323f6dc 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamResponseDTO.java @@ -7,8 +7,8 @@ public record SelectUniversityExamResponseDTO(@Schema(description = "์‹œํ—˜ id", @Schema(description = "์‹œํ—˜ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ1") String examName, @Schema(description = "์‹œํ—˜ ์ œํ•œ ์‹œ๊ฐ„(์ดˆ)", example = "3600") int examTimeLimit, @Schema(description = "์‹œํ—˜ ์‘์‹œ ์ƒํƒœ", example = "์‹œํ—˜ ์‘์‹œ ์ „") String examStatus) { - public static SelectUniversityExamResponseDTO of(Long examId, String examName, int examTimeLimit, - String examStatus) { + public static SelectUniversityExamResponseDTO of(final Long examId, final String examName, final int examTimeLimit, + final String examStatus) { return new SelectUniversityExamResponseDTO(examId, examName, examTimeLimit, examStatus); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java index 7ed0f7f..813ea6d 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityExamsResponseDTO.java @@ -8,9 +8,9 @@ public record SelectUniversityExamsResponseDTO(@Schema(description = "๋Œ€ํ•™ id" @Schema(description = "๋Œ€ํ•™ ์ด๋ฆ„", example = "์ค‘์•™๋Œ€ํ•™๊ต") String universityName, @Schema(description = "๋‹จ๊ณผ๋Œ€ํ•™ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ") String universityCollege, @Schema(description = "์‹œํ—˜ ๋ฆฌ์ŠคํŠธ") List examList) { - public static SelectUniversityExamsResponseDTO of(Long universityId, String universityName, - String universityCollege, - List examList) { + public static SelectUniversityExamsResponseDTO of(final Long universityId, final String universityName, + final String universityCollege, + final List examList) { return new SelectUniversityExamsResponseDTO(universityId, universityName, universityCollege, examList); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java index aec3a92..805cdd3 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityResponseDTO.java @@ -9,7 +9,7 @@ public record SelectUniversityResponseDTO( @Schema(description = "๋‹จ๊ณผ๋Œ€ํ•™ ์ด๋ฆ„", example = "๊ฒฝ์˜๊ฒฝ์ œ") String collegeName, @Schema(description = "๋Œ€ํ•™ ์„ ํƒ ์—ฌ๋ถ€", example = "true") boolean memberStatus ) { - public static SelectUniversityResponseDTO of(Long universityId, String universityName, String collegeName, boolean memberStatus) { + public static SelectUniversityResponseDTO of(final Long universityId, final String universityName, final String collegeName, final boolean memberStatus) { return new SelectUniversityResponseDTO(universityId, universityName, collegeName, memberStatus); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java index 80d006f..13dc2ed 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/selectUniversity/controller/dto/response/SelectUniversityUpdateResponseDTO.java @@ -6,7 +6,7 @@ public record SelectUniversityUpdateResponseDTO( @Schema(description="์„ ํƒ ์™„๋ฃŒ ์—ฌ๋ถ€", example="true") boolean isSelected ) { - public static SelectUniversityUpdateResponseDTO of(boolean isSelected) { + public static SelectUniversityUpdateResponseDTO of(final boolean isSelected) { return new SelectUniversityUpdateResponseDTO(isSelected); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java index 3dffee1..7a13fe4 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageAndAnswerResponseDTO.java @@ -10,9 +10,9 @@ public record UniversityExamImageAndAnswerResponseDTO( @Schema(description = "์‹œํ—˜ ๋ฌธ์ œ ์ด๋ฏธ์ง€ ๋ฆฌ์ŠคํŠธ") List examQuestionList, @Schema(description = "์ด๋ฏธ์ง€ ํ•ด์ œ PDF URL") String examAnswerUrl ) { - static public UniversityExamImageAndAnswerResponseDTO of(String universityExamName, - List examQuestionList, - String examAnswerUrl) { + static public UniversityExamImageAndAnswerResponseDTO of(final String universityExamName, + final List examQuestionList, + final String examAnswerUrl) { return new UniversityExamImageAndAnswerResponseDTO(universityExamName, examQuestionList, examAnswerUrl); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java index c8f21c5..b0a0424 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamImageResponseDTO.java @@ -4,7 +4,7 @@ @Schema(name = "UniversityExamImageResponseDTO", description = "๋Œ€ํ•™ ์‹œํ—˜ ์ด๋ฏธ์ง€ ์กฐํšŒ ์š”์ฒญ DTO") public record UniversityExamImageResponseDTO(@Schema(description = "์‹œํ—˜ ๋ฌธ์ œ ์ด๋ฏธ์ง€ URL") String examImgUrl) { - static public UniversityExamImageResponseDTO of(String examImgUrl) { + public static UniversityExamImageResponseDTO of(final String examImgUrl) { return new UniversityExamImageResponseDTO(examImgUrl); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java index 3bd7ee0..7beffed 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/university/controller/dto/response/UniversityExamInfoResponseDTO.java @@ -5,7 +5,7 @@ public record UniversityExamInfoResponseDTO(@Schema(description = "์‹œํ—˜ id", example = "1") Long examId, @Schema(description = "์‹œํ—˜ ์ด๋ฆ„(๋Œ€ํ•™ + ์‹œํ—˜ ๋…„๋„ + ์‹œํ—˜ ์ด๋ฆ„)", example = "๊ฑด๊ตญ๋Œ€ํ•™๊ต - 2021 ์ธ๋ฌธ์‚ฌํšŒ 1") String examName, @Schema(description = "์‹œํ—˜ ์ œํ•œ ์‹œ๊ฐ„ (์ดˆ)", example = "6000") int examTimeLimit) { - public static UniversityExamInfoResponseDTO of(Long examId, String examName, int examTimeLimit) { + public static UniversityExamInfoResponseDTO of(final Long examId, final String examName, final int examTimeLimit) { return new UniversityExamInfoResponseDTO(examId, examName, examTimeLimit); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java index 1be83a3..5d85e39 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordIdResponse.java @@ -5,7 +5,7 @@ @Schema(name = "UniversityExamRecordIdResponse", description = "๋Œ€ํ•™ ์‹œํ—˜ ๊ธฐ๋ก ์ƒ์„ฑ ์‘๋‹ต DTO") public record UniversityExamRecordIdResponse( @Schema(description = "๊ธฐ๋ก๋œ ๋Œ€ํ•™ ์‹œํ—˜ ๋‹ต์•ˆ id", example = "1") Long universityExamRecordId) { - public static UniversityExamRecordIdResponse of(Long universityExamRecordId) { + public static UniversityExamRecordIdResponse of(final Long universityExamRecordId) { return new UniversityExamRecordIdResponse(universityExamRecordId); } } \ No newline at end of file diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java index bccb46a..01a0986 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResponseDTO.java @@ -8,7 +8,7 @@ public record UniversityExamRecordResponseDTO( @Schema(description = "์‹œํ—˜ ํ•ด์ œ PDF URL", example = "1") String examAnswerUrl, @Schema(description = "์‹œํ—˜ ์ฒจ์‚ญ ๊ฒฐ๊ณผ PDF URL", example = "1") String examResultUrl ) { - public static UniversityExamRecordResponseDTO of(String universityExamName, String examAnswerUrl, String examResultUrl) { + public static UniversityExamRecordResponseDTO of(final String universityExamName, final String examAnswerUrl, final String examResultUrl) { return new UniversityExamRecordResponseDTO(universityExamName, examAnswerUrl, examResultUrl); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java index 5a64c86..a43c006 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamRecordResultResponseDTO.java @@ -6,7 +6,7 @@ public record UniversityExamRecordResultResponseDTO( @Schema(description = "์ฒจ์‚ญ ๊ฒฐ๊ณผ PDF URL") String examResultUrl ) { - public static UniversityExamRecordResultResponseDTO of(String examResultUrl) { + public static UniversityExamRecordResultResponseDTO of(final String examResultUrl) { return new UniversityExamRecordResultResponseDTO(examResultUrl); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java index d01a8f4..9a89a78 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/domain/universityExamRecord/controller/dto/response/UniversityExamSheetPreSignedUrlResponseDTO.java @@ -6,7 +6,7 @@ public record UniversityExamSheetPreSignedUrlResponseDTO( @Schema(description = "์‹œํ—˜๋ณด๊ธฐ: [3] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ ํ›„ ์‹œํ—˜ ๊ธฐ๋ก API ์—์„œ ๋‹ค์‹œ ์„œ๋ฒ„๋กœ ๋ณด๋‚ด์•ผํ•˜๋Š” ํŒŒ์ผ ์ด๋ฆ„") String resultFileName, @Schema(description = "์‹œํ—˜๋ณด๊ธฐ: [2] ๋‹ต์•ˆ์ง€ ์—…๋กœ๋“œ API๋ฅผ ์š”์ฒญํ•  URL") String preSignedUrl) { - public static UniversityExamSheetPreSignedUrlResponseDTO of(String resultFileName, String preSignedUrl) { + public static UniversityExamSheetPreSignedUrlResponseDTO of(final String resultFileName, final String preSignedUrl) { return new UniversityExamSheetPreSignedUrlResponseDTO(resultFileName, preSignedUrl); } } diff --git a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/vo/PreSignedUrlVO.java b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/vo/PreSignedUrlVO.java index 0173b0c..8fe793f 100644 --- a/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/vo/PreSignedUrlVO.java +++ b/nonsoolmateServer/src/main/java/com/nonsoolmate/nonsoolmateServer/external/aws/service/vo/PreSignedUrlVO.java @@ -9,7 +9,7 @@ public class PreSignedUrlVO { private String fileName; private String url; - public static PreSignedUrlVO of(String fileName, String url) { + public static PreSignedUrlVO of(final String fileName, final String url) { return new PreSignedUrlVO(fileName, url); } } From ede93a5b05ac36e8fb7201fe1d392f28cece5e8f Mon Sep 17 00:00:00 2001 From: euna <81363864+sung-silver@users.noreply.github.com> Date: Sat, 9 Mar 2024 13:56:59 +0900 Subject: [PATCH 465/465] =?UTF-8?q?[DEL]=20dev-CI=EC=97=90=EC=84=9C=20ls?= =?UTF-8?q?=20=EB=AA=85=EB=A0=B9=EC=96=B4=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dev-CI.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/dev-CI.yml b/.github/workflows/dev-CI.yml index 47c064e..5707deb 100644 --- a/.github/workflows/dev-CI.yml +++ b/.github/workflows/dev-CI.yml @@ -26,7 +26,6 @@ jobs: echo "${{ secrets.DEV_APPLICATION }}" > src/main/resources/application.yaml mkdir -p src/main/resources/key echo "${{ secrets.CLOUDFRONT_PRIVATE_KEY }}" > src/main/resources/key/cloudfront-private-key.pem - ls src/main/resources/key working-directory: ${{ env.working-directory }} - name: build