Restore complete implementations
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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<Page<AdoptionResponse>> getAllAdoptions(Pageable pageable) {
|
||||
return ResponseEntity.ok(adoptionService.getAllAdoptions(pageable));
|
||||
|
||||
@@ -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<Page<AppointmentResponse>> getAllAppointments(Pageable pageable) {
|
||||
return ResponseEntity.ok(appointmentService.getAllAppointments(pageable));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<Page<CategoryResponse>> getAllCategories(
|
||||
@RequestParam(required = false) String q,
|
||||
|
||||
@@ -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<Page<CustomerResponse>> getAllCustomers(
|
||||
@RequestParam(required = false) String q,
|
||||
|
||||
@@ -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<List<DropdownOption>> getPets() {
|
||||
return ResponseEntity.ok(
|
||||
|
||||
@@ -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<Page<InventoryResponse>> getAllInventory(Pageable pageable) {
|
||||
return ResponseEntity.ok(inventoryService.getAllInventory(pageable));
|
||||
|
||||
@@ -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<Page<PetResponse>> getAllPets(
|
||||
@RequestParam(required = false) String q,
|
||||
|
||||
@@ -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<Page<ProductResponse>> getAllProducts(
|
||||
@RequestParam(required = false) String q,
|
||||
|
||||
@@ -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<Page<ProductSupplierResponse>> getAllProductSuppliers(Pageable pageable) {
|
||||
return ResponseEntity.ok(productSupplierService.getAllProductSuppliers(pageable));
|
||||
|
||||
@@ -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<Page<PurchaseOrderResponse>> getAllPurchaseOrders(Pageable pageable) {
|
||||
return ResponseEntity.ok(purchaseOrderService.getAllPurchaseOrders(pageable));
|
||||
|
||||
@@ -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<RefundResponse> createRefund(
|
||||
@PathVariable Long saleId,
|
||||
|
||||
@@ -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<Page<SaleResponse>> getAllSales(Pageable pageable) {
|
||||
return ResponseEntity.ok(saleService.getAllSales(pageable));
|
||||
|
||||
@@ -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<Page<ServiceResponse>> getAllServices(
|
||||
@RequestParam(required = false) String q,
|
||||
|
||||
@@ -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<Page<SupplierResponse>> getAllSuppliers(
|
||||
@RequestParam(required = false) String q,
|
||||
|
||||
@@ -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<Page<UserResponse>> getAllUsers(Pageable pageable) {
|
||||
return ResponseEntity.ok(userService.getAllUsers(pageable));
|
||||
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<TopProduct> topProducts;
|
||||
private List<DailySales> dailySales;
|
||||
|
||||
public DashboardResponse() {
|
||||
}
|
||||
|
||||
public DashboardResponse(SalesSummary salesSummary, InventorySummary inventorySummary, List<TopProduct> topProducts, List<DailySales> 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<TopProduct> getTopProducts() {
|
||||
return topProducts;
|
||||
}
|
||||
|
||||
public void setTopProducts(List<TopProduct> topProducts) {
|
||||
this.topProducts = topProducts;
|
||||
}
|
||||
|
||||
public List<DailySales> getDailySales() {
|
||||
return dailySales;
|
||||
}
|
||||
|
||||
public void setDailySales(List<DailySales> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Long> 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<Long> getPetIds() {
|
||||
return petIds;
|
||||
}
|
||||
|
||||
public void setPetIds(List<Long> 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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String> petNames, List<Long> 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<String> getPetNames() {
|
||||
return petNames;
|
||||
}
|
||||
|
||||
public void setPetNames(List<String> petNames) {
|
||||
this.petNames = petNames;
|
||||
}
|
||||
|
||||
public List<Long> getPetIds() {
|
||||
return petIds;
|
||||
}
|
||||
|
||||
public void setPetIds(List<Long> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Long> ids;
|
||||
|
||||
public List<Long> getIds() {
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setIds(List<Long> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<ProductSupplierKey> keys;
|
||||
|
||||
public List<ProductSupplierKey> getKeys() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
public void setKeys(List<ProductSupplierKey> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PurchaseOrderItemResponse> 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<PurchaseOrderItemResponse> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<PurchaseOrderItemResponse> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<RefundItemRequest> items;
|
||||
|
||||
private String refundReason;
|
||||
|
||||
public List<RefundItemRequest> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<RefundItemRequest> 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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<RefundItemResponse> items;
|
||||
private LocalDateTime createdAt;
|
||||
|
||||
|
||||
|
||||
|
||||
public RefundResponse() {
|
||||
}
|
||||
|
||||
public RefundResponse(Long id, Long saleId, LocalDateTime refundDate, BigDecimal refundAmount, String refundReason, Long processedBy, String processedByName, List<RefundItemResponse> 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<RefundItemResponse> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<RefundItemResponse> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<SaleItemRequest> 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<SaleItemRequest> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<SaleItemRequest> 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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<SaleItemResponse> 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<SaleItemResponse> 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<SaleItemResponse> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<SaleItemResponse> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Pet> 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<Pet> getPets() {
|
||||
return pets;
|
||||
}
|
||||
|
||||
public void setPets(Set<Pet> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PurchaseOrderItem> 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<PurchaseOrderItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<PurchaseOrderItem> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<RefundItem> 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<RefundItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<RefundItem> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<SaleItem> 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<SaleItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<SaleItem> 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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<AdoptionResponse> getAllAdoptions(Pageable pageable) {
|
||||
return adoptionRepository.findAll(pageable).map(this::mapToResponse);
|
||||
}
|
||||
|
||||
@@ -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<AppointmentResponse> getAllAppointments(Pageable pageable) {
|
||||
return appointmentRepository.findAll(pageable).map(this::mapToResponse);
|
||||
}
|
||||
|
||||
@@ -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<CategoryResponse> getAllCategories(String query, Pageable pageable) {
|
||||
Page<Category> categories;
|
||||
if (query != null && !query.trim().isEmpty()) {
|
||||
|
||||
@@ -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<CustomerResponse> getAllCustomers(String query, Pageable pageable) {
|
||||
Page<Customer> customers;
|
||||
if (query != null && !query.trim().isEmpty()) {
|
||||
|
||||
@@ -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<InventoryResponse> getAllInventory(Pageable pageable) {
|
||||
return inventoryRepository.findAll(pageable).map(this::mapToResponse);
|
||||
}
|
||||
|
||||
@@ -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<PetResponse> getAllPets(String query, Pageable pageable) {
|
||||
Page<Pet> pets;
|
||||
if (query != null && !query.trim().isEmpty()) {
|
||||
|
||||
@@ -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<ProductResponse> getAllProducts(String query, Pageable pageable) {
|
||||
Page<Product> products;
|
||||
if (query != null && !query.trim().isEmpty()) {
|
||||
|
||||
@@ -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<ProductSupplierResponse> getAllProductSuppliers(Pageable pageable) {
|
||||
return productSupplierRepository.findAll(pageable).map(this::mapToResponse);
|
||||
}
|
||||
|
||||
@@ -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<PurchaseOrderResponse> getAllPurchaseOrders(Pageable pageable) {
|
||||
return purchaseOrderRepository.findAll(pageable).map(this::mapToResponse);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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<SaleResponse> getAllSales(Pageable pageable) {
|
||||
return saleRepository.findAll(pageable).map(this::mapToResponse);
|
||||
}
|
||||
|
||||
@@ -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<ServiceResponse> getAllServices(String query, Pageable pageable) {
|
||||
Page<com.petshop.backend.entity.Service> services;
|
||||
if (query != null && !query.trim().isEmpty()) {
|
||||
|
||||
@@ -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<SupplierResponse> getAllSuppliers(String query, Pageable pageable) {
|
||||
Page<Supplier> suppliers;
|
||||
if (query != null && !query.trim().isEmpty()) {
|
||||
|
||||
@@ -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<UserResponse> getAllUsers(Pageable pageable) {
|
||||
return userRepository.findAll(pageable).map(this::mapToResponse);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user