From f5be79cb44ff16c1db85b793738074a4772dd446 Mon Sep 17 00:00:00 2001 From: Zufar Sunagatov Date: Tue, 18 Jul 2023 22:14:23 +0100 Subject: [PATCH] Deprecated functionality was deleted (#53) --- .env | 42 - certs/zufarkeystore.p12 | Bin 4550 -> 0 bytes .../online-store-0.0.1-SNAPSHOT-deps.graphml | 6991 ----------------- docker-compose.yaml | 161 +- docker/localstack/Dockerfile | 8 - .../localstack/localstack_bootstrap.sh | 97 - kube/config-map.yaml | 12 - kube/mongo.yaml | 47 - kube/online-store.yaml | 35 - pom.xml | 74 +- .../onlinestore/OnlineStoreApplication.java | 5 +- .../aws/configuration/AwsConfiguration.java | 60 - .../AwsDynamoDbConfiguration.java | 55 - .../configuration/AwsSnsConfiguration.java | 56 - .../configuration/AwsSqsConfiguration.java | 29 - .../aws/sqs/SqsBatchMessageSender.java | 28 - .../aws/sqs/SqsMessageReceiver.java | 31 - .../onlinestore/aws/sqs/SqsMessageSender.java | 26 - .../common/exception/ExceptionsHandler.java | 3 +- .../converter/AddressDtoConverter.java | 26 - .../converter/CustomerDtoConverter.java | 38 - .../onlinestore/customer/dto/AddressDto.java | 27 - .../onlinestore/customer/dto/CustomerDto.java | 38 - .../customer/endpoint/CustomerEndpoint.java | 95 - .../customer/endpoint/UrlConstants.java | 6 - .../onlinestore/customer/entity/Address.java | 34 - .../onlinestore/customer/entity/Customer.java | 44 - .../repository/CustomerRepository.java | 8 - .../converter/NotificationDtoConverter.java | 34 - .../notification/dto/NotificationDto.java | 29 - .../endpoint/NotificationEndpoint.java | 99 - .../notification/entity/Notification.java | 30 - .../repository/NotificationRepository.java | 11 - ...NotificationsMongoDatabaseInitializer.java | 29 - .../payment/dto/PaymentRequest.java | 4 - .../payment/dto/PaymentResponse.java | 4 - .../product/ProductsSumCalculator.java | 20 - .../converter/ProductInfoDtoConverter.java | 27 - .../onlinestore/product/dto/PriceDto.java | 27 - .../product/dto/ProductInfoDto.java | 31 - .../product/endpoint/ProductsEndpoint.java | 109 - .../product/entity/ProductInfo.java | 101 - .../repository/ProductInfoRepository.java | 10 - .../review/advice/ReviewControllerAdvice.java | 39 - .../review/controller/ApiResponse.java | 52 - .../review/controller/ReviewController.java | 105 - .../review/converter/ReviewDtoConverter.java | 38 - .../onlinestore/review/dto/ReviewDto.java | 32 - .../onlinestore/review/entity/Review.java | 98 - .../ReviewDeleteFailedException.java | 13 - .../exception/ReviewNotFoundException.java | 13 - .../review/repository/ReviewRepository.java | 12 - .../review/service/ReviewService.java | 50 - .../exception/JwtTokenExceptionsHandler.java | 5 +- .../PurchaseTransactionHandler.java | 43 - .../PurchaseTransactionDtoConverter.java | 30 - .../dto/PurchaseTransactionDto.java | 22 - .../transacton/dto/TransactionRequest.java | 26 - .../endpoint/TransactionsEndpoint.java | 44 - src/main/resources/application.yaml | 44 +- .../db/changelog/db.changelog-1.0.xml | 11 - .../db/changelog/db.changelog-master.xml | 10 - .../resources/db/db.changelog-master.yaml | 1 + .../onlinestore/endpoint/TestOfTests.java | 11 - 64 files changed, 32 insertions(+), 9308 deletions(-) delete mode 100644 certs/zufarkeystore.p12 delete mode 100644 dependency-graph/snapshots/online-store-0.0.1-SNAPSHOT-deps.graphml delete mode 100644 docker/localstack/Dockerfile delete mode 100644 init-scripts/localstack/localstack_bootstrap.sh delete mode 100644 kube/config-map.yaml delete mode 100644 kube/mongo.yaml delete mode 100644 kube/online-store.yaml delete mode 100644 src/main/java/com/zufar/onlinestore/aws/configuration/AwsConfiguration.java delete mode 100644 src/main/java/com/zufar/onlinestore/aws/configuration/AwsDynamoDbConfiguration.java delete mode 100644 src/main/java/com/zufar/onlinestore/aws/configuration/AwsSnsConfiguration.java delete mode 100644 src/main/java/com/zufar/onlinestore/aws/configuration/AwsSqsConfiguration.java delete mode 100644 src/main/java/com/zufar/onlinestore/aws/sqs/SqsBatchMessageSender.java delete mode 100644 src/main/java/com/zufar/onlinestore/aws/sqs/SqsMessageReceiver.java delete mode 100644 src/main/java/com/zufar/onlinestore/aws/sqs/SqsMessageSender.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/converter/AddressDtoConverter.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/converter/CustomerDtoConverter.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/dto/AddressDto.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/dto/CustomerDto.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/endpoint/CustomerEndpoint.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/endpoint/UrlConstants.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/entity/Address.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/entity/Customer.java delete mode 100644 src/main/java/com/zufar/onlinestore/customer/repository/CustomerRepository.java delete mode 100644 src/main/java/com/zufar/onlinestore/notification/converter/NotificationDtoConverter.java delete mode 100644 src/main/java/com/zufar/onlinestore/notification/dto/NotificationDto.java delete mode 100644 src/main/java/com/zufar/onlinestore/notification/endpoint/NotificationEndpoint.java delete mode 100644 src/main/java/com/zufar/onlinestore/notification/entity/Notification.java delete mode 100644 src/main/java/com/zufar/onlinestore/notification/repository/NotificationRepository.java delete mode 100644 src/main/java/com/zufar/onlinestore/notification/repository/NotificationsMongoDatabaseInitializer.java delete mode 100644 src/main/java/com/zufar/onlinestore/payment/dto/PaymentRequest.java delete mode 100644 src/main/java/com/zufar/onlinestore/payment/dto/PaymentResponse.java delete mode 100644 src/main/java/com/zufar/onlinestore/product/ProductsSumCalculator.java delete mode 100644 src/main/java/com/zufar/onlinestore/product/converter/ProductInfoDtoConverter.java delete mode 100644 src/main/java/com/zufar/onlinestore/product/dto/PriceDto.java delete mode 100644 src/main/java/com/zufar/onlinestore/product/dto/ProductInfoDto.java delete mode 100644 src/main/java/com/zufar/onlinestore/product/endpoint/ProductsEndpoint.java delete mode 100644 src/main/java/com/zufar/onlinestore/product/entity/ProductInfo.java delete mode 100644 src/main/java/com/zufar/onlinestore/product/repository/ProductInfoRepository.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/advice/ReviewControllerAdvice.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/controller/ApiResponse.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/controller/ReviewController.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/converter/ReviewDtoConverter.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/dto/ReviewDto.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/entity/Review.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/exception/ReviewDeleteFailedException.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/exception/ReviewNotFoundException.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/repository/ReviewRepository.java delete mode 100644 src/main/java/com/zufar/onlinestore/review/service/ReviewService.java delete mode 100644 src/main/java/com/zufar/onlinestore/transacton/PurchaseTransactionHandler.java delete mode 100644 src/main/java/com/zufar/onlinestore/transacton/converter/PurchaseTransactionDtoConverter.java delete mode 100644 src/main/java/com/zufar/onlinestore/transacton/dto/PurchaseTransactionDto.java delete mode 100644 src/main/java/com/zufar/onlinestore/transacton/dto/TransactionRequest.java delete mode 100644 src/main/java/com/zufar/onlinestore/transacton/endpoint/TransactionsEndpoint.java delete mode 100644 src/main/resources/db/changelog/db.changelog-1.0.xml delete mode 100644 src/main/resources/db/changelog/db.changelog-master.xml create mode 100644 src/main/resources/db/db.changelog-master.yaml delete mode 100644 src/test/java/com/zufar/onlinestore/endpoint/TestOfTests.java diff --git a/.env b/.env index 0a2f8ced..e69de29b 100644 --- a/.env +++ b/.env @@ -1,42 +0,0 @@ -ELASTIC_VERSION=8.5.3 - -## Passwords for stack users -# - -# User 'elastic' (built-in) -# -# Superuser role, full access to cluster management and data indices. -# https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-users.html -ELASTIC_PASSWORD='changeme' - -# User 'logstash_internal' (custom) -# -# The user Logstash uses to connect and send data to Elasticsearch. -# https://www.elastic.co/guide/en/logstash/current/ls-security.html -LOGSTASH_INTERNAL_PASSWORD='changeme' - -# User 'kibana_system' (built-in) -# -# The user Kibana uses to connect and communicate with Elasticsearch. -# https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-users.html -KIBANA_SYSTEM_PASSWORD='changeme' - -# Users 'metricbeat_internal', 'filebeat_internal' and 'heartbeat_internal' (custom) -# -# The users Beats use to connect and send data to Elasticsearch. -# https://www.elastic.co/guide/en/beats/metricbeat/current/feature-roles.html -METRICBEAT_INTERNAL_PASSWORD='changeme' -FILEBEAT_INTERNAL_PASSWORD='changeme' -HEARTBEAT_INTERNAL_PASSWORD='changeme' - -# User 'monitoring_internal' (custom) -# -# The user Metricbeat uses to collect monitoring data from stack components. -# https://www.elastic.co/guide/en/elasticsearch/reference/current/how-monitoring-works.html -MONITORING_INTERNAL_PASSWORD='changeme' - -# User 'beats_system' (built-in) -# -# The user the Beats use when storing monitoring information in Elasticsearch. -# https://www.elastic.co/guide/en/elasticsearch/reference/current/built-in-users.html -BEATS_SYSTEM_PASSWORD='changeme' diff --git a/certs/zufarkeystore.p12 b/certs/zufarkeystore.p12 deleted file mode 100644 index 1a972b0723301f2840f073e89795463e8c486b3e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4550 zcma)gXEYm**MFqM-g{F!R)`g9?@g;jYuBz(vlK;$U8J>Ywr16?QLD8nF=7-oDh*;& zyJ|h(|M@@X`#aC8=Xr6@J@+&2+xs~ef}rgM65N3xXuUwB;5fawb4mhYf_Dg7TS5e_ z^*``K2!ib1|Dedk2@zx>|G)zO6fcPUzg-k$1i*I)(ryTXv=id`uY-sZVhvIF&qx6g zC1j976X-%ME=0pyX9mdSAH;itmJ0iH<-l5Q;ot>7W;5rngm6>gTD z6i(L7fb_UY0%~koX!{7X)8Il39#^dVVGM>Wxo{1UJ9#Je?aQ3eTOVjTguAR05{Lfn zY_r)vN{NBP{kr198n*RJ@hxj~!+UCDHi@Q!u5Vwrd+tJ{B*p z%Un3wjxCsNC}-+P;O`Ty<=wu`_mVhe`ugbm@ZK!9S0^B3i~SF)(ekX~S={rWwhESG zbv&Nr?W7q|`8C?f$^Y`QBZmABT|KAWGcRR0gAf(IT(xxsHE?~`a#=M(TkfmCBMihK zSH}f{jT}imPgw^EeaVNl(Izg<_;Z?;rOxqJ2m9DLDN~59<~UZ;r%b>1I?3dzd50A_ zRx0F=^ZJzyi4_v8bQIDrd@w=m%sa6>yXl`$>#+c43@j3gJmUd$fYu9m7xg3*tR6b* z*yu1Z=Oe>tEvOmGZ2S~CjOMNVuB5ams+AvsN7D$rtNrxlvx%*UzztT|05CK_u;4{& z)OOQL5TYM)IY!ph4%6SJYjr0N3*!ZEwF~0JNa>58NieiX_orIq=QI%YG!1%_&Nd&v zoeQ?M_R-VB$HCa`RIGBts}5M=%4m|^c086!y@Sg5m0n0EmEZWbj0$u+)}`jo3| zLP_cFS5)j;lr^Y=19f)vE!I~AsP%3C-uH!m_M#(`sTv^eYxP~YPKJHAuiT=Sr#bv! z*KZ7O!*HqX@Aw>ABCZL6vje>>$qpEBuG&Uc>m@}=iVXhxSYc08^80m;I1L?oXqm0= zS53=!&9R#veh1Kfu#O31HIo4AP6iS%NPwo_W))4G~mcN1Oj zVi?+|5j*2JLe0f^rvKATe%*$_5*)ue-m@kVX6VmFeu>jHWJ?nXy@XoHCimOI)VQ+p z3ZK!;kH$Es7AzD6!bfFIjN)xp2aEEv`i8jaG)ZeI*STHVUlxbh=Zx>6?2o-3|adRbWH!U9jwB}?}0--OlVehe9|pQf@%NGY;9w(;4WbPib6+2te5wxZfN+i=b-9s7PE^IF<%oaAdo zY}NPoUwS@MBs8C18u&kOH#1KVJ=z*qN#CA(uKi|GYdZkowDz>ufBuVIrL^I@&I)}o z^cxFhikIvv&4u9LR#?DeqADSiTRg9NXw4WGNJAXWoJIKC2GII#%c>+(QW`)7p8BTF z-%0>3hS@K7nNLXo0;Z#UQ*-BQkD}eNmzklAe$F=|HRb8Z)q;{f(C`T>YGpYKmQLQp zQ_;t}MyGjU_ul2T9fo}1RmJiNSN@~4qImq(9A5>0G57vK=ab$2-b+kRO`Ityk!kJr zcT1%|Yg>3hNyD53-N&C?70;KZ!wNq@u^By_tdnr-#`&%MkbsFDIiZBw4$e0Jz5Zj~ z1m!O6-AYs=s*Hn(upB5S^4z)0vuG{Ixb}xwwSjzx1KUr`qgaiXH#$8MR}7*dYI6xt zqPSnm8|{rWn&Tl8%bv%cw|=;g)4_)e^vVzf~5vLI6W!11@*Is1JWW^%8nI2GVeWf&EU+qK>g5_KD@VNsAGG#hoIed_l- zMBMbuvmD+0ss$;lbg5_aqb*3zfX*~0+9|tc>GV^CjVrCh+qxNSLak5^bbbt7U%#Dc z&lsNiHmaSQFRFTRq9(mt2>E1Z-YcWvo*pj=iN-yT6^l*>x|6z6`|Y8{x~l_+Y%RA` zWBF?S9im%nDF#^Hin$*EZQ8?HBBQVxj@o2d;)D2naXX&kytKPGf=Z7`FwH8uahl#jojqdHC0@#Te?nID=9v5BVnPx6(qZKKP2L9K zCx>wb_w($QKpn=>UVWUo(h}EfRBEgLHJi4o-sO-|#;guuE`&;sbDuv_CFIO=kRo;Z zil}v|#n6Y^(BhyG?C%2(pd>F~ST;(I~* zF(+Z&{TJt?jv|hES6Mx^E#k>oP@{KlGKk zgpUdJ*C#oq&1vJ3KNZz$@5d`;l8@e0`VqKM&Um<#`n@u6cOE9%k)9??Lqwzfu}IPB z{6}oiYCGP96xj~72rkI!<=2xPa`TA&=_sCu#V2n+k~Mu|B-v=5+%l+dSmaJgmYs^x zV~t;^$CAIy932q@potDhR6Qgjce70emwJ6w9ZMV|Xx|l^XS}c5&X2ku$r8xtDF`yf zyWd$^RQS3Cj9?HWmBDY}ohimy63A%xa*ln#dNV~e=L5{SQ-`O5_Nus2qU)e3kOAHO zk-qbNiSpioWK)JL4Plw5t8AXR8wK{RK_G9+5JL~4MB2k-&yT&k&C=v|M4^e2gbC&- zP#sF+Xw zz*bVoUv>%O#82h81xQ741^#+H$VcwKkfWK48i{v8Wk|O zpd)HxU&?rHG|k~~#iJ1oiT_JzBv0StXM2TI&-G0r)3W^{7=-{u(dFJA42(2l?@{^g zFUG(fKRyGRDq3c`x@t(NBwz<9az5D9sfHQoH4(?zM;eUH1MyC5>DCRq#Z&=xjg={; zt7ng^ZOhjrvZoK@a}CltUy}uW#%MJic6c-~|Me9nIHbl$^5kqmS%r)EJ})>6p30|+cUfvjHMh#42S`5t@JG3@>S}2&L4g)*Z-;$DEOF) zkM(gktIotj<334b$dd{2Lg+NF>kEEWwEp^=wlBKgzh$KF&zjlFit~|ut=C9OouPG1 z9tI6D_djUsk&Cfe7v70z+^4vuiBNo@|JK-RkXuD0Yg#P5XoFU~_uO-?dcRMUM(Dew zC_PQT*b?_nk(hDtH<<nSX_0#0Vy9i7`(Sw7NrO>?ay7;1R|WrA7e{L034&LL<>)DSEjCI(@u);~@XRoz!v zk9U1o;q@4WmilPHwLjL~8e3wu*-mc2Oq`Wif9ilP$)}Fmv$F!X=-x6r_>p}OA;O3K zMRiA|7qUlCe==&Zub6|BgeJr!4}CLSgq!?Kf6QO}OFX$aX9BO7brscjT6j5~f}03_dveFsI^}wp_}N1ux0b{H ztQPRacPfV+wbRP0B1gYpBI1VCvAr;)dREuTmlp)TPr}c}hBZ}O?!5m^+0X13Akr7A zTY(BV4+&?mUAylxMfLv0a!Z}7&yNT)n#n8q_3GiCy6olZ`dDAX5Nfj09L<1TdXOO@I9Ra^d@nM&SE@9f=LAg>%+(mQDCN7o@=mP$2K0rB%H`TSI^ zQTIuu_Zmqa@knRy0;t9aQW>?7KlwB|sbjpw=9}cHg+r@kAFaplpAswbW0lvqo<-rt zm|FG+WMzC}WoD%hKfqK{s8p!b!noIY&i>N24{>X3=H(Ypi3cZtYTHG>zS%PnKe%mZ z`T8aG&+}<}1XHw2wpi+w06ysHyhl+mI!&jP-9*v+*OY`=;MPe&qwIAEBfgSTiTFXN z4&g~xO`tqQYp2@qfdA*m$vD$jonFRAMqHz<^`}VT*jKQv7gg3maJ^~%o>$6@p0ncI zVO#4^yn-&{%Wa;##Nj5(aD5ydaEKs)+e3GF&p()p5-71e5Tv(&i|s&FjZ2LM}{^h2>>D9NI7? z1Z@sa5gTDvO9V>2LBlgL8~s#Vi|l|oBOM(@?tJ&lf+%NoU!(R$vIWE#A_bxR_qPEg zAOaBbbflZ0(r6@Qm+E-yY1Fj_SYv-gjKq0k&S - - - - - - - - - - - - - org.springframework -:spring-messaging -:6.0.2 (605339) - - - - - - - - - - io.micrometer -:micrometer-observation -:1.10.2 (65732) - - - - - - - - - - org.keycloak -:keycloak-common -:21.1.0 (172314) - - - - - - - - - - software.amazon.awssdk -:utils -:2.17.230 (135485) - - - - - - - - - - org.keycloak -:keycloak-authz-client -:21.1.0 (75936) - - - - - - - - - - org.hibernate.validator -:hibernate-validator -:8.0.0.Final (1326496) - - - - - - - - - - org.springframework -:spring-jdbc -:6.0.2 (428744) - - - - - - - - - - org.springframework.data -:spring-data-mongodb -:4.0.0 (0) - - - - - - - - - - com.sun.activation -:jakarta.activation -:1.2.2 (68453) - - - - - - - - - - org.mongodb -:bson -:4.8.0 (508019) - - - - - - - - - - org.springframework -:spring-aop -:6.0.2 (395698) - - - - - - - - - - org.aspectj -:aspectjweaver -:1.9.9.1 (2088354) - - - - - - - - - - org.springframework.boot -:spring-boot-starter -:3.0.0 (4767) - - - - - - - - - - software.amazon.awssdk -:profiles -:2.17.230 (31856) - - - - - - - - - - io.prometheus -:simpleclient -:0.16.0 (90482) - - - - - - - - - - com.zaxxer -:HikariCP -:5.0.1 (161902) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-web -:3.0.0 (4802) - - - - - - - - - - com.fasterxml.jackson.datatype -:jackson-datatype-jdk8 -:2.14.1 (0) - - - - - - - - - - org.slf4j -:slf4j-api -:2.0.4 (61753) - - - - - - - - - - io.netty -:netty-transport-classes-epoll -:4.1.85.Final (142080) - - - - - - - - - - software.amazon.awssdk -:kms -:2.17.230 (1094440) - - - - - - - - - - org.jboss.logging -:jboss-logging -:3.5.0.Final (62562) - - - - - - - - - - org.hibernate.orm -:hibernate-core -:6.1.5.Final (9736806) - - - - - - - - - - org.apache.tomcat.embed -:tomcat-embed-el -:10.1.1 (257138) - - - - - - - - - - com.amazonaws -:aws-java-sdk-s3 -:1.11.106 (767472) - - - - - - - - - - com.fasterxml.jackson.core -:jackson-core -:2.14.0 (0) - - - - - - - - - - io.awspring.cloud -:spring-cloud-aws-messaging -:2.4.2 (120469) - - - - - - - - - - io.netty -:netty-resolver -:4.1.85.Final (37777) - - - - - - - - - - org.springframework.boot -:spring-boot-actuator-autoconfigure -:3.0.0 (684959) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-jdbc -:3.0.0 (4769) - - - - - - - - - - org.glassfish.jaxb -:jaxb-runtime -:4.0.1 (918430) - - - - - - - - - - org.keycloak -:keycloak-core -:21.1.0 (345463) - - - - - - - - - - org.yaml -:snakeyaml -:1.33 (331715) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-security -:3.0.0 (4741) - - - - - - - - - - io.micrometer -:micrometer-core -:1.10.2 (775752) - - - - - - - - - - com.sun.istack -:istack-commons-runtime -:4.1.1 (26147) - - - - - - - - - - jakarta.annotation -:jakarta.annotation-api -:2.1.1 (26141) - - - - - - - - - - software.amazon.awssdk -:json-utils -:2.17.230 (30092) - - - - - - - - - - io.swagger.core.v3 -:swagger-annotations -:2.2.6 (42085) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-tomcat -:3.0.0 (4791) - - - - - - - - - - org.springframework -:spring-jcl -:6.0.2 (23489) - - - - - - - - - - org.keycloak -:keycloak-policy-enforcer -:21.1.0 (55225) - - - - - - - - - - io.springfox -:springfox-schema -:3.0.0 (102482) - - - - - - - - - - org.mongodb -:mongodb-driver-core -:4.8.0 (1583147) - - - - - - - - - - org.postgresql -:postgresql -:42.6.0 (1081604) - - - - - - - - - - org.keycloak -:keycloak-adapter-core -:21.1.0 (113946) - - - - - - - - - - org.springframework.security -:spring-security-web -:6.0.0 (759745) - - - - - - - - - - io.netty -:netty-transport -:4.1.85.Final (488001) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-data-mongodb -:3.0.0 (4775) - - - - - - - - - - software.amazon.awssdk -:http-client-spi -:2.17.230 (81213) - - - - - - - - - - software.amazon.awssdk -:aws-core -:2.17.230 (124144) - - - - - - - - - - org.springframework.boot -:spring-boot-autoconfigure -:3.0.0 (1623827) - - - - - - - - - - com.fasterxml.jackson.module -:jackson-module-parameter-names -:2.14.1 (0) - - - - - - - - - - jakarta.validation -:jakarta.validation-api -:3.0.2 (93298) - - - - - - - - - - software.amazon.ion -:ion-java -:1.0.2 (565410) - - - - - - - - - - org.springframework.plugin -:spring-plugin-core -:2.0.0.RELEASE (28823) - - - - - - - - - - io.netty -:netty-handler -:4.1.85.Final (540540) - - - - - - - - - - org.springframework.boot -:spring-boot-actuator -:3.0.0 (666643) - - - - - - - - - - io.springfox -:springfox-swagger-common -:3.0.0 (116305) - - - - - - - - - - com.amazonaws -:aws-java-sdk-core -:1.11.106 (840754) - - - - - - - - - - software.amazon.awssdk -:annotations -:2.17.230 (13277) - - - - - - - - - - org.hdrhistogram -:HdrHistogram -:2.1.12 (173763) - - - - - - - - - - org.springframework.boot -:spring-boot -:3.0.0 (1478558) - - - - - - - - - - io.netty -:netty-buffer -:4.1.85.Final (305093) - - - - - - - - - - jakarta.activation -:jakarta.activation-api -:2.1.0 (63473) - - - - - - - - - - software.amazon.awssdk -:metrics-spi -:2.17.230 (27325) - - - - - - - - - - org.springframework -:spring-context -:6.0.2 (1173094) - - - - - - - - - - org.keycloak -:keycloak-crypto-default -:21.1.0 (34172) - - - - - - - - - - org.springframework.security -:spring-security-config -:6.0.0 (1584815) - - - - - - - - - - org.antlr -:antlr4-runtime -:4.10.1 (322137) - - - - - - - - - - org.springframework -:spring-tx -:6.0.2 (271071) - - - - - - - - - - io.springfox -:springfox-swagger2 -:3.0.0 (109813) - - - - - - - - - - org.springframework -:spring-web -:6.0.2 (1733009) - - - - - - - - - - software.amazon.awssdk -:regions -:2.17.230 (698848) - - - - - - - - - - org.springframework -:spring-core -:6.0.2 (1804099) - - - - - - - - - - io.netty -:netty-codec-http2 -:4.1.85.Final (479918) - - - - - - - - - - commons-logging -:commons-logging -:1.1.3 (62050) - - - - - - - - - - com.amazonaws -:aws-java-sdk-ec2 -:1.11.106 (3015263) - - - - - - - - - - io.netty -:netty-transport-native-unix-common -:4.1.85.Final (43686) - - - - - - - - - - org.hibernate.common -:hibernate-commons-annotations -:6.0.2.Final (66797) - - - - - - - - - - org.springframework -:spring-expression -:6.0.2 (291111) - - - - - - - - - - com.zufar-project -:online-store -:0.0.1-SNAPSHOT (0) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-actuator -:3.0.0 (4805) - - - - - - - - - - jakarta.persistence -:jakarta.persistence-api -:3.1.0 (165250) - - - - - - - - - - com.fasterxml -:classmate -:1.5.1 (67815) - - - - - - - - - - software.amazon.awssdk -:aws-json-protocol -:2.17.230 (112691) - - - - - - - - - - org.apache.httpcomponents -:httpclient -:4.5.13 (0) - - - - - - - - - - com.fasterxml.jackson.core -:jackson-annotations -:2.14.1 (76090) - - - - - - - - - - org.apache.logging.log4j -:log4j-api -:2.19.0 (317566) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-json -:3.0.0 (4746) - - - - - - - - - - io.github.classgraph -:classgraph -:4.8.83 (504676) - - - - - - - - - - io.prometheus -:simpleclient_tracer_otel_agent -:0.16.0 (4611) - - - - - - - - - - net.bytebuddy -:byte-buddy -:1.12.19 (3958480) - - - - - - - - - - io.micrometer -:micrometer-commons -:1.10.2 (39723) - - - - - - - - - - org.keycloak -:keycloak-server-spi -:21.1.0 (232101) - - - - - - - - - - net.logstash.logback -:logstash-logback-encoder -:4.11 (499957) - - - - - - - - - - org.apache.logging.log4j -:log4j-to-slf4j -:2.19.0 (18643) - - - - - - - - - - software.amazon.awssdk -:dynamodb-enhanced -:2.19.8 (0) - - - - - - - - - - software.amazon.awssdk -:third-party-jackson-core -:2.17.230 (390083) - - - - - - - - - - org.springframework.security -:spring-security-crypto -:6.0.0 (84187) - - - - - - - - - - software.amazon.awssdk -:protocol-core -:2.17.230 (35216) - - - - - - - - - - io.netty -:netty-common -:4.1.85.Final (654353) - - - - - - - - - - org.bouncycastle -:bcutil-jdk15on -:1.70 (482530) - - - - - - - - - - io.netty -:netty-codec-http -:4.1.85.Final (649718) - - - - - - - - - - com.amazonaws -:aws-java-sdk-dynamodb -:1.11.106 (1179814) - - - - - - - - - - software.amazon.awssdk -:auth -:2.17.230 (171339) - - - - - - - - - - com.amazonaws -:aws-java-sdk-kms -:1.11.106 (402436) - - - - - - - - - - io.prometheus -:simpleclient_tracer_common -:0.16.0 (3405) - - - - - - - - - - io.springfox -:springfox-spring-webmvc -:3.0.0 (14488) - - - - - - - - - - org.apache.tomcat.embed -:tomcat-embed-websocket -:10.1.1 (276508) - - - - - - - - - - com.amazonaws -:aws-java-sdk-sqs -:1.11.106 (279843) - - - - - - - - - - org.springframework -:spring-beans -:6.0.2 (841371) - - - - - - - - - - org.glassfish.jaxb -:jaxb-core -:4.0.1 (140712) - - - - - - - - - - org.apache.tomcat.embed -:tomcat-embed-core -:10.1.1 (3390106) - - - - - - - - - - software.amazon.awssdk -:apache-client -:2.17.230 (73910) - - - - - - - - - - software.amazon.eventstream -:eventstream -:1.0.1 (30193) - - - - - - - - - - software.amazon.awssdk -:netty-nio-client -:2.17.230 (282613) - - - - - - - - - - jakarta.transaction -:jakarta.transaction-api -:2.0.1 (28607) - - - - - - - - - - com.fasterxml.jackson.core -:jackson-databind -:2.14.0 (0) - - - - - - - - - - org.checkerframework -:checker-qual -:3.31.0 (223971) - - - - - - - - - - org.reactivestreams -:reactive-streams -:1.0.4 (11640) - - - - - - - - - - org.keycloak -:keycloak-server-spi-private -:21.1.0 (654382) - - - - - - - - - - io.jsonwebtoken -:jjwt-jackson -:0.11.5 (8238) - - - - - - - - - - org.latencyutils -:LatencyUtils -:2.0.3 (29779) - - - - - - - - - - org.bouncycastle -:bcpkix-jdk15on -:1.70 (963713) - - - - - - - - - - io.netty -:netty-codec -:4.1.85.Final (343569) - - - - - - - - - - org.bouncycastle -:bcprov-jdk15on -:1.70 (5867298) - - - - - - - - - - ch.qos.logback -:logback-core -:1.4.5 (577488) - - - - - - - - - - io.micrometer -:micrometer-registry-prometheus -:1.10.2 (41000) - - - - - - - - - - io.jsonwebtoken -:jjwt-impl -:0.11.5 (80670) - - - - - - - - - - io.springfox -:springfox-swagger-ui -:3.0.0 (2731924) - - - - - - - - - - org.springframework.data -:spring-data-jpa -:3.0.0 (0) - - - - - - - - - - org.keycloak -:keycloak-adapter-spi -:21.1.0 (12936) - - - - - - - - - - io.springfox -:springfox-core -:3.0.0 (262789) - - - - - - - - - - com.amazonaws -:aws-java-sdk-sns -:1.11.106 (294040) - - - - - - - - - - org.apache.httpcomponents -:httpcore -:4.4.15 (328324) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-validation -:3.0.0 (4766) - - - - - - - - - - io.prometheus -:simpleclient_tracer_otel -:0.16.0 (4338) - - - - - - - - - - com.fasterxml.jackson.datatype -:jackson-datatype-jsr310 -:2.14.1 (0) - - - - - - - - - - org.mapstruct -:mapstruct -:1.3.1.Final (23045) - - - - - - - - - - org.springframework.security -:spring-security-core -:6.0.0 (506232) - - - - - - - - - - io.jsonwebtoken -:jjwt-api -:0.11.5 (77457) - - - - - - - - - - com.amazonaws -:jmespath-java -:1.11.106 (26794) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-logging -:3.0.0 (4756) - - - - - - - - - - org.slf4j -:jul-to-slf4j -:2.0.4 (4716) - - - - - - - - - - io.springfox -:springfox-spi -:3.0.0 (55153) - - - - - - - - - - io.awspring.cloud -:spring-cloud-aws-context -:2.4.2 (81618) - - - - - - - - - - jakarta.xml.bind -:jakarta.xml.bind-api -:4.0.0 (127111) - - - - - - - - - - ch.qos.logback -:logback-classic -:1.4.5 (266143) - - - - - - - - - - io.springfox -:springfox-spring-web -:3.0.0 (188537) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-aop -:3.0.0 (4768) - - - - - - - - - - org.springframework.boot -:spring-boot-starter-data-jpa -:3.0.0 (4760) - - - - - - - - - - io.swagger -:swagger-annotations -:1.5.20 (21750) - - - - - - - - - - javax.activation -:javax.activation-api -:1.2.0 (56674) - - - - - - - - - - jakarta.inject -:jakarta.inject-api -:2.0.0 (10128) - - - - - - - - - - org.mongodb -:bson-record-codec -:4.8.0 (13509) - - - - - - - - - - software.amazon.awssdk -:dynamodb -:2.17.230 (2147526) - - - - - - - - - - software.amazon.awssdk -:sdk-core -:2.17.230 (757559) - - - - - - - - - - io.prometheus -:simpleclient_common -:0.16.0 (8011) - - - - - - - - - - org.mongodb -:mongodb-driver-sync -:4.8.0 (149686) - - - - - - - - - - org.jboss -:jandex -:2.4.2.Final (230776) - - - - - - - - - - org.springframework.plugin -:spring-plugin-metadata -:2.0.0.RELEASE (9877) - - - - - - - - - - io.swagger -:swagger-models -:1.5.20 (152068) - - - - - - - - - - org.springframework -:spring-aspects -:6.0.2 (48049) - - - - - - - - - - io.springfox -:springfox-spring-webflux -:3.0.0 (13916) - - - - - - - - - - com.fasterxml.jackson.dataformat -:jackson-dataformat-cbor -:2.14.1 (0) - - - - - - - - - - org.eclipse.angus -:angus-activation -:1.0.0 (20744) - - - - - - - - - - org.keycloak -:keycloak-spring-security-adapter -:21.1.0 (59012) - - - - - - - - - - org.springframework -:spring-webmvc -:6.0.2 (1006689) - - - - - - - - - - io.awspring.cloud -:spring-cloud-aws-core -:2.4.2 (64235) - - - - - - - - - - joda-time -:joda-time -:2.8.1 (621931) - - - - - - - - - - org.glassfish.jaxb -:txw2 -:4.0.1 (74261) - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.0.3) - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.30) - - - - - - - - - - - compile - - - - - - - - - - - compile (3.4.1.Final) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (3.4.1.Final) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (2.0.0-alpha1) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - compile (3.0.0) - - - - - - - - - - - compile (2.0.0) - - - - - - - - - - - runtime (3.4.3.Final) - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - runtime (1.12.18) - - - - - - - - - - - runtime (3.0.1) - - - - - - - - - - - runtime (3.0.2) - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.12.266) - - - - - - - - - - - compile (1.12.266) - - - - - - - - - - - compile (5.3.13) - - - - - - - - - - - compile (1.7.32) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime (2.14.1) - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (2.13.4) - - - - - - - - - - - compile (2.13.4.2) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.0.3) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (5.2.0.RELEASE) - - - - - - - - - - - compile (5.2.0.RELEASE) - - - - - - - - - - - compile (5.2.0.RELEASE) - - - - - - - - - - - compile (1.7.25) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.25) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (2.1.2) - - - - - - - - - - - compile - - - - - - - - - - - compile (4.5.2) - - - - - - - - - - - compile - - - - - - - - - - - compile (2.6.6) - - - - - - - - - - - compile (2.6.6) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.25) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.10.0) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.30) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (2.14.1) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.2.3) - - - - - - - - - - - compile (2.8.9) - - - - - - - - - - - compile (1.7.36) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.25) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (4.4.13) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (4.1.77.Final) - - - - - - - - - - - compile (4.1.77.Final) - - - - - - - - - - - compile (4.1.77.Final) - - - - - - - - - - - compile (4.1.77.Final) - - - - - - - - - - - compile (4.1.77.Final) - - - - - - - - - - - compile (4.1.77.Final) - - - - - - - - - - - compile (4.1.77.Final) - - - - - - - - - - - compile (4.1.77.Final) - - - - - - - - - - - compile (1.0.3) - - - - - - - - - - - compile (1.7.30) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (2.12.6.1) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - compile (1.10.11) - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.25) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (6.0.0) - - - - - - - - - - - compile (1.10.1) - - - - - - - - - - - compile (2.6.6) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (5.3.13) - - - - - - - - - - - compile (1.7.32) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.25) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.30) - - - - - - - - - - - compile (1.0.3) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.25) - - - - - - - - - - - compile (2.9.5) - - - - - - - - - - - compile (1.7.22) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.25) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - runtime - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (1.7.30) - - - - - - - - - - - compile (3.4.1.Final) - - - - - - - - - - - compile - - - - - - - - - - - runtime - - - - - - - - - - - compile (2.13.4) - - - - - - - - - - - runtime (2.13.4.2) - - - - - - - - - - - runtime (2.13.4) - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile - - - - - - - - - - - compile (5.3.13) - - - - - - - - - - - compile (5.3.13) - - - - - - - - - - - compile (1.12.266) - - - - - - - - - - - compile (1.12.266) - - - - - - - - - - - compile (1.12.266) - - - - - - - - - - - compile (1.7.32) - - - - - - - - - - - compile - - - - - - - diff --git a/docker-compose.yaml b/docker-compose.yaml index 928ae653..f2f3d1e5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,24 +1,6 @@ version: '3.9' services: - # - # Mongo Database - # - mongodb: - image: "mongo:latest" - container_name: mongodb - environment: - - MONGO_INITDB_ROOT_USERNAME=rootuser - - MONGO_INITDB_ROOT_PASSWORD=rootpass - ports: - - '27017:27017' - networks: - - online-store-network - profiles: - - dev - - test - - prod - # # Postgresql Database # @@ -52,160 +34,19 @@ services: ports: - '8083:8083' user: root - environment: - AWS_ENDPOINT_URL: http://awslocal:4566 healthcheck: test: "curl --fail --silent localhost:8083/actuator/health | grep UP || exit 1" interval: 20s timeout: 5s retries: 5 start_period: 40s - depends_on: - - mongodb deploy: replicas: 1 networks: - online-store-network - profiles: - - test - - # The 'setup' service runs a one-off script which initializes users inside - # Elasticsearch — such as 'logstash_internal' and 'kibana_system' — with the - # values of the passwords defined in the '.env' file. - # - # This task is only performed during the *initial* startup of the stack. On all - # subsequent runs, the service simply returns immediately, without performing - # any modification to existing users. - setup: - build: - context: ./elastic-stack/setup/ - args: - ELASTIC_VERSION: ${ELASTIC_VERSION} - init: true - volumes: - - ./elastic-stack/setup/entrypoint.sh:/entrypoint.sh:ro,Z - - ./elastic-stack/setup/helpers.sh:/helpers.sh:ro,Z - - ./elastic-stack/setup/roles:/roles:ro,Z - - ./elastic-stack/setup:/state:Z - environment: - ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-} - LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-} - KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-} - METRICBEAT_INTERNAL_PASSWORD: ${METRICBEAT_INTERNAL_PASSWORD:-} - FILEBEAT_INTERNAL_PASSWORD: ${FILEBEAT_INTERNAL_PASSWORD:-} - HEARTBEAT_INTERNAL_PASSWORD: ${HEARTBEAT_INTERNAL_PASSWORD:-} - MONITORING_INTERNAL_PASSWORD: ${MONITORING_INTERNAL_PASSWORD:-} - BEATS_SYSTEM_PASSWORD: ${BEATS_SYSTEM_PASSWORD:-} - networks: - - online-store-network - depends_on: - online-store-app: - condition: service_healthy - profiles: - - prod - - # - # ELASTICSEARCH - # - elasticsearch: - build: - context: ./elastic-stack/elasticsearch/ - args: - ELASTIC_VERSION: ${ELASTIC_VERSION} - volumes: - - ./elastic-stack/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro,Z - - ./elastic-stack/elasticsearch:/usr/share/elasticsearch/data:Z - ports: - - '9200:9200' - - '9300:9300' - environment: - node.name: elasticsearch - ES_JAVA_OPTS: -Xms512m -Xmx512m - ELASTIC_PASSWORD: ${ELASTIC_PASSWORD:-} - discovery.type: single-node # Use single node discovery in order to disable production mode and avoid bootstrap checks. - networks: - - online-store-network - profiles: - - prod - - # - # LOGSTASH - # - logstash: - build: - context: ./elastic-stack/logstash/ - args: - ELASTIC_VERSION: ${ELASTIC_VERSION} - volumes: - - ./elastic-stack/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro,Z - - ./elastic-stack/logstash/pipeline:/usr/share/logstash/pipeline:ro,Z - ports: - - '5044:5044' - - '50000:50000/tcp' - - '50000:50000/udp' - - '9600:9600' - environment: - LS_JAVA_OPTS: -Xms256m -Xmx256m - LOGSTASH_INTERNAL_PASSWORD: ${LOGSTASH_INTERNAL_PASSWORD:-} - networks: - - online-store-network - depends_on: - - elasticsearch - profiles: - - prod - - # - # KIBANA - # - kibana: - build: - context: ./elastic-stack/kibana/ - args: - ELASTIC_VERSION: ${ELASTIC_VERSION} - volumes: - - ./elastic-stack/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro,Z - ports: - - '5601:5601' - environment: - KIBANA_SYSTEM_PASSWORD: ${KIBANA_SYSTEM_PASSWORD:-} - networks: - - online-store-network - depends_on: - - elasticsearch profiles: - prod - # - # Localstack - # - localstack: - image: 'localstack/localstack:latest' - container_name: localstack - build: - context: ./ - dockerfile: docker/localstack/Dockerfile - hostname: awslocal - ports: - - '4566:4566' - - '4510-4559:4510-4559' - user: root - environment: - DEBUG: 0 - SERVICES: "sqs,sns,dynamodb" - HOSTNAME_EXTERNAL: awslocal - PERSISTENCE: "/var/lib/localstack/state" - AWS_DEFAULT_REGION: us-east-1 - DYNAMODB_SHARE_DB: 1 - DYNAMODB_IN_MEMORY: 1 - EDGE_PORT: 4566 - volumes: - - "/var/run/docker.sock:/var/run/docker.sock" - - "./init-scripts/localstack:/etc/localstack/init/ready.d" - networks: - - online-store-network - profiles: - - aws - sonarqube: image: sonarqube:latest container_name: onlinestore-sonarqube @@ -219,7 +60,7 @@ services: - sonarqube_extensions:/opt/sonarqube/extensions - sonarqube_bundled-plugins:/opt/sonarqube/lib/bundled-plugins profiles: - - dev + - prod networks: online-store-network: diff --git a/docker/localstack/Dockerfile b/docker/localstack/Dockerfile deleted file mode 100644 index 81d017e3..00000000 --- a/docker/localstack/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ - -# -# LOCALSTACK -# -FROM localstack/localstack:latest -LABEL maintainer="zufar.sunagatov@gmail.com" - - diff --git a/init-scripts/localstack/localstack_bootstrap.sh b/init-scripts/localstack/localstack_bootstrap.sh deleted file mode 100644 index 8390da81..00000000 --- a/init-scripts/localstack/localstack_bootstrap.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/bash -echo "-----------------------------------------------------------------------------------" -echo "########### Setting env variables ###########" -export AWS_ENDPOINT_URL=http://awslocal:4566 -export AWS_DEFAULT_PROFILE=test-profile -export AWS_REGION=us-east-1 -export AWS_OUTPUT_FORMAT=json -export SNS_TOPIC=purchase-transactions-sns-topic -export SQS_QUEUE=purchase-transactions-sqs-queue -export DYNAMODB_TABLE_NAME=Customer - -export EMAIL_ADDRESS=zufar.sunagatov@gmail.com - -echo "AWS_ENDPOINT_URL = ${AWS_ENDPOINT_URL}" -echo "AWS_DEFAULT_PROFILE = ${AWS_DEFAULT_PROFILE}" -echo "AWS_REGION = ${AWS_REGION}" -echo "SNS_TOPIC = ${SNS_TOPIC}" -echo "SQS_QUEUE = ${SQS_QUEUE}" -echo "DYNAMODB_TABLE_NAME = ${DYNAMODB_TABLE_NAME}" -echo "CURRENT MACHINE HOSTNAME = ${HOSTNAME}" - -echo "-----------------------------------------------------------------------------------" -echo "########### Setting up localstack profile ###########" -aws configure set aws_access_key_id access_key --profile="$AWS_DEFAULT_PROFILE" -aws configure set aws_secret_access_key secret_key --profile="$AWS_DEFAULT_PROFILE" -aws configure set region $AWS_REGION --profile="$AWS_DEFAULT_PROFILE" -aws configure set output $AWS_OUTPUT_FORMAT --profile="$AWS_DEFAULT_PROFILE" -aws configure list --profile $AWS_DEFAULT_PROFILE - -echo "-----------------------------------------------------------------------------------" -echo "########### Creating AWS SQS queue ###########" -aws --endpoint-url="$AWS_ENDPOINT_URL" \ -sqs create-queue \ ---region $AWS_REGION \ ---queue-name $SQS_QUEUE \ - -echo "-----------------------------------------------------------------------------------" -echo "########### Printing list of AWS SQS queues ###########" -aws --endpoint-url="$AWS_ENDPOINT_URL" \ -sqs list-queues \ ---region $AWS_REGION - -echo "-----------------------------------------------------------------------------------" -echo "########### Creating AWS SNS topic ###########" -aws --endpoint-url="$AWS_ENDPOINT_URL" \ - sns create-topic \ ---region $AWS_REGION \ ---name $SNS_TOPIC - -echo "-----------------------------------------------------------------------------------" -echo "########### Printing list of AWS SNS topics ###########" -aws --endpoint-url="$AWS_ENDPOINT_URL" \ -sns list-topics \ ---region $AWS_REGION \ ---starting-token=0 \ ---max-items=3 - -echo "-----------------------------------------------------------------------------------" -echo "########### Subscribe The Specified Email to AWS SNS topic ###########" -aws --endpoint-url="$AWS_ENDPOINT_URL" \ -sns subscribe \ ---region us-east-1 \ ---topic-arn arn:aws:sns:$AWS_REGION:000000000000:$SNS_TOPIC \ ---protocol email \ ---notification-endpoint $EMAIL_ADDRESS - -echo "-----------------------------------------------------------------------------------" -echo "########### Subscribe AWS SQS queue to AWS SNS topic ###########" -aws --endpoint-url="$AWS_ENDPOINT_URL" \ -sns subscribe \ ---region $AWS_REGION \ ---topic-arn arn:aws:sns:$AWS_REGION:000000000000:$SNS_TOPIC \ ---protocol sqs \ ---notification-endpoint arn:aws:sqs:$AWS_REGION:000000000000:$SQS_QUEUE \ ---return-subscription-arn - -echo "-----------------------------------------------------------------------------------" -echo "########### Printing list of AWS SNS topic subscriptions ###########" -aws --endpoint-url $AWS_ENDPOINT_URL \ -sns list-subscriptions \ ---region $AWS_REGION - -echo "-----------------------------------------------------------------------------------" -echo "########### Deleting existed DynamoDB table ###########" -aws --endpoint-url="$AWS_ENDPOINT_URL" \ -dynamodb delete-table \ ---table-name $DYNAMODB_TABLE_NAME - -echo "-----------------------------------------------------------------------------------" -echo "########### Creating DynamoDB table ###########" -aws --endpoint-url="$AWS_ENDPOINT_URL" \ -dynamodb create-table \ ---region $AWS_REGION \ ---table-name $DYNAMODB_TABLE_NAME \ ---attribute-definitions AttributeName=id,AttributeType=S \ ---key-schema AttributeName=id,KeyType=HASH \ ---provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \ No newline at end of file diff --git a/kube/config-map.yaml b/kube/config-map.yaml deleted file mode 100644 index 9a3b458a..00000000 --- a/kube/config-map.yaml +++ /dev/null @@ -1,12 +0,0 @@ -kind: ConfigMap -apiVersion: v1 -metadata: -name: online-store-configmap -data: -# Configuration values can be set as key-value properties -database: mongodb -database_uri: mongodb://localhost:27017 -# Or set as complete file contents (even JSON!) -keys: | - image.public.key=771 - rsa.public.key=42 \ No newline at end of file diff --git a/kube/mongo.yaml b/kube/mongo.yaml deleted file mode 100644 index c2b3dea7..00000000 --- a/kube/mongo.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: mongo-pvc -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 256Mi ---- -apiVersion: v1 -kind: Service -metadata: - name: mongo -spec: - selector: - app: mongo - ports: - - port: 27017 - targetPort: 27017 ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: mongo -spec: - selector: - matchLabels: - app: mongo - template: - metadata: - labels: - app: mongo - spec: - containers: - - name: mongo - image: mongo:3.6.17-xenial - ports: - - containerPort: 27017 - volumeMounts: - - name: storage - mountPath: /data/db - volumes: - - name: storage - persistentVolumeClaim: - claimName: mongo-pvc \ No newline at end of file diff --git a/kube/online-store.yaml b/kube/online-store.yaml deleted file mode 100644 index e14925b9..00000000 --- a/kube/online-store.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment # Kubernetes resource kind we are creating -metadata: - name: online-store-app -spec: - replicas: 1 # Number of replicas that will be created for this deployment - selector: - matchLabels: - app: online-store-app - template: - metadata: - labels: - app: online-store-app - spec: - containers: - - name: online-store - image: zufarexplainedit/online-store:0.0.2 # Image that will be used to containers in the cluster - imagePullPolicy: Always - ports: - - containerPort: 8083 # The port that the container is running on in the cluster - env: - - name: MONGO_URL - value: mongodb://mongo:27017/dev ---- -apiVersion: v1 # Kubernetes API version -kind: Service # Kubernetes resource kind we are creating -metadata: # Metadata of the resource kind we are creating - name: online-store-app-service -spec: - selector: - app: online-store-app - ports: - - protocol: TCP - port: 8083 # The port that the service is running on in the cluster - targetPort: 8083 # The port exposed by the service \ No newline at end of file diff --git a/pom.xml b/pom.xml index d69a51f7..fc822db5 100644 --- a/pom.xml +++ b/pom.xml @@ -13,20 +13,6 @@ - - com.amazonaws - aws-java-sdk-bom - 1.11.106 - pom - import - - - software.amazon.awssdk - bom - 2.17.230 - pom - import - org.apache.logging.log4j log4j-bom @@ -41,7 +27,7 @@ online-store 0.0.1-SNAPSHOT Online Store - AWS Microservice for learning purpose + Online-store project for learning purpose UTF-8 @@ -50,26 +36,26 @@ 17 17 2.0.5 - 2.14.0 - 2.19.8 + 2.15.1 3.1.1 5.4.2 5.4.2 1.4.0 1.4.0 - 5.9.0 - 2.14.0 + 5.9.2 + 2.14.2 3.0.0 - 2.2.6 - 19.0.3 - 2.4.2 + 2.2.8 + 21.0.1 3.8.1 2.22.2 0.8.5 0.11.5 0.11.5 0.11.5 - 4.11 + 7.3 + 3.0.0 + 42.6.0 @@ -146,10 +132,6 @@ micrometer-registry-prometheus runtime - - org.springframework.boot - spring-boot-starter-data-mongodb - @@ -188,7 +170,7 @@ test - + com.fasterxml.jackson.core jackson-core @@ -200,44 +182,24 @@ ${jackson-databind.version} - - - io.awspring.cloud - spring-cloud-aws-messaging - ${spring-cloud-aws-messaging.version} - - - com.amazonaws - aws-java-sdk-sqs - - - com.amazonaws - aws-java-sdk-dynamodb - - - software.amazon.awssdk - dynamodb-enhanced - ${dynamodb-enhanced.version} - - - software.amazon.awssdk - kms - - - software.amazon.awssdk - dynamodb - + org.springframework.boot spring-boot-starter-data-jpa + + org.postgresql + postgresql + ${postgresql.version} + + org.springframework.boot spring-boot-maven-plugin - 3.0.0 + ${spring-boot-maven-plugin.version} diff --git a/src/main/java/com/zufar/onlinestore/OnlineStoreApplication.java b/src/main/java/com/zufar/onlinestore/OnlineStoreApplication.java index 45ecfa43..ab071770 100644 --- a/src/main/java/com/zufar/onlinestore/OnlineStoreApplication.java +++ b/src/main/java/com/zufar/onlinestore/OnlineStoreApplication.java @@ -2,13 +2,10 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.data.mongodb.config.EnableMongoAuditing; -import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; -@EnableMongoRepositories -@EnableMongoAuditing @SpringBootApplication public class OnlineStoreApplication { + public static void main(String[] args) { SpringApplication.run(OnlineStoreApplication.class, args); } diff --git a/src/main/java/com/zufar/onlinestore/aws/configuration/AwsConfiguration.java b/src/main/java/com/zufar/onlinestore/aws/configuration/AwsConfiguration.java deleted file mode 100644 index fd1d5f37..00000000 --- a/src/main/java/com/zufar/onlinestore/aws/configuration/AwsConfiguration.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.zufar.onlinestore.aws.configuration; - -import com.amazonaws.auth.AWSCredentials; -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.auth.AWSStaticCredentialsProvider; -import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.client.builder.AwsClientBuilder; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; - -import lombok.Getter; -import software.amazon.awssdk.auth.credentials.AwsBasicCredentials; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider; - -@Profile("Aws-Profile") -@Getter -@Configuration -public class AwsConfiguration { - - @Value("${cloud.aws.credentials.access-key}") - private String awsAccessKey; - - @Value("${cloud.aws.credentials.secret-key}") - private String awsSecretKey; - - @Value("${cloud.aws.service.endpoint}") - private String awsServiceEndpoint; - - @Value("${cloud.aws.region.static}") - private String awsRegion; - - @Bean - public AWSCredentials getAWSCredentials() { - return new BasicAWSCredentials(awsAccessKey, awsSecretKey); - } - - @Bean - public AWSCredentialsProvider getAwsSystemPropertyCredentialsProvider() { - return new AWSStaticCredentialsProvider(getAWSCredentials()); - } - - @Bean - public AwsCredentialsProvider getAwsCredentialsProvider() { - return StaticCredentialsProvider.create(getAwsBasicCredentials()); - } - - @Bean - public AwsBasicCredentials getAwsBasicCredentials() { - return AwsBasicCredentials.create(awsAccessKey, awsSecretKey); - } - - @Bean - public AwsClientBuilder.EndpointConfiguration getEndpointConfiguration() { - return new AwsClientBuilder.EndpointConfiguration(awsServiceEndpoint, awsRegion); - } -} diff --git a/src/main/java/com/zufar/onlinestore/aws/configuration/AwsDynamoDbConfiguration.java b/src/main/java/com/zufar/onlinestore/aws/configuration/AwsDynamoDbConfiguration.java deleted file mode 100644 index 14200dfc..00000000 --- a/src/main/java/com/zufar/onlinestore/aws/configuration/AwsDynamoDbConfiguration.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.zufar.onlinestore.aws.configuration; - -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.client.builder.AwsClientBuilder; -import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; -import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; -import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; - -import lombok.RequiredArgsConstructor; -import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; -import software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient; -import software.amazon.awssdk.regions.Region; -import software.amazon.awssdk.services.dynamodb.DynamoDbClient; - -@Profile("Aws-Profile") -@Configuration -@RequiredArgsConstructor -public class AwsDynamoDbConfiguration { - private final AwsCredentialsProvider awsSdkCredentialsProvider; - private final AWSCredentialsProvider awsAuthCredentialsProvider; - private final AwsClientBuilder.EndpointConfiguration endpointConfiguration; - - @Bean - public DynamoDBMapper dynamoDBMapper() { - return new DynamoDBMapper(getAmazonDynamoDB()); - } - - @Bean - public DynamoDbEnhancedClient getDynamoDbEnhancedClient() { - return DynamoDbEnhancedClient.builder() - .dynamoDbClient(getDynamoDbClient()) - .build(); - } - - @Bean - public DynamoDbClient getDynamoDbClient() { - return DynamoDbClient.builder() - .credentialsProvider(awsSdkCredentialsProvider) - .region(Region.EU_WEST_2) - .build(); - } - - @Bean - public AmazonDynamoDB getAmazonDynamoDB() { - return AmazonDynamoDBClientBuilder - .standard() - .withEndpointConfiguration(endpointConfiguration) - .withCredentials(awsAuthCredentialsProvider) - .build(); - } -} diff --git a/src/main/java/com/zufar/onlinestore/aws/configuration/AwsSnsConfiguration.java b/src/main/java/com/zufar/onlinestore/aws/configuration/AwsSnsConfiguration.java deleted file mode 100644 index e8dad4cc..00000000 --- a/src/main/java/com/zufar/onlinestore/aws/configuration/AwsSnsConfiguration.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.zufar.onlinestore.aws.configuration; - -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.client.builder.AwsClientBuilder; -import com.amazonaws.services.sns.AmazonSNS; -import com.amazonaws.services.sns.AmazonSNSClientBuilder; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.messaging.converter.MappingJackson2MessageConverter; - -import io.awspring.cloud.messaging.core.NotificationMessagingTemplate; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - - -@Profile("Aws-Profile") -@Getter -@Configuration -@RequiredArgsConstructor -public class AwsSnsConfiguration { - private final AwsConfiguration awsConfiguration; - private final AWSCredentialsProvider awsCredentialsProvider; - - @Value("${cloud.aws.sns.topic.url}") - private String snsEndpoint; - - @Value("${cloud.aws.sns.topic.name}") - private String topicName; - - @Bean - public AmazonSNS getAmazonSNS() { - AwsClientBuilder.EndpointConfiguration endpointConfiguration = - new AwsClientBuilder.EndpointConfiguration(snsEndpoint, awsConfiguration.getAwsRegion()); - - return AmazonSNSClientBuilder.standard() - .withCredentials(awsCredentialsProvider) - .withEndpointConfiguration(endpointConfiguration) - .build(); - } - - @Bean - public NotificationMessagingTemplate notificationMessagingTemplate() { - MappingJackson2MessageConverter mappingJackson2MessageConverter = new MappingJackson2MessageConverter(); - mappingJackson2MessageConverter.setSerializedPayloadClass(String.class); - mappingJackson2MessageConverter.getObjectMapper().registerModule(new JavaTimeModule()); - - NotificationMessagingTemplate notificationMessagingTemplate = new NotificationMessagingTemplate(getAmazonSNS()); - notificationMessagingTemplate.setMessageConverter(mappingJackson2MessageConverter); - notificationMessagingTemplate.setDefaultDestinationName(topicName); - return notificationMessagingTemplate; - } -} diff --git a/src/main/java/com/zufar/onlinestore/aws/configuration/AwsSqsConfiguration.java b/src/main/java/com/zufar/onlinestore/aws/configuration/AwsSqsConfiguration.java deleted file mode 100644 index 7b326d62..00000000 --- a/src/main/java/com/zufar/onlinestore/aws/configuration/AwsSqsConfiguration.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.zufar.onlinestore.aws.configuration; - -import com.amazonaws.auth.AWSCredentialsProvider; -import com.amazonaws.regions.Regions; -import com.amazonaws.services.sqs.AmazonSQS; -import com.amazonaws.services.sqs.AmazonSQSClientBuilder; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Profile("Aws-Profile") -@Configuration -@RequiredArgsConstructor -@Getter -public class AwsSqsConfiguration { - private final AWSCredentialsProvider awsCredentialsProvider; - - @Bean - public AmazonSQS getAmazonSqs() { - return AmazonSQSClientBuilder.standard() - .withCredentials(awsCredentialsProvider) - .withRegion(Regions.DEFAULT_REGION) - .build(); - } -} diff --git a/src/main/java/com/zufar/onlinestore/aws/sqs/SqsBatchMessageSender.java b/src/main/java/com/zufar/onlinestore/aws/sqs/SqsBatchMessageSender.java deleted file mode 100644 index 56fc8fe6..00000000 --- a/src/main/java/com/zufar/onlinestore/aws/sqs/SqsBatchMessageSender.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.zufar.onlinestore.aws.sqs; - -import com.amazonaws.services.sqs.AmazonSQS; -import com.amazonaws.services.sqs.model.SendMessageBatchRequest; -import com.amazonaws.services.sqs.model.SendMessageBatchRequestEntry; -import lombok.RequiredArgsConstructor; - -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Service; - -import java.util.Collection; - -@Profile("Aws-Profile") -@Service -@RequiredArgsConstructor -public class SqsBatchMessageSender { - private static final String QUEUE_URL = System.getProperty("AWS_QUEUE_URL"); - - private final AmazonSQS sqsClient; - - public void send(Collection messages) { - final SendMessageBatchRequest messageBatchRequest = new SendMessageBatchRequest() - .withQueueUrl(QUEUE_URL) - .withEntries(messages); - - sqsClient.sendMessageBatch(messageBatchRequest); - } -} diff --git a/src/main/java/com/zufar/onlinestore/aws/sqs/SqsMessageReceiver.java b/src/main/java/com/zufar/onlinestore/aws/sqs/SqsMessageReceiver.java deleted file mode 100644 index d6d09e0a..00000000 --- a/src/main/java/com/zufar/onlinestore/aws/sqs/SqsMessageReceiver.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.zufar.onlinestore.aws.sqs; - -import com.amazonaws.services.sqs.AmazonSQS; -import com.amazonaws.services.sqs.model.Message; - -import lombok.RequiredArgsConstructor; - -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -@Profile("Aws-Profile") -@Service -@RequiredArgsConstructor -public class SqsMessageReceiver { - private final AmazonSQS sqsClient; - - public Collection receiveAllMessageBodies(final String queueUrl) { - List messages = sqsClient - .receiveMessage(queueUrl) - .getMessages(); - - return messages - .stream() - .map(Message::getBody) - .collect(Collectors.toList()); - } -} diff --git a/src/main/java/com/zufar/onlinestore/aws/sqs/SqsMessageSender.java b/src/main/java/com/zufar/onlinestore/aws/sqs/SqsMessageSender.java deleted file mode 100644 index f383e938..00000000 --- a/src/main/java/com/zufar/onlinestore/aws/sqs/SqsMessageSender.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.zufar.onlinestore.aws.sqs; - -import com.amazonaws.services.sqs.AmazonSQS; -import com.amazonaws.services.sqs.model.SendMessageRequest; -import lombok.RequiredArgsConstructor; - -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Service; - -@Profile("Aws-Profile") -@Service -@RequiredArgsConstructor -public class SqsMessageSender { - private static final String QUEUE_URL = System.getProperty("AWS_QUEUE_URL"); - - private final AmazonSQS sqsClient; - - public void send(final String messageBody) { - final SendMessageRequest message = new SendMessageRequest() - .withQueueUrl(QUEUE_URL) - .withMessageBody(messageBody) - .withDelaySeconds(5); - - sqsClient.sendMessage(message); - } -} diff --git a/src/main/java/com/zufar/onlinestore/common/exception/ExceptionsHandler.java b/src/main/java/com/zufar/onlinestore/common/exception/ExceptionsHandler.java index 1221c466..f115b3a2 100644 --- a/src/main/java/com/zufar/onlinestore/common/exception/ExceptionsHandler.java +++ b/src/main/java/com/zufar/onlinestore/common/exception/ExceptionsHandler.java @@ -1,6 +1,5 @@ package com.zufar.onlinestore.common.exception; -import com.amazonaws.util.StringUtils; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.validation.FieldError; @@ -23,7 +22,7 @@ public ResponseEntity> handleMethodArgumentNotValidException .collect(Collectors.toMap(error -> ((FieldError) error).getField(), error -> { String errorMessage = error.getDefaultMessage(); - if (StringUtils.isNullOrEmpty(errorMessage)) { + if (errorMessage == null || errorMessage.isBlank()) { errorMessage = "ErrorMessage is empty"; } return errorMessage; diff --git a/src/main/java/com/zufar/onlinestore/customer/converter/AddressDtoConverter.java b/src/main/java/com/zufar/onlinestore/customer/converter/AddressDtoConverter.java deleted file mode 100644 index d844078a..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/converter/AddressDtoConverter.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.zufar.onlinestore.customer.converter; - -import com.zufar.onlinestore.customer.dto.AddressDto; -import com.zufar.onlinestore.customer.entity.Address; - -import org.springframework.stereotype.Service; - -@Service -public class AddressDtoConverter { - - public AddressDto convertToDto(final Address entity) { - return AddressDto.builder() - .line(entity.getLine()) - .city(entity.getCity()) - .country(entity.getCountry()) - .build(); - } - - public Address convertToEntity(final AddressDto dto) { - return Address.builder() - .line(dto.getLine()) - .city(dto.getCity()) - .country(dto.getCountry()) - .build(); - } -} diff --git a/src/main/java/com/zufar/onlinestore/customer/converter/CustomerDtoConverter.java b/src/main/java/com/zufar/onlinestore/customer/converter/CustomerDtoConverter.java deleted file mode 100644 index 2ae016e3..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/converter/CustomerDtoConverter.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.zufar.onlinestore.customer.converter; - -import com.zufar.onlinestore.customer.dto.AddressDto; -import com.zufar.onlinestore.customer.dto.CustomerDto; -import com.zufar.onlinestore.customer.entity.Address; -import com.zufar.onlinestore.customer.entity.Customer; - -import org.springframework.stereotype.Service; - -import lombok.AllArgsConstructor; - -@Service -@AllArgsConstructor -public class CustomerDtoConverter { - private final AddressDtoConverter addressDtoConverter; - - public CustomerDto convertToDto(final Customer entity) { - AddressDto addressDto = addressDtoConverter.convertToDto(entity.getAddress()); - return CustomerDto.builder() - .customerId(entity.getCustomerId()) - .firstName(entity.getFirstName()) - .lastName(entity.getLastName()) - .email(entity.getEmail()) - .address(addressDto) - .build(); - } - - public Customer convertToEntity(final CustomerDto dto) { - Address addressDto = addressDtoConverter.convertToEntity(dto.getAddress()); - return Customer.builder() - .customerId(dto.getCustomerId()) - .firstName(dto.getFirstName()) - .lastName(dto.getLastName()) - .email(dto.getEmail()) - .address(addressDto) - .build(); - } -} diff --git a/src/main/java/com/zufar/onlinestore/customer/dto/AddressDto.java b/src/main/java/com/zufar/onlinestore/customer/dto/AddressDto.java deleted file mode 100644 index 13f7b58c..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/dto/AddressDto.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.zufar.onlinestore.customer.dto; - -import jakarta.validation.constraints.Size; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import jakarta.validation.constraints.NotBlank; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class AddressDto { - - @NotBlank(message = "Line is mandatory") - @Size(max = 55, message = "Line length must be less than 55 characters") - private String line; - - @NotBlank(message = "City is mandatory") - @Size(max = 55, message = "City length must be less than 55 characters") - private String city; - - @NotBlank(message = "Country is mandatory") - @Size(max = 55, message = "Country length must be less than 55 characters") - private String country; -} diff --git a/src/main/java/com/zufar/onlinestore/customer/dto/CustomerDto.java b/src/main/java/com/zufar/onlinestore/customer/dto/CustomerDto.java deleted file mode 100644 index 7e702866..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/dto/CustomerDto.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.zufar.onlinestore.customer.dto; - -import jakarta.annotation.Nullable; -import jakarta.validation.Valid; -import jakarta.validation.constraints.Email; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class CustomerDto { - - @Nullable - private String customerId; - - @NotBlank(message = "FirstName is mandatory") - @Size(max = 55, message = "FirstName length must be less than 55 characters") - private String firstName; - - @NotBlank(message = "LastName is mandatory") - @Size(max = 55, message = "LastName length must be less than 55 characters") - private String lastName; - - @Email(message = "Email should be valid") - @NotBlank(message = "Email is mandatory") - private String email; - - @Valid - @NotNull(message = "Address is mandatory") - private AddressDto address; -} diff --git a/src/main/java/com/zufar/onlinestore/customer/endpoint/CustomerEndpoint.java b/src/main/java/com/zufar/onlinestore/customer/endpoint/CustomerEndpoint.java deleted file mode 100644 index 5bda2272..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/endpoint/CustomerEndpoint.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.zufar.onlinestore.customer.endpoint; - -import com.zufar.onlinestore.customer.converter.CustomerDtoConverter; -import com.zufar.onlinestore.customer.dto.CustomerDto; -import com.zufar.onlinestore.customer.entity.Customer; -import com.zufar.onlinestore.customer.repository.CustomerRepository; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.Collection; -import java.util.List; -import java.util.Optional; - -import static com.zufar.onlinestore.customer.endpoint.UrlConstants.API_CUSTOMERS; - -@Slf4j -@RestController -@RequiredArgsConstructor -@Validated -@RequestMapping(value = API_CUSTOMERS) -public class CustomerEndpoint { - private final CustomerRepository customerCrudRepository; - private final CustomerDtoConverter customerDtoConverter; - - @PostMapping - public ResponseEntity saveCustomer(@RequestBody @Valid final CustomerDto saveCustomerRequest) { - log.info("Received saveCustomerRequest to create Customer - {}.", saveCustomerRequest); - Customer customerEntity = customerDtoConverter.convertToEntity(saveCustomerRequest); - customerCrudRepository.save(customerEntity); - log.info("The Customer was created"); - return ResponseEntity.status(HttpStatus.CREATED) - .build(); - } - - @GetMapping("/{id}") - public ResponseEntity getCustomerById(@PathVariable("id") @NotBlank final String customerId) { - log.info("Received request to get the Customer with id - {}.", customerId); - Optional customer = customerCrudRepository.findById(Long.parseLong(customerId)); - if (customer.isEmpty()) { - log.info("the Customer with id - {} is absent.", customerId); - return ResponseEntity.notFound() - .build(); - } - CustomerDto customerDto = customerDtoConverter.convertToDto(customer.get()); - log.info("the Customer with id - {} was retrieved - {}.", customerId, customerDto); - return ResponseEntity.ok() - .body(customerDto); - } - - @GetMapping - public ResponseEntity> getAllCustomers() { - log.info("Received request to get all customers"); - List customerEntities = customerCrudRepository.findAll(); - if (customerEntities.isEmpty()) { - log.info("All customers are absent."); - return ResponseEntity.notFound() - .build(); - } - Collection customers = customerEntities.stream() - .map(customerDtoConverter::convertToDto) - .toList(); - - log.info("All customers were retrieved - {}.", customers); - return ResponseEntity.ok() - .body(customers); - } - - @DeleteMapping("/{id}") - public ResponseEntity deleteCustomerById(@PathVariable("id") @NotBlank final String customerId) { - log.info("Received request to delete the Customer with id - {}.", customerId); - customerCrudRepository.deleteById(Long.parseLong(customerId)); - log.info("the Customer with id - {} was deleted.", customerId); - return ResponseEntity.ok() - .build(); - } - - @PutMapping("/{id}") - public ResponseEntity updateCustomer(@PathVariable("id") @NotBlank final String customerId, - @RequestBody @Valid @NotNull final CustomerDto updateCustomerRequest) { - log.info("Received updateCustomerRequest to update the Customer with id - {}, updateCustomerRequest - {}.", customerId, updateCustomerRequest); - Customer customerEntity = customerDtoConverter.convertToEntity(updateCustomerRequest); - customerEntity.setCustomerId(customerId); - customerCrudRepository.save(customerEntity); - log.info("the Customer with id - {} was updated.", customerId); - return ResponseEntity.ok() - .build(); - } -} diff --git a/src/main/java/com/zufar/onlinestore/customer/endpoint/UrlConstants.java b/src/main/java/com/zufar/onlinestore/customer/endpoint/UrlConstants.java deleted file mode 100644 index ea6b71f2..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/endpoint/UrlConstants.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.zufar.onlinestore.customer.endpoint; - -public final class UrlConstants { - public static final String API_CUSTOMERS = "/api/customers"; -} - diff --git a/src/main/java/com/zufar/onlinestore/customer/entity/Address.java b/src/main/java/com/zufar/onlinestore/customer/entity/Address.java deleted file mode 100644 index 65c48593..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/entity/Address.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.zufar.onlinestore.customer.entity; - -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.Table; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Entity -@Table(name = "addresses") -public class Address { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE) - private Long id; - - @Column(name = "line", nullable = false) - private String line; - - @Column(name = "city", nullable = false) - private String city; - - @Column(name = "country", nullable = false) - private String country; -} diff --git a/src/main/java/com/zufar/onlinestore/customer/entity/Customer.java b/src/main/java/com/zufar/onlinestore/customer/entity/Customer.java deleted file mode 100644 index 18fce04d..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/entity/Customer.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.zufar.onlinestore.customer.entity; - -import jakarta.persistence.CascadeType; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Entity -@Table(name = "customers") -public class Customer { - - @Id - @Column(nullable = false) - @GeneratedValue(strategy = GenerationType.SEQUENCE) - private String customerId; - - @Column(name = "first_name", nullable = false) - private String firstName; - - @Column(name = "last_name", nullable = false) - private String lastName; - - @Column(name = "email", nullable = false) - private String email; - - @OneToOne(cascade = CascadeType.ALL) - @JoinColumn(name = "address_id", referencedColumnName = "id") - private Address address; - -} diff --git a/src/main/java/com/zufar/onlinestore/customer/repository/CustomerRepository.java b/src/main/java/com/zufar/onlinestore/customer/repository/CustomerRepository.java deleted file mode 100644 index 71fb933b..00000000 --- a/src/main/java/com/zufar/onlinestore/customer/repository/CustomerRepository.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.zufar.onlinestore.customer.repository; - -import com.zufar.onlinestore.customer.entity.Customer; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface CustomerRepository extends JpaRepository {} diff --git a/src/main/java/com/zufar/onlinestore/notification/converter/NotificationDtoConverter.java b/src/main/java/com/zufar/onlinestore/notification/converter/NotificationDtoConverter.java deleted file mode 100644 index d9583697..00000000 --- a/src/main/java/com/zufar/onlinestore/notification/converter/NotificationDtoConverter.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.zufar.onlinestore.notification.converter; - -import com.zufar.onlinestore.customer.converter.CustomerDtoConverter; -import com.zufar.onlinestore.customer.dto.CustomerDto; -import com.zufar.onlinestore.notification.dto.NotificationDto; -import com.zufar.onlinestore.notification.entity.Notification; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Service; - -/** - * @author Alex Zarubin - * created on 27.05.2023 - */ -@Service -@AllArgsConstructor -public class NotificationDtoConverter { - private final CustomerDtoConverter customerDtoConverter; - - public NotificationDto convertToDto(final Notification entity) { - CustomerDto customerDto = customerDtoConverter.convertToDto(entity.getRecipient()); - return NotificationDto.builder() - .message(entity.getMessage()) - .recipient(customerDto) - .build(); - } - - public Notification convertToEntity(final NotificationDto dto) { - CustomerDto customerDto = dto.getRecipient(); - return Notification.builder() - .message(dto.getMessage()) - .recipient(customerDtoConverter.convertToEntity(customerDto)) - .build(); - } -} diff --git a/src/main/java/com/zufar/onlinestore/notification/dto/NotificationDto.java b/src/main/java/com/zufar/onlinestore/notification/dto/NotificationDto.java deleted file mode 100644 index 2938aab7..00000000 --- a/src/main/java/com/zufar/onlinestore/notification/dto/NotificationDto.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.zufar.onlinestore.notification.dto; - -import com.zufar.onlinestore.customer.dto.CustomerDto; -import jakarta.annotation.Nullable; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.Size; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -/** - * @author Alex Zarubin - * created on 27.05.2023 - */ -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class NotificationDto { - @Nullable - private int id; - - @NotBlank(message = "Message is mandatory") - @Size(max = 255, message = "Message length must be less than 255 characters") - private String message; - - private CustomerDto recipient; -} diff --git a/src/main/java/com/zufar/onlinestore/notification/endpoint/NotificationEndpoint.java b/src/main/java/com/zufar/onlinestore/notification/endpoint/NotificationEndpoint.java deleted file mode 100644 index 54113163..00000000 --- a/src/main/java/com/zufar/onlinestore/notification/endpoint/NotificationEndpoint.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.zufar.onlinestore.notification.endpoint; - -import com.zufar.onlinestore.notification.converter.NotificationDtoConverter; -import com.zufar.onlinestore.notification.dto.NotificationDto; -import com.zufar.onlinestore.notification.entity.Notification; -import com.zufar.onlinestore.notification.repository.NotificationRepository; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -import java.util.Optional; - -/** - * @author Alex Zarubin - * created on 27.05.2023 - */ -@Slf4j -@RestController -@RequiredArgsConstructor -@Validated -@RequestMapping(value = "/api/notifications") -public class NotificationEndpoint { - - private final NotificationDtoConverter notificationDtoConverter; - private final NotificationRepository notificationRepository; - - @PostMapping - @ResponseBody - public ResponseEntity createNotification(@RequestBody @Valid @NotNull(message = "Notification is mandatory") final NotificationDto request) { - log.info("Received request to create Notification - {}.", request); - Notification notification = notificationDtoConverter.convertToEntity(request); - notificationRepository.save(notification); - log.info("The Notification was created"); - return ResponseEntity.status(HttpStatus.CREATED) - .build(); - } - - @GetMapping("/{id}") - @ResponseBody - public ResponseEntity getNotificationById(@PathVariable("id") String id) { - log.info("Received request to get the Notification with id - {}.", id); - Optional notification = notificationRepository.findById(Integer.parseInt(id)); - if (notification.isEmpty()) { - log.info("the Notification with id - {} is absent.", id); - return ResponseEntity.notFound() - .build(); - } - NotificationDto notificationDto = notificationDtoConverter.convertToDto(notification.get()); - return ResponseEntity.ok(notificationDto); - } - - @GetMapping - @ResponseBody - public ResponseEntity> getAllNotifications() { - log.info("Received request to get all Notifications"); - List notifications = notificationRepository.findAll(); - if (notifications.isEmpty()) { - log.info("Notifications are absent."); - return ResponseEntity.notFound() - .build(); - } - List notificationDtos = notifications.stream() - .map(notificationDtoConverter::convertToDto) - .toList(); - log.info("All Notifications were retrieved - {}.", notificationDtos); - return ResponseEntity.ok(notificationDtos); - } - - @PutMapping("/{id}") - public ResponseEntity updateNotification(@PathVariable("id") String id, @RequestBody @Valid @NotNull(message = "Notification is mandatory") final NotificationDto request) { - log.info("Received request to update the Notification with id - {}.", id); - Optional notification = notificationRepository.findById(Integer.parseInt(id)); - if (notification.isEmpty()) { - log.info("The Notification with id - {} is absent.", id); - return ResponseEntity.notFound() - .build(); - } - Notification notificationToUpdate = notificationDtoConverter.convertToEntity(request); - notificationToUpdate.setId(Integer.parseInt(id)); - notificationRepository.save(notificationToUpdate); - log.info("The Notification with id - {} was updated.", id); - return ResponseEntity.ok().build(); - } - - @DeleteMapping("/{id}") - public ResponseEntity deleteNotification(@PathVariable("id") String id) { - log.info("Received request to delete the Notification with id - {}.", id); - notificationRepository.deleteById(Integer.parseInt(id)); - log.info("The Notification with id - {} was deleted.", id); - return ResponseEntity.ok().build(); - } - -} diff --git a/src/main/java/com/zufar/onlinestore/notification/entity/Notification.java b/src/main/java/com/zufar/onlinestore/notification/entity/Notification.java deleted file mode 100644 index 61c8046f..00000000 --- a/src/main/java/com/zufar/onlinestore/notification/entity/Notification.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.zufar.onlinestore.notification.entity; - -import com.zufar.onlinestore.customer.entity.Customer; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -/** - * @author Alex Zarubin - * created on 24.05.2023 - */ - - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -@Document -public class Notification { - - @Id - private int id; - - private String message; - private Customer recipient; -} - diff --git a/src/main/java/com/zufar/onlinestore/notification/repository/NotificationRepository.java b/src/main/java/com/zufar/onlinestore/notification/repository/NotificationRepository.java deleted file mode 100644 index 21bea0cb..00000000 --- a/src/main/java/com/zufar/onlinestore/notification/repository/NotificationRepository.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.zufar.onlinestore.notification.repository; - - -import com.zufar.onlinestore.notification.entity.Notification; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface NotificationRepository extends MongoRepository { -} - diff --git a/src/main/java/com/zufar/onlinestore/notification/repository/NotificationsMongoDatabaseInitializer.java b/src/main/java/com/zufar/onlinestore/notification/repository/NotificationsMongoDatabaseInitializer.java deleted file mode 100644 index 0d416dac..00000000 --- a/src/main/java/com/zufar/onlinestore/notification/repository/NotificationsMongoDatabaseInitializer.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.zufar.onlinestore.notification.repository; - -import com.zufar.onlinestore.customer.entity.Customer; -import com.zufar.onlinestore.notification.entity.Notification; -import org.springframework.boot.CommandLineRunner; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author Alex Zarubin - * created on 27.05.2023 - */ -@Configuration -public class NotificationsMongoDatabaseInitializer { - - - @Bean - CommandLineRunner notificationCommandLineRunner(NotificationRepository repository) { - //TODO: remove this - Customer customer = new Customer(); - - return strings -> { - repository.save(new Notification(1, "Notification1", customer)); - repository.save(new Notification(2, "Notification2", customer)); - repository.save(new Notification(3, "Notification3", customer)); - repository.save(new Notification(4, "Notification4", customer)); - }; - } -} diff --git a/src/main/java/com/zufar/onlinestore/payment/dto/PaymentRequest.java b/src/main/java/com/zufar/onlinestore/payment/dto/PaymentRequest.java deleted file mode 100644 index 2c510ee3..00000000 --- a/src/main/java/com/zufar/onlinestore/payment/dto/PaymentRequest.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.zufar.onlinestore.payment.dto; - -public class PaymentRequest { -} diff --git a/src/main/java/com/zufar/onlinestore/payment/dto/PaymentResponse.java b/src/main/java/com/zufar/onlinestore/payment/dto/PaymentResponse.java deleted file mode 100644 index e67b422d..00000000 --- a/src/main/java/com/zufar/onlinestore/payment/dto/PaymentResponse.java +++ /dev/null @@ -1,4 +0,0 @@ -package com.zufar.onlinestore.payment.dto; - -public class PaymentResponse { -} diff --git a/src/main/java/com/zufar/onlinestore/product/ProductsSumCalculator.java b/src/main/java/com/zufar/onlinestore/product/ProductsSumCalculator.java deleted file mode 100644 index e967e019..00000000 --- a/src/main/java/com/zufar/onlinestore/product/ProductsSumCalculator.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.zufar.onlinestore.product; - -import com.zufar.onlinestore.product.dto.PriceDto; -import com.zufar.onlinestore.product.dto.ProductInfoDto; - -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.util.Collection; - -@Service -public class ProductsSumCalculator { - - public BigDecimal calculate(final Collection products) { - return products.stream() - .map(ProductInfoDto::getPrice) - .map(PriceDto::getAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add); - } -} diff --git a/src/main/java/com/zufar/onlinestore/product/converter/ProductInfoDtoConverter.java b/src/main/java/com/zufar/onlinestore/product/converter/ProductInfoDtoConverter.java deleted file mode 100644 index 294ac60e..00000000 --- a/src/main/java/com/zufar/onlinestore/product/converter/ProductInfoDtoConverter.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.zufar.onlinestore.product.converter; - -import com.zufar.onlinestore.product.dto.ProductInfoDto; -import com.zufar.onlinestore.product.entity.ProductInfo; -import lombok.AllArgsConstructor; -import org.springframework.stereotype.Component; - -@Component -public class ProductInfoDtoConverter { - - public ProductInfoDto convertToDto(final ProductInfo entity) { - return ProductInfoDto.builder() - .id(entity.getId()) - .category(entity.getCategory()) - .name(entity.getName()) - .price(entity.getPrice()) - .build(); - } - - public ProductInfo convertToEntity(final ProductInfoDto dto) { - return ProductInfo.builder() - .category(dto.getCategory()) - .name(dto.getName()) - .price(dto.getPrice()) - .build(); - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/product/dto/PriceDto.java b/src/main/java/com/zufar/onlinestore/product/dto/PriceDto.java deleted file mode 100644 index 68009885..00000000 --- a/src/main/java/com/zufar/onlinestore/product/dto/PriceDto.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.zufar.onlinestore.product.dto; - -import java.math.BigDecimal; - -import jakarta.validation.constraints.DecimalMin; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class PriceDto { - - @NotNull(message = "Price is mandatory") - @DecimalMin(value = "10.0", message = "Price minimum value should be more than 10") - private BigDecimal amount; - - @NotBlank(message = "Currency is mandatory") - @Size(max = 55, message = "Currency length must be less than 55 characters") - private String currency; -} diff --git a/src/main/java/com/zufar/onlinestore/product/dto/ProductInfoDto.java b/src/main/java/com/zufar/onlinestore/product/dto/ProductInfoDto.java deleted file mode 100644 index 28b010ab..00000000 --- a/src/main/java/com/zufar/onlinestore/product/dto/ProductInfoDto.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.zufar.onlinestore.product.dto; - -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Size; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class ProductInfoDto { - - private int id; - - @NotBlank(message = "Name is mandatory") - @Size(max = 55, message = "Name length must be less than 55 characters") - private String name; - - @Valid - @NotNull(message = "Price is mandatory") - private PriceDto price; - - @NotBlank(message = "Category is mandatory") - @Size(max = 55, message = "Category length must be less than 55 characters") - private String category; -} diff --git a/src/main/java/com/zufar/onlinestore/product/endpoint/ProductsEndpoint.java b/src/main/java/com/zufar/onlinestore/product/endpoint/ProductsEndpoint.java deleted file mode 100644 index e4373363..00000000 --- a/src/main/java/com/zufar/onlinestore/product/endpoint/ProductsEndpoint.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.zufar.onlinestore.product.endpoint; - -import com.zufar.onlinestore.product.converter.ProductInfoDtoConverter; -import com.zufar.onlinestore.product.dto.ProductInfoDto; -import com.zufar.onlinestore.product.entity.ProductInfo; -import com.zufar.onlinestore.product.repository.ProductInfoRepository; - -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.DeleteMapping; -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.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Collection; -import java.util.Optional; - -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@RestController -@RequiredArgsConstructor -@Validated -@RequestMapping(value = "/api/products") -public class ProductsEndpoint { - private final ProductInfoRepository productInfoRepository; - private final ProductInfoDtoConverter productInfoDtoConverter; - - @PostMapping - @ResponseBody - public ResponseEntity saveProduct(@RequestBody @Valid @NotNull(message = "Request body is mandatory") - final ProductInfoDto request) { - log.info("Received request to create ProductInfo - {}.", request); - ProductInfo productInfo = productInfoDtoConverter.convertToEntity(request); - productInfoRepository.save(productInfo); - log.info("The ProductInfo was created"); - return ResponseEntity.status(HttpStatus.CREATED) - .build(); - } - - @GetMapping("/{id}") - @ResponseBody - public ResponseEntity getProductInfoById(@PathVariable("id") @NotBlank final String id) { - log.info("Received request to get the ProductInfo with id - {}.", id); - Optional ProductInfo = productInfoRepository.findById(Integer.parseInt(id)); - if (ProductInfo.isEmpty()) { - log.info("the ProductInfo with id - {} is absent.", id); - return ResponseEntity.notFound() - .build(); - } - ProductInfoDto ProductInfoDto = productInfoDtoConverter.convertToDto(ProductInfo.get()); - log.info("the ProductInfo with id - {} was retrieved - {}.", id, ProductInfoDto); - return ResponseEntity.ok() - .body(ProductInfoDto); - } - - @GetMapping - @ResponseBody - public ResponseEntity> getAllProducts() { - log.info("Received request to get all ProductInfos"); - Collection productInfoCollection = productInfoRepository.findAll(); - if (productInfoCollection.isEmpty()) { - log.info("All ProductInfos are absent."); - return ResponseEntity.notFound() - .build(); - } - Collection ProductInfos = productInfoCollection.stream() - .map(productInfoDtoConverter::convertToDto) - .toList(); - - log.info("All ProductInfos were retrieved - {}.", ProductInfos); - return ResponseEntity.ok() - .body(ProductInfos); - } - - @DeleteMapping("/{id}") - @ResponseBody - public ResponseEntity deleteById(@PathVariable("id") @NotBlank final String id) { - log.info("Received request to delete the ProductInfo with id - {}.", id); - productInfoRepository.deleteById(Integer.parseInt(id)); - log.info("the ProductInfo with id - {} was deleted.", id); - return ResponseEntity.ok() - .build(); - } - - @PutMapping("/{id}") - @ResponseBody - public ResponseEntity updateProductInfo(@PathVariable("id") @NotBlank final String id, - @RequestBody @Valid @NotNull final ProductInfoDto request) { - log.info("Received request to update the ProductInfo with id - {}, request - {}.", id, request); - ProductInfo productInfo = productInfoDtoConverter.convertToEntity(request); - productInfo.setId(Integer.parseInt(id)); - productInfoRepository.save(productInfo); - log.info("the ProductInfo with id - {} was updated.", id); - return ResponseEntity.ok() - .build(); - } - -} diff --git a/src/main/java/com/zufar/onlinestore/product/entity/ProductInfo.java b/src/main/java/com/zufar/onlinestore/product/entity/ProductInfo.java deleted file mode 100644 index 6f734714..00000000 --- a/src/main/java/com/zufar/onlinestore/product/entity/ProductInfo.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.zufar.onlinestore.product.entity; - -import com.zufar.onlinestore.product.dto.PriceDto; -import lombok.Builder; -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -import java.util.Objects; - -@Builder -@Document -public class ProductInfo { - - @Id - private int id; - - private String name; - - private PriceDto price; - - private String category; - - public ProductInfo(int id, String name, PriceDto price, String category) { - this.id = id; - this.name = name; - this.price = price; - this.category = category; - } - - public ProductInfo() { - } - - public int getId() { - return this.id; - } - - public String getName() { - return this.name; - } - - public PriceDto getPrice() { - return this.price; - } - - public String getCategory() { - return this.category; - } - - public void setId(int id) { - this.id = id; - } - - public void setName(String name) { - this.name = name; - } - - public void setPrice(PriceDto price) { - this.price = price; - } - - public void setCategory(String category) { - this.category = category; - } - - public boolean equals(final Object o) { - if (o == this) return true; - if (!(o instanceof final ProductInfo other)) return false; - if (!other.canEqual(this)) return false; - if (this.getId() != other.getId()) return false; - final Object this$name = this.getName(); - final Object other$name = other.getName(); - if (!Objects.equals(this$name, other$name)) return false; - final Object this$price = this.getPrice(); - final Object other$price = other.getPrice(); - if (!Objects.equals(this$price, other$price)) return false; - final Object this$category = this.getCategory(); - final Object other$category = other.getCategory(); - return Objects.equals(this$category, other$category); - } - - protected boolean canEqual(final Object other) { - return other instanceof ProductInfo; - } - - public int hashCode() { - final int PRIME = 59; - int result = 1; - result = result * PRIME + this.getId(); - final Object $name = this.getName(); - result = result * PRIME + ($name == null ? 43 : $name.hashCode()); - final Object $price = this.getPrice(); - result = result * PRIME + ($price == null ? 43 : $price.hashCode()); - final Object $category = this.getCategory(); - result = result * PRIME + ($category == null ? 43 : $category.hashCode()); - return result; - } - - public String toString() { - return "ProductInfo(id=" + this.getId() + ", name=" + this.getName() + ", price=" + this.getPrice() + ", category=" + this.getCategory() + ")"; - } -} diff --git a/src/main/java/com/zufar/onlinestore/product/repository/ProductInfoRepository.java b/src/main/java/com/zufar/onlinestore/product/repository/ProductInfoRepository.java deleted file mode 100644 index 980d2497..00000000 --- a/src/main/java/com/zufar/onlinestore/product/repository/ProductInfoRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.zufar.onlinestore.product.repository; - -import com.zufar.onlinestore.product.entity.ProductInfo; - -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; - -@Repository -public interface ProductInfoRepository extends MongoRepository { -} diff --git a/src/main/java/com/zufar/onlinestore/review/advice/ReviewControllerAdvice.java b/src/main/java/com/zufar/onlinestore/review/advice/ReviewControllerAdvice.java deleted file mode 100644 index a2593b29..00000000 --- a/src/main/java/com/zufar/onlinestore/review/advice/ReviewControllerAdvice.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.zufar.onlinestore.review.advice; - -import com.zufar.onlinestore.review.controller.ApiResponse; -import com.zufar.onlinestore.review.exception.ReviewDeleteFailedException; -import com.zufar.onlinestore.review.exception.ReviewNotFoundException; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.RestControllerAdvice; - -import java.time.LocalDateTime; - -@Slf4j -@RestControllerAdvice -public class ReviewControllerAdvice { - - @ExceptionHandler(ReviewNotFoundException.class) - public ResponseEntity> handleReviewNotFoundException(ReviewNotFoundException ex) { - log.error("Error occurred: {}", ex.getMessage()); - ApiResponse apiResponse = ApiResponse.builder() - .message(ex.getMessage()) - .status(HttpStatus.NOT_FOUND.value()) - .timeStamp(LocalDateTime.now()) - .build(); - return new ResponseEntity<>(apiResponse, HttpStatus.NOT_FOUND); - } - - @ExceptionHandler(ReviewDeleteFailedException.class) - public ResponseEntity> handleReviewDeleteFailedException(ReviewDeleteFailedException ex) { - log.error("Error occurred: {}", ex.getMessage()); - ApiResponse apiResponse = ApiResponse.builder() - .message(ex.getMessage()) - .status(HttpStatus.INTERNAL_SERVER_ERROR.value()) - .timeStamp(LocalDateTime.now()) - .build(); - return new ResponseEntity<>(apiResponse, HttpStatus.INTERNAL_SERVER_ERROR); - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/controller/ApiResponse.java b/src/main/java/com/zufar/onlinestore/review/controller/ApiResponse.java deleted file mode 100644 index b055abec..00000000 --- a/src/main/java/com/zufar/onlinestore/review/controller/ApiResponse.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.zufar.onlinestore.review.controller; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonProperty; -import lombok.Builder; - -import java.time.LocalDateTime; - -@Builder -public class ApiResponse { - @JsonProperty("data") - private T data; - @JsonProperty("message") - private String message; - @JsonProperty("status") - private int status; - @JsonProperty("time_stamp") - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") - private LocalDateTime timeStamp; - - public T getData() { - return this.data; - } - - public String getMessage() { - return this.message; - } - - public int getStatus() { - return this.status; - } - - public LocalDateTime getTimeStamp() { - return this.timeStamp; - } - - public void setData(T data) { - this.data = data; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setStatus(int status) { - this.status = status; - } - - public void setTimeStamp(LocalDateTime timeStamp) { - this.timeStamp = timeStamp; - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/controller/ReviewController.java b/src/main/java/com/zufar/onlinestore/review/controller/ReviewController.java deleted file mode 100644 index 819b07bc..00000000 --- a/src/main/java/com/zufar/onlinestore/review/controller/ReviewController.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.zufar.onlinestore.review.controller; - -import com.zufar.onlinestore.review.dto.ReviewDto; -import com.zufar.onlinestore.review.exception.ReviewNotFoundException; -import com.zufar.onlinestore.review.service.ReviewService; -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; - -import java.time.LocalDateTime; -import java.util.List; - -@Slf4j -@RestController -@RequestMapping(ReviewController.REVIEW_URL) -@Validated -@RequiredArgsConstructor -public class ReviewController { - - public static final String REVIEW_URL = "/api/products"; - private final ReviewService reviewService; - - @PostMapping("/{productId}/reviews") - public ResponseEntity> addReview(@PathVariable String productId, - @RequestBody @Valid @NotNull(message = "Request body is mandatory") ReviewDto request) { - log.info("Received request to create Review - {}.", request); - request.setProductId(productId); - ReviewDto savedReviewDto = reviewService.addReview(request); - log.info("[{}] Review with ID {} was created for product {}.", LocalDateTime.now(), savedReviewDto.getId(), productId); - - ApiResponse apiResponse = ApiResponse.builder() - .data(savedReviewDto) - .message("Review is added") - .timeStamp(LocalDateTime.now()) - .status(HttpStatus.CREATED.value()) - .build(); - - return ResponseEntity.status(HttpStatus.CREATED).body(apiResponse); - } - - @GetMapping("/{productId}/reviews") - public ResponseEntity>> getProductReviews(@PathVariable String productId) { - log.info("Received request to get all Reviews for Product Id {}", productId); - List reviewDtos = reviewService.getProductReviews(productId); - if (reviewDtos.isEmpty()) { - log.info("Reviews for product Id {} are absent.", productId); - return ResponseEntity.notFound().build(); - } - log.info("All Reviews for Product - {} were retrieved - {}.", productId, reviewDtos); - - ApiResponse> apiResponse = ApiResponse.>builder() - .data(reviewDtos) - .message("Reviews retrieved successfully") - .timeStamp(LocalDateTime.now()) - .status(HttpStatus.OK.value()) - .build(); - - return ResponseEntity.ok().body(apiResponse); - } - - @DeleteMapping("/reviews/{reviewId}") - public ResponseEntity> deleteReview(@PathVariable Long reviewId) { - log.info("Received request to delete the Review with id - {}.", reviewId); - reviewService.deleteReview(reviewId); - log.info("The Review with id - {} was deleted.", reviewId); - - ApiResponse apiResponse = ApiResponse.builder() - .data(String.valueOf(reviewId)) - .message(String.format("The Review with id %s was deleted.", reviewId)) - .timeStamp(LocalDateTime.now()) - .status(HttpStatus.OK.value()) - .build(); - - return ResponseEntity.ok(apiResponse); - } - - @PutMapping("/reviews/{reviewId}") - public ResponseEntity> editReview(@PathVariable Long reviewId, - @RequestBody @Valid @NotNull(message = "Request body is mandatory") ReviewDto request) { - log.info("Received request to edit the review with id - {}, request - {}.", reviewId, request); - - ReviewDto existingReviewDto = reviewService.findReview(reviewId) - .orElseThrow(() -> new ReviewNotFoundException(reviewId)); - - existingReviewDto.setText(request.getText()); - existingReviewDto.setRating(request.getRating()); - - ReviewDto updatedReviewDto = reviewService.addReview(existingReviewDto); - - log.info("The review with id - {} was edited.", updatedReviewDto.getId()); - - ApiResponse apiResponse = ApiResponse.builder() - .data(updatedReviewDto) - .message(String.format("The review with id %s was edited.", updatedReviewDto.getId())) - .timeStamp(LocalDateTime.now()) - .status(HttpStatus.OK.value()) - .build(); - return ResponseEntity.ok(apiResponse); - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/converter/ReviewDtoConverter.java b/src/main/java/com/zufar/onlinestore/review/converter/ReviewDtoConverter.java deleted file mode 100644 index c61cc09f..00000000 --- a/src/main/java/com/zufar/onlinestore/review/converter/ReviewDtoConverter.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.zufar.onlinestore.review.converter; - -import com.zufar.onlinestore.review.dto.ReviewDto; -import com.zufar.onlinestore.review.entity.Review; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.stream.Collectors; - -@Component -public class ReviewDtoConverter { - - public ReviewDto convertToDto(Review review) { - return ReviewDto.builder() - .id(review.getId()) - .text(review.getText()) - .rating(review.getRating()) - .productId(review.getProductId()) - .customerId(review.getCustomerId()) - .build(); - } - - public Review convertToEntity(ReviewDto reviewDto) { - return Review.builder() - .id(reviewDto.getId()) - .text(reviewDto.getText()) - .rating(reviewDto.getRating()) - .productId(reviewDto.getProductId()) - .customerId(reviewDto.getCustomerId()) - .build(); - } - - public List convertToDtoList(List entities) { - return entities.stream() - .map(this::convertToDto) - .collect(Collectors.toList()); - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/dto/ReviewDto.java b/src/main/java/com/zufar/onlinestore/review/dto/ReviewDto.java deleted file mode 100644 index 8d8218ad..00000000 --- a/src/main/java/com/zufar/onlinestore/review/dto/ReviewDto.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.zufar.onlinestore.review.dto; - -import jakarta.validation.constraints.*; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class ReviewDto { - - private Long id; - - @NotBlank(message = "Review text is mandatory") - @Size(min = 30, message = "Review text length must be more than 30 characters") - @Size(max = 200, message = "Review text length must be less than 200 characters") - private String text; - - @Min(value = 1, message = "Rating should be at least 1") - @Max(value = 5, message = "Rating should not exceed 5") - @NotNull(message = "Rating is mandatory") - private int rating; - - @NotBlank(message = "Product ID is mandatory") - private String productId; - - @NotBlank(message = "Customer ID is mandatory") - private String customerId; -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/entity/Review.java b/src/main/java/com/zufar/onlinestore/review/entity/Review.java deleted file mode 100644 index d06a4d29..00000000 --- a/src/main/java/com/zufar/onlinestore/review/entity/Review.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.zufar.onlinestore.review.entity; - -import jakarta.persistence.*; -import lombok.Builder; -import org.springframework.data.annotation.CreatedDate; -import org.springframework.data.mongodb.core.mapping.Field; - -import java.time.LocalDate; -import java.util.Objects; - -@Builder -@Entity -@Table(name = "review") -public class Review { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id", nullable = false) - private Long id; - - private String productId; - private String customerId; - private String text; - private int rating; - - @CreatedDate - @Field("date") - private LocalDate date; - - public Review(Long id, String productId, String customerId, String text, int rating, LocalDate date) { - this.id = id; - this.productId = productId; - this.customerId = customerId; - this.text = text; - this.rating = rating; - this.date = date; - } - - public Review() { - } - - - public Long getId() { return id; } - - public String getProductId() { - return this.productId; - } - - public String getCustomerId() { - return this.customerId; - } - - public String getText() { - return this.text; - } - - public int getRating() { - return this.rating; - } - - public LocalDate getDate() { - return this.date; - } - - public void setId(Long id) { this.id = id; } - - public void setProductId(String productId) { - this.productId = productId; - } - - public void setCustomerId(String customerId) { - this.customerId = customerId; - } - - public void setText(String text) { - this.text = text; - } - - public void setRating(int rating) { - this.rating = rating; - } - - public void setDate(LocalDate date) { - this.date = date; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Review review = (Review) o; - return id.equals(review.id); - } - - @Override - public int hashCode() { - return Objects.hash(id); - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/exception/ReviewDeleteFailedException.java b/src/main/java/com/zufar/onlinestore/review/exception/ReviewDeleteFailedException.java deleted file mode 100644 index f9b78563..00000000 --- a/src/main/java/com/zufar/onlinestore/review/exception/ReviewDeleteFailedException.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.zufar.onlinestore.review.exception; - -import lombok.Getter; - -@Getter -public class ReviewDeleteFailedException extends RuntimeException { - private final Long reviewId; - - public ReviewDeleteFailedException(Long reviewId) { - super(String.format("Failed to delete review with id %s.", reviewId)); - this.reviewId = reviewId; - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/exception/ReviewNotFoundException.java b/src/main/java/com/zufar/onlinestore/review/exception/ReviewNotFoundException.java deleted file mode 100644 index 91000a5b..00000000 --- a/src/main/java/com/zufar/onlinestore/review/exception/ReviewNotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.zufar.onlinestore.review.exception; - -import lombok.Getter; - -@Getter -public class ReviewNotFoundException extends RuntimeException { - private final Long reviewId; - - public ReviewNotFoundException(Long reviewId) { - super(String.format("Review with id %s not found.", reviewId)); - this.reviewId = reviewId; - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/repository/ReviewRepository.java b/src/main/java/com/zufar/onlinestore/review/repository/ReviewRepository.java deleted file mode 100644 index 5210b75a..00000000 --- a/src/main/java/com/zufar/onlinestore/review/repository/ReviewRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.zufar.onlinestore.review.repository; - -import com.zufar.onlinestore.review.entity.Review; -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.mongodb.repository.MongoRepository; -import org.springframework.stereotype.Repository; - -import java.util.List; -@Repository -public interface ReviewRepository extends JpaRepository { - List findAllByProductId(String productId); -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/review/service/ReviewService.java b/src/main/java/com/zufar/onlinestore/review/service/ReviewService.java deleted file mode 100644 index 99c9da35..00000000 --- a/src/main/java/com/zufar/onlinestore/review/service/ReviewService.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.zufar.onlinestore.review.service; - -import com.zufar.onlinestore.review.converter.ReviewDtoConverter; -import com.zufar.onlinestore.review.dto.ReviewDto; -import com.zufar.onlinestore.review.entity.Review; -import com.zufar.onlinestore.review.exception.ReviewDeleteFailedException; -import com.zufar.onlinestore.review.exception.ReviewNotFoundException; -import com.zufar.onlinestore.review.repository.ReviewRepository; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.Optional; - -@Service -@RequiredArgsConstructor -public class ReviewService { - - private final ReviewRepository reviewRepository; - private final ReviewDtoConverter reviewDtoConverter; - - @Transactional - public ReviewDto addReview(ReviewDto reviewDto) { - Review savedReview = reviewRepository.save(reviewDtoConverter.convertToEntity(reviewDto)); - return reviewDtoConverter.convertToDto(savedReview); - } - - public Optional findReview(Long reviewId) { - return Optional.ofNullable(reviewRepository.findById(reviewId) - .map(reviewDtoConverter::convertToDto) - .orElseThrow(() -> new ReviewNotFoundException(reviewId))); - } - - public List getProductReviews(String productId) { - return reviewDtoConverter.convertToDtoList(reviewRepository.findAllByProductId(productId)); - } - - @Transactional - public Long deleteReview(Long reviewId) { - reviewRepository.findById(reviewId).orElseThrow(() -> new ReviewNotFoundException(reviewId)); - reviewRepository.deleteById(reviewId); - - if (reviewRepository.existsById(reviewId)) { - throw new ReviewDeleteFailedException(reviewId); - } - - return reviewId; - } -} \ No newline at end of file diff --git a/src/main/java/com/zufar/onlinestore/security/exception/JwtTokenExceptionsHandler.java b/src/main/java/com/zufar/onlinestore/security/exception/JwtTokenExceptionsHandler.java index 9ed9b060..031fc712 100644 --- a/src/main/java/com/zufar/onlinestore/security/exception/JwtTokenExceptionsHandler.java +++ b/src/main/java/com/zufar/onlinestore/security/exception/JwtTokenExceptionsHandler.java @@ -1,5 +1,6 @@ package com.zufar.onlinestore.security.exception; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; @@ -7,8 +8,6 @@ import java.util.HashMap; import java.util.Map; -import software.amazon.awssdk.http.HttpStatusCode; - @ControllerAdvice public class JwtTokenExceptionsHandler { @@ -17,7 +16,7 @@ public ResponseEntity> handleJwtTokenException(final JwtToke Map errors = new HashMap<>(); errors.put("JwtToken Error message", exception.getMessage()); errors.put("JwtToken Cause Error message", exception.getCause().getMessage()); - return ResponseEntity.status(HttpStatusCode.UNAUTHORIZED) + return ResponseEntity.status(HttpStatus.UNAUTHORIZED) .body(errors); } } diff --git a/src/main/java/com/zufar/onlinestore/transacton/PurchaseTransactionHandler.java b/src/main/java/com/zufar/onlinestore/transacton/PurchaseTransactionHandler.java deleted file mode 100644 index 8c7db00e..00000000 --- a/src/main/java/com/zufar/onlinestore/transacton/PurchaseTransactionHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.zufar.onlinestore.transacton; - -import com.zufar.onlinestore.transacton.converter.PurchaseTransactionDtoConverter; -import com.zufar.onlinestore.transacton.dto.TransactionRequest; -import com.zufar.onlinestore.transacton.dto.PurchaseTransactionDto; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.messaging.Message; -import org.springframework.messaging.support.GenericMessage; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.Collections; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -@Service -@RequiredArgsConstructor -public class PurchaseTransactionHandler { - private final PurchaseTransactionDtoConverter purchaseTransactionConverter; - - @Value("${cloud.aws.sqs.queue.purchase-transactions-sqs-queue-url}") - public String queueUrl; - - @Value("${cloud.aws.sns.topic.name}") - private String topicName; - - public void processRequest(final TransactionRequest request) { - log.info("Received request {}.", request); - PurchaseTransactionDto purchaseTransactionDto = purchaseTransactionConverter.convert(request); - - log.info("Sending purchase transaction {}", purchaseTransactionDto); - Message message = new GenericMessage<>(purchaseTransactionDto); - - log.info("Purchase transaction was sent {}", purchaseTransactionDto); - } - - public Collection getAllTransactions() { - return Collections.emptyList(); - } -} diff --git a/src/main/java/com/zufar/onlinestore/transacton/converter/PurchaseTransactionDtoConverter.java b/src/main/java/com/zufar/onlinestore/transacton/converter/PurchaseTransactionDtoConverter.java deleted file mode 100644 index 95d7a1ff..00000000 --- a/src/main/java/com/zufar/onlinestore/transacton/converter/PurchaseTransactionDtoConverter.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.zufar.onlinestore.transacton.converter; - -import com.zufar.onlinestore.transacton.dto.TransactionRequest; -import com.zufar.onlinestore.transacton.dto.PurchaseTransactionDto; -import com.zufar.onlinestore.product.ProductsSumCalculator; - -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.UUID; - -import lombok.RequiredArgsConstructor; - -@Service -@RequiredArgsConstructor -public class PurchaseTransactionDtoConverter { - private final ProductsSumCalculator productsSumCalculator; - - public PurchaseTransactionDto convert(final TransactionRequest request) { - BigDecimal totalSum = productsSumCalculator.calculate(request.getProducts()); - - return PurchaseTransactionDto.builder() - .transactionId(UUID.randomUUID()) - .customerId(request.getCustomerId()) - .totalSum(totalSum) - .createdAt(LocalDateTime.now()) - .build(); - } -} diff --git a/src/main/java/com/zufar/onlinestore/transacton/dto/PurchaseTransactionDto.java b/src/main/java/com/zufar/onlinestore/transacton/dto/PurchaseTransactionDto.java deleted file mode 100644 index 45a40239..00000000 --- a/src/main/java/com/zufar/onlinestore/transacton/dto/PurchaseTransactionDto.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.zufar.onlinestore.transacton.dto; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.UUID; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class PurchaseTransactionDto { - - private UUID transactionId; - private String customerId; - private BigDecimal totalSum; - private LocalDateTime createdAt; -} diff --git a/src/main/java/com/zufar/onlinestore/transacton/dto/TransactionRequest.java b/src/main/java/com/zufar/onlinestore/transacton/dto/TransactionRequest.java deleted file mode 100644 index e0883e54..00000000 --- a/src/main/java/com/zufar/onlinestore/transacton/dto/TransactionRequest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.zufar.onlinestore.transacton.dto; - - -import com.zufar.onlinestore.product.dto.ProductInfoDto; - -import java.util.Collection; - -import jakarta.validation.constraints.NotBlank; -import jakarta.validation.constraints.NotNull; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@Builder -@AllArgsConstructor -@NoArgsConstructor -public class TransactionRequest { - - @NotBlank - private String customerId; - - @NotNull - private Collection products; -} diff --git a/src/main/java/com/zufar/onlinestore/transacton/endpoint/TransactionsEndpoint.java b/src/main/java/com/zufar/onlinestore/transacton/endpoint/TransactionsEndpoint.java deleted file mode 100644 index 181e02e7..00000000 --- a/src/main/java/com/zufar/onlinestore/transacton/endpoint/TransactionsEndpoint.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.zufar.onlinestore.transacton.endpoint; - -import com.zufar.onlinestore.transacton.dto.TransactionRequest; -import com.zufar.onlinestore.transacton.PurchaseTransactionHandler; - -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.validation.annotation.Validated; -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.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Collection; - -import jakarta.validation.Valid; -import jakarta.validation.constraints.NotNull; -import lombok.RequiredArgsConstructor; - -@RestController -@RequiredArgsConstructor -@Validated -@RequestMapping(value = "/api/store") -public class TransactionsEndpoint { - private final PurchaseTransactionHandler purchaseTransactionHandler; - - @PostMapping(value = "/transactions") - @ResponseBody - public ResponseEntity makeTransaction(@RequestBody @Valid @NotNull(message = "TransactionRequest body is mandatory") final TransactionRequest transactionRequest) { - purchaseTransactionHandler.processRequest(transactionRequest); - return ResponseEntity.status(HttpStatus.CREATED) - .build(); - } - - @GetMapping(value = "/transactions") - @ResponseBody - public ResponseEntity> getAllTransactions() { - Collection allTransactions = purchaseTransactionHandler.getAllTransactions(); - return ResponseEntity.ok() - .body(allTransactions); - } -} diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index 37b59f06..bb49f426 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -1,7 +1,7 @@ + # # Server Properties # - server: port: 8083 ssl: @@ -18,7 +18,7 @@ server: # spring: application: - name: Online Store Application + name: Online Store Application banner: charset: UTF-8 location: classpath:banner.txt @@ -31,21 +31,13 @@ spring: password: postgres jpa: hibernate: - ddl-auto: update # set to none with liquibase - database: POSTGRESQL - database-platform: org.hibernate.dialect.PostgreSQL92Dialect + ddl-auto: validate liquibase: - enabled: false - change-log: classpath:db/changelog/db.changelog-master.xml - data: - mongodb: - host: localhost - port: 27017 - database: data - username: rootuser - password: rootpass - authentication-database: admin - auto-index-creation: true + enabled: true + change-log: classpath:db/db.changelog-master.yaml + url: jdbc:postgresql://localhost:5432/testdb + user: postgres + password: postgres # # Spring Doc Properties @@ -79,26 +71,6 @@ management: tags: application: ${spring.application.name} -# -# AWS Properties -# -cloud: - aws: - service: - endpoint: ${AWS_ENDPOINT_URL:http://localhost:4566} - region: - static: us-east-1 - credentials: - access-key: aws_access_key_id - secret-key: aws_secret_access_key - sqs: - queue: - purchase-transactions-sqs-queue-url: ${cloud.aws.service.endpoint}/000000000000/purchase-transactions-sqs-queue - sns: - topic: - name: purchase-transactions-sns-topic - url: ${cloud.aws.service.endpoint} - # # JWT Security Properties # diff --git a/src/main/resources/db/changelog/db.changelog-1.0.xml b/src/main/resources/db/changelog/db.changelog-1.0.xml deleted file mode 100644 index b91e2376..00000000 --- a/src/main/resources/db/changelog/db.changelog-1.0.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/src/main/resources/db/changelog/db.changelog-master.xml b/src/main/resources/db/changelog/db.changelog-master.xml deleted file mode 100644 index 5ab25a1c..00000000 --- a/src/main/resources/db/changelog/db.changelog-master.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/src/main/resources/db/db.changelog-master.yaml b/src/main/resources/db/db.changelog-master.yaml new file mode 100644 index 00000000..7935ec2f --- /dev/null +++ b/src/main/resources/db/db.changelog-master.yaml @@ -0,0 +1 @@ +databaseChangeLog: diff --git a/src/test/java/com/zufar/onlinestore/endpoint/TestOfTests.java b/src/test/java/com/zufar/onlinestore/endpoint/TestOfTests.java deleted file mode 100644 index d083fa80..00000000 --- a/src/test/java/com/zufar/onlinestore/endpoint/TestOfTests.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.zufar.onlinestore.endpoint; -import org.junit.jupiter.api.Test; - -import static io.smallrye.common.constraint.Assert.assertTrue; - -public class TestOfTests { - @Test - void aaaa() throws Exception{ - assertTrue(true); - } -}