From d6eaeb2d885bb663b482bed9a3163230efe2e023 Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Thu, 5 Mar 2026 06:00:38 -0700 Subject: [PATCH] Restore complete implementations --- pom.xml | 13 +- .../backend/config/DataInitializer.java | 6 +- .../controller/AdoptionController.java | 5 +- .../controller/AppointmentController.java | 5 +- .../backend/controller/AuthController.java | 7 +- .../controller/CategoryController.java | 5 +- .../controller/CustomerController.java | 5 +- .../controller/DropdownController.java | 14 +- .../controller/InventoryController.java | 5 +- .../backend/controller/PetController.java | 5 +- .../backend/controller/ProductController.java | 5 +- .../controller/ProductSupplierController.java | 5 +- .../controller/PurchaseOrderController.java | 5 +- .../backend/controller/RefundController.java | 5 +- .../backend/controller/SaleController.java | 5 +- .../backend/controller/ServiceController.java | 5 +- .../controller/SupplierController.java | 5 +- .../backend/controller/UserController.java | 5 +- .../backend/dto/adoption/AdoptionRequest.java | 71 +++- .../dto/adoption/AdoptionResponse.java | 130 ++++++- .../dto/analytics/DashboardResponse.java | 323 +++++++++++++++++- .../dto/appointment/AppointmentRequest.java | 91 ++++- .../dto/appointment/AppointmentResponse.java | 160 ++++++++- .../backend/dto/auth/LoginRequest.java | 40 ++- .../backend/dto/auth/LoginResponse.java | 68 +++- .../backend/dto/auth/UserInfoResponse.java | 78 ++++- .../backend/dto/category/CategoryRequest.java | 40 ++- .../dto/category/CategoryResponse.java | 80 ++++- .../backend/dto/common/BulkDeleteRequest.java | 31 +- .../backend/dto/common/DropdownOption.java | 48 ++- .../backend/dto/customer/CustomerRequest.java | 60 +++- .../dto/customer/CustomerResponse.java | 100 +++++- .../dto/inventory/InventoryRequest.java | 60 +++- .../dto/inventory/InventoryResponse.java | 140 +++++++- .../petshop/backend/dto/pet/PetRequest.java | 81 ++++- .../petshop/backend/dto/pet/PetResponse.java | 120 ++++++- .../backend/dto/product/ProductRequest.java | 71 +++- .../backend/dto/product/ProductResponse.java | 120 ++++++- .../BulkDeleteProductSupplierRequest.java | 31 +- .../productsupplier/ProductSupplierKey.java | 50 ++- .../ProductSupplierRequest.java | 71 +++- .../ProductSupplierResponse.java | 120 ++++++- .../purchaseorder/PurchaseOrderResponse.java | 228 ++++++++++++- .../backend/dto/refund/RefundItemRequest.java | 40 ++- .../backend/dto/refund/RefundRequest.java | 43 ++- .../backend/dto/refund/RefundResponse.java | 208 ++++++++++- .../backend/dto/sale/SaleItemRequest.java | 40 ++- .../petshop/backend/dto/sale/SaleRequest.java | 82 ++++- .../backend/dto/sale/SaleResponse.java | 268 ++++++++++++++- .../backend/dto/service/ServiceRequest.java | 71 +++- .../backend/dto/service/ServiceResponse.java | 110 +++++- .../backend/dto/supplier/SupplierRequest.java | 80 ++++- .../dto/supplier/SupplierResponse.java | 120 ++++++- .../petshop/backend/dto/user/UserRequest.java | 80 ++++- .../backend/dto/user/UserResponse.java | 110 +++++- .../com/petshop/backend/entity/Adoption.java | 109 +++++- .../petshop/backend/entity/Appointment.java | 129 ++++++- .../com/petshop/backend/entity/Category.java | 79 ++++- .../com/petshop/backend/entity/Customer.java | 99 +++++- .../com/petshop/backend/entity/Inventory.java | 109 +++++- .../java/com/petshop/backend/entity/Pet.java | 119 ++++++- .../com/petshop/backend/entity/Product.java | 109 +++++- .../backend/entity/ProductSupplier.java | 147 +++++++- .../petshop/backend/entity/PurchaseOrder.java | 129 ++++++- .../backend/entity/PurchaseOrderItem.java | 89 ++++- .../com/petshop/backend/entity/Refund.java | 109 +++++- .../petshop/backend/entity/RefundItem.java | 79 ++++- .../java/com/petshop/backend/entity/Sale.java | 149 +++++++- .../com/petshop/backend/entity/SaleItem.java | 89 ++++- .../com/petshop/backend/entity/Service.java | 109 +++++- .../com/petshop/backend/entity/Store.java | 69 +++- .../com/petshop/backend/entity/Supplier.java | 119 ++++++- .../java/com/petshop/backend/entity/User.java | 119 ++++++- .../security/JwtAuthenticationFilter.java | 6 +- .../backend/security/SecurityConfig.java | 6 +- .../security/UserDetailsServiceImpl.java | 5 +- .../backend/service/AdoptionService.java | 7 +- .../backend/service/AppointmentService.java | 8 +- .../backend/service/CategoryService.java | 5 +- .../backend/service/CustomerService.java | 5 +- .../backend/service/InventoryService.java | 7 +- .../petshop/backend/service/PetService.java | 5 +- .../backend/service/ProductService.java | 6 +- .../service/ProductSupplierService.java | 7 +- .../backend/service/PurchaseOrderService.java | 5 +- .../backend/service/RefundService.java | 9 +- .../petshop/backend/service/SaleService.java | 10 +- .../backend/service/ServiceService.java | 5 +- .../backend/service/SupplierService.java | 5 +- .../petshop/backend/service/UserService.java | 6 +- 90 files changed, 5623 insertions(+), 218 deletions(-) diff --git a/pom.xml b/pom.xml index 73c8b055..47a732fe 100644 --- a/pom.xml +++ b/pom.xml @@ -75,8 +75,6 @@ 2.3.0 - - @@ -87,5 +85,12 @@ 17 17 - - + + + + org.springframework.boot + spring-boot-maven-plugin + + + + diff --git a/src/main/java/com/petshop/backend/config/DataInitializer.java b/src/main/java/com/petshop/backend/config/DataInitializer.java index 93c41309..cf311496 100644 --- a/src/main/java/com/petshop/backend/config/DataInitializer.java +++ b/src/main/java/com/petshop/backend/config/DataInitializer.java @@ -7,12 +7,16 @@ import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Component; @Component - public class DataInitializer implements CommandLineRunner { private final UserRepository userRepository; private final PasswordEncoder passwordEncoder; + public DataInitializer(UserRepository userRepository, PasswordEncoder passwordEncoder) { + this.userRepository = userRepository; + this.passwordEncoder = passwordEncoder; + } + @Override public void run(String... args) { if (userRepository.findByUsername("admin").isEmpty()) { diff --git a/src/main/java/com/petshop/backend/controller/AdoptionController.java b/src/main/java/com/petshop/backend/controller/AdoptionController.java index 81be9fd7..8fbc4db3 100644 --- a/src/main/java/com/petshop/backend/controller/AdoptionController.java +++ b/src/main/java/com/petshop/backend/controller/AdoptionController.java @@ -13,11 +13,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/adoptions") - public class AdoptionController { private final AdoptionService adoptionService; + public AdoptionController(AdoptionService adoptionService) { + this.adoptionService = adoptionService; + } + @GetMapping public ResponseEntity> getAllAdoptions(Pageable pageable) { return ResponseEntity.ok(adoptionService.getAllAdoptions(pageable)); diff --git a/src/main/java/com/petshop/backend/controller/AppointmentController.java b/src/main/java/com/petshop/backend/controller/AppointmentController.java index 12ba8aa4..a08416b5 100644 --- a/src/main/java/com/petshop/backend/controller/AppointmentController.java +++ b/src/main/java/com/petshop/backend/controller/AppointmentController.java @@ -13,11 +13,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/appointments") - public class AppointmentController { private final AppointmentService appointmentService; + public AppointmentController(AppointmentService appointmentService) { + this.appointmentService = appointmentService; + } + @GetMapping public ResponseEntity> getAllAppointments(Pageable pageable) { return ResponseEntity.ok(appointmentService.getAllAppointments(pageable)); diff --git a/src/main/java/com/petshop/backend/controller/AuthController.java b/src/main/java/com/petshop/backend/controller/AuthController.java index cab4ef52..970d45c9 100644 --- a/src/main/java/com/petshop/backend/controller/AuthController.java +++ b/src/main/java/com/petshop/backend/controller/AuthController.java @@ -23,13 +23,18 @@ import java.util.Map; @RestController @RequestMapping("/api/v1/auth") - public class AuthController { private final AuthenticationManager authenticationManager; private final UserRepository userRepository; private final JwtUtil jwtUtil; + public AuthController(AuthenticationManager authenticationManager, UserRepository userRepository, JwtUtil jwtUtil) { + this.authenticationManager = authenticationManager; + this.userRepository = userRepository; + this.jwtUtil = jwtUtil; + } + @PostMapping("/login") public ResponseEntity login(@Valid @RequestBody LoginRequest request) { try { diff --git a/src/main/java/com/petshop/backend/controller/CategoryController.java b/src/main/java/com/petshop/backend/controller/CategoryController.java index 510f729d..f03055b4 100644 --- a/src/main/java/com/petshop/backend/controller/CategoryController.java +++ b/src/main/java/com/petshop/backend/controller/CategoryController.java @@ -13,11 +13,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/categories") - public class CategoryController { private final CategoryService categoryService; + public CategoryController(CategoryService categoryService) { + this.categoryService = categoryService; + } + @GetMapping public ResponseEntity> getAllCategories( @RequestParam(required = false) String q, diff --git a/src/main/java/com/petshop/backend/controller/CustomerController.java b/src/main/java/com/petshop/backend/controller/CustomerController.java index 96ac564f..75bed4fc 100644 --- a/src/main/java/com/petshop/backend/controller/CustomerController.java +++ b/src/main/java/com/petshop/backend/controller/CustomerController.java @@ -13,11 +13,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/customers") - public class CustomerController { private final CustomerService customerService; + public CustomerController(CustomerService customerService) { + this.customerService = customerService; + } + @GetMapping public ResponseEntity> getAllCustomers( @RequestParam(required = false) String q, diff --git a/src/main/java/com/petshop/backend/controller/DropdownController.java b/src/main/java/com/petshop/backend/controller/DropdownController.java index 48cc4b5e..b0b60930 100644 --- a/src/main/java/com/petshop/backend/controller/DropdownController.java +++ b/src/main/java/com/petshop/backend/controller/DropdownController.java @@ -13,7 +13,6 @@ import java.util.stream.Collectors; @RestController @RequestMapping("/api/v1/dropdowns") - public class DropdownController { private final PetRepository petRepository; @@ -24,6 +23,19 @@ public class DropdownController { private final StoreRepository storeRepository; private final SupplierRepository supplierRepository; + public DropdownController(PetRepository petRepository, CustomerRepository customerRepository, + ServiceRepository serviceRepository, ProductRepository productRepository, + CategoryRepository categoryRepository, StoreRepository storeRepository, + SupplierRepository supplierRepository) { + this.petRepository = petRepository; + this.customerRepository = customerRepository; + this.serviceRepository = serviceRepository; + this.productRepository = productRepository; + this.categoryRepository = categoryRepository; + this.storeRepository = storeRepository; + this.supplierRepository = supplierRepository; + } + @GetMapping("/pets") public ResponseEntity> getPets() { return ResponseEntity.ok( diff --git a/src/main/java/com/petshop/backend/controller/InventoryController.java b/src/main/java/com/petshop/backend/controller/InventoryController.java index f4c6742a..44db2471 100644 --- a/src/main/java/com/petshop/backend/controller/InventoryController.java +++ b/src/main/java/com/petshop/backend/controller/InventoryController.java @@ -14,12 +14,15 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/inventory") - @PreAuthorize("hasRole('ADMIN')") public class InventoryController { private final InventoryService inventoryService; + public InventoryController(InventoryService inventoryService) { + this.inventoryService = inventoryService; + } + @GetMapping public ResponseEntity> getAllInventory(Pageable pageable) { return ResponseEntity.ok(inventoryService.getAllInventory(pageable)); diff --git a/src/main/java/com/petshop/backend/controller/PetController.java b/src/main/java/com/petshop/backend/controller/PetController.java index 1d70bf87..70c68e8f 100644 --- a/src/main/java/com/petshop/backend/controller/PetController.java +++ b/src/main/java/com/petshop/backend/controller/PetController.java @@ -13,11 +13,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/pets") - public class PetController { private final PetService petService; + public PetController(PetService petService) { + this.petService = petService; + } + @GetMapping public ResponseEntity> getAllPets( @RequestParam(required = false) String q, diff --git a/src/main/java/com/petshop/backend/controller/ProductController.java b/src/main/java/com/petshop/backend/controller/ProductController.java index 98d0fe10..12999b70 100644 --- a/src/main/java/com/petshop/backend/controller/ProductController.java +++ b/src/main/java/com/petshop/backend/controller/ProductController.java @@ -13,11 +13,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/products") - public class ProductController { private final ProductService productService; + public ProductController(ProductService productService) { + this.productService = productService; + } + @GetMapping public ResponseEntity> getAllProducts( @RequestParam(required = false) String q, diff --git a/src/main/java/com/petshop/backend/controller/ProductSupplierController.java b/src/main/java/com/petshop/backend/controller/ProductSupplierController.java index 18c31c79..ea56c4ad 100644 --- a/src/main/java/com/petshop/backend/controller/ProductSupplierController.java +++ b/src/main/java/com/petshop/backend/controller/ProductSupplierController.java @@ -14,12 +14,15 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/product-suppliers") - @PreAuthorize("hasRole('ADMIN')") public class ProductSupplierController { private final ProductSupplierService productSupplierService; + public ProductSupplierController(ProductSupplierService productSupplierService) { + this.productSupplierService = productSupplierService; + } + @GetMapping public ResponseEntity> getAllProductSuppliers(Pageable pageable) { return ResponseEntity.ok(productSupplierService.getAllProductSuppliers(pageable)); diff --git a/src/main/java/com/petshop/backend/controller/PurchaseOrderController.java b/src/main/java/com/petshop/backend/controller/PurchaseOrderController.java index 4496b750..5a3c214c 100644 --- a/src/main/java/com/petshop/backend/controller/PurchaseOrderController.java +++ b/src/main/java/com/petshop/backend/controller/PurchaseOrderController.java @@ -10,12 +10,15 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/purchase-orders") - @PreAuthorize("hasRole('ADMIN')") public class PurchaseOrderController { private final PurchaseOrderService purchaseOrderService; + public PurchaseOrderController(PurchaseOrderService purchaseOrderService) { + this.purchaseOrderService = purchaseOrderService; + } + @GetMapping public ResponseEntity> getAllPurchaseOrders(Pageable pageable) { return ResponseEntity.ok(purchaseOrderService.getAllPurchaseOrders(pageable)); diff --git a/src/main/java/com/petshop/backend/controller/RefundController.java b/src/main/java/com/petshop/backend/controller/RefundController.java index 2410f0b5..1086b9af 100644 --- a/src/main/java/com/petshop/backend/controller/RefundController.java +++ b/src/main/java/com/petshop/backend/controller/RefundController.java @@ -10,11 +10,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/sales") - public class RefundController { private final RefundService refundService; + public RefundController(RefundService refundService) { + this.refundService = refundService; + } + @PostMapping("/{saleId}/refunds") public ResponseEntity createRefund( @PathVariable Long saleId, diff --git a/src/main/java/com/petshop/backend/controller/SaleController.java b/src/main/java/com/petshop/backend/controller/SaleController.java index 71599551..0618c317 100644 --- a/src/main/java/com/petshop/backend/controller/SaleController.java +++ b/src/main/java/com/petshop/backend/controller/SaleController.java @@ -12,11 +12,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/sales") - public class SaleController { private final SaleService saleService; + public SaleController(SaleService saleService) { + this.saleService = saleService; + } + @GetMapping public ResponseEntity> getAllSales(Pageable pageable) { return ResponseEntity.ok(saleService.getAllSales(pageable)); diff --git a/src/main/java/com/petshop/backend/controller/ServiceController.java b/src/main/java/com/petshop/backend/controller/ServiceController.java index 979028c9..f9167a0b 100644 --- a/src/main/java/com/petshop/backend/controller/ServiceController.java +++ b/src/main/java/com/petshop/backend/controller/ServiceController.java @@ -13,11 +13,14 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/services") - public class ServiceController { private final ServiceService serviceService; + public ServiceController(ServiceService serviceService) { + this.serviceService = serviceService; + } + @GetMapping public ResponseEntity> getAllServices( @RequestParam(required = false) String q, diff --git a/src/main/java/com/petshop/backend/controller/SupplierController.java b/src/main/java/com/petshop/backend/controller/SupplierController.java index fd9c4622..255f01dc 100644 --- a/src/main/java/com/petshop/backend/controller/SupplierController.java +++ b/src/main/java/com/petshop/backend/controller/SupplierController.java @@ -14,12 +14,15 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/suppliers") - @PreAuthorize("hasRole('ADMIN')") public class SupplierController { private final SupplierService supplierService; + public SupplierController(SupplierService supplierService) { + this.supplierService = supplierService; + } + @GetMapping public ResponseEntity> getAllSuppliers( @RequestParam(required = false) String q, diff --git a/src/main/java/com/petshop/backend/controller/UserController.java b/src/main/java/com/petshop/backend/controller/UserController.java index d6719f2b..a43f01f8 100644 --- a/src/main/java/com/petshop/backend/controller/UserController.java +++ b/src/main/java/com/petshop/backend/controller/UserController.java @@ -14,12 +14,15 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("/api/v1/users") - @PreAuthorize("hasRole('ADMIN')") public class UserController { private final UserService userService; + public UserController(UserService userService) { + this.userService = userService; + } + @GetMapping public ResponseEntity> getAllUsers(Pageable pageable) { return ResponseEntity.ok(userService.getAllUsers(pageable)); diff --git a/src/main/java/com/petshop/backend/dto/adoption/AdoptionRequest.java b/src/main/java/com/petshop/backend/dto/adoption/AdoptionRequest.java index 690ba25b..417ef3a9 100644 --- a/src/main/java/com/petshop/backend/dto/adoption/AdoptionRequest.java +++ b/src/main/java/com/petshop/backend/dto/adoption/AdoptionRequest.java @@ -2,10 +2,9 @@ package com.petshop.backend.dto.adoption; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; - import java.math.BigDecimal; import java.time.LocalDate; - +import java.util.Objects; public class AdoptionRequest { @NotNull(message = "Pet ID is required") @@ -22,4 +21,72 @@ public class AdoptionRequest { private BigDecimal adoptionFee; private String notes; + + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public Long getCustomerId() { + return customerId; + } + + public void setCustomerId(Long customerId) { + this.customerId = customerId; + } + + public LocalDate getAdoptionDate() { + return adoptionDate; + } + + public void setAdoptionDate(LocalDate adoptionDate) { + this.adoptionDate = adoptionDate; + } + + public BigDecimal getAdoptionFee() { + return adoptionFee; + } + + public void setAdoptionFee(BigDecimal adoptionFee) { + this.adoptionFee = adoptionFee; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + AdoptionRequest that = (AdoptionRequest) o; + return Objects.equals(petId, that.petId) && + Objects.equals(customerId, that.customerId) && + Objects.equals(adoptionDate, that.adoptionDate) && + Objects.equals(adoptionFee, that.adoptionFee) && + Objects.equals(notes, that.notes); + } + + @Override + public int hashCode() { + return Objects.hash(petId, customerId, adoptionDate, adoptionFee, notes); + } + + @Override + public String toString() { + return "AdoptionRequest{" + + "petId=" + petId + + ", customerId=" + customerId + + ", adoptionDate=" + adoptionDate + + ", adoptionFee=" + adoptionFee + + ", notes='" + notes + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/adoption/AdoptionResponse.java b/src/main/java/com/petshop/backend/dto/adoption/AdoptionResponse.java index 796a82ff..e0c3faec 100644 --- a/src/main/java/com/petshop/backend/dto/adoption/AdoptionResponse.java +++ b/src/main/java/com/petshop/backend/dto/adoption/AdoptionResponse.java @@ -1,12 +1,9 @@ package com.petshop.backend.dto.adoption; - import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; - - - +import java.util.Objects; public class AdoptionResponse { private Long id; @@ -19,4 +16,129 @@ public class AdoptionResponse { private String notes; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public AdoptionResponse() { + } + + public AdoptionResponse(Long id, Long petId, String petName, Long customerId, String customerName, LocalDate adoptionDate, BigDecimal adoptionFee, String notes, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.petId = petId; + this.petName = petName; + this.customerId = customerId; + this.customerName = customerName; + this.adoptionDate = adoptionDate; + this.adoptionFee = adoptionFee; + this.notes = notes; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public String getPetName() { + return petName; + } + + public void setPetName(String petName) { + this.petName = petName; + } + + public Long getCustomerId() { + return customerId; + } + + public void setCustomerId(Long customerId) { + this.customerId = customerId; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public LocalDate getAdoptionDate() { + return adoptionDate; + } + + public void setAdoptionDate(LocalDate adoptionDate) { + this.adoptionDate = adoptionDate; + } + + public BigDecimal getAdoptionFee() { + return adoptionFee; + } + + public void setAdoptionFee(BigDecimal adoptionFee) { + this.adoptionFee = adoptionFee; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + AdoptionResponse that = (AdoptionResponse) o; + return Objects.equals(id, that.id) && Objects.equals(petId, that.petId) && Objects.equals(petName, that.petName) && Objects.equals(customerId, that.customerId) && Objects.equals(customerName, that.customerName) && Objects.equals(adoptionDate, that.adoptionDate) && Objects.equals(adoptionFee, that.adoptionFee) && Objects.equals(notes, that.notes) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, petName, customerId, customerName, adoptionDate, adoptionFee, notes, createdAt, updatedAt); + } + + @Override + public String toString() { + return "AdoptionResponse{" + + "id=" + id + + ", petId=" + petId + + ", petName='" + petName + '\'' + + ", customerId=" + customerId + + ", customerName='" + customerName + '\'' + + ", adoptionDate=" + adoptionDate + + ", adoptionFee=" + adoptionFee + + ", notes='" + notes + '\'' + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/analytics/DashboardResponse.java b/src/main/java/com/petshop/backend/dto/analytics/DashboardResponse.java index b7d420f8..263d3fae 100644 --- a/src/main/java/com/petshop/backend/dto/analytics/DashboardResponse.java +++ b/src/main/java/com/petshop/backend/dto/analytics/DashboardResponse.java @@ -1,54 +1,343 @@ package com.petshop.backend.dto.analytics; - import java.math.BigDecimal; import java.util.List; -import java.util.Map; - - - +import java.util.Objects; public class DashboardResponse { private SalesSummary salesSummary; private InventorySummary inventorySummary; private List topProducts; private List dailySales; + + public DashboardResponse() { + } + + public DashboardResponse(SalesSummary salesSummary, InventorySummary inventorySummary, List topProducts, List dailySales) { + this.salesSummary = salesSummary; + this.inventorySummary = inventorySummary; + this.topProducts = topProducts; + this.dailySales = dailySales; + } + + public SalesSummary getSalesSummary() { + return salesSummary; + } + + public void setSalesSummary(SalesSummary salesSummary) { + this.salesSummary = salesSummary; + } + + public InventorySummary getInventorySummary() { + return inventorySummary; + } + + public void setInventorySummary(InventorySummary inventorySummary) { + this.inventorySummary = inventorySummary; + } + + public List getTopProducts() { + return topProducts; + } + + public void setTopProducts(List topProducts) { + this.topProducts = topProducts; + } + + public List getDailySales() { + return dailySales; + } + + public void setDailySales(List dailySales) { + this.dailySales = dailySales; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DashboardResponse that = (DashboardResponse) o; + return Objects.equals(salesSummary, that.salesSummary) && Objects.equals(inventorySummary, that.inventorySummary) && Objects.equals(topProducts, that.topProducts) && Objects.equals(dailySales, that.dailySales); + } + + @Override + public int hashCode() { + return Objects.hash(salesSummary, inventorySummary, topProducts, dailySales); + } + + @Override + public String toString() { + return "DashboardResponse{" + + "salesSummary=" + salesSummary + + ", inventorySummary=" + inventorySummary + + ", topProducts=" + topProducts + + ", dailySales=" + dailySales + + '}'; + } } - - - class SalesSummary { private BigDecimal totalRevenue; private Long totalSales; private BigDecimal totalRefunds; private Long totalRefundCount; + + public SalesSummary() { + } + + public SalesSummary(BigDecimal totalRevenue, Long totalSales, BigDecimal totalRefunds, Long totalRefundCount) { + this.totalRevenue = totalRevenue; + this.totalSales = totalSales; + this.totalRefunds = totalRefunds; + this.totalRefundCount = totalRefundCount; + } + + public BigDecimal getTotalRevenue() { + return totalRevenue; + } + + public void setTotalRevenue(BigDecimal totalRevenue) { + this.totalRevenue = totalRevenue; + } + + public Long getTotalSales() { + return totalSales; + } + + public void setTotalSales(Long totalSales) { + this.totalSales = totalSales; + } + + public BigDecimal getTotalRefunds() { + return totalRefunds; + } + + public void setTotalRefunds(BigDecimal totalRefunds) { + this.totalRefunds = totalRefunds; + } + + public Long getTotalRefundCount() { + return totalRefundCount; + } + + public void setTotalRefundCount(Long totalRefundCount) { + this.totalRefundCount = totalRefundCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SalesSummary that = (SalesSummary) o; + return Objects.equals(totalRevenue, that.totalRevenue) && Objects.equals(totalSales, that.totalSales) && Objects.equals(totalRefunds, that.totalRefunds) && Objects.equals(totalRefundCount, that.totalRefundCount); + } + + @Override + public int hashCode() { + return Objects.hash(totalRevenue, totalSales, totalRefunds, totalRefundCount); + } + + @Override + public String toString() { + return "SalesSummary{" + + "totalRevenue=" + totalRevenue + + ", totalSales=" + totalSales + + ", totalRefunds=" + totalRefunds + + ", totalRefundCount=" + totalRefundCount + + '}'; + } } - - - class InventorySummary { private Long totalProducts; private Long lowStockProducts; private Long outOfStockProducts; + + public InventorySummary() { + } + + public InventorySummary(Long totalProducts, Long lowStockProducts, Long outOfStockProducts) { + this.totalProducts = totalProducts; + this.lowStockProducts = lowStockProducts; + this.outOfStockProducts = outOfStockProducts; + } + + public Long getTotalProducts() { + return totalProducts; + } + + public void setTotalProducts(Long totalProducts) { + this.totalProducts = totalProducts; + } + + public Long getLowStockProducts() { + return lowStockProducts; + } + + public void setLowStockProducts(Long lowStockProducts) { + this.lowStockProducts = lowStockProducts; + } + + public Long getOutOfStockProducts() { + return outOfStockProducts; + } + + public void setOutOfStockProducts(Long outOfStockProducts) { + this.outOfStockProducts = outOfStockProducts; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + InventorySummary that = (InventorySummary) o; + return Objects.equals(totalProducts, that.totalProducts) && Objects.equals(lowStockProducts, that.lowStockProducts) && Objects.equals(outOfStockProducts, that.outOfStockProducts); + } + + @Override + public int hashCode() { + return Objects.hash(totalProducts, lowStockProducts, outOfStockProducts); + } + + @Override + public String toString() { + return "InventorySummary{" + + "totalProducts=" + totalProducts + + ", lowStockProducts=" + lowStockProducts + + ", outOfStockProducts=" + outOfStockProducts + + '}'; + } } - - - class TopProduct { private Long productId; private String productName; private Long quantitySold; private BigDecimal revenue; + + public TopProduct() { + } + + public TopProduct(Long productId, String productName, Long quantitySold, BigDecimal revenue) { + this.productId = productId; + this.productName = productName; + this.quantitySold = quantitySold; + this.revenue = revenue; + } + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Long getQuantitySold() { + return quantitySold; + } + + public void setQuantitySold(Long quantitySold) { + this.quantitySold = quantitySold; + } + + public BigDecimal getRevenue() { + return revenue; + } + + public void setRevenue(BigDecimal revenue) { + this.revenue = revenue; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + TopProduct that = (TopProduct) o; + return Objects.equals(productId, that.productId) && Objects.equals(productName, that.productName) && Objects.equals(quantitySold, that.quantitySold) && Objects.equals(revenue, that.revenue); + } + + @Override + public int hashCode() { + return Objects.hash(productId, productName, quantitySold, revenue); + } + + @Override + public String toString() { + return "TopProduct{" + + "productId=" + productId + + ", productName='" + productName + '\'' + + ", quantitySold=" + quantitySold + + ", revenue=" + revenue + + '}'; + } } - - - class DailySales { private String date; private BigDecimal revenue; private Long salesCount; + + public DailySales() { + } + + public DailySales(String date, BigDecimal revenue, Long salesCount) { + this.date = date; + this.revenue = revenue; + this.salesCount = salesCount; + } + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public BigDecimal getRevenue() { + return revenue; + } + + public void setRevenue(BigDecimal revenue) { + this.revenue = revenue; + } + + public Long getSalesCount() { + return salesCount; + } + + public void setSalesCount(Long salesCount) { + this.salesCount = salesCount; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DailySales that = (DailySales) o; + return Objects.equals(date, that.date) && Objects.equals(revenue, that.revenue) && Objects.equals(salesCount, that.salesCount); + } + + @Override + public int hashCode() { + return Objects.hash(date, revenue, salesCount); + } + + @Override + public String toString() { + return "DailySales{" + + "date='" + date + '\'' + + ", revenue=" + revenue + + ", salesCount=" + salesCount + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/appointment/AppointmentRequest.java b/src/main/java/com/petshop/backend/dto/appointment/AppointmentRequest.java index 2e51532e..107e6856 100644 --- a/src/main/java/com/petshop/backend/dto/appointment/AppointmentRequest.java +++ b/src/main/java/com/petshop/backend/dto/appointment/AppointmentRequest.java @@ -3,11 +3,10 @@ package com.petshop.backend.dto.appointment; import com.petshop.backend.entity.Appointment; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; - import java.time.LocalDate; import java.time.LocalTime; import java.util.List; - +import java.util.Objects; public class AppointmentRequest { @NotNull(message = "Customer ID is required") @@ -29,4 +28,92 @@ public class AppointmentRequest { private List petIds; private String notes; + + public Long getCustomerId() { + return customerId; + } + + public void setCustomerId(Long customerId) { + this.customerId = customerId; + } + + public Long getServiceId() { + return serviceId; + } + + public void setServiceId(Long serviceId) { + this.serviceId = serviceId; + } + + public LocalDate getAppointmentDate() { + return appointmentDate; + } + + public void setAppointmentDate(LocalDate appointmentDate) { + this.appointmentDate = appointmentDate; + } + + public LocalTime getAppointmentTime() { + return appointmentTime; + } + + public void setAppointmentTime(LocalTime appointmentTime) { + this.appointmentTime = appointmentTime; + } + + public Appointment.AppointmentStatus getStatus() { + return status; + } + + public void setStatus(Appointment.AppointmentStatus status) { + this.status = status; + } + + public List getPetIds() { + return petIds; + } + + public void setPetIds(List petIds) { + this.petIds = petIds; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + AppointmentRequest that = (AppointmentRequest) o; + return Objects.equals(customerId, that.customerId) && + Objects.equals(serviceId, that.serviceId) && + Objects.equals(appointmentDate, that.appointmentDate) && + Objects.equals(appointmentTime, that.appointmentTime) && + status == that.status && + Objects.equals(petIds, that.petIds) && + Objects.equals(notes, that.notes); + } + + @Override + public int hashCode() { + return Objects.hash(customerId, serviceId, appointmentDate, appointmentTime, status, petIds, notes); + } + + @Override + public String toString() { + return "AppointmentRequest{" + + "customerId=" + customerId + + ", serviceId=" + serviceId + + ", appointmentDate=" + appointmentDate + + ", appointmentTime=" + appointmentTime + + ", status=" + status + + ", petIds=" + petIds + + ", notes='" + notes + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/appointment/AppointmentResponse.java b/src/main/java/com/petshop/backend/dto/appointment/AppointmentResponse.java index d2b54f66..b84b4dad 100644 --- a/src/main/java/com/petshop/backend/dto/appointment/AppointmentResponse.java +++ b/src/main/java/com/petshop/backend/dto/appointment/AppointmentResponse.java @@ -1,13 +1,10 @@ package com.petshop.backend.dto.appointment; - import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.List; - - - +import java.util.Objects; public class AppointmentResponse { private Long id; @@ -23,4 +20,159 @@ public class AppointmentResponse { private String notes; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public AppointmentResponse() { + } + + public AppointmentResponse(Long id, Long customerId, String customerName, Long serviceId, String serviceName, LocalDate appointmentDate, LocalTime appointmentTime, String status, List petNames, List petIds, String notes, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.customerId = customerId; + this.customerName = customerName; + this.serviceId = serviceId; + this.serviceName = serviceName; + this.appointmentDate = appointmentDate; + this.appointmentTime = appointmentTime; + this.status = status; + this.petNames = petNames; + this.petIds = petIds; + this.notes = notes; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getCustomerId() { + return customerId; + } + + public void setCustomerId(Long customerId) { + this.customerId = customerId; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public Long getServiceId() { + return serviceId; + } + + public void setServiceId(Long serviceId) { + this.serviceId = serviceId; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public LocalDate getAppointmentDate() { + return appointmentDate; + } + + public void setAppointmentDate(LocalDate appointmentDate) { + this.appointmentDate = appointmentDate; + } + + public LocalTime getAppointmentTime() { + return appointmentTime; + } + + public void setAppointmentTime(LocalTime appointmentTime) { + this.appointmentTime = appointmentTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public List getPetNames() { + return petNames; + } + + public void setPetNames(List petNames) { + this.petNames = petNames; + } + + public List getPetIds() { + return petIds; + } + + public void setPetIds(List petIds) { + this.petIds = petIds; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + AppointmentResponse that = (AppointmentResponse) o; + return Objects.equals(id, that.id) && Objects.equals(customerId, that.customerId) && Objects.equals(customerName, that.customerName) && Objects.equals(serviceId, that.serviceId) && Objects.equals(serviceName, that.serviceName) && Objects.equals(appointmentDate, that.appointmentDate) && Objects.equals(appointmentTime, that.appointmentTime) && Objects.equals(status, that.status) && Objects.equals(petNames, that.petNames) && Objects.equals(petIds, that.petIds) && Objects.equals(notes, that.notes) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, customerId, customerName, serviceId, serviceName, appointmentDate, appointmentTime, status, petNames, petIds, notes, createdAt, updatedAt); + } + + @Override + public String toString() { + return "AppointmentResponse{" + + "id=" + id + + ", customerId=" + customerId + + ", customerName='" + customerName + '\'' + + ", serviceId=" + serviceId + + ", serviceName='" + serviceName + '\'' + + ", appointmentDate=" + appointmentDate + + ", appointmentTime=" + appointmentTime + + ", status='" + status + '\'' + + ", petNames=" + petNames + + ", petIds=" + petIds + + ", notes='" + notes + '\'' + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/auth/LoginRequest.java b/src/main/java/com/petshop/backend/dto/auth/LoginRequest.java index 3adfd91a..970c4719 100644 --- a/src/main/java/com/petshop/backend/dto/auth/LoginRequest.java +++ b/src/main/java/com/petshop/backend/dto/auth/LoginRequest.java @@ -1,7 +1,7 @@ package com.petshop.backend.dto.auth; import jakarta.validation.constraints.NotBlank; - +import java.util.Objects; public class LoginRequest { @NotBlank(message = "Username is required") @@ -9,4 +9,42 @@ public class LoginRequest { @NotBlank(message = "Password is required") private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + LoginRequest that = (LoginRequest) o; + return Objects.equals(username, that.username) && + Objects.equals(password, that.password); + } + + @Override + public int hashCode() { + return Objects.hash(username, password); + } + + @Override + public String toString() { + return "LoginRequest{" + + "username='" + username + '\'' + + ", password='" + password + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/auth/LoginResponse.java b/src/main/java/com/petshop/backend/dto/auth/LoginResponse.java index 67574120..11141df6 100644 --- a/src/main/java/com/petshop/backend/dto/auth/LoginResponse.java +++ b/src/main/java/com/petshop/backend/dto/auth/LoginResponse.java @@ -1,11 +1,75 @@ package com.petshop.backend.dto.auth; - - +import java.util.Objects; public class LoginResponse { private String token; private String username; private String fullName; private String role; + + public LoginResponse() { + } + + public LoginResponse(String token, String username, String fullName, String role) { + this.token = token; + this.username = username; + this.fullName = fullName; + this.role = role; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + LoginResponse that = (LoginResponse) o; + return Objects.equals(token, that.token) && Objects.equals(username, that.username) && Objects.equals(fullName, that.fullName) && Objects.equals(role, that.role); + } + + @Override + public int hashCode() { + return Objects.hash(token, username, fullName, role); + } + + @Override + public String toString() { + return "LoginResponse{" + + "token='" + token + '\'' + + ", username='" + username + '\'' + + ", fullName='" + fullName + '\'' + + ", role='" + role + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/auth/UserInfoResponse.java b/src/main/java/com/petshop/backend/dto/auth/UserInfoResponse.java index 9e863cb4..a3142040 100644 --- a/src/main/java/com/petshop/backend/dto/auth/UserInfoResponse.java +++ b/src/main/java/com/petshop/backend/dto/auth/UserInfoResponse.java @@ -1,7 +1,6 @@ package com.petshop.backend.dto.auth; - - +import java.util.Objects; public class UserInfoResponse { private Long id; @@ -9,4 +8,79 @@ public class UserInfoResponse { private String fullName; private String email; private String role; + + public UserInfoResponse() { + } + + public UserInfoResponse(Long id, String username, String fullName, String email, String role) { + this.id = id; + this.username = username; + this.fullName = fullName; + this.email = email; + this.role = role; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + UserInfoResponse that = (UserInfoResponse) o; + return Objects.equals(id, that.id) && Objects.equals(username, that.username) && Objects.equals(fullName, that.fullName) && Objects.equals(email, that.email) && Objects.equals(role, that.role); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, fullName, email, role); + } + + @Override + public String toString() { + return "UserInfoResponse{" + + "id=" + id + + ", username='" + username + '\'' + + ", fullName='" + fullName + '\'' + + ", email='" + email + '\'' + + ", role='" + role + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/category/CategoryRequest.java b/src/main/java/com/petshop/backend/dto/category/CategoryRequest.java index 19b7d4b4..e73cca59 100644 --- a/src/main/java/com/petshop/backend/dto/category/CategoryRequest.java +++ b/src/main/java/com/petshop/backend/dto/category/CategoryRequest.java @@ -1,11 +1,49 @@ package com.petshop.backend.dto.category; import jakarta.validation.constraints.NotBlank; - +import java.util.Objects; public class CategoryRequest { @NotBlank(message = "Category name is required") private String categoryName; private String categoryDescription; + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + public String getCategoryDescription() { + return categoryDescription; + } + + public void setCategoryDescription(String categoryDescription) { + this.categoryDescription = categoryDescription; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CategoryRequest that = (CategoryRequest) o; + return Objects.equals(categoryName, that.categoryName) && + Objects.equals(categoryDescription, that.categoryDescription); + } + + @Override + public int hashCode() { + return Objects.hash(categoryName, categoryDescription); + } + + @Override + public String toString() { + return "CategoryRequest{" + + "categoryName='" + categoryName + '\'' + + ", categoryDescription='" + categoryDescription + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/category/CategoryResponse.java b/src/main/java/com/petshop/backend/dto/category/CategoryResponse.java index 758be129..fe008c16 100644 --- a/src/main/java/com/petshop/backend/dto/category/CategoryResponse.java +++ b/src/main/java/com/petshop/backend/dto/category/CategoryResponse.java @@ -1,10 +1,7 @@ package com.petshop.backend.dto.category; - import java.time.LocalDateTime; - - - +import java.util.Objects; public class CategoryResponse { private Long id; @@ -12,4 +9,79 @@ public class CategoryResponse { private String categoryDescription; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public CategoryResponse() { + } + + public CategoryResponse(Long id, String categoryName, String categoryDescription, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.categoryName = categoryName; + this.categoryDescription = categoryDescription; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + public String getCategoryDescription() { + return categoryDescription; + } + + public void setCategoryDescription(String categoryDescription) { + this.categoryDescription = categoryDescription; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CategoryResponse that = (CategoryResponse) o; + return Objects.equals(id, that.id) && Objects.equals(categoryName, that.categoryName) && Objects.equals(categoryDescription, that.categoryDescription) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, categoryName, categoryDescription, createdAt, updatedAt); + } + + @Override + public String toString() { + return "CategoryResponse{" + + "id=" + id + + ", categoryName='" + categoryName + '\'' + + ", categoryDescription='" + categoryDescription + '\'' + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/common/BulkDeleteRequest.java b/src/main/java/com/petshop/backend/dto/common/BulkDeleteRequest.java index 99391913..bec920f1 100644 --- a/src/main/java/com/petshop/backend/dto/common/BulkDeleteRequest.java +++ b/src/main/java/com/petshop/backend/dto/common/BulkDeleteRequest.java @@ -1,11 +1,38 @@ package com.petshop.backend.dto.common; import jakarta.validation.constraints.NotEmpty; - import java.util.List; - +import java.util.Objects; public class BulkDeleteRequest { @NotEmpty(message = "IDs list cannot be empty") private List ids; + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + BulkDeleteRequest that = (BulkDeleteRequest) o; + return Objects.equals(ids, that.ids); + } + + @Override + public int hashCode() { + return Objects.hash(ids); + } + + @Override + public String toString() { + return "BulkDeleteRequest{" + + "ids=" + ids + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/common/DropdownOption.java b/src/main/java/com/petshop/backend/dto/common/DropdownOption.java index 494fa5a7..6ea0d058 100644 --- a/src/main/java/com/petshop/backend/dto/common/DropdownOption.java +++ b/src/main/java/com/petshop/backend/dto/common/DropdownOption.java @@ -1,9 +1,53 @@ package com.petshop.backend.dto.common; - - +import java.util.Objects; public class DropdownOption { private Long id; private String label; + + public DropdownOption() { + } + + public DropdownOption(Long id, String label) { + this.id = id; + this.label = label; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + DropdownOption that = (DropdownOption) o; + return Objects.equals(id, that.id) && Objects.equals(label, that.label); + } + + @Override + public int hashCode() { + return Objects.hash(id, label); + } + + @Override + public String toString() { + return "DropdownOption{" + + "id=" + id + + ", label='" + label + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/customer/CustomerRequest.java b/src/main/java/com/petshop/backend/dto/customer/CustomerRequest.java index 5f068b32..464c80b7 100644 --- a/src/main/java/com/petshop/backend/dto/customer/CustomerRequest.java +++ b/src/main/java/com/petshop/backend/dto/customer/CustomerRequest.java @@ -2,7 +2,7 @@ package com.petshop.backend.dto.customer; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; - +import java.util.Objects; public class CustomerRequest { @NotBlank(message = "Customer name is required") @@ -13,4 +13,62 @@ public class CustomerRequest { private String customerPhone; private String customerAddress; + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public String getCustomerEmail() { + return customerEmail; + } + + public void setCustomerEmail(String customerEmail) { + this.customerEmail = customerEmail; + } + + public String getCustomerPhone() { + return customerPhone; + } + + public void setCustomerPhone(String customerPhone) { + this.customerPhone = customerPhone; + } + + public String getCustomerAddress() { + return customerAddress; + } + + public void setCustomerAddress(String customerAddress) { + this.customerAddress = customerAddress; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CustomerRequest that = (CustomerRequest) o; + return Objects.equals(customerName, that.customerName) && + Objects.equals(customerEmail, that.customerEmail) && + Objects.equals(customerPhone, that.customerPhone) && + Objects.equals(customerAddress, that.customerAddress); + } + + @Override + public int hashCode() { + return Objects.hash(customerName, customerEmail, customerPhone, customerAddress); + } + + @Override + public String toString() { + return "CustomerRequest{" + + "customerName='" + customerName + '\'' + + ", customerEmail='" + customerEmail + '\'' + + ", customerPhone='" + customerPhone + '\'' + + ", customerAddress='" + customerAddress + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/customer/CustomerResponse.java b/src/main/java/com/petshop/backend/dto/customer/CustomerResponse.java index 6f929bae..3e6be930 100644 --- a/src/main/java/com/petshop/backend/dto/customer/CustomerResponse.java +++ b/src/main/java/com/petshop/backend/dto/customer/CustomerResponse.java @@ -1,10 +1,7 @@ package com.petshop.backend.dto.customer; - import java.time.LocalDateTime; - - - +import java.util.Objects; public class CustomerResponse { private Long id; @@ -14,4 +11,99 @@ public class CustomerResponse { private String customerAddress; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public CustomerResponse() { + } + + public CustomerResponse(Long id, String customerName, String customerEmail, String customerPhone, String customerAddress, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.customerName = customerName; + this.customerEmail = customerEmail; + this.customerPhone = customerPhone; + this.customerAddress = customerAddress; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public String getCustomerEmail() { + return customerEmail; + } + + public void setCustomerEmail(String customerEmail) { + this.customerEmail = customerEmail; + } + + public String getCustomerPhone() { + return customerPhone; + } + + public void setCustomerPhone(String customerPhone) { + this.customerPhone = customerPhone; + } + + public String getCustomerAddress() { + return customerAddress; + } + + public void setCustomerAddress(String customerAddress) { + this.customerAddress = customerAddress; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CustomerResponse that = (CustomerResponse) o; + return Objects.equals(id, that.id) && Objects.equals(customerName, that.customerName) && Objects.equals(customerEmail, that.customerEmail) && Objects.equals(customerPhone, that.customerPhone) && Objects.equals(customerAddress, that.customerAddress) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, customerName, customerEmail, customerPhone, customerAddress, createdAt, updatedAt); + } + + @Override + public String toString() { + return "CustomerResponse{" + + "id=" + id + + ", customerName='" + customerName + '\'' + + ", customerEmail='" + customerEmail + '\'' + + ", customerPhone='" + customerPhone + '\'' + + ", customerAddress='" + customerAddress + '\'' + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/inventory/InventoryRequest.java b/src/main/java/com/petshop/backend/dto/inventory/InventoryRequest.java index fb4ff6b9..947b7517 100644 --- a/src/main/java/com/petshop/backend/dto/inventory/InventoryRequest.java +++ b/src/main/java/com/petshop/backend/dto/inventory/InventoryRequest.java @@ -2,7 +2,7 @@ package com.petshop.backend.dto.inventory; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.PositiveOrZero; - +import java.util.Objects; public class InventoryRequest { @NotNull(message = "Product ID is required") @@ -17,4 +17,62 @@ public class InventoryRequest { @PositiveOrZero(message = "Reorder level must be zero or positive") private Integer reorderLevel = 10; + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public Long getStoreId() { + return storeId; + } + + public void setStoreId(Long storeId) { + this.storeId = storeId; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Integer getReorderLevel() { + return reorderLevel; + } + + public void setReorderLevel(Integer reorderLevel) { + this.reorderLevel = reorderLevel; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + InventoryRequest that = (InventoryRequest) o; + return Objects.equals(productId, that.productId) && + Objects.equals(storeId, that.storeId) && + Objects.equals(quantity, that.quantity) && + Objects.equals(reorderLevel, that.reorderLevel); + } + + @Override + public int hashCode() { + return Objects.hash(productId, storeId, quantity, reorderLevel); + } + + @Override + public String toString() { + return "InventoryRequest{" + + "productId=" + productId + + ", storeId=" + storeId + + ", quantity=" + quantity + + ", reorderLevel=" + reorderLevel + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/inventory/InventoryResponse.java b/src/main/java/com/petshop/backend/dto/inventory/InventoryResponse.java index feff7600..cb618959 100644 --- a/src/main/java/com/petshop/backend/dto/inventory/InventoryResponse.java +++ b/src/main/java/com/petshop/backend/dto/inventory/InventoryResponse.java @@ -1,10 +1,7 @@ package com.petshop.backend.dto.inventory; - import java.time.LocalDateTime; - - - +import java.util.Objects; public class InventoryResponse { private Long id; @@ -18,4 +15,139 @@ public class InventoryResponse { private LocalDateTime lastRestocked; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public InventoryResponse() { + } + + public InventoryResponse(Long id, Long productId, String productName, String categoryName, Long storeId, String storeName, Integer quantity, Integer reorderLevel, LocalDateTime lastRestocked, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.productId = productId; + this.productName = productName; + this.categoryName = categoryName; + this.storeId = storeId; + this.storeName = storeName; + this.quantity = quantity; + this.reorderLevel = reorderLevel; + this.lastRestocked = lastRestocked; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + public Long getStoreId() { + return storeId; + } + + public void setStoreId(Long storeId) { + this.storeId = storeId; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Integer getReorderLevel() { + return reorderLevel; + } + + public void setReorderLevel(Integer reorderLevel) { + this.reorderLevel = reorderLevel; + } + + public LocalDateTime getLastRestocked() { + return lastRestocked; + } + + public void setLastRestocked(LocalDateTime lastRestocked) { + this.lastRestocked = lastRestocked; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + InventoryResponse that = (InventoryResponse) o; + return Objects.equals(id, that.id) && Objects.equals(productId, that.productId) && Objects.equals(productName, that.productName) && Objects.equals(categoryName, that.categoryName) && Objects.equals(storeId, that.storeId) && Objects.equals(storeName, that.storeName) && Objects.equals(quantity, that.quantity) && Objects.equals(reorderLevel, that.reorderLevel) && Objects.equals(lastRestocked, that.lastRestocked) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, productId, productName, categoryName, storeId, storeName, quantity, reorderLevel, lastRestocked, createdAt, updatedAt); + } + + @Override + public String toString() { + return "InventoryResponse{" + + "id=" + id + + ", productId=" + productId + + ", productName='" + productName + '\'' + + ", categoryName='" + categoryName + '\'' + + ", storeId=" + storeId + + ", storeName='" + storeName + '\'' + + ", quantity=" + quantity + + ", reorderLevel=" + reorderLevel + + ", lastRestocked=" + lastRestocked + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/pet/PetRequest.java b/src/main/java/com/petshop/backend/dto/pet/PetRequest.java index 202dc6e7..aeb0f0db 100644 --- a/src/main/java/com/petshop/backend/dto/pet/PetRequest.java +++ b/src/main/java/com/petshop/backend/dto/pet/PetRequest.java @@ -4,9 +4,8 @@ import com.petshop.backend.entity.Pet; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; - import java.math.BigDecimal; - +import java.util.Objects; public class PetRequest { @NotBlank(message = "Pet name is required") @@ -24,4 +23,82 @@ public class PetRequest { private Pet.PetStatus petStatus; private BigDecimal petPrice; + + public String getPetName() { + return petName; + } + + public void setPetName(String petName) { + this.petName = petName; + } + + public String getPetSpecies() { + return petSpecies; + } + + public void setPetSpecies(String petSpecies) { + this.petSpecies = petSpecies; + } + + public String getPetBreed() { + return petBreed; + } + + public void setPetBreed(String petBreed) { + this.petBreed = petBreed; + } + + public Integer getPetAge() { + return petAge; + } + + public void setPetAge(Integer petAge) { + this.petAge = petAge; + } + + public Pet.PetStatus getPetStatus() { + return petStatus; + } + + public void setPetStatus(Pet.PetStatus petStatus) { + this.petStatus = petStatus; + } + + public BigDecimal getPetPrice() { + return petPrice; + } + + public void setPetPrice(BigDecimal petPrice) { + this.petPrice = petPrice; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PetRequest that = (PetRequest) o; + return Objects.equals(petName, that.petName) && + Objects.equals(petSpecies, that.petSpecies) && + Objects.equals(petBreed, that.petBreed) && + Objects.equals(petAge, that.petAge) && + petStatus == that.petStatus && + Objects.equals(petPrice, that.petPrice); + } + + @Override + public int hashCode() { + return Objects.hash(petName, petSpecies, petBreed, petAge, petStatus, petPrice); + } + + @Override + public String toString() { + return "PetRequest{" + + "petName='" + petName + '\'' + + ", petSpecies='" + petSpecies + '\'' + + ", petBreed='" + petBreed + '\'' + + ", petAge=" + petAge + + ", petStatus=" + petStatus + + ", petPrice=" + petPrice + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/pet/PetResponse.java b/src/main/java/com/petshop/backend/dto/pet/PetResponse.java index 9409b0ad..18e31381 100644 --- a/src/main/java/com/petshop/backend/dto/pet/PetResponse.java +++ b/src/main/java/com/petshop/backend/dto/pet/PetResponse.java @@ -1,11 +1,8 @@ package com.petshop.backend.dto.pet; - import java.math.BigDecimal; import java.time.LocalDateTime; - - - +import java.util.Objects; public class PetResponse { private Long id; @@ -17,4 +14,119 @@ public class PetResponse { private BigDecimal petPrice; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public PetResponse() { + } + + public PetResponse(Long id, String petName, String petSpecies, String petBreed, Integer petAge, String petStatus, BigDecimal petPrice, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.petName = petName; + this.petSpecies = petSpecies; + this.petBreed = petBreed; + this.petAge = petAge; + this.petStatus = petStatus; + this.petPrice = petPrice; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPetName() { + return petName; + } + + public void setPetName(String petName) { + this.petName = petName; + } + + public String getPetSpecies() { + return petSpecies; + } + + public void setPetSpecies(String petSpecies) { + this.petSpecies = petSpecies; + } + + public String getPetBreed() { + return petBreed; + } + + public void setPetBreed(String petBreed) { + this.petBreed = petBreed; + } + + public Integer getPetAge() { + return petAge; + } + + public void setPetAge(Integer petAge) { + this.petAge = petAge; + } + + public String getPetStatus() { + return petStatus; + } + + public void setPetStatus(String petStatus) { + this.petStatus = petStatus; + } + + public BigDecimal getPetPrice() { + return petPrice; + } + + public void setPetPrice(BigDecimal petPrice) { + this.petPrice = petPrice; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PetResponse that = (PetResponse) o; + return Objects.equals(id, that.id) && Objects.equals(petName, that.petName) && Objects.equals(petSpecies, that.petSpecies) && Objects.equals(petBreed, that.petBreed) && Objects.equals(petAge, that.petAge) && Objects.equals(petStatus, that.petStatus) && Objects.equals(petPrice, that.petPrice) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, petName, petSpecies, petBreed, petAge, petStatus, petPrice, createdAt, updatedAt); + } + + @Override + public String toString() { + return "PetResponse{" + + "id=" + id + + ", petName='" + petName + '\'' + + ", petSpecies='" + petSpecies + '\'' + + ", petBreed='" + petBreed + '\'' + + ", petAge=" + petAge + + ", petStatus='" + petStatus + '\'' + + ", petPrice=" + petPrice + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/product/ProductRequest.java b/src/main/java/com/petshop/backend/dto/product/ProductRequest.java index c784513d..e4f68fd7 100644 --- a/src/main/java/com/petshop/backend/dto/product/ProductRequest.java +++ b/src/main/java/com/petshop/backend/dto/product/ProductRequest.java @@ -3,9 +3,8 @@ package com.petshop.backend.dto.product; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; - import java.math.BigDecimal; - +import java.util.Objects; public class ProductRequest { @NotBlank(message = "Product name is required") @@ -21,4 +20,72 @@ public class ProductRequest { private BigDecimal productPrice; private Boolean active = true; + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Long getCategoryId() { + return categoryId; + } + + public void setCategoryId(Long categoryId) { + this.categoryId = categoryId; + } + + public String getProductDescription() { + return productDescription; + } + + public void setProductDescription(String productDescription) { + this.productDescription = productDescription; + } + + public BigDecimal getProductPrice() { + return productPrice; + } + + public void setProductPrice(BigDecimal productPrice) { + this.productPrice = productPrice; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ProductRequest that = (ProductRequest) o; + return Objects.equals(productName, that.productName) && + Objects.equals(categoryId, that.categoryId) && + Objects.equals(productDescription, that.productDescription) && + Objects.equals(productPrice, that.productPrice) && + Objects.equals(active, that.active); + } + + @Override + public int hashCode() { + return Objects.hash(productName, categoryId, productDescription, productPrice, active); + } + + @Override + public String toString() { + return "ProductRequest{" + + "productName='" + productName + '\'' + + ", categoryId=" + categoryId + + ", productDescription='" + productDescription + '\'' + + ", productPrice=" + productPrice + + ", active=" + active + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/product/ProductResponse.java b/src/main/java/com/petshop/backend/dto/product/ProductResponse.java index ec6b3ae9..d54632c4 100644 --- a/src/main/java/com/petshop/backend/dto/product/ProductResponse.java +++ b/src/main/java/com/petshop/backend/dto/product/ProductResponse.java @@ -1,11 +1,8 @@ package com.petshop.backend.dto.product; - import java.math.BigDecimal; import java.time.LocalDateTime; - - - +import java.util.Objects; public class ProductResponse { private Long id; @@ -17,4 +14,119 @@ public class ProductResponse { private Boolean active; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public ProductResponse() { + } + + public ProductResponse(Long id, String productName, Long categoryId, String categoryName, String productDescription, BigDecimal productPrice, Boolean active, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.productName = productName; + this.categoryId = categoryId; + this.categoryName = categoryName; + this.productDescription = productDescription; + this.productPrice = productPrice; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Long getCategoryId() { + return categoryId; + } + + public void setCategoryId(Long categoryId) { + this.categoryId = categoryId; + } + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + public String getProductDescription() { + return productDescription; + } + + public void setProductDescription(String productDescription) { + this.productDescription = productDescription; + } + + public BigDecimal getProductPrice() { + return productPrice; + } + + public void setProductPrice(BigDecimal productPrice) { + this.productPrice = productPrice; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ProductResponse that = (ProductResponse) o; + return Objects.equals(id, that.id) && Objects.equals(productName, that.productName) && Objects.equals(categoryId, that.categoryId) && Objects.equals(categoryName, that.categoryName) && Objects.equals(productDescription, that.productDescription) && Objects.equals(productPrice, that.productPrice) && Objects.equals(active, that.active) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, productName, categoryId, categoryName, productDescription, productPrice, active, createdAt, updatedAt); + } + + @Override + public String toString() { + return "ProductResponse{" + + "id=" + id + + ", productName='" + productName + '\'' + + ", categoryId=" + categoryId + + ", categoryName='" + categoryName + '\'' + + ", productDescription='" + productDescription + '\'' + + ", productPrice=" + productPrice + + ", active=" + active + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/productsupplier/BulkDeleteProductSupplierRequest.java b/src/main/java/com/petshop/backend/dto/productsupplier/BulkDeleteProductSupplierRequest.java index 97704bd8..7eb8a3cc 100644 --- a/src/main/java/com/petshop/backend/dto/productsupplier/BulkDeleteProductSupplierRequest.java +++ b/src/main/java/com/petshop/backend/dto/productsupplier/BulkDeleteProductSupplierRequest.java @@ -1,11 +1,38 @@ package com.petshop.backend.dto.productsupplier; import jakarta.validation.constraints.NotEmpty; - import java.util.List; - +import java.util.Objects; public class BulkDeleteProductSupplierRequest { @NotEmpty(message = "Keys list cannot be empty") private List keys; + + public List getKeys() { + return keys; + } + + public void setKeys(List keys) { + this.keys = keys; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + BulkDeleteProductSupplierRequest that = (BulkDeleteProductSupplierRequest) o; + return Objects.equals(keys, that.keys); + } + + @Override + public int hashCode() { + return Objects.hash(keys); + } + + @Override + public String toString() { + return "BulkDeleteProductSupplierRequest{" + + "keys=" + keys + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierKey.java b/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierKey.java index ca1c0c96..557dbeda 100644 --- a/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierKey.java +++ b/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierKey.java @@ -1,12 +1,54 @@ package com.petshop.backend.dto.productsupplier; -import jakarta.validation.constraints.NotEmpty; - -import java.util.List; - +import java.util.Objects; public class ProductSupplierKey { private Long productId; private Long supplierId; + + public ProductSupplierKey() { + } + + public ProductSupplierKey(Long productId, Long supplierId) { + this.productId = productId; + this.supplierId = supplierId; + } + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public Long getSupplierId() { + return supplierId; + } + + public void setSupplierId(Long supplierId) { + this.supplierId = supplierId; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ProductSupplierKey that = (ProductSupplierKey) o; + return Objects.equals(productId, that.productId) && Objects.equals(supplierId, that.supplierId); + } + + @Override + public int hashCode() { + return Objects.hash(productId, supplierId); + } + + @Override + public String toString() { + return "ProductSupplierKey{" + + "productId=" + productId + + ", supplierId=" + supplierId + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierRequest.java b/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierRequest.java index 7e0ef87a..7854b37e 100644 --- a/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierRequest.java +++ b/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierRequest.java @@ -3,9 +3,8 @@ package com.petshop.backend.dto.productsupplier; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; import jakarta.validation.constraints.PositiveOrZero; - import java.math.BigDecimal; - +import java.util.Objects; public class ProductSupplierRequest { @NotNull(message = "Product ID is required") @@ -22,4 +21,72 @@ public class ProductSupplierRequest { private Integer leadTimeDays; private Boolean isPreferred = false; + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public Long getSupplierId() { + return supplierId; + } + + public void setSupplierId(Long supplierId) { + this.supplierId = supplierId; + } + + public BigDecimal getCostPrice() { + return costPrice; + } + + public void setCostPrice(BigDecimal costPrice) { + this.costPrice = costPrice; + } + + public Integer getLeadTimeDays() { + return leadTimeDays; + } + + public void setLeadTimeDays(Integer leadTimeDays) { + this.leadTimeDays = leadTimeDays; + } + + public Boolean getIsPreferred() { + return isPreferred; + } + + public void setIsPreferred(Boolean isPreferred) { + this.isPreferred = isPreferred; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ProductSupplierRequest that = (ProductSupplierRequest) o; + return Objects.equals(productId, that.productId) && + Objects.equals(supplierId, that.supplierId) && + Objects.equals(costPrice, that.costPrice) && + Objects.equals(leadTimeDays, that.leadTimeDays) && + Objects.equals(isPreferred, that.isPreferred); + } + + @Override + public int hashCode() { + return Objects.hash(productId, supplierId, costPrice, leadTimeDays, isPreferred); + } + + @Override + public String toString() { + return "ProductSupplierRequest{" + + "productId=" + productId + + ", supplierId=" + supplierId + + ", costPrice=" + costPrice + + ", leadTimeDays=" + leadTimeDays + + ", isPreferred=" + isPreferred + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierResponse.java b/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierResponse.java index 49535076..44cafe3c 100644 --- a/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierResponse.java +++ b/src/main/java/com/petshop/backend/dto/productsupplier/ProductSupplierResponse.java @@ -1,11 +1,8 @@ package com.petshop.backend.dto.productsupplier; - import java.math.BigDecimal; import java.time.LocalDateTime; - - - +import java.util.Objects; public class ProductSupplierResponse { private Long productId; @@ -17,4 +14,119 @@ public class ProductSupplierResponse { private Boolean isPreferred; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public ProductSupplierResponse() { + } + + public ProductSupplierResponse(Long productId, String productName, Long supplierId, String supplierName, BigDecimal costPrice, Integer leadTimeDays, Boolean isPreferred, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.productId = productId; + this.productName = productName; + this.supplierId = supplierId; + this.supplierName = supplierName; + this.costPrice = costPrice; + this.leadTimeDays = leadTimeDays; + this.isPreferred = isPreferred; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Long getSupplierId() { + return supplierId; + } + + public void setSupplierId(Long supplierId) { + this.supplierId = supplierId; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public BigDecimal getCostPrice() { + return costPrice; + } + + public void setCostPrice(BigDecimal costPrice) { + this.costPrice = costPrice; + } + + public Integer getLeadTimeDays() { + return leadTimeDays; + } + + public void setLeadTimeDays(Integer leadTimeDays) { + this.leadTimeDays = leadTimeDays; + } + + public Boolean getIsPreferred() { + return isPreferred; + } + + public void setIsPreferred(Boolean isPreferred) { + this.isPreferred = isPreferred; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ProductSupplierResponse that = (ProductSupplierResponse) o; + return Objects.equals(productId, that.productId) && Objects.equals(productName, that.productName) && Objects.equals(supplierId, that.supplierId) && Objects.equals(supplierName, that.supplierName) && Objects.equals(costPrice, that.costPrice) && Objects.equals(leadTimeDays, that.leadTimeDays) && Objects.equals(isPreferred, that.isPreferred) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(productId, productName, supplierId, supplierName, costPrice, leadTimeDays, isPreferred, createdAt, updatedAt); + } + + @Override + public String toString() { + return "ProductSupplierResponse{" + + "productId=" + productId + + ", productName='" + productName + '\'' + + ", supplierId=" + supplierId + + ", supplierName='" + supplierName + '\'' + + ", costPrice=" + costPrice + + ", leadTimeDays=" + leadTimeDays + + ", isPreferred=" + isPreferred + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/purchaseorder/PurchaseOrderResponse.java b/src/main/java/com/petshop/backend/dto/purchaseorder/PurchaseOrderResponse.java index d6f214c2..403aa274 100644 --- a/src/main/java/com/petshop/backend/dto/purchaseorder/PurchaseOrderResponse.java +++ b/src/main/java/com/petshop/backend/dto/purchaseorder/PurchaseOrderResponse.java @@ -1,13 +1,10 @@ package com.petshop.backend.dto.purchaseorder; - import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; - - - +import java.util.Objects; public class PurchaseOrderResponse { private Long id; @@ -22,9 +19,141 @@ public class PurchaseOrderResponse { private LocalDateTime createdAt; private LocalDateTime updatedAt; - - - + public PurchaseOrderResponse() { + } + + public PurchaseOrderResponse(Long id, Long supplierId, String supplierName, LocalDate orderDate, LocalDate expectedDelivery, String status, BigDecimal totalAmount, String notes, List items, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.supplierId = supplierId; + this.supplierName = supplierName; + this.orderDate = orderDate; + this.expectedDelivery = expectedDelivery; + this.status = status; + this.totalAmount = totalAmount; + this.notes = notes; + this.items = items; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSupplierId() { + return supplierId; + } + + public void setSupplierId(Long supplierId) { + this.supplierId = supplierId; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public LocalDate getOrderDate() { + return orderDate; + } + + public void setOrderDate(LocalDate orderDate) { + this.orderDate = orderDate; + } + + public LocalDate getExpectedDelivery() { + return expectedDelivery; + } + + public void setExpectedDelivery(LocalDate expectedDelivery) { + this.expectedDelivery = expectedDelivery; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public BigDecimal getTotalAmount() { + return totalAmount; + } + + public void setTotalAmount(BigDecimal totalAmount) { + this.totalAmount = totalAmount; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PurchaseOrderResponse that = (PurchaseOrderResponse) o; + return Objects.equals(id, that.id) && Objects.equals(supplierId, that.supplierId) && Objects.equals(supplierName, that.supplierName) && Objects.equals(orderDate, that.orderDate) && Objects.equals(expectedDelivery, that.expectedDelivery) && Objects.equals(status, that.status) && Objects.equals(totalAmount, that.totalAmount) && Objects.equals(notes, that.notes) && Objects.equals(items, that.items) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, supplierId, supplierName, orderDate, expectedDelivery, status, totalAmount, notes, items, createdAt, updatedAt); + } + + @Override + public String toString() { + return "PurchaseOrderResponse{" + + "id=" + id + + ", supplierId=" + supplierId + + ", supplierName='" + supplierName + '\'' + + ", orderDate=" + orderDate + + ", expectedDelivery=" + expectedDelivery + + ", status='" + status + '\'' + + ", totalAmount=" + totalAmount + + ", notes='" + notes + '\'' + + ", items=" + items + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } + public static class PurchaseOrderItemResponse { private Long id; private Long productId; @@ -32,5 +161,90 @@ public class PurchaseOrderResponse { private Integer quantity; private BigDecimal unitCost; private BigDecimal subtotal; + + public PurchaseOrderItemResponse() { + } + + public PurchaseOrderItemResponse(Long id, Long productId, String productName, Integer quantity, BigDecimal unitCost, BigDecimal subtotal) { + this.id = id; + this.productId = productId; + this.productName = productName; + this.quantity = quantity; + this.unitCost = unitCost; + this.subtotal = subtotal; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public BigDecimal getUnitCost() { + return unitCost; + } + + public void setUnitCost(BigDecimal unitCost) { + this.unitCost = unitCost; + } + + public BigDecimal getSubtotal() { + return subtotal; + } + + public void setSubtotal(BigDecimal subtotal) { + this.subtotal = subtotal; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PurchaseOrderItemResponse that = (PurchaseOrderItemResponse) o; + return Objects.equals(id, that.id) && Objects.equals(productId, that.productId) && Objects.equals(productName, that.productName) && Objects.equals(quantity, that.quantity) && Objects.equals(unitCost, that.unitCost) && Objects.equals(subtotal, that.subtotal); + } + + @Override + public int hashCode() { + return Objects.hash(id, productId, productName, quantity, unitCost, subtotal); + } + + @Override + public String toString() { + return "PurchaseOrderItemResponse{" + + "id=" + id + + ", productId=" + productId + + ", productName='" + productName + '\'' + + ", quantity=" + quantity + + ", unitCost=" + unitCost + + ", subtotal=" + subtotal + + '}'; + } } } diff --git a/src/main/java/com/petshop/backend/dto/refund/RefundItemRequest.java b/src/main/java/com/petshop/backend/dto/refund/RefundItemRequest.java index 96ed87f8..5c28c3f3 100644 --- a/src/main/java/com/petshop/backend/dto/refund/RefundItemRequest.java +++ b/src/main/java/com/petshop/backend/dto/refund/RefundItemRequest.java @@ -2,7 +2,7 @@ package com.petshop.backend.dto.refund; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; - +import java.util.Objects; public class RefundItemRequest { @NotNull(message = "Sale item ID is required") @@ -11,4 +11,42 @@ public class RefundItemRequest { @NotNull(message = "Quantity is required") @Positive(message = "Quantity must be positive") private Integer quantity; + + public Long getSaleItemId() { + return saleItemId; + } + + public void setSaleItemId(Long saleItemId) { + this.saleItemId = saleItemId; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RefundItemRequest that = (RefundItemRequest) o; + return Objects.equals(saleItemId, that.saleItemId) && + Objects.equals(quantity, that.quantity); + } + + @Override + public int hashCode() { + return Objects.hash(saleItemId, quantity); + } + + @Override + public String toString() { + return "RefundItemRequest{" + + "saleItemId=" + saleItemId + + ", quantity=" + quantity + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/refund/RefundRequest.java b/src/main/java/com/petshop/backend/dto/refund/RefundRequest.java index 677c3439..154e838f 100644 --- a/src/main/java/com/petshop/backend/dto/refund/RefundRequest.java +++ b/src/main/java/com/petshop/backend/dto/refund/RefundRequest.java @@ -2,11 +2,8 @@ package com.petshop.backend.dto.refund; import jakarta.validation.Valid; import jakarta.validation.constraints.NotEmpty; -import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Positive; - import java.util.List; - +import java.util.Objects; public class RefundRequest { @NotEmpty(message = "At least one item is required") @@ -14,4 +11,42 @@ public class RefundRequest { private List items; private String refundReason; + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public String getRefundReason() { + return refundReason; + } + + public void setRefundReason(String refundReason) { + this.refundReason = refundReason; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RefundRequest that = (RefundRequest) o; + return Objects.equals(items, that.items) && + Objects.equals(refundReason, that.refundReason); + } + + @Override + public int hashCode() { + return Objects.hash(items, refundReason); + } + + @Override + public String toString() { + return "RefundRequest{" + + "items=" + items + + ", refundReason='" + refundReason + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/refund/RefundResponse.java b/src/main/java/com/petshop/backend/dto/refund/RefundResponse.java index 2f031b65..a502fb25 100644 --- a/src/main/java/com/petshop/backend/dto/refund/RefundResponse.java +++ b/src/main/java/com/petshop/backend/dto/refund/RefundResponse.java @@ -1,12 +1,9 @@ package com.petshop.backend.dto.refund; - import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; - - - +import java.util.Objects; public class RefundResponse { private Long id; @@ -19,9 +16,121 @@ public class RefundResponse { private List items; private LocalDateTime createdAt; - - - + public RefundResponse() { + } + + public RefundResponse(Long id, Long saleId, LocalDateTime refundDate, BigDecimal refundAmount, String refundReason, Long processedBy, String processedByName, List items, LocalDateTime createdAt) { + this.id = id; + this.saleId = saleId; + this.refundDate = refundDate; + this.refundAmount = refundAmount; + this.refundReason = refundReason; + this.processedBy = processedBy; + this.processedByName = processedByName; + this.items = items; + this.createdAt = createdAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSaleId() { + return saleId; + } + + public void setSaleId(Long saleId) { + this.saleId = saleId; + } + + public LocalDateTime getRefundDate() { + return refundDate; + } + + public void setRefundDate(LocalDateTime refundDate) { + this.refundDate = refundDate; + } + + public BigDecimal getRefundAmount() { + return refundAmount; + } + + public void setRefundAmount(BigDecimal refundAmount) { + this.refundAmount = refundAmount; + } + + public String getRefundReason() { + return refundReason; + } + + public void setRefundReason(String refundReason) { + this.refundReason = refundReason; + } + + public Long getProcessedBy() { + return processedBy; + } + + public void setProcessedBy(Long processedBy) { + this.processedBy = processedBy; + } + + public String getProcessedByName() { + return processedByName; + } + + public void setProcessedByName(String processedByName) { + this.processedByName = processedByName; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RefundResponse that = (RefundResponse) o; + return Objects.equals(id, that.id) && Objects.equals(saleId, that.saleId) && Objects.equals(refundDate, that.refundDate) && Objects.equals(refundAmount, that.refundAmount) && Objects.equals(refundReason, that.refundReason) && Objects.equals(processedBy, that.processedBy) && Objects.equals(processedByName, that.processedByName) && Objects.equals(items, that.items) && Objects.equals(createdAt, that.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, saleId, refundDate, refundAmount, refundReason, processedBy, processedByName, items, createdAt); + } + + @Override + public String toString() { + return "RefundResponse{" + + "id=" + id + + ", saleId=" + saleId + + ", refundDate=" + refundDate + + ", refundAmount=" + refundAmount + + ", refundReason='" + refundReason + '\'' + + ", processedBy=" + processedBy + + ", processedByName='" + processedByName + '\'' + + ", items=" + items + + ", createdAt=" + createdAt + + '}'; + } + public static class RefundItemResponse { private Long id; private Long saleItemId; @@ -29,5 +138,90 @@ public class RefundResponse { private String productName; private Integer quantity; private BigDecimal refundAmount; + + public RefundItemResponse() { + } + + public RefundItemResponse(Long id, Long saleItemId, Long productId, String productName, Integer quantity, BigDecimal refundAmount) { + this.id = id; + this.saleItemId = saleItemId; + this.productId = productId; + this.productName = productName; + this.quantity = quantity; + this.refundAmount = refundAmount; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getSaleItemId() { + return saleItemId; + } + + public void setSaleItemId(Long saleItemId) { + this.saleItemId = saleItemId; + } + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public BigDecimal getRefundAmount() { + return refundAmount; + } + + public void setRefundAmount(BigDecimal refundAmount) { + this.refundAmount = refundAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RefundItemResponse that = (RefundItemResponse) o; + return Objects.equals(id, that.id) && Objects.equals(saleItemId, that.saleItemId) && Objects.equals(productId, that.productId) && Objects.equals(productName, that.productName) && Objects.equals(quantity, that.quantity) && Objects.equals(refundAmount, that.refundAmount); + } + + @Override + public int hashCode() { + return Objects.hash(id, saleItemId, productId, productName, quantity, refundAmount); + } + + @Override + public String toString() { + return "RefundItemResponse{" + + "id=" + id + + ", saleItemId=" + saleItemId + + ", productId=" + productId + + ", productName='" + productName + '\'' + + ", quantity=" + quantity + + ", refundAmount=" + refundAmount + + '}'; + } } } diff --git a/src/main/java/com/petshop/backend/dto/sale/SaleItemRequest.java b/src/main/java/com/petshop/backend/dto/sale/SaleItemRequest.java index 0722fc77..985aa0c4 100644 --- a/src/main/java/com/petshop/backend/dto/sale/SaleItemRequest.java +++ b/src/main/java/com/petshop/backend/dto/sale/SaleItemRequest.java @@ -2,7 +2,7 @@ package com.petshop.backend.dto.sale; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; - +import java.util.Objects; public class SaleItemRequest { @NotNull(message = "Product ID is required") @@ -11,4 +11,42 @@ public class SaleItemRequest { @NotNull(message = "Quantity is required") @Positive(message = "Quantity must be positive") private Integer quantity; + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SaleItemRequest that = (SaleItemRequest) o; + return Objects.equals(productId, that.productId) && + Objects.equals(quantity, that.quantity); + } + + @Override + public int hashCode() { + return Objects.hash(productId, quantity); + } + + @Override + public String toString() { + return "SaleItemRequest{" + + "productId=" + productId + + ", quantity=" + quantity + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/sale/SaleRequest.java b/src/main/java/com/petshop/backend/dto/sale/SaleRequest.java index 26b22952..bece02f5 100644 --- a/src/main/java/com/petshop/backend/dto/sale/SaleRequest.java +++ b/src/main/java/com/petshop/backend/dto/sale/SaleRequest.java @@ -3,11 +3,9 @@ package com.petshop.backend.dto.sale; import jakarta.validation.Valid; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; -import jakarta.validation.constraints.Positive; - import java.math.BigDecimal; import java.util.List; - +import java.util.Objects; public class SaleRequest { private Long customerId; @@ -24,4 +22,82 @@ public class SaleRequest { private List items; private String notes; + + public Long getCustomerId() { + return customerId; + } + + public void setCustomerId(Long customerId) { + this.customerId = customerId; + } + + public Long getStoreId() { + return storeId; + } + + public void setStoreId(Long storeId) { + this.storeId = storeId; + } + + public String getPaymentMethod() { + return paymentMethod; + } + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + public BigDecimal getTax() { + return tax; + } + + public void setTax(BigDecimal tax) { + this.tax = tax; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SaleRequest that = (SaleRequest) o; + return Objects.equals(customerId, that.customerId) && + Objects.equals(storeId, that.storeId) && + Objects.equals(paymentMethod, that.paymentMethod) && + Objects.equals(tax, that.tax) && + Objects.equals(items, that.items) && + Objects.equals(notes, that.notes); + } + + @Override + public int hashCode() { + return Objects.hash(customerId, storeId, paymentMethod, tax, items, notes); + } + + @Override + public String toString() { + return "SaleRequest{" + + "customerId=" + customerId + + ", storeId=" + storeId + + ", paymentMethod='" + paymentMethod + '\'' + + ", tax=" + tax + + ", items=" + items + + ", notes='" + notes + '\'' + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/sale/SaleResponse.java b/src/main/java/com/petshop/backend/dto/sale/SaleResponse.java index d1cf1c45..b8634308 100644 --- a/src/main/java/com/petshop/backend/dto/sale/SaleResponse.java +++ b/src/main/java/com/petshop/backend/dto/sale/SaleResponse.java @@ -1,12 +1,9 @@ package com.petshop.backend.dto.sale; - import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; - - - +import java.util.Objects; public class SaleResponse { private Long id; @@ -25,9 +22,181 @@ public class SaleResponse { private List items; private LocalDateTime createdAt; - - - + public SaleResponse() { + } + + public SaleResponse(Long id, LocalDateTime saleDate, Long employeeId, String employeeName, Long customerId, String customerName, Long storeId, String storeName, BigDecimal subtotal, BigDecimal tax, BigDecimal total, String paymentMethod, String notes, List items, LocalDateTime createdAt) { + this.id = id; + this.saleDate = saleDate; + this.employeeId = employeeId; + this.employeeName = employeeName; + this.customerId = customerId; + this.customerName = customerName; + this.storeId = storeId; + this.storeName = storeName; + this.subtotal = subtotal; + this.tax = tax; + this.total = total; + this.paymentMethod = paymentMethod; + this.notes = notes; + this.items = items; + this.createdAt = createdAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public LocalDateTime getSaleDate() { + return saleDate; + } + + public void setSaleDate(LocalDateTime saleDate) { + this.saleDate = saleDate; + } + + public Long getEmployeeId() { + return employeeId; + } + + public void setEmployeeId(Long employeeId) { + this.employeeId = employeeId; + } + + public String getEmployeeName() { + return employeeName; + } + + public void setEmployeeName(String employeeName) { + this.employeeName = employeeName; + } + + public Long getCustomerId() { + return customerId; + } + + public void setCustomerId(Long customerId) { + this.customerId = customerId; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public Long getStoreId() { + return storeId; + } + + public void setStoreId(Long storeId) { + this.storeId = storeId; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public BigDecimal getSubtotal() { + return subtotal; + } + + public void setSubtotal(BigDecimal subtotal) { + this.subtotal = subtotal; + } + + public BigDecimal getTax() { + return tax; + } + + public void setTax(BigDecimal tax) { + this.tax = tax; + } + + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public String getPaymentMethod() { + return paymentMethod; + } + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SaleResponse that = (SaleResponse) o; + return Objects.equals(id, that.id) && Objects.equals(saleDate, that.saleDate) && Objects.equals(employeeId, that.employeeId) && Objects.equals(employeeName, that.employeeName) && Objects.equals(customerId, that.customerId) && Objects.equals(customerName, that.customerName) && Objects.equals(storeId, that.storeId) && Objects.equals(storeName, that.storeName) && Objects.equals(subtotal, that.subtotal) && Objects.equals(tax, that.tax) && Objects.equals(total, that.total) && Objects.equals(paymentMethod, that.paymentMethod) && Objects.equals(notes, that.notes) && Objects.equals(items, that.items) && Objects.equals(createdAt, that.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, saleDate, employeeId, employeeName, customerId, customerName, storeId, storeName, subtotal, tax, total, paymentMethod, notes, items, createdAt); + } + + @Override + public String toString() { + return "SaleResponse{" + + "id=" + id + + ", saleDate=" + saleDate + + ", employeeId=" + employeeId + + ", employeeName='" + employeeName + '\'' + + ", customerId=" + customerId + + ", customerName='" + customerName + '\'' + + ", storeId=" + storeId + + ", storeName='" + storeName + '\'' + + ", subtotal=" + subtotal + + ", tax=" + tax + + ", total=" + total + + ", paymentMethod='" + paymentMethod + '\'' + + ", notes='" + notes + '\'' + + ", items=" + items + + ", createdAt=" + createdAt + + '}'; + } + public static class SaleItemResponse { private Long id; private Long productId; @@ -35,5 +204,90 @@ public class SaleResponse { private Integer quantity; private BigDecimal unitPrice; private BigDecimal subtotal; + + public SaleItemResponse() { + } + + public SaleItemResponse(Long id, Long productId, String productName, Integer quantity, BigDecimal unitPrice, BigDecimal subtotal) { + this.id = id; + this.productId = productId; + this.productName = productName; + this.quantity = quantity; + this.unitPrice = unitPrice; + this.subtotal = subtotal; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getProductId() { + return productId; + } + + public void setProductId(Long productId) { + this.productId = productId; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public BigDecimal getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(BigDecimal unitPrice) { + this.unitPrice = unitPrice; + } + + public BigDecimal getSubtotal() { + return subtotal; + } + + public void setSubtotal(BigDecimal subtotal) { + this.subtotal = subtotal; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SaleItemResponse that = (SaleItemResponse) o; + return Objects.equals(id, that.id) && Objects.equals(productId, that.productId) && Objects.equals(productName, that.productName) && Objects.equals(quantity, that.quantity) && Objects.equals(unitPrice, that.unitPrice) && Objects.equals(subtotal, that.subtotal); + } + + @Override + public int hashCode() { + return Objects.hash(id, productId, productName, quantity, unitPrice, subtotal); + } + + @Override + public String toString() { + return "SaleItemResponse{" + + "id=" + id + + ", productId=" + productId + + ", productName='" + productName + '\'' + + ", quantity=" + quantity + + ", unitPrice=" + unitPrice + + ", subtotal=" + subtotal + + '}'; + } } } diff --git a/src/main/java/com/petshop/backend/dto/service/ServiceRequest.java b/src/main/java/com/petshop/backend/dto/service/ServiceRequest.java index b5c6bbce..123d704e 100644 --- a/src/main/java/com/petshop/backend/dto/service/ServiceRequest.java +++ b/src/main/java/com/petshop/backend/dto/service/ServiceRequest.java @@ -3,9 +3,8 @@ package com.petshop.backend.dto.service; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Positive; - import java.math.BigDecimal; - +import java.util.Objects; public class ServiceRequest { @NotBlank(message = "Service name is required") @@ -21,4 +20,72 @@ public class ServiceRequest { private Integer serviceDurationMinutes; private Boolean active = true; + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getServiceDescription() { + return serviceDescription; + } + + public void setServiceDescription(String serviceDescription) { + this.serviceDescription = serviceDescription; + } + + public BigDecimal getServicePrice() { + return servicePrice; + } + + public void setServicePrice(BigDecimal servicePrice) { + this.servicePrice = servicePrice; + } + + public Integer getServiceDurationMinutes() { + return serviceDurationMinutes; + } + + public void setServiceDurationMinutes(Integer serviceDurationMinutes) { + this.serviceDurationMinutes = serviceDurationMinutes; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ServiceRequest that = (ServiceRequest) o; + return Objects.equals(serviceName, that.serviceName) && + Objects.equals(serviceDescription, that.serviceDescription) && + Objects.equals(servicePrice, that.servicePrice) && + Objects.equals(serviceDurationMinutes, that.serviceDurationMinutes) && + Objects.equals(active, that.active); + } + + @Override + public int hashCode() { + return Objects.hash(serviceName, serviceDescription, servicePrice, serviceDurationMinutes, active); + } + + @Override + public String toString() { + return "ServiceRequest{" + + "serviceName='" + serviceName + '\'' + + ", serviceDescription='" + serviceDescription + '\'' + + ", servicePrice=" + servicePrice + + ", serviceDurationMinutes=" + serviceDurationMinutes + + ", active=" + active + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/service/ServiceResponse.java b/src/main/java/com/petshop/backend/dto/service/ServiceResponse.java index 992d8fdc..fd7e12ad 100644 --- a/src/main/java/com/petshop/backend/dto/service/ServiceResponse.java +++ b/src/main/java/com/petshop/backend/dto/service/ServiceResponse.java @@ -1,11 +1,8 @@ package com.petshop.backend.dto.service; - import java.math.BigDecimal; import java.time.LocalDateTime; - - - +import java.util.Objects; public class ServiceResponse { private Long id; @@ -16,4 +13,109 @@ public class ServiceResponse { private Boolean active; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public ServiceResponse() { + } + + public ServiceResponse(Long id, String serviceName, String serviceDescription, BigDecimal servicePrice, Integer serviceDurationMinutes, Boolean active, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.serviceName = serviceName; + this.serviceDescription = serviceDescription; + this.servicePrice = servicePrice; + this.serviceDurationMinutes = serviceDurationMinutes; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getServiceDescription() { + return serviceDescription; + } + + public void setServiceDescription(String serviceDescription) { + this.serviceDescription = serviceDescription; + } + + public BigDecimal getServicePrice() { + return servicePrice; + } + + public void setServicePrice(BigDecimal servicePrice) { + this.servicePrice = servicePrice; + } + + public Integer getServiceDurationMinutes() { + return serviceDurationMinutes; + } + + public void setServiceDurationMinutes(Integer serviceDurationMinutes) { + this.serviceDurationMinutes = serviceDurationMinutes; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ServiceResponse that = (ServiceResponse) o; + return Objects.equals(id, that.id) && Objects.equals(serviceName, that.serviceName) && Objects.equals(serviceDescription, that.serviceDescription) && Objects.equals(servicePrice, that.servicePrice) && Objects.equals(serviceDurationMinutes, that.serviceDurationMinutes) && Objects.equals(active, that.active) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, serviceName, serviceDescription, servicePrice, serviceDurationMinutes, active, createdAt, updatedAt); + } + + @Override + public String toString() { + return "ServiceResponse{" + + "id=" + id + + ", serviceName='" + serviceName + '\'' + + ", serviceDescription='" + serviceDescription + '\'' + + ", servicePrice=" + servicePrice + + ", serviceDurationMinutes=" + serviceDurationMinutes + + ", active=" + active + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/supplier/SupplierRequest.java b/src/main/java/com/petshop/backend/dto/supplier/SupplierRequest.java index 36081cf2..99fbe478 100644 --- a/src/main/java/com/petshop/backend/dto/supplier/SupplierRequest.java +++ b/src/main/java/com/petshop/backend/dto/supplier/SupplierRequest.java @@ -2,7 +2,7 @@ package com.petshop.backend.dto.supplier; import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; - +import java.util.Objects; public class SupplierRequest { @NotBlank(message = "Supplier name is required") @@ -16,4 +16,82 @@ public class SupplierRequest { private String supplierPhone; private String supplierAddress; private Boolean active = true; + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public String getSupplierContact() { + return supplierContact; + } + + public void setSupplierContact(String supplierContact) { + this.supplierContact = supplierContact; + } + + public String getSupplierEmail() { + return supplierEmail; + } + + public void setSupplierEmail(String supplierEmail) { + this.supplierEmail = supplierEmail; + } + + public String getSupplierPhone() { + return supplierPhone; + } + + public void setSupplierPhone(String supplierPhone) { + this.supplierPhone = supplierPhone; + } + + public String getSupplierAddress() { + return supplierAddress; + } + + public void setSupplierAddress(String supplierAddress) { + this.supplierAddress = supplierAddress; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SupplierRequest that = (SupplierRequest) o; + return Objects.equals(supplierName, that.supplierName) && + Objects.equals(supplierContact, that.supplierContact) && + Objects.equals(supplierEmail, that.supplierEmail) && + Objects.equals(supplierPhone, that.supplierPhone) && + Objects.equals(supplierAddress, that.supplierAddress) && + Objects.equals(active, that.active); + } + + @Override + public int hashCode() { + return Objects.hash(supplierName, supplierContact, supplierEmail, supplierPhone, supplierAddress, active); + } + + @Override + public String toString() { + return "SupplierRequest{" + + "supplierName='" + supplierName + '\'' + + ", supplierContact='" + supplierContact + '\'' + + ", supplierEmail='" + supplierEmail + '\'' + + ", supplierPhone='" + supplierPhone + '\'' + + ", supplierAddress='" + supplierAddress + '\'' + + ", active=" + active + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/supplier/SupplierResponse.java b/src/main/java/com/petshop/backend/dto/supplier/SupplierResponse.java index 8af255d1..348b7f81 100644 --- a/src/main/java/com/petshop/backend/dto/supplier/SupplierResponse.java +++ b/src/main/java/com/petshop/backend/dto/supplier/SupplierResponse.java @@ -1,10 +1,7 @@ package com.petshop.backend.dto.supplier; - import java.time.LocalDateTime; - - - +import java.util.Objects; public class SupplierResponse { private Long id; @@ -16,4 +13,119 @@ public class SupplierResponse { private Boolean active; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public SupplierResponse() { + } + + public SupplierResponse(Long id, String supplierName, String supplierContact, String supplierEmail, String supplierPhone, String supplierAddress, Boolean active, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.supplierName = supplierName; + this.supplierContact = supplierContact; + this.supplierEmail = supplierEmail; + this.supplierPhone = supplierPhone; + this.supplierAddress = supplierAddress; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public String getSupplierContact() { + return supplierContact; + } + + public void setSupplierContact(String supplierContact) { + this.supplierContact = supplierContact; + } + + public String getSupplierEmail() { + return supplierEmail; + } + + public void setSupplierEmail(String supplierEmail) { + this.supplierEmail = supplierEmail; + } + + public String getSupplierPhone() { + return supplierPhone; + } + + public void setSupplierPhone(String supplierPhone) { + this.supplierPhone = supplierPhone; + } + + public String getSupplierAddress() { + return supplierAddress; + } + + public void setSupplierAddress(String supplierAddress) { + this.supplierAddress = supplierAddress; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SupplierResponse that = (SupplierResponse) o; + return Objects.equals(id, that.id) && Objects.equals(supplierName, that.supplierName) && Objects.equals(supplierContact, that.supplierContact) && Objects.equals(supplierEmail, that.supplierEmail) && Objects.equals(supplierPhone, that.supplierPhone) && Objects.equals(supplierAddress, that.supplierAddress) && Objects.equals(active, that.active) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, supplierName, supplierContact, supplierEmail, supplierPhone, supplierAddress, active, createdAt, updatedAt); + } + + @Override + public String toString() { + return "SupplierResponse{" + + "id=" + id + + ", supplierName='" + supplierName + '\'' + + ", supplierContact='" + supplierContact + '\'' + + ", supplierEmail='" + supplierEmail + '\'' + + ", supplierPhone='" + supplierPhone + '\'' + + ", supplierAddress='" + supplierAddress + '\'' + + ", active=" + active + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/user/UserRequest.java b/src/main/java/com/petshop/backend/dto/user/UserRequest.java index ca68354b..72b1dbfb 100644 --- a/src/main/java/com/petshop/backend/dto/user/UserRequest.java +++ b/src/main/java/com/petshop/backend/dto/user/UserRequest.java @@ -5,7 +5,7 @@ import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; - +import java.util.Objects; public class UserRequest { @NotBlank(message = "Username is required") @@ -25,4 +25,82 @@ public class UserRequest { private User.Role role; private Boolean active = true; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User.Role getRole() { + return role; + } + + public void setRole(User.Role role) { + this.role = role; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + UserRequest that = (UserRequest) o; + return Objects.equals(username, that.username) && + Objects.equals(password, that.password) && + Objects.equals(fullName, that.fullName) && + Objects.equals(email, that.email) && + role == that.role && + Objects.equals(active, that.active); + } + + @Override + public int hashCode() { + return Objects.hash(username, password, fullName, email, role, active); + } + + @Override + public String toString() { + return "UserRequest{" + + "username='" + username + '\'' + + ", password='" + password + '\'' + + ", fullName='" + fullName + '\'' + + ", email='" + email + '\'' + + ", role=" + role + + ", active=" + active + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/dto/user/UserResponse.java b/src/main/java/com/petshop/backend/dto/user/UserResponse.java index 0fac71c9..8b383366 100644 --- a/src/main/java/com/petshop/backend/dto/user/UserResponse.java +++ b/src/main/java/com/petshop/backend/dto/user/UserResponse.java @@ -1,10 +1,7 @@ package com.petshop.backend.dto.user; - import java.time.LocalDateTime; - - - +import java.util.Objects; public class UserResponse { private Long id; @@ -15,4 +12,109 @@ public class UserResponse { private Boolean active; private LocalDateTime createdAt; private LocalDateTime updatedAt; + + public UserResponse() { + } + + public UserResponse(Long id, String username, String fullName, String email, String role, Boolean active, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.username = username; + this.fullName = fullName; + this.email = email; + this.role = role; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + UserResponse that = (UserResponse) o; + return Objects.equals(id, that.id) && Objects.equals(username, that.username) && Objects.equals(fullName, that.fullName) && Objects.equals(email, that.email) && Objects.equals(role, that.role) && Objects.equals(active, that.active) && Objects.equals(createdAt, that.createdAt) && Objects.equals(updatedAt, that.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, fullName, email, role, active, createdAt, updatedAt); + } + + @Override + public String toString() { + return "UserResponse{" + + "id=" + id + + ", username='" + username + '\'' + + ", fullName='" + fullName + '\'' + + ", email='" + email + '\'' + + ", role='" + role + '\'' + + ", active=" + active + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Adoption.java b/src/main/java/com/petshop/backend/entity/Adoption.java index 51366e27..da005d5f 100644 --- a/src/main/java/com/petshop/backend/entity/Adoption.java +++ b/src/main/java/com/petshop/backend/entity/Adoption.java @@ -7,12 +7,10 @@ import org.hibernate.annotations.UpdateTimestamp; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "adoptions") - - - public class Adoption { @Id @@ -43,4 +41,109 @@ public class Adoption { @UpdateTimestamp @Column(name = "updated_at") private LocalDateTime updatedAt; + + public Adoption() { + } + + public Adoption(Long id, Pet pet, Customer customer, LocalDate adoptionDate, BigDecimal adoptionFee, String notes, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.pet = pet; + this.customer = customer; + this.adoptionDate = adoptionDate; + this.adoptionFee = adoptionFee; + this.notes = notes; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Pet getPet() { + return pet; + } + + public void setPet(Pet pet) { + this.pet = pet; + } + + public Customer getCustomer() { + return customer; + } + + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public LocalDate getAdoptionDate() { + return adoptionDate; + } + + public void setAdoptionDate(LocalDate adoptionDate) { + this.adoptionDate = adoptionDate; + } + + public BigDecimal getAdoptionFee() { + return adoptionFee; + } + + public void setAdoptionFee(BigDecimal adoptionFee) { + this.adoptionFee = adoptionFee; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Adoption adoption = (Adoption) o; + return Objects.equals(id, adoption.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Adoption{" + + "id=" + id + + ", pet=" + pet + + ", customer=" + customer + + ", adoptionDate=" + adoptionDate + + ", adoptionFee=" + adoptionFee + + ", notes='" + notes + '\'' + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Appointment.java b/src/main/java/com/petshop/backend/entity/Appointment.java index 60b6d1c0..358c137b 100644 --- a/src/main/java/com/petshop/backend/entity/Appointment.java +++ b/src/main/java/com/petshop/backend/entity/Appointment.java @@ -8,13 +8,11 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.util.HashSet; +import java.util.Objects; import java.util.Set; @Entity @Table(name = "appointments") - - - public class Appointment { @Id @@ -61,4 +59,129 @@ public class Appointment { public enum AppointmentStatus { Scheduled, Completed, Cancelled } + + public Appointment() { + } + + public Appointment(Long id, Customer customer, Service service, LocalDate appointmentDate, LocalTime appointmentTime, AppointmentStatus status, String notes, Set pets, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.customer = customer; + this.service = service; + this.appointmentDate = appointmentDate; + this.appointmentTime = appointmentTime; + this.status = status; + this.notes = notes; + this.pets = pets; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Customer getCustomer() { + return customer; + } + + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public Service getService() { + return service; + } + + public void setService(Service service) { + this.service = service; + } + + public LocalDate getAppointmentDate() { + return appointmentDate; + } + + public void setAppointmentDate(LocalDate appointmentDate) { + this.appointmentDate = appointmentDate; + } + + public LocalTime getAppointmentTime() { + return appointmentTime; + } + + public void setAppointmentTime(LocalTime appointmentTime) { + this.appointmentTime = appointmentTime; + } + + public AppointmentStatus getStatus() { + return status; + } + + public void setStatus(AppointmentStatus status) { + this.status = status; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public Set getPets() { + return pets; + } + + public void setPets(Set pets) { + this.pets = pets; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Appointment that = (Appointment) o; + return Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Appointment{" + + "id=" + id + + ", customer=" + customer + + ", service=" + service + + ", appointmentDate=" + appointmentDate + + ", appointmentTime=" + appointmentTime + + ", status=" + status + + ", notes='" + notes + '\'' + + ", pets=" + pets + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Category.java b/src/main/java/com/petshop/backend/entity/Category.java index 7380c6d3..47a9963a 100644 --- a/src/main/java/com/petshop/backend/entity/Category.java +++ b/src/main/java/com/petshop/backend/entity/Category.java @@ -5,12 +5,10 @@ import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "categories") - - - public class Category { @Id @@ -30,4 +28,79 @@ public class Category { @UpdateTimestamp @Column(name = "updated_at") private LocalDateTime updatedAt; + + public Category() { + } + + public Category(Long id, String categoryName, String categoryDescription, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.categoryName = categoryName; + this.categoryDescription = categoryDescription; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCategoryName() { + return categoryName; + } + + public void setCategoryName(String categoryName) { + this.categoryName = categoryName; + } + + public String getCategoryDescription() { + return categoryDescription; + } + + public void setCategoryDescription(String categoryDescription) { + this.categoryDescription = categoryDescription; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Category category = (Category) o; + return Objects.equals(id, category.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Category{" + + "id=" + id + + ", categoryName='" + categoryName + '\'' + + ", categoryDescription='" + categoryDescription + '\'' + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Customer.java b/src/main/java/com/petshop/backend/entity/Customer.java index 496cd705..b0b319a6 100644 --- a/src/main/java/com/petshop/backend/entity/Customer.java +++ b/src/main/java/com/petshop/backend/entity/Customer.java @@ -5,12 +5,10 @@ import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "customers") - - - public class Customer { @Id @@ -36,4 +34,99 @@ public class Customer { @UpdateTimestamp @Column(name = "updated_at") private LocalDateTime updatedAt; + + public Customer() { + } + + public Customer(Long id, String customerName, String customerEmail, String customerPhone, String customerAddress, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.customerName = customerName; + this.customerEmail = customerEmail; + this.customerPhone = customerPhone; + this.customerAddress = customerAddress; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getCustomerName() { + return customerName; + } + + public void setCustomerName(String customerName) { + this.customerName = customerName; + } + + public String getCustomerEmail() { + return customerEmail; + } + + public void setCustomerEmail(String customerEmail) { + this.customerEmail = customerEmail; + } + + public String getCustomerPhone() { + return customerPhone; + } + + public void setCustomerPhone(String customerPhone) { + this.customerPhone = customerPhone; + } + + public String getCustomerAddress() { + return customerAddress; + } + + public void setCustomerAddress(String customerAddress) { + this.customerAddress = customerAddress; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Customer customer = (Customer) o; + return Objects.equals(id, customer.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Customer{" + + "id=" + id + + ", customerName='" + customerName + '\'' + + ", customerEmail='" + customerEmail + '\'' + + ", customerPhone='" + customerPhone + '\'' + + ", customerAddress='" + customerAddress + '\'' + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Inventory.java b/src/main/java/com/petshop/backend/entity/Inventory.java index bdcd42ef..4e67b106 100644 --- a/src/main/java/com/petshop/backend/entity/Inventory.java +++ b/src/main/java/com/petshop/backend/entity/Inventory.java @@ -5,14 +5,12 @@ import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "inventory", uniqueConstraints = { @UniqueConstraint(name = "unique_product_store", columnNames = {"product_id", "store_id"}) }) - - - public class Inventory { @Id @@ -43,4 +41,109 @@ public class Inventory { @UpdateTimestamp @Column(name = "updated_at") private LocalDateTime updatedAt; + + public Inventory() { + } + + public Inventory(Long id, Product product, Store store, Integer quantity, Integer reorderLevel, LocalDateTime lastRestocked, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.product = product; + this.store = store; + this.quantity = quantity; + this.reorderLevel = reorderLevel; + this.lastRestocked = lastRestocked; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Product getProduct() { + return product; + } + + public void setProduct(Product product) { + this.product = product; + } + + public Store getStore() { + return store; + } + + public void setStore(Store store) { + this.store = store; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Integer getReorderLevel() { + return reorderLevel; + } + + public void setReorderLevel(Integer reorderLevel) { + this.reorderLevel = reorderLevel; + } + + public LocalDateTime getLastRestocked() { + return lastRestocked; + } + + public void setLastRestocked(LocalDateTime lastRestocked) { + this.lastRestocked = lastRestocked; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Inventory inventory = (Inventory) o; + return Objects.equals(id, inventory.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Inventory{" + + "id=" + id + + ", product=" + product + + ", store=" + store + + ", quantity=" + quantity + + ", reorderLevel=" + reorderLevel + + ", lastRestocked=" + lastRestocked + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Pet.java b/src/main/java/com/petshop/backend/entity/Pet.java index 8e0587ba..0cd1c707 100644 --- a/src/main/java/com/petshop/backend/entity/Pet.java +++ b/src/main/java/com/petshop/backend/entity/Pet.java @@ -6,12 +6,10 @@ import org.hibernate.annotations.UpdateTimestamp; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "pets") - - - public class Pet { @Id @@ -48,4 +46,119 @@ public class Pet { public enum PetStatus { Available, Adopted, Under_Care } + + public Pet() { + } + + public Pet(Long id, String petName, String petSpecies, String petBreed, Integer petAge, PetStatus petStatus, BigDecimal petPrice, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.petName = petName; + this.petSpecies = petSpecies; + this.petBreed = petBreed; + this.petAge = petAge; + this.petStatus = petStatus; + this.petPrice = petPrice; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getPetName() { + return petName; + } + + public void setPetName(String petName) { + this.petName = petName; + } + + public String getPetSpecies() { + return petSpecies; + } + + public void setPetSpecies(String petSpecies) { + this.petSpecies = petSpecies; + } + + public String getPetBreed() { + return petBreed; + } + + public void setPetBreed(String petBreed) { + this.petBreed = petBreed; + } + + public Integer getPetAge() { + return petAge; + } + + public void setPetAge(Integer petAge) { + this.petAge = petAge; + } + + public PetStatus getPetStatus() { + return petStatus; + } + + public void setPetStatus(PetStatus petStatus) { + this.petStatus = petStatus; + } + + public BigDecimal getPetPrice() { + return petPrice; + } + + public void setPetPrice(BigDecimal petPrice) { + this.petPrice = petPrice; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Pet pet = (Pet) o; + return Objects.equals(id, pet.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Pet{" + + "id=" + id + + ", petName='" + petName + '\'' + + ", petSpecies='" + petSpecies + '\'' + + ", petBreed='" + petBreed + '\'' + + ", petAge=" + petAge + + ", petStatus=" + petStatus + + ", petPrice=" + petPrice + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Product.java b/src/main/java/com/petshop/backend/entity/Product.java index 49ebf645..2a3e0dd9 100644 --- a/src/main/java/com/petshop/backend/entity/Product.java +++ b/src/main/java/com/petshop/backend/entity/Product.java @@ -6,12 +6,10 @@ import org.hibernate.annotations.UpdateTimestamp; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "products") - - - public class Product { @Id @@ -41,4 +39,109 @@ public class Product { @UpdateTimestamp @Column(name = "updated_at") private LocalDateTime updatedAt; + + public Product() { + } + + public Product(Long id, String productName, Category category, String productDescription, BigDecimal productPrice, Boolean active, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.productName = productName; + this.category = category; + this.productDescription = productDescription; + this.productPrice = productPrice; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getProductName() { + return productName; + } + + public void setProductName(String productName) { + this.productName = productName; + } + + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public String getProductDescription() { + return productDescription; + } + + public void setProductDescription(String productDescription) { + this.productDescription = productDescription; + } + + public BigDecimal getProductPrice() { + return productPrice; + } + + public void setProductPrice(BigDecimal productPrice) { + this.productPrice = productPrice; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Product product = (Product) o; + return Objects.equals(id, product.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Product{" + + "id=" + id + + ", productName='" + productName + '\'' + + ", category=" + category + + ", productDescription='" + productDescription + '\'' + + ", productPrice=" + productPrice + + ", active=" + active + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/ProductSupplier.java b/src/main/java/com/petshop/backend/entity/ProductSupplier.java index bb157386..b9758404 100644 --- a/src/main/java/com/petshop/backend/entity/ProductSupplier.java +++ b/src/main/java/com/petshop/backend/entity/ProductSupplier.java @@ -7,12 +7,10 @@ import org.hibernate.annotations.UpdateTimestamp; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "product_suppliers") - - - @IdClass(ProductSupplier.ProductSupplierId.class) public class ProductSupplier { @@ -43,11 +41,148 @@ public class ProductSupplier { @Column(name = "updated_at") private LocalDateTime updatedAt; - - - + public ProductSupplier() { + } + + public ProductSupplier(Product product, Supplier supplier, BigDecimal costPrice, Integer leadTimeDays, Boolean isPreferred, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.product = product; + this.supplier = supplier; + this.costPrice = costPrice; + this.leadTimeDays = leadTimeDays; + this.isPreferred = isPreferred; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Product getProduct() { + return product; + } + + public void setProduct(Product product) { + this.product = product; + } + + public Supplier getSupplier() { + return supplier; + } + + public void setSupplier(Supplier supplier) { + this.supplier = supplier; + } + + public BigDecimal getCostPrice() { + return costPrice; + } + + public void setCostPrice(BigDecimal costPrice) { + this.costPrice = costPrice; + } + + public Integer getLeadTimeDays() { + return leadTimeDays; + } + + public void setLeadTimeDays(Integer leadTimeDays) { + this.leadTimeDays = leadTimeDays; + } + + public Boolean getIsPreferred() { + return isPreferred; + } + + public void setIsPreferred(Boolean isPreferred) { + this.isPreferred = isPreferred; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ProductSupplier that = (ProductSupplier) o; + return Objects.equals(product, that.product) && Objects.equals(supplier, that.supplier); + } + + @Override + public int hashCode() { + return Objects.hash(product, supplier); + } + + @Override + public String toString() { + return "ProductSupplier{" + + "product=" + product + + ", supplier=" + supplier + + ", costPrice=" + costPrice + + ", leadTimeDays=" + leadTimeDays + + ", isPreferred=" + isPreferred + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } + public static class ProductSupplierId implements Serializable { private Long product; private Long supplier; + + public ProductSupplierId() { + } + + public ProductSupplierId(Long product, Long supplier) { + this.product = product; + this.supplier = supplier; + } + + public Long getProduct() { + return product; + } + + public void setProduct(Long product) { + this.product = product; + } + + public Long getSupplier() { + return supplier; + } + + public void setSupplier(Long supplier) { + this.supplier = supplier; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ProductSupplierId that = (ProductSupplierId) o; + return Objects.equals(product, that.product) && Objects.equals(supplier, that.supplier); + } + + @Override + public int hashCode() { + return Objects.hash(product, supplier); + } + + @Override + public String toString() { + return "ProductSupplierId{" + + "product=" + product + + ", supplier=" + supplier + + '}'; + } } } diff --git a/src/main/java/com/petshop/backend/entity/PurchaseOrder.java b/src/main/java/com/petshop/backend/entity/PurchaseOrder.java index 3112a1aa..3a63683f 100644 --- a/src/main/java/com/petshop/backend/entity/PurchaseOrder.java +++ b/src/main/java/com/petshop/backend/entity/PurchaseOrder.java @@ -9,12 +9,10 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Objects; @Entity @Table(name = "purchase_orders") - - - public class PurchaseOrder { @Id @@ -55,4 +53,129 @@ public class PurchaseOrder { public enum OrderStatus { Pending, Delivered, Cancelled } + + public PurchaseOrder() { + } + + public PurchaseOrder(Long id, Supplier supplier, LocalDate orderDate, LocalDate expectedDelivery, OrderStatus status, BigDecimal totalAmount, String notes, List items, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.supplier = supplier; + this.orderDate = orderDate; + this.expectedDelivery = expectedDelivery; + this.status = status; + this.totalAmount = totalAmount; + this.notes = notes; + this.items = items; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Supplier getSupplier() { + return supplier; + } + + public void setSupplier(Supplier supplier) { + this.supplier = supplier; + } + + public LocalDate getOrderDate() { + return orderDate; + } + + public void setOrderDate(LocalDate orderDate) { + this.orderDate = orderDate; + } + + public LocalDate getExpectedDelivery() { + return expectedDelivery; + } + + public void setExpectedDelivery(LocalDate expectedDelivery) { + this.expectedDelivery = expectedDelivery; + } + + public OrderStatus getStatus() { + return status; + } + + public void setStatus(OrderStatus status) { + this.status = status; + } + + public BigDecimal getTotalAmount() { + return totalAmount; + } + + public void setTotalAmount(BigDecimal totalAmount) { + this.totalAmount = totalAmount; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PurchaseOrder that = (PurchaseOrder) o; + return Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "PurchaseOrder{" + + "id=" + id + + ", supplier=" + supplier + + ", orderDate=" + orderDate + + ", expectedDelivery=" + expectedDelivery + + ", status=" + status + + ", totalAmount=" + totalAmount + + ", notes='" + notes + '\'' + + ", items=" + items + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/PurchaseOrderItem.java b/src/main/java/com/petshop/backend/entity/PurchaseOrderItem.java index f6485616..6278d3f9 100644 --- a/src/main/java/com/petshop/backend/entity/PurchaseOrderItem.java +++ b/src/main/java/com/petshop/backend/entity/PurchaseOrderItem.java @@ -3,12 +3,10 @@ package com.petshop.backend.entity; import jakarta.persistence.*; import java.math.BigDecimal; +import java.util.Objects; @Entity @Table(name = "purchase_order_items") - - - public class PurchaseOrderItem { @Id @@ -31,4 +29,89 @@ public class PurchaseOrderItem { @Column(nullable = false, precision = 10, scale = 2) private BigDecimal subtotal; + + public PurchaseOrderItem() { + } + + public PurchaseOrderItem(Long id, PurchaseOrder purchaseOrder, Product product, Integer quantity, BigDecimal unitCost, BigDecimal subtotal) { + this.id = id; + this.purchaseOrder = purchaseOrder; + this.product = product; + this.quantity = quantity; + this.unitCost = unitCost; + this.subtotal = subtotal; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public PurchaseOrder getPurchaseOrder() { + return purchaseOrder; + } + + public void setPurchaseOrder(PurchaseOrder purchaseOrder) { + this.purchaseOrder = purchaseOrder; + } + + public Product getProduct() { + return product; + } + + public void setProduct(Product product) { + this.product = product; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public BigDecimal getUnitCost() { + return unitCost; + } + + public void setUnitCost(BigDecimal unitCost) { + this.unitCost = unitCost; + } + + public BigDecimal getSubtotal() { + return subtotal; + } + + public void setSubtotal(BigDecimal subtotal) { + this.subtotal = subtotal; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + PurchaseOrderItem that = (PurchaseOrderItem) o; + return Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "PurchaseOrderItem{" + + "id=" + id + + ", purchaseOrder=" + purchaseOrder + + ", product=" + product + + ", quantity=" + quantity + + ", unitCost=" + unitCost + + ", subtotal=" + subtotal + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Refund.java b/src/main/java/com/petshop/backend/entity/Refund.java index 48297ec1..8fe89c9a 100644 --- a/src/main/java/com/petshop/backend/entity/Refund.java +++ b/src/main/java/com/petshop/backend/entity/Refund.java @@ -7,12 +7,10 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Objects; @Entity @Table(name = "refunds") - - - public class Refund { @Id @@ -42,4 +40,109 @@ public class Refund { @CreationTimestamp @Column(name = "created_at", updatable = false) private LocalDateTime createdAt; + + public Refund() { + } + + public Refund(Long id, Sale sale, LocalDateTime refundDate, BigDecimal refundAmount, String refundReason, User processedBy, List items, LocalDateTime createdAt) { + this.id = id; + this.sale = sale; + this.refundDate = refundDate; + this.refundAmount = refundAmount; + this.refundReason = refundReason; + this.processedBy = processedBy; + this.items = items; + this.createdAt = createdAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Sale getSale() { + return sale; + } + + public void setSale(Sale sale) { + this.sale = sale; + } + + public LocalDateTime getRefundDate() { + return refundDate; + } + + public void setRefundDate(LocalDateTime refundDate) { + this.refundDate = refundDate; + } + + public BigDecimal getRefundAmount() { + return refundAmount; + } + + public void setRefundAmount(BigDecimal refundAmount) { + this.refundAmount = refundAmount; + } + + public String getRefundReason() { + return refundReason; + } + + public void setRefundReason(String refundReason) { + this.refundReason = refundReason; + } + + public User getProcessedBy() { + return processedBy; + } + + public void setProcessedBy(User processedBy) { + this.processedBy = processedBy; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Refund refund = (Refund) o; + return Objects.equals(id, refund.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Refund{" + + "id=" + id + + ", sale=" + sale + + ", refundDate=" + refundDate + + ", refundAmount=" + refundAmount + + ", refundReason='" + refundReason + '\'' + + ", processedBy=" + processedBy + + ", items=" + items + + ", createdAt=" + createdAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/RefundItem.java b/src/main/java/com/petshop/backend/entity/RefundItem.java index 59826733..1724679a 100644 --- a/src/main/java/com/petshop/backend/entity/RefundItem.java +++ b/src/main/java/com/petshop/backend/entity/RefundItem.java @@ -3,12 +3,10 @@ package com.petshop.backend.entity; import jakarta.persistence.*; import java.math.BigDecimal; +import java.util.Objects; @Entity @Table(name = "refund_items") - - - public class RefundItem { @Id @@ -28,4 +26,79 @@ public class RefundItem { @Column(name = "refund_amount", nullable = false, precision = 10, scale = 2) private BigDecimal refundAmount; + + public RefundItem() { + } + + public RefundItem(Long id, Refund refund, SaleItem saleItem, Integer quantity, BigDecimal refundAmount) { + this.id = id; + this.refund = refund; + this.saleItem = saleItem; + this.quantity = quantity; + this.refundAmount = refundAmount; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Refund getRefund() { + return refund; + } + + public void setRefund(Refund refund) { + this.refund = refund; + } + + public SaleItem getSaleItem() { + return saleItem; + } + + public void setSaleItem(SaleItem saleItem) { + this.saleItem = saleItem; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public BigDecimal getRefundAmount() { + return refundAmount; + } + + public void setRefundAmount(BigDecimal refundAmount) { + this.refundAmount = refundAmount; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + RefundItem that = (RefundItem) o; + return Objects.equals(id, that.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "RefundItem{" + + "id=" + id + + ", refund=" + refund + + ", saleItem=" + saleItem + + ", quantity=" + quantity + + ", refundAmount=" + refundAmount + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Sale.java b/src/main/java/com/petshop/backend/entity/Sale.java index 29ccff01..fc1e8765 100644 --- a/src/main/java/com/petshop/backend/entity/Sale.java +++ b/src/main/java/com/petshop/backend/entity/Sale.java @@ -7,12 +7,10 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.Objects; @Entity @Table(name = "sales") - - - public class Sale { @Id @@ -55,4 +53,149 @@ public class Sale { @CreationTimestamp @Column(name = "created_at", updatable = false) private LocalDateTime createdAt; + + public Sale() { + } + + public Sale(Long id, LocalDateTime saleDate, User employee, Customer customer, Store store, BigDecimal subtotal, BigDecimal tax, BigDecimal total, String paymentMethod, String notes, List items, LocalDateTime createdAt) { + this.id = id; + this.saleDate = saleDate; + this.employee = employee; + this.customer = customer; + this.store = store; + this.subtotal = subtotal; + this.tax = tax; + this.total = total; + this.paymentMethod = paymentMethod; + this.notes = notes; + this.items = items; + this.createdAt = createdAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public LocalDateTime getSaleDate() { + return saleDate; + } + + public void setSaleDate(LocalDateTime saleDate) { + this.saleDate = saleDate; + } + + public User getEmployee() { + return employee; + } + + public void setEmployee(User employee) { + this.employee = employee; + } + + public Customer getCustomer() { + return customer; + } + + public void setCustomer(Customer customer) { + this.customer = customer; + } + + public Store getStore() { + return store; + } + + public void setStore(Store store) { + this.store = store; + } + + public BigDecimal getSubtotal() { + return subtotal; + } + + public void setSubtotal(BigDecimal subtotal) { + this.subtotal = subtotal; + } + + public BigDecimal getTax() { + return tax; + } + + public void setTax(BigDecimal tax) { + this.tax = tax; + } + + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public String getPaymentMethod() { + return paymentMethod; + } + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Sale sale = (Sale) o; + return Objects.equals(id, sale.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Sale{" + + "id=" + id + + ", saleDate=" + saleDate + + ", employee=" + employee + + ", customer=" + customer + + ", store=" + store + + ", subtotal=" + subtotal + + ", tax=" + tax + + ", total=" + total + + ", paymentMethod='" + paymentMethod + '\'' + + ", notes='" + notes + '\'' + + ", items=" + items + + ", createdAt=" + createdAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/SaleItem.java b/src/main/java/com/petshop/backend/entity/SaleItem.java index c5f183d9..5b883f4c 100644 --- a/src/main/java/com/petshop/backend/entity/SaleItem.java +++ b/src/main/java/com/petshop/backend/entity/SaleItem.java @@ -3,12 +3,10 @@ package com.petshop.backend.entity; import jakarta.persistence.*; import java.math.BigDecimal; +import java.util.Objects; @Entity @Table(name = "sale_items") - - - public class SaleItem { @Id @@ -31,4 +29,89 @@ public class SaleItem { @Column(nullable = false, precision = 10, scale = 2) private BigDecimal subtotal; + + public SaleItem() { + } + + public SaleItem(Long id, Sale sale, Product product, Integer quantity, BigDecimal unitPrice, BigDecimal subtotal) { + this.id = id; + this.sale = sale; + this.product = product; + this.quantity = quantity; + this.unitPrice = unitPrice; + this.subtotal = subtotal; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Sale getSale() { + return sale; + } + + public void setSale(Sale sale) { + this.sale = sale; + } + + public Product getProduct() { + return product; + } + + public void setProduct(Product product) { + this.product = product; + } + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public BigDecimal getUnitPrice() { + return unitPrice; + } + + public void setUnitPrice(BigDecimal unitPrice) { + this.unitPrice = unitPrice; + } + + public BigDecimal getSubtotal() { + return subtotal; + } + + public void setSubtotal(BigDecimal subtotal) { + this.subtotal = subtotal; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + SaleItem saleItem = (SaleItem) o; + return Objects.equals(id, saleItem.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "SaleItem{" + + "id=" + id + + ", sale=" + sale + + ", product=" + product + + ", quantity=" + quantity + + ", unitPrice=" + unitPrice + + ", subtotal=" + subtotal + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Service.java b/src/main/java/com/petshop/backend/entity/Service.java index 7c293e78..e3148cd9 100644 --- a/src/main/java/com/petshop/backend/entity/Service.java +++ b/src/main/java/com/petshop/backend/entity/Service.java @@ -6,12 +6,10 @@ import org.hibernate.annotations.UpdateTimestamp; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "services") - - - public class Service { @Id @@ -40,4 +38,109 @@ public class Service { @UpdateTimestamp @Column(name = "updated_at") private LocalDateTime updatedAt; + + public Service() { + } + + public Service(Long id, String serviceName, String serviceDescription, BigDecimal servicePrice, Integer serviceDurationMinutes, Boolean active, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.serviceName = serviceName; + this.serviceDescription = serviceDescription; + this.servicePrice = servicePrice; + this.serviceDurationMinutes = serviceDurationMinutes; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getServiceName() { + return serviceName; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public String getServiceDescription() { + return serviceDescription; + } + + public void setServiceDescription(String serviceDescription) { + this.serviceDescription = serviceDescription; + } + + public BigDecimal getServicePrice() { + return servicePrice; + } + + public void setServicePrice(BigDecimal servicePrice) { + this.servicePrice = servicePrice; + } + + public Integer getServiceDurationMinutes() { + return serviceDurationMinutes; + } + + public void setServiceDurationMinutes(Integer serviceDurationMinutes) { + this.serviceDurationMinutes = serviceDurationMinutes; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Service service = (Service) o; + return Objects.equals(id, service.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Service{" + + "id=" + id + + ", serviceName='" + serviceName + '\'' + + ", serviceDescription='" + serviceDescription + '\'' + + ", servicePrice=" + servicePrice + + ", serviceDurationMinutes=" + serviceDurationMinutes + + ", active=" + active + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Store.java b/src/main/java/com/petshop/backend/entity/Store.java index 8f9befe2..35861c87 100644 --- a/src/main/java/com/petshop/backend/entity/Store.java +++ b/src/main/java/com/petshop/backend/entity/Store.java @@ -4,12 +4,10 @@ import jakarta.persistence.*; import org.hibernate.annotations.CreationTimestamp; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "stores") - - - public class Store { @Id @@ -25,4 +23,69 @@ public class Store { @CreationTimestamp @Column(name = "created_at", updatable = false) private LocalDateTime createdAt; + + public Store() { + } + + public Store(Long id, String storeName, String storeLocation, LocalDateTime createdAt) { + this.id = id; + this.storeName = storeName; + this.storeLocation = storeLocation; + this.createdAt = createdAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getStoreLocation() { + return storeLocation; + } + + public void setStoreLocation(String storeLocation) { + this.storeLocation = storeLocation; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Store store = (Store) o; + return Objects.equals(id, store.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Store{" + + "id=" + id + + ", storeName='" + storeName + '\'' + + ", storeLocation='" + storeLocation + '\'' + + ", createdAt=" + createdAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/Supplier.java b/src/main/java/com/petshop/backend/entity/Supplier.java index 3aa5f66d..c0279738 100644 --- a/src/main/java/com/petshop/backend/entity/Supplier.java +++ b/src/main/java/com/petshop/backend/entity/Supplier.java @@ -5,12 +5,10 @@ import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "suppliers") - - - public class Supplier { @Id @@ -42,4 +40,119 @@ public class Supplier { @UpdateTimestamp @Column(name = "updated_at") private LocalDateTime updatedAt; + + public Supplier() { + } + + public Supplier(Long id, String supplierName, String supplierContact, String supplierEmail, String supplierPhone, String supplierAddress, Boolean active, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.supplierName = supplierName; + this.supplierContact = supplierContact; + this.supplierEmail = supplierEmail; + this.supplierPhone = supplierPhone; + this.supplierAddress = supplierAddress; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public String getSupplierContact() { + return supplierContact; + } + + public void setSupplierContact(String supplierContact) { + this.supplierContact = supplierContact; + } + + public String getSupplierEmail() { + return supplierEmail; + } + + public void setSupplierEmail(String supplierEmail) { + this.supplierEmail = supplierEmail; + } + + public String getSupplierPhone() { + return supplierPhone; + } + + public void setSupplierPhone(String supplierPhone) { + this.supplierPhone = supplierPhone; + } + + public String getSupplierAddress() { + return supplierAddress; + } + + public void setSupplierAddress(String supplierAddress) { + this.supplierAddress = supplierAddress; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + Supplier supplier = (Supplier) o; + return Objects.equals(id, supplier.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "Supplier{" + + "id=" + id + + ", supplierName='" + supplierName + '\'' + + ", supplierContact='" + supplierContact + '\'' + + ", supplierEmail='" + supplierEmail + '\'' + + ", supplierPhone='" + supplierPhone + '\'' + + ", supplierAddress='" + supplierAddress + '\'' + + ", active=" + active + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/entity/User.java b/src/main/java/com/petshop/backend/entity/User.java index 22674b64..7d6901a8 100644 --- a/src/main/java/com/petshop/backend/entity/User.java +++ b/src/main/java/com/petshop/backend/entity/User.java @@ -5,12 +5,10 @@ import org.hibernate.annotations.CreationTimestamp; import org.hibernate.annotations.UpdateTimestamp; import java.time.LocalDateTime; +import java.util.Objects; @Entity @Table(name = "users") - - - public class User { @Id @@ -47,4 +45,119 @@ public class User { public enum Role { STAFF, ADMIN } + + public User() { + } + + public User(Long id, String username, String password, String fullName, String email, Role role, Boolean active, LocalDateTime createdAt, LocalDateTime updatedAt) { + this.id = id; + this.username = username; + this.password = password; + this.fullName = fullName; + this.email = email; + this.role = role; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getFullName() { + return fullName; + } + + public void setFullName(String fullName) { + this.fullName = fullName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Role getRole() { + return role; + } + + public void setRole(Role role) { + this.role = role; + } + + public Boolean getActive() { + return active; + } + + public void setActive(Boolean active) { + this.active = active; + } + + public LocalDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(LocalDateTime createdAt) { + this.createdAt = createdAt; + } + + public LocalDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(LocalDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + User user = (User) o; + return Objects.equals(id, user.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + return "User{" + + "id=" + id + + ", username='" + username + '\'' + + ", password='" + password + '\'' + + ", fullName='" + fullName + '\'' + + ", email='" + email + '\'' + + ", role=" + role + + ", active=" + active + + ", createdAt=" + createdAt + + ", updatedAt=" + updatedAt + + '}'; + } } diff --git a/src/main/java/com/petshop/backend/security/JwtAuthenticationFilter.java b/src/main/java/com/petshop/backend/security/JwtAuthenticationFilter.java index 9ef6610b..02e967aa 100644 --- a/src/main/java/com/petshop/backend/security/JwtAuthenticationFilter.java +++ b/src/main/java/com/petshop/backend/security/JwtAuthenticationFilter.java @@ -16,12 +16,16 @@ import org.springframework.web.filter.OncePerRequestFilter; import java.io.IOException; @Component - public class JwtAuthenticationFilter extends OncePerRequestFilter { private final JwtUtil jwtUtil; private final UserDetailsService userDetailsService; + public JwtAuthenticationFilter(JwtUtil jwtUtil, UserDetailsService userDetailsService) { + this.jwtUtil = jwtUtil; + this.userDetailsService = userDetailsService; + } + @Override protected void doFilterInternal( @NonNull HttpServletRequest request, diff --git a/src/main/java/com/petshop/backend/security/SecurityConfig.java b/src/main/java/com/petshop/backend/security/SecurityConfig.java index 573281ec..dadf9d93 100644 --- a/src/main/java/com/petshop/backend/security/SecurityConfig.java +++ b/src/main/java/com/petshop/backend/security/SecurityConfig.java @@ -21,12 +21,16 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic @Configuration @EnableWebSecurity @EnableMethodSecurity - public class SecurityConfig { private final JwtAuthenticationFilter jwtAuthFilter; private final UserDetailsService userDetailsService; + public SecurityConfig(JwtAuthenticationFilter jwtAuthFilter, UserDetailsService userDetailsService) { + this.jwtAuthFilter = jwtAuthFilter; + this.userDetailsService = userDetailsService; + } + @Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { http diff --git a/src/main/java/com/petshop/backend/security/UserDetailsServiceImpl.java b/src/main/java/com/petshop/backend/security/UserDetailsServiceImpl.java index 09dd2d5b..d2bdcfff 100644 --- a/src/main/java/com/petshop/backend/security/UserDetailsServiceImpl.java +++ b/src/main/java/com/petshop/backend/security/UserDetailsServiceImpl.java @@ -11,11 +11,14 @@ import org.springframework.stereotype.Service; import java.util.Collections; @Service - public class UserDetailsServiceImpl implements UserDetailsService { private final UserRepository userRepository; + public UserDetailsServiceImpl(UserRepository userRepository) { + this.userRepository = userRepository; + } + @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username) diff --git a/src/main/java/com/petshop/backend/service/AdoptionService.java b/src/main/java/com/petshop/backend/service/AdoptionService.java index 089bc164..021e058a 100644 --- a/src/main/java/com/petshop/backend/service/AdoptionService.java +++ b/src/main/java/com/petshop/backend/service/AdoptionService.java @@ -16,13 +16,18 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class AdoptionService { private final AdoptionRepository adoptionRepository; private final PetRepository petRepository; private final CustomerRepository customerRepository; + public AdoptionService(AdoptionRepository adoptionRepository, PetRepository petRepository, CustomerRepository customerRepository) { + this.adoptionRepository = adoptionRepository; + this.petRepository = petRepository; + this.customerRepository = customerRepository; + } + public Page getAllAdoptions(Pageable pageable) { return adoptionRepository.findAll(pageable).map(this::mapToResponse); } diff --git a/src/main/java/com/petshop/backend/service/AppointmentService.java b/src/main/java/com/petshop/backend/service/AppointmentService.java index fcd7eaed..5244c5f1 100644 --- a/src/main/java/com/petshop/backend/service/AppointmentService.java +++ b/src/main/java/com/petshop/backend/service/AppointmentService.java @@ -22,7 +22,6 @@ import java.util.Set; import java.util.stream.Collectors; @Service - public class AppointmentService { private final AppointmentRepository appointmentRepository; @@ -30,6 +29,13 @@ public class AppointmentService { private final ServiceRepository serviceRepository; private final PetRepository petRepository; + public AppointmentService(AppointmentRepository appointmentRepository, CustomerRepository customerRepository, ServiceRepository serviceRepository, PetRepository petRepository) { + this.appointmentRepository = appointmentRepository; + this.customerRepository = customerRepository; + this.serviceRepository = serviceRepository; + this.petRepository = petRepository; + } + public Page getAllAppointments(Pageable pageable) { return appointmentRepository.findAll(pageable).map(this::mapToResponse); } diff --git a/src/main/java/com/petshop/backend/service/CategoryService.java b/src/main/java/com/petshop/backend/service/CategoryService.java index f8fdf7e8..b575a8eb 100644 --- a/src/main/java/com/petshop/backend/service/CategoryService.java +++ b/src/main/java/com/petshop/backend/service/CategoryService.java @@ -12,11 +12,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class CategoryService { private final CategoryRepository categoryRepository; + public CategoryService(CategoryRepository categoryRepository) { + this.categoryRepository = categoryRepository; + } + public Page getAllCategories(String query, Pageable pageable) { Page categories; if (query != null && !query.trim().isEmpty()) { diff --git a/src/main/java/com/petshop/backend/service/CustomerService.java b/src/main/java/com/petshop/backend/service/CustomerService.java index 608aa535..7b826a72 100644 --- a/src/main/java/com/petshop/backend/service/CustomerService.java +++ b/src/main/java/com/petshop/backend/service/CustomerService.java @@ -12,11 +12,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class CustomerService { private final CustomerRepository customerRepository; + public CustomerService(CustomerRepository customerRepository) { + this.customerRepository = customerRepository; + } + public Page getAllCustomers(String query, Pageable pageable) { Page customers; if (query != null && !query.trim().isEmpty()) { diff --git a/src/main/java/com/petshop/backend/service/InventoryService.java b/src/main/java/com/petshop/backend/service/InventoryService.java index d2a4395d..4aa368a2 100644 --- a/src/main/java/com/petshop/backend/service/InventoryService.java +++ b/src/main/java/com/petshop/backend/service/InventoryService.java @@ -18,13 +18,18 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; @Service - public class InventoryService { private final InventoryRepository inventoryRepository; private final ProductRepository productRepository; private final StoreRepository storeRepository; + public InventoryService(InventoryRepository inventoryRepository, ProductRepository productRepository, StoreRepository storeRepository) { + this.inventoryRepository = inventoryRepository; + this.productRepository = productRepository; + this.storeRepository = storeRepository; + } + public Page getAllInventory(Pageable pageable) { return inventoryRepository.findAll(pageable).map(this::mapToResponse); } diff --git a/src/main/java/com/petshop/backend/service/PetService.java b/src/main/java/com/petshop/backend/service/PetService.java index 0509f346..3c40a161 100644 --- a/src/main/java/com/petshop/backend/service/PetService.java +++ b/src/main/java/com/petshop/backend/service/PetService.java @@ -12,11 +12,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class PetService { private final PetRepository petRepository; + public PetService(PetRepository petRepository) { + this.petRepository = petRepository; + } + public Page getAllPets(String query, Pageable pageable) { Page pets; if (query != null && !query.trim().isEmpty()) { diff --git a/src/main/java/com/petshop/backend/service/ProductService.java b/src/main/java/com/petshop/backend/service/ProductService.java index 2b7646de..423249a5 100644 --- a/src/main/java/com/petshop/backend/service/ProductService.java +++ b/src/main/java/com/petshop/backend/service/ProductService.java @@ -14,12 +14,16 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class ProductService { private final ProductRepository productRepository; private final CategoryRepository categoryRepository; + public ProductService(ProductRepository productRepository, CategoryRepository categoryRepository) { + this.productRepository = productRepository; + this.categoryRepository = categoryRepository; + } + public Page getAllProducts(String query, Pageable pageable) { Page products; if (query != null && !query.trim().isEmpty()) { diff --git a/src/main/java/com/petshop/backend/service/ProductSupplierService.java b/src/main/java/com/petshop/backend/service/ProductSupplierService.java index c93c5899..3b87ef61 100644 --- a/src/main/java/com/petshop/backend/service/ProductSupplierService.java +++ b/src/main/java/com/petshop/backend/service/ProductSupplierService.java @@ -16,13 +16,18 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class ProductSupplierService { private final ProductSupplierRepository productSupplierRepository; private final ProductRepository productRepository; private final SupplierRepository supplierRepository; + public ProductSupplierService(ProductSupplierRepository productSupplierRepository, ProductRepository productRepository, SupplierRepository supplierRepository) { + this.productSupplierRepository = productSupplierRepository; + this.productRepository = productRepository; + this.supplierRepository = supplierRepository; + } + public Page getAllProductSuppliers(Pageable pageable) { return productSupplierRepository.findAll(pageable).map(this::mapToResponse); } diff --git a/src/main/java/com/petshop/backend/service/PurchaseOrderService.java b/src/main/java/com/petshop/backend/service/PurchaseOrderService.java index d3ecd74a..d87b2f6f 100644 --- a/src/main/java/com/petshop/backend/service/PurchaseOrderService.java +++ b/src/main/java/com/petshop/backend/service/PurchaseOrderService.java @@ -14,11 +14,14 @@ import java.util.List; import java.util.stream.Collectors; @Service - public class PurchaseOrderService { private final PurchaseOrderRepository purchaseOrderRepository; + public PurchaseOrderService(PurchaseOrderRepository purchaseOrderRepository) { + this.purchaseOrderRepository = purchaseOrderRepository; + } + public Page getAllPurchaseOrders(Pageable pageable) { return purchaseOrderRepository.findAll(pageable).map(this::mapToResponse); } diff --git a/src/main/java/com/petshop/backend/service/RefundService.java b/src/main/java/com/petshop/backend/service/RefundService.java index 1758d732..ae378996 100644 --- a/src/main/java/com/petshop/backend/service/RefundService.java +++ b/src/main/java/com/petshop/backend/service/RefundService.java @@ -16,7 +16,6 @@ import java.util.ArrayList; import java.util.List; @Service - public class RefundService { private final RefundRepository refundRepository; @@ -25,6 +24,14 @@ public class RefundService { private final InventoryRepository inventoryRepository; private final UserRepository userRepository; + public RefundService(RefundRepository refundRepository, SaleRepository saleRepository, SaleItemRepository saleItemRepository, InventoryRepository inventoryRepository, UserRepository userRepository) { + this.refundRepository = refundRepository; + this.saleRepository = saleRepository; + this.saleItemRepository = saleItemRepository; + this.inventoryRepository = inventoryRepository; + this.userRepository = userRepository; + } + @Transactional public RefundResponse createRefund(Long saleId, RefundRequest request) { String username = SecurityContextHolder.getContext().getAuthentication().getName(); diff --git a/src/main/java/com/petshop/backend/service/SaleService.java b/src/main/java/com/petshop/backend/service/SaleService.java index d74b6fa8..b5db6959 100644 --- a/src/main/java/com/petshop/backend/service/SaleService.java +++ b/src/main/java/com/petshop/backend/service/SaleService.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.List; @Service - public class SaleService { private final SaleRepository saleRepository; @@ -28,6 +27,15 @@ public class SaleService { private final InventoryRepository inventoryRepository; private final UserRepository userRepository; + public SaleService(SaleRepository saleRepository, ProductRepository productRepository, CustomerRepository customerRepository, StoreRepository storeRepository, InventoryRepository inventoryRepository, UserRepository userRepository) { + this.saleRepository = saleRepository; + this.productRepository = productRepository; + this.customerRepository = customerRepository; + this.storeRepository = storeRepository; + this.inventoryRepository = inventoryRepository; + this.userRepository = userRepository; + } + public Page getAllSales(Pageable pageable) { return saleRepository.findAll(pageable).map(this::mapToResponse); } diff --git a/src/main/java/com/petshop/backend/service/ServiceService.java b/src/main/java/com/petshop/backend/service/ServiceService.java index e01b2092..72e5662f 100644 --- a/src/main/java/com/petshop/backend/service/ServiceService.java +++ b/src/main/java/com/petshop/backend/service/ServiceService.java @@ -11,11 +11,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class ServiceService { private final ServiceRepository serviceRepository; + public ServiceService(ServiceRepository serviceRepository) { + this.serviceRepository = serviceRepository; + } + public Page getAllServices(String query, Pageable pageable) { Page services; if (query != null && !query.trim().isEmpty()) { diff --git a/src/main/java/com/petshop/backend/service/SupplierService.java b/src/main/java/com/petshop/backend/service/SupplierService.java index 91daaa35..c7cdefaa 100644 --- a/src/main/java/com/petshop/backend/service/SupplierService.java +++ b/src/main/java/com/petshop/backend/service/SupplierService.java @@ -12,11 +12,14 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class SupplierService { private final SupplierRepository supplierRepository; + public SupplierService(SupplierRepository supplierRepository) { + this.supplierRepository = supplierRepository; + } + public Page getAllSuppliers(String query, Pageable pageable) { Page suppliers; if (query != null && !query.trim().isEmpty()) { diff --git a/src/main/java/com/petshop/backend/service/UserService.java b/src/main/java/com/petshop/backend/service/UserService.java index e9e7c3e9..1183ea2f 100644 --- a/src/main/java/com/petshop/backend/service/UserService.java +++ b/src/main/java/com/petshop/backend/service/UserService.java @@ -13,12 +13,16 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service - public class UserService { private final UserRepository userRepository; private final PasswordEncoder passwordEncoder; + public UserService(UserRepository userRepository, PasswordEncoder passwordEncoder) { + this.userRepository = userRepository; + this.passwordEncoder = passwordEncoder; + } + public Page getAllUsers(Pageable pageable) { return userRepository.findAll(pageable).map(this::mapToResponse); }