From bb8cc89e785c7a765865a3a74d5da1e100fa8db2 Mon Sep 17 00:00:00 2001 From: Danila_Mochalov Date: Sun, 16 Apr 2023 14:15:45 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B5=D0=BD=D1=82=D0=B0=20Lab5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data.mv.db | Bin 118784 -> 143360 bytes .../lab1/lab34/controller/CommentDto.java | 3 ++ .../mvc_controllers/FeedMvcController.java | 45 ++++++++++++++++-- .../mvc_controllers/ProfileMvcController.java | 15 ++++++ .../lab34/repository/ProfileRepository.java | 4 ++ .../lab1/lab34/services/ProfileService.java | 6 +++ .../resources/templates/commentModal.html | 31 ++++++++++++ src/main/resources/templates/default.html | 3 ++ .../resources/templates/editCommentModal.html | 30 ++++++++++++ .../resources/templates/editPostModal.html | 5 -- src/main/resources/templates/feed.html | 6 +-- src/main/resources/templates/feedPosts.html | 39 ++++++++++++--- src/main/resources/templates/profilePage.html | 29 +++++++++++ 13 files changed, 195 insertions(+), 21 deletions(-) create mode 100644 src/main/resources/templates/commentModal.html create mode 100644 src/main/resources/templates/editCommentModal.html create mode 100644 src/main/resources/templates/profilePage.html diff --git a/data.mv.db b/data.mv.db index e689d5469bceecb261a673ce02f18be79c7451e0..23341a7dfcff156160d9916417572497890060d6 100644 GIT binary patch delta 14252 zcmeHOX>1kO6`niK&(9kH$82FW4uL=(c<$`;k|s6<0$IR?h7@Sp%$tQJ218g%TeY^4 zTB%YZVJ2bJstaUk2()RQ3<` z6!dPNpjvV*or8tg^4OW5oZ0NIt+3yz;hD|o!(eb}ZMT(7EOztcz4UzNrrqA%_MU?5 zs}jBFus3)+3P$w8wgSgJ1JpP|IqYje zlaLYgu5Icr68GFwU{;yuSY^_QkyHsYtA@2gPOY$`CDMy!R+wyFz&U7)1pjnqFDpi# z0`DI!PBJse;+S-1NXVo%sEQ6t75NDbAx(8dGz&Fd14Fa*v6Z05oiWu`V{b62=gQ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rYwQPF!MDlFat=uO0~ z6S9pa*)~GRewwTOn>dG?iZJly+|`-z!(WrHsv4Ze)el0e;W4MwnM>fuGCbg;&v58d zRDser>d?0YlXdzsOozu?I1vspq{BV|d;TBZ_5|?KPWWIj=jdTW&fF)W>T-tfj6odE zoqYtB@YfZ zZV@4Fb**NtKUSlVw!XhQ5H;#4@_42|+qj+MPBFJG$K3iHog^hKuhKK)<(M~RS@d$G zIdeifuUc)Tj!sGN^*i3pHP3Q5@eU*ydLY@~by_c|G^*i5r7grIrWTa15#ux$PBe_Q zpd6iL(gI`+wI}NcFCW3F8L;P$x(2PMe>@R>LXgJOJB*Yb4jI0U2=jN_E{eMGs^PDTBkC< zL+kX~nNez5r!$JD^`<{J{S=r~W&9uTRj?lW=y2s(gxL_z{~dl&>7RfIgF9|QDjaEn z(+ty#yT1n+eDMOzRT>Y$y+NPs9mTipyIb*+r+B%hc-d3D>?vNNikGQtmwSz%>)Q4l z)3{3kBT=Ay!oIUBV zYm?4*+U=o^)-SXpL039vO|L9#7g`r)9(GHpcqPpFN~qLJs8fHHCAWK*S3iufm{Xt~ zpI7Lh`H|uj@gdv6qNg_PCzatc>haW zH>PAd#8F%1@Sfw;<_{O386Q+2fu9_QEBLAkV)qw#6<(x+Tnmg)U+-~H1s { + List findByLoginLike(String login); } diff --git a/src/main/java/com/webproglabs/lab1/lab34/services/ProfileService.java b/src/main/java/com/webproglabs/lab1/lab34/services/ProfileService.java index 933e9bb..1be9ffe 100644 --- a/src/main/java/com/webproglabs/lab1/lab34/services/ProfileService.java +++ b/src/main/java/com/webproglabs/lab1/lab34/services/ProfileService.java @@ -28,6 +28,12 @@ public class ProfileService { return profile.orElseThrow(EntityNotFoundException::new); } + @Transactional + public Profile findUserByLogin(String login) { + final Optional profile = profileRepository.findByLoginLike(login).stream().findFirst(); + return profile.orElseThrow(EntityNotFoundException::new); + } + @Transactional public List findAllUsers() { return profileRepository.findAll(); diff --git a/src/main/resources/templates/commentModal.html b/src/main/resources/templates/commentModal.html new file mode 100644 index 0000000..a09c141 --- /dev/null +++ b/src/main/resources/templates/commentModal.html @@ -0,0 +1,31 @@ + + + + + +
+ + + + + +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/default.html b/src/main/resources/templates/default.html index 098c64a..4d91ccf 100644 --- a/src/main/resources/templates/default.html +++ b/src/main/resources/templates/default.html @@ -33,6 +33,9 @@ \ No newline at end of file diff --git a/src/main/resources/templates/editCommentModal.html b/src/main/resources/templates/editCommentModal.html new file mode 100644 index 0000000..1a3ccb9 --- /dev/null +++ b/src/main/resources/templates/editCommentModal.html @@ -0,0 +1,30 @@ + + + + + +
+ + + + +
+ + \ No newline at end of file diff --git a/src/main/resources/templates/editPostModal.html b/src/main/resources/templates/editPostModal.html index fcb157d..51b5340 100644 --- a/src/main/resources/templates/editPostModal.html +++ b/src/main/resources/templates/editPostModal.html @@ -29,9 +29,4 @@ - \ No newline at end of file diff --git a/src/main/resources/templates/feed.html b/src/main/resources/templates/feed.html index 2b02dd5..13aee47 100644 --- a/src/main/resources/templates/feed.html +++ b/src/main/resources/templates/feed.html @@ -27,10 +27,6 @@ - + \ No newline at end of file diff --git a/src/main/resources/templates/feedPosts.html b/src/main/resources/templates/feedPosts.html index e6064e4..c21453a 100644 --- a/src/main/resources/templates/feedPosts.html +++ b/src/main/resources/templates/feedPosts.html @@ -26,13 +26,13 @@ -
+

Автор: - +
@@ -48,6 +48,34 @@
+ +
+
+

Комментарии:

+
+

+
+

+ +
+ + + +
+ +
+
+ +
+
+
+
+
+ +
+
+ +
- \ No newline at end of file diff --git a/src/main/resources/templates/profilePage.html b/src/main/resources/templates/profilePage.html new file mode 100644 index 0000000..5715542 --- /dev/null +++ b/src/main/resources/templates/profilePage.html @@ -0,0 +1,29 @@ + + + + + +
+ +
+
+

Профиль

+

+

Список постов пользователя:

+ +
+
+

+
+
+

+ Нет постов +

+
+
+ +
+ + \ No newline at end of file