From 89c65c7403ae604ced6b3ed9476bf2ed2f1122e7 Mon Sep 17 00:00:00 2001 From: lgwk42 Date: Thu, 4 Jul 2024 00:53:31 +0900 Subject: [PATCH] fix :: post request fix class -> record --- .../qvick/domain/check/client/dto/Check.java | 24 ------------------- .../application/service/PostServiceImpl.java | 8 +++---- .../client/dto/request/PostDeleteRequest.java | 13 +++------- .../client/dto/request/PostEditRequest.java | 17 ++++--------- .../dto/request/PostRegisterRequest.java | 15 ++++-------- 5 files changed, 16 insertions(+), 61 deletions(-) delete mode 100644 src/main/java/com/project/qvick/domain/check/client/dto/Check.java diff --git a/src/main/java/com/project/qvick/domain/check/client/dto/Check.java b/src/main/java/com/project/qvick/domain/check/client/dto/Check.java deleted file mode 100644 index 408efe88..00000000 --- a/src/main/java/com/project/qvick/domain/check/client/dto/Check.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.project.qvick.domain.check.client.dto; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -import java.time.LocalDateTime; - -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -@Builder -public class Check { - - private String name; - private String stdId; - private String room; - private boolean isChecked; - private LocalDateTime checkedDate; - -} diff --git a/src/main/java/com/project/qvick/domain/post/application/service/PostServiceImpl.java b/src/main/java/com/project/qvick/domain/post/application/service/PostServiceImpl.java index 40f0a235..f5ea92a7 100644 --- a/src/main/java/com/project/qvick/domain/post/application/service/PostServiceImpl.java +++ b/src/main/java/com/project/qvick/domain/post/application/service/PostServiceImpl.java @@ -30,15 +30,15 @@ public Post postFind(Long postId) { @Override public void postEdit(PostEditRequest request){ - Post post = postUtil.findPost(request.getPostId()); - post.setTitle(request.getTitle()); - post.setContent(request.getContent()); + Post post = postUtil.findPost(request.postId()); + post.setTitle(request.title()); + post.setContent(request.content()); postRepository.save(postMapper.toEntity(post)); } @Override public void postDelete(PostDeleteRequest request){ - postRepository.deleteById(request.getPostId()); + postRepository.deleteById(request.postId()); } } diff --git a/src/main/java/com/project/qvick/domain/post/client/dto/request/PostDeleteRequest.java b/src/main/java/com/project/qvick/domain/post/client/dto/request/PostDeleteRequest.java index e4be7286..f15ceb80 100644 --- a/src/main/java/com/project/qvick/domain/post/client/dto/request/PostDeleteRequest.java +++ b/src/main/java/com/project/qvick/domain/post/client/dto/request/PostDeleteRequest.java @@ -1,12 +1,5 @@ package com.project.qvick.domain.post.client.dto.request; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class PostDeleteRequest { - - private Long postId; - -} +public record PostDeleteRequest( + Long postId +){} \ No newline at end of file diff --git a/src/main/java/com/project/qvick/domain/post/client/dto/request/PostEditRequest.java b/src/main/java/com/project/qvick/domain/post/client/dto/request/PostEditRequest.java index f3916e39..f410872b 100644 --- a/src/main/java/com/project/qvick/domain/post/client/dto/request/PostEditRequest.java +++ b/src/main/java/com/project/qvick/domain/post/client/dto/request/PostEditRequest.java @@ -1,14 +1,7 @@ package com.project.qvick.domain.post.client.dto.request; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class PostEditRequest { - - private Long postId; - private String title; - private String content; - -} +public record PostEditRequest( + Long postId, + String title, + String content +){} diff --git a/src/main/java/com/project/qvick/domain/post/client/dto/request/PostRegisterRequest.java b/src/main/java/com/project/qvick/domain/post/client/dto/request/PostRegisterRequest.java index 49031b40..0c7e46e3 100644 --- a/src/main/java/com/project/qvick/domain/post/client/dto/request/PostRegisterRequest.java +++ b/src/main/java/com/project/qvick/domain/post/client/dto/request/PostRegisterRequest.java @@ -1,13 +1,6 @@ package com.project.qvick.domain.post.client.dto.request; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public class PostRegisterRequest { - - private String title; - private String content; - -} +public record PostRegisterRequest( + String title, + String content +){}