From 60781eeea32c07a8be6cf075136911927f448248 Mon Sep 17 00:00:00 2001 From: Guhapriya01 Date: Sun, 20 Oct 2024 12:48:54 +0530 Subject: [PATCH] refactor: move Member DTOs to member.dto package for better organization --- .../borrowing/BorrowingService.java | 2 +- .../libraryman_api/borrowing/BorrowingsDto.java | 2 +- .../libraryman_api/member/MemberController.java | 16 +++++++++++++--- .../com/libraryman_api/member/MemberService.java | 3 +++ .../member/{ => dto}/MembersDto.java | 4 +++- .../member/{ => dto}/UpdateMembersDto.java | 2 +- .../member/{ => dto}/UpdatePasswordDto.java | 2 +- 7 files changed, 23 insertions(+), 8 deletions(-) rename src/main/java/com/libraryman_api/member/{ => dto}/MembersDto.java (96%) rename src/main/java/com/libraryman_api/member/{ => dto}/UpdateMembersDto.java (96%) rename src/main/java/com/libraryman_api/member/{ => dto}/UpdatePasswordDto.java (95%) diff --git a/src/main/java/com/libraryman_api/borrowing/BorrowingService.java b/src/main/java/com/libraryman_api/borrowing/BorrowingService.java index 35cec20..7a1c510 100644 --- a/src/main/java/com/libraryman_api/borrowing/BorrowingService.java +++ b/src/main/java/com/libraryman_api/borrowing/BorrowingService.java @@ -9,7 +9,7 @@ import com.libraryman_api.fine.FineRepository; import com.libraryman_api.member.MemberService; import com.libraryman_api.member.Members; -import com.libraryman_api.member.MembersDto; +import com.libraryman_api.member.dto.MembersDto; import com.libraryman_api.notification.NotificationService; import org.springframework.data.domain.Page; diff --git a/src/main/java/com/libraryman_api/borrowing/BorrowingsDto.java b/src/main/java/com/libraryman_api/borrowing/BorrowingsDto.java index 28b36b3..7c1b392 100644 --- a/src/main/java/com/libraryman_api/borrowing/BorrowingsDto.java +++ b/src/main/java/com/libraryman_api/borrowing/BorrowingsDto.java @@ -2,7 +2,7 @@ import com.libraryman_api.book.BookDto; import com.libraryman_api.fine.Fines; -import com.libraryman_api.member.MembersDto; +import com.libraryman_api.member.dto.MembersDto; import java.util.Date; diff --git a/src/main/java/com/libraryman_api/member/MemberController.java b/src/main/java/com/libraryman_api/member/MemberController.java index 74ff8d3..20a729a 100644 --- a/src/main/java/com/libraryman_api/member/MemberController.java +++ b/src/main/java/com/libraryman_api/member/MemberController.java @@ -1,7 +1,5 @@ package com.libraryman_api.member; -import com.libraryman_api.exception.ResourceNotFoundException; - import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -9,7 +7,19 @@ import org.springframework.data.web.PageableDefault; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; +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.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.libraryman_api.exception.ResourceNotFoundException; +import com.libraryman_api.member.dto.MembersDto; +import com.libraryman_api.member.dto.UpdateMembersDto; +import com.libraryman_api.member.dto.UpdatePasswordDto; /** * REST controller for managing library members. diff --git a/src/main/java/com/libraryman_api/member/MemberService.java b/src/main/java/com/libraryman_api/member/MemberService.java index a74566c..8f053c8 100644 --- a/src/main/java/com/libraryman_api/member/MemberService.java +++ b/src/main/java/com/libraryman_api/member/MemberService.java @@ -12,6 +12,9 @@ import com.libraryman_api.exception.InvalidPasswordException; import com.libraryman_api.exception.InvalidSortFieldException; import com.libraryman_api.exception.ResourceNotFoundException; +import com.libraryman_api.member.dto.MembersDto; +import com.libraryman_api.member.dto.UpdateMembersDto; +import com.libraryman_api.member.dto.UpdatePasswordDto; import com.libraryman_api.notification.NotificationService; import com.libraryman_api.security.config.PasswordEncoder; diff --git a/src/main/java/com/libraryman_api/member/MembersDto.java b/src/main/java/com/libraryman_api/member/dto/MembersDto.java similarity index 96% rename from src/main/java/com/libraryman_api/member/MembersDto.java rename to src/main/java/com/libraryman_api/member/dto/MembersDto.java index 93a7c73..7f97d8a 100644 --- a/src/main/java/com/libraryman_api/member/MembersDto.java +++ b/src/main/java/com/libraryman_api/member/dto/MembersDto.java @@ -1,7 +1,9 @@ -package com.libraryman_api.member; +package com.libraryman_api.member.dto; import java.util.Date; +import com.libraryman_api.member.Role; + public class MembersDto { private int memberId; diff --git a/src/main/java/com/libraryman_api/member/UpdateMembersDto.java b/src/main/java/com/libraryman_api/member/dto/UpdateMembersDto.java similarity index 96% rename from src/main/java/com/libraryman_api/member/UpdateMembersDto.java rename to src/main/java/com/libraryman_api/member/dto/UpdateMembersDto.java index a3e6692..8859bb3 100644 --- a/src/main/java/com/libraryman_api/member/UpdateMembersDto.java +++ b/src/main/java/com/libraryman_api/member/dto/UpdateMembersDto.java @@ -1,4 +1,4 @@ -package com.libraryman_api.member; +package com.libraryman_api.member.dto; public class UpdateMembersDto { diff --git a/src/main/java/com/libraryman_api/member/UpdatePasswordDto.java b/src/main/java/com/libraryman_api/member/dto/UpdatePasswordDto.java similarity index 95% rename from src/main/java/com/libraryman_api/member/UpdatePasswordDto.java rename to src/main/java/com/libraryman_api/member/dto/UpdatePasswordDto.java index 5f593d2..a7be20a 100644 --- a/src/main/java/com/libraryman_api/member/UpdatePasswordDto.java +++ b/src/main/java/com/libraryman_api/member/dto/UpdatePasswordDto.java @@ -1,4 +1,4 @@ -package com.libraryman_api.member; +package com.libraryman_api.member.dto; public class UpdatePasswordDto {