From 4b9638ad2f96fff8979b5b94224f54194b810a4a Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 7 Apr 2023 20:33:54 +0400 Subject: [PATCH] =?UTF-8?q?4=20lab=20=D0=BF=D0=BE=D0=BF=D1=8B=D1=82=D0=BA?= =?UTF-8?q?=D0=B0=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF?= =?UTF-8?q?=D0=BE=D1=81=D1=82=D0=BE=D0=B2=20(=D0=BD=D0=B5=D1=83=D0=B4?= =?UTF-8?q?=D0=B0=D1=87=D0=BD=D0=BE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data.mv.db | Bin 32768 -> 49152 bytes .../sbapp/Comment/controller/CommentDto.java | 1 + .../sbapp/Post/controller/PostController.java | 6 +++--- .../is/sbapp/Post/controller/PostDto.java | 1 + .../ru/ulstu/is/sbapp/Post/model/Post.java | 5 ----- .../is/sbapp/Post/service/PostService.java | 5 +++-- .../is/sbapp/User/controller/UserDto.java | 1 + 7 files changed, 9 insertions(+), 10 deletions(-) diff --git a/data.mv.db b/data.mv.db index 2ed9f001ebf895bbc144f783fe2d41ea827c5fff..bb1af255f395f556ef581ddfbd72a8103834b23d 100644 GIT binary patch literal 49152 zcmeHQTW=i6b)FfK(kvFVlJUtPLRo$s7lYFM+uRxf;@j-C78;|*k*=4|-Mqn!s0f@Z^APWzlS zkmp*qWroCeXQSTkHtoYrkNNK2{oYQTF52S#@Dsk>;KO|t!NQ60vZ90fJQ(gpb^jrXaqC@8Uc-f zMnEHQx(K93enkS<;yVpAyGaAqIUdwdTT3U+(FKCl5CUu}&kc=J`vXqFnSVX=UZwimm9rq_95Uqr$wMd)Y%;!P ziBDU6V)04DWg=4%naUMcJn`v^&p>>#vpaN~&uv~1hxKb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kRK qdfr|%IR4M#&!7K~#v?8MAM@{M comments = new ArrayList<>(); + public PostDto(){} public PostDto(Post post) { this.Heading = post.getHeading(); diff --git a/src/main/java/ru/ulstu/is/sbapp/Post/model/Post.java b/src/main/java/ru/ulstu/is/sbapp/Post/model/Post.java index 26af7e1..05d176b 100644 --- a/src/main/java/ru/ulstu/is/sbapp/Post/model/Post.java +++ b/src/main/java/ru/ulstu/is/sbapp/Post/model/Post.java @@ -33,11 +33,6 @@ public class Post { private List comments=new ArrayList<>(); public Post(){} - public Post(String Heading, String Content) - { - this.Heading = Heading; - this.Content = Content; - } public Post(String Heading, String Content,byte[] image) { this.Heading = Heading; diff --git a/src/main/java/ru/ulstu/is/sbapp/Post/service/PostService.java b/src/main/java/ru/ulstu/is/sbapp/Post/service/PostService.java index 475029c..fc61ce4 100644 --- a/src/main/java/ru/ulstu/is/sbapp/Post/service/PostService.java +++ b/src/main/java/ru/ulstu/is/sbapp/Post/service/PostService.java @@ -6,6 +6,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import ru.ulstu.is.sbapp.Comment.model.Comment; import ru.ulstu.is.sbapp.Comment.repository.CommentRepository; +import ru.ulstu.is.sbapp.Post.controller.PostDto; import ru.ulstu.is.sbapp.Post.model.Post; import ru.ulstu.is.sbapp.Post.repository.PostRepository; import ru.ulstu.is.sbapp.User.model.User; @@ -27,8 +28,8 @@ public class PostService { this.validatorUtil=validatorUtil; } @Transactional - public Post addPost(String Heading, String Content) { - final Post post = new Post(Heading,Content); + public Post addPost(PostDto postDto) { + final Post post = new Post(postDto); validatorUtil.validate(post); return postRepository.save(post); } diff --git a/src/main/java/ru/ulstu/is/sbapp/User/controller/UserDto.java b/src/main/java/ru/ulstu/is/sbapp/User/controller/UserDto.java index 2e4a3f2..18daf50 100644 --- a/src/main/java/ru/ulstu/is/sbapp/User/controller/UserDto.java +++ b/src/main/java/ru/ulstu/is/sbapp/User/controller/UserDto.java @@ -20,6 +20,7 @@ public class UserDto { private List comments = new ArrayList<>(); + public UserDto(){} public UserDto(User user) { this.id=user.getId(); this.firstName = user.getFirstName();