diff --git a/PHASE_7_CHECKLIST.md b/PHASE_7_CHECKLIST.md new file mode 100644 index 00000000..304ad5b5 --- /dev/null +++ b/PHASE_7_CHECKLIST.md @@ -0,0 +1,331 @@ +# Phase 7: Service & DTO Update Checklist + +## Overview +All entity schemas have been updated. This checklist covers required changes to compile the application. + +--- + +## 1. Store → StoreLocation Updates + +### Repositories +- [x] `StoreRepository.java` - Updated to use StoreLocation + +### Services +- [ ] `StoreService.java` + - [ ] Change all `Store` → `StoreLocation` + - [ ] Update field references: `store.getStoreLocation()` → `store.getAddress()` + - [ ] Update DTOs to match StoreLocation fields + +- [ ] `SaleService.java` + - [ ] Change `Store store` → `StoreLocation store` + - [ ] Update `.getStore()` → returns StoreLocation + - [ ] Update DTO mappings + +- [ ] `InventoryService.java` + - [ ] Remove all Store/storeId references (inventory is now global) + - [ ] Update queries to remove store filtering + +- [ ] `AnalyticsService.java` + - [ ] Update Store references to StoreLocation + +### DTOs +- [ ] `dto/store/StoreRequest.java` → rename/update to StoreLocationRequest + - [ ] Update fields: add `address`, `phone`, `email` + - [ ] Remove `storeLocation` field + +- [ ] `dto/store/StoreResponse.java` → rename/update to StoreLocationResponse + - [ ] Change all field names to match StoreLocation entity + +- [ ] `dto/sale/SaleResponse.java` + - [ ] Update Store references to StoreLocation + +- [ ] `dto/inventory/InventoryResponse.java` + - [ ] Remove `storeId` and `storeName` fields + +### Controllers +- [ ] `StoreController.java` + - [ ] Update all Store references to StoreLocation + +--- + +## 2. User → Employee Updates (Sales) + +### Services +- [ ] `SaleService.java` + - [ ] Change `User employee` → `Employee employee` + - [ ] Update repository/entity references + - [ ] Map employee fields correctly (employeeId, firstName, lastName) + +### DTOs +- [ ] `dto/sale/SaleRequest.java` + - [ ] Change `userId` → `employeeId` + +- [ ] `dto/sale/SaleResponse.java` + - [ ] Add employee details (firstName, lastName, not username/fullName) + +--- + +## 3. ID Field Name Changes + +### All Services - Update getter/setter calls: + +- [ ] `PetService.java` + - [ ] `.getId()` → `.getPetId()` + - [ ] `.setId()` → `.setPetId()` + +- [ ] `CustomerService.java` + - [ ] `.getId()` → `.getCustomerId()` + - [ ] `.setId()` → `.setCustomerId()` + +- [ ] `ProductService.java` + - [ ] `.getId()` → `.getProdId()` + - [ ] `.setId()` → `.setProdId()` + +- [ ] `SupplierService.java` + - [ ] `.getId()` → `.getSupId()` + - [ ] `.setId()` → `.setSupId()` + +- [ ] `CategoryService.java` + - [ ] `.getId()` → `.getCategoryId()` + - [ ] `.setId()` → `.setCategoryId()` + +- [ ] `ServiceService.java` (service for Service entity) + - [ ] `.getId()` → `.getServiceId()` + - [ ] `.setId()` → `.setServiceId()` + +- [ ] `AdoptionService.java` + - [ ] `.getId()` → `.getAdoptionId()` + - [ ] `.setId()` → `.setAdoptionId()` + +- [ ] `AppointmentService.java` + - [ ] `.getId()` → `.getAppointmentId()` + - [ ] `.setId()` → `.setAppointmentId()` + +- [ ] `SaleService.java` + - [ ] `.getId()` → `.getSaleId()` + - [ ] `.setId()` → `.setSaleId()` + +- [ ] `SaleItemRepository.java` / `SaleService.java` + - [ ] `.getId()` → `.getSaleItemId()` + +- [ ] `InventoryService.java` + - [ ] `.getId()` → `.getInventoryId()` + +- [ ] `PurchaseOrderService.java` + - [ ] `.getId()` → `.getPurchaseOrderId()` + - [ ] `.setId()` → `.setPurchaseOrderId()` + +### All DTOs - Update field names: +- [ ] All Response DTOs: change `id` → specific ID field (`petId`, `customerId`, etc.) +- [ ] All Request DTOs: update ID references accordingly + +--- + +## 4. Enum → String Conversions + +### Services + +- [ ] `PetService.java` + - [ ] Remove `Pet.PetStatus` enum references + - [ ] Use `String` for status + - [ ] Update validation to check string values ("Available", "Adopted", etc.) + +- [ ] `AppointmentService.java` + - [ ] Remove `Appointment.AppointmentStatus` enum + - [ ] Use `String` for appointmentStatus + - [ ] Update validation to check string values ("Booked", "Completed", "Cancelled") + +- [ ] `PurchaseOrderService.java` + - [ ] Remove `PurchaseOrder.OrderStatus` enum + - [ ] Use `String` for status + - [ ] Update validation to check string values ("Pending", "Delivered", etc.) + +### DTOs + +- [ ] `dto/pet/PetRequest.java` & `PetResponse.java` + - [ ] Change `PetStatus status` → `String petStatus` + +- [ ] `dto/appointment/AppointmentRequest.java` & `AppointmentResponse.java` + - [ ] Change `AppointmentStatus status` → `String appointmentStatus` + +- [ ] `dto/purchaseorder/PurchaseOrderRequest.java` & `PurchaseOrderResponse.java` + - [ ] Change `OrderStatus status` → `String status` + +--- + +## 5. Removed Fields - Delete References + +### CustomerService.java & DTOs +- [ ] Remove `customerAddress` field +- [ ] Update `Customer` entity mappings + +### SupplierService.java & DTOs +- [ ] Remove `active` field +- [ ] Remove `supplierAddress` field +- [ ] Split contact: `supplierContact` → `supContactFirstName` + `supContactLastName` + +### ServiceService.java & DTOs +- [ ] Remove `active` field + +### ProductService.java & DTOs +- [ ] Remove `active` field + +### SaleService.java & DTOs +- [ ] Remove `customer` field (sales no longer track customer) +- [ ] Remove `subtotal` field +- [ ] Remove `tax` field +- [ ] Remove `notes` field +- [ ] Change `total` → `totalAmount` + +### SaleItemService/DTOs +- [ ] Remove `subtotal` field from SaleItem + +### InventoryService.java & DTOs +- [ ] Remove `reorderLevel` field +- [ ] Remove `lastRestocked` field + +### PurchaseOrderService.java & DTOs +- [ ] Remove `expectedDelivery` field +- [ ] Remove `totalAmount` field +- [ ] Remove `notes` field +- [ ] Remove `items` list (PurchaseOrderItem not in desktop schema) + +### AdoptionService.java & DTOs +- [ ] Remove `adoptionFee` field +- [ ] Remove `notes` field +- [ ] Add `adoptionStatus` field + +--- + +## 6. Renamed Fields (snake_case → camelCase) + +### Customer +- [ ] `customer_name` → split to `firstName` + `lastName` +- [ ] `customer_email` → `email` +- [ ] `customer_phone` → `phone` + +### Pet +- [ ] `pet_name` → `petName` +- [ ] `pet_species` → `petSpecies` +- [ ] `pet_breed` → `petBreed` +- [ ] `pet_age` → `petAge` +- [ ] `pet_status` → `petStatus` +- [ ] `pet_price` → `petPrice` + +### Product +- [ ] `product_name` → `prodName` +- [ ] `product_description` → `prodDesc` +- [ ] `product_price` → `prodPrice` +- [ ] `category_id` → `categoryId` (FK) + +### Supplier +- [ ] `supplier_name` → `supCompany` +- [ ] `supplier_contact` → `supContactFirstName` + `supContactLastName` +- [ ] `supplier_email` → `supEmail` +- [ ] `supplier_phone` → `supPhone` + +### Category +- [ ] `category_name` → `categoryName` +- [ ] `category_description` → `categoryType` + +### Service +- [ ] `service_name` → `serviceName` +- [ ] `service_description` → `serviceDesc` +- [ ] `service_price` → `servicePrice` +- [ ] `service_duration_minutes` → `serviceDuration` + +### Sale +- [ ] `sale_date` → `saleDate` +- [ ] `employee_id` → `employeeId` (FK) +- [ ] `store_id` → `storeId` (FK) +- [ ] `total` → `totalAmount` +- [ ] `payment_method` → `paymentMethod` +- [ ] Add `isRefund` field +- [ ] Add `originalSaleId` field (FK to sale) + +### SaleItem +- [ ] `sale_id` → `saleId` (FK) +- [ ] `product_id` → `prodId` (FK) +- [ ] `unit_price` → `unitPrice` + +### Appointment +- [ ] `appointment_date` → `appointmentDate` +- [ ] `appointment_time` → `appointmentTime` +- [ ] `status` → `appointmentStatus` +- [ ] Join table: `appointment_pets` → `appointmentPet` + +### Adoption +- [ ] `pet_id` → `petId` (FK) +- [ ] `customer_id` → `customerId` (FK) +- [ ] `adoption_date` → `adoptionDate` +- [ ] Add `adoptionStatus` + +### Inventory +- [ ] `product_id` → `prodId` (FK) + +### ProductSupplier +- [ ] `product_id` → `prodId` (FK) +- [ ] `supplier_id` → `supId` (FK) +- [ ] `cost_price` → `cost` + +### PurchaseOrder +- [ ] `supplier_id` → `supId` (FK) +- [ ] `order_date` → `orderDate` + +--- + +## 7. New Entities - Add Services/Controllers (Optional) + +These entities exist but may not need full CRUD yet: + +- [ ] `EmployeeService.java` - basic CRUD for employees +- [ ] `EmployeeController.java` - REST endpoints for employees +- [ ] `ActivityLogService.java` - logging service +- [ ] Employee/ActivityLog DTOs + +--- + +## 8. DropdownController Updates + +- [ ] `DropdownController.java` + - [ ] Update queries for renamed columns + - [ ] Update Store → StoreLocation references + - [ ] Fix any broken field references + +--- + +## 9. Validation & Error Messages + +After making all changes above: + +- [ ] Search codebase for any remaining references to removed fields +- [ ] Update validation error messages to use new field names +- [ ] Update API documentation (Swagger annotations) + +--- + +## Quick Search Commands + +Find remaining issues: +```bash +# Find Store references (should be StoreLocation) +grep -r "import.*\.Store;" src/main/java --include="*.java" + +# Find .getId() calls (should be specific IDs) +grep -r "\.getId()" src/main/java/com/petshop/backend/service + +# Find enum references +grep -r "PetStatus\|AppointmentStatus\|OrderStatus" src/main/java --include="*.java" + +# Find removed fields +grep -r "customerAddress\|subtotal\|active" src/main/java --include="*.java" +``` + +--- + +## Testing After Changes + +1. Verify compilation: `mvn clean compile` +2. Run tests: `mvn test` +3. Start services: `docker-compose up -d` +4. Test endpoints with updated field names