From 01550bac30260179939a6cb6a46d4245c8d9596f Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Sun, 29 Mar 2026 22:54:16 -0600 Subject: [PATCH 1/3] Expand pet product data --- .../V11__expand_pet_product_seed.sql | 389 ++++++++++++++++++ 1 file changed, 389 insertions(+) create mode 100644 backend/src/main/resources/db/migration/V11__expand_pet_product_seed.sql diff --git a/backend/src/main/resources/db/migration/V11__expand_pet_product_seed.sql b/backend/src/main/resources/db/migration/V11__expand_pet_product_seed.sql new file mode 100644 index 00000000..f2ca3259 --- /dev/null +++ b/backend/src/main/resources/db/migration/V11__expand_pet_product_seed.sql @@ -0,0 +1,389 @@ +-- Expand pet and product seed data + +INSERT INTO pet (petName, petSpecies, petBreed, petAge, petStatus, petPrice) +VALUES +('Rocky', 'Dog', 'German Shepherd', 1, 'Available', 475.00), +('Daisy', 'Dog', 'Poodle', 2, 'Available', 512.00), +('Cooper', 'Dog', 'Bulldog', 3, 'Available', 560.00), +('Ruby', 'Dog', 'Boxer', 4, 'Available', 575.00), +('Tucker', 'Dog', 'Dachshund', 5, 'Available', 634.00), +('Rosie', 'Dog', 'Shih Tzu', 1, 'Available', 660.00), +('Bear', 'Dog', 'Rottweiler', 2, 'Available', 686.00), +('Maggie', 'Dog', 'Corgi', 3, 'Available', 745.00), +('Leo', 'Dog', 'Husky', 4, 'Available', 749.00), +('Penny', 'Dog', 'Border Collie', 5, 'Available', 808.00), +('Jax', 'Dog', 'German Shepherd', 1, 'Available', 823.00), +('Nala', 'Dog', 'Poodle', 2, 'Available', 871.00), +('Finn', 'Dog', 'Bulldog', 3, 'Available', 447.00), +('Sadie', 'Dog', 'Boxer', 4, 'Available', 495.00), +('Ace', 'Dog', 'Dachshund', 5, 'Available', 510.00), +('Zoe', 'Dog', 'Shih Tzu', 1, 'Available', 547.00), +('Ollie', 'Dog', 'Rottweiler', 2, 'Available', 606.00), +('Millie', 'Dog', 'Corgi', 3, 'Available', 654.00), +('Murphy', 'Dog', 'Husky', 4, 'Available', 691.00), +('Willow', 'Dog', 'Border Collie', 5, 'Available', 728.00), +('Bentley', 'Dog', 'German Shepherd', 1, 'Available', 776.00), +('Lily', 'Dog', 'Poodle', 2, 'Available', 780.00), +('Scout', 'Dog', 'Bulldog', 3, 'Available', 828.00), +('Gracie', 'Dog', 'Boxer', 4, 'Available', 876.00), +('Ranger', 'Dog', 'Dachshund', 5, 'Available', 452.00), +('Hazel', 'Dog', 'Shih Tzu', 1, 'Available', 478.00), +('Moose', 'Dog', 'Rottweiler', 2, 'Available', 515.00), +('Mia', 'Dog', 'Corgi', 3, 'Available', 530.00), +('Simba', 'Cat', 'Ragdoll', 1, 'Available', 295.00), +('Cleo', 'Cat', 'Bengal', 2, 'Available', 321.00), +('Oreo', 'Cat', 'British Shorthair', 3, 'Available', 358.00), +('Pepper', 'Cat', 'Sphynx', 4, 'Available', 417.00), +('Jasper', 'Cat', 'Scottish Fold', 5, 'Available', 454.00), +('Phoebe', 'Cat', 'Russian Blue', 1, 'Available', 491.00), +('Shadow', 'Cat', 'Abyssinian', 2, 'Available', 528.00), +('Mochi', 'Cat', 'Birman', 3, 'Available', 554.00), +('Louie', 'Cat', 'Ragdoll', 4, 'Available', 591.00), +('Ivy', 'Cat', 'Bengal', 5, 'Available', 606.00), +('Theo', 'Cat', 'British Shorthair', 1, 'Available', 654.00), +('Piper', 'Cat', 'Sphynx', 2, 'Available', 251.00), +('Nova', 'Cat', 'Scottish Fold', 3, 'Available', 277.00), +('Archie', 'Cat', 'Russian Blue', 4, 'Available', 336.00), +('Olive', 'Cat', 'Abyssinian', 5, 'Available', 362.00), +('Boots', 'Cat', 'Birman', 1, 'Available', 399.00), +('Maple', 'Cat', 'Ragdoll', 2, 'Available', 436.00), +('Gizmo', 'Cat', 'Bengal', 3, 'Available', 473.00), +('Nina', 'Cat', 'British Shorthair', 4, 'Available', 499.00), +('Salem', 'Cat', 'Sphynx', 5, 'Available', 547.00), +('Stella', 'Cat', 'Scottish Fold', 1, 'Available', 595.00), +('Kiki', 'Cat', 'Russian Blue', 2, 'Available', 610.00), +('Sunny', 'Cat', 'Abyssinian', 3, 'Available', 658.00), +('Mabel', 'Cat', 'Birman', 4, 'Available', 244.00), +('Coco', 'Bird', 'Cockatiel', 1, 'Available', 119.00), +('Sky', 'Bird', 'Parakeet', 2, 'Available', 145.00), +('Sunny', 'Bird', 'Canary', 3, 'Available', 204.00), +('Kiwi', 'Bird', 'Lovebird', 1, 'Available', 230.00), +('Pico', 'Bird', 'Finch', 2, 'Available', 81.00), +('Blue', 'Bird', 'Conure', 3, 'Available', 118.00), +('Rio', 'Bird', 'Cockatiel', 1, 'Available', 144.00), +('Angel', 'Bird', 'Parakeet', 2, 'Available', 203.00), +('Chirpy', 'Bird', 'Canary', 3, 'Available', 251.00), +('Peach', 'Bird', 'Lovebird', 1, 'Available', 91.00), +('Mango', 'Bird', 'Finch', 2, 'Available', 128.00), +('Pearl', 'Bird', 'Conure', 3, 'Available', 165.00), +('Bubbles', 'Fish', 'Goldfish', 1, 'Available', 30.00), +('Splash', 'Fish', 'Betta', 2, 'Available', 56.00), +('Coral', 'Fish', 'Guppy', 1, 'Available', 23.00), +('Neptune', 'Fish', 'Molly', 2, 'Available', 23.00), +('Marlin', 'Fish', 'Tetra', 1, 'Available', 49.00), +('Finley', 'Fish', 'Angelfish', 2, 'Available', 27.00), +('Pebble', 'Fish', 'Goldfish', 1, 'Available', 64.00), +('Wave', 'Fish', 'Betta', 2, 'Available', 20.00), +('Aqua', 'Fish', 'Guppy', 1, 'Available', 57.00), +('Flash', 'Fish', 'Molly', 2, 'Available', 46.00), +('Nemo', 'Fish', 'Tetra', 1, 'Available', 13.00), +('Pearl', 'Fish', 'Angelfish', 2, 'Available', 61.00), +('Thumper', 'Rabbit', 'Mini Lop', 1, 'Available', 147.00), +('Clover', 'Rabbit', 'Netherland Dwarf', 2, 'Available', 173.00), +('Biscuit', 'Rabbit', 'Lionhead', 3, 'Adopted', 110.00), +('Hazel', 'Rabbit', 'Rex', 1, 'Adopted', 125.00), +('Juniper', 'Rabbit', 'Mini Lop', 2, 'Adopted', 73.00), +('Poppy', 'Rabbit', 'Netherland Dwarf', 3, 'Adopted', 88.00), +('Snowball', 'Rabbit', 'Lionhead', 1, 'Adopted', 158.00), +('Maple', 'Rabbit', 'Rex', 2, 'Adopted', 162.00), +('Peanut', 'Hamster', 'Syrian', 1, 'Adopted', 36.00), +('Nibbles', 'Hamster', 'Dwarf', 2, 'Adopted', 36.00), +('Pumpkin', 'Hamster', 'Roborovski', 1, 'Adopted', 25.00), +('Mocha', 'Hamster', 'Syrian', 2, 'Adopted', 40.00), +('Buttons', 'Hamster', 'Dwarf', 1, 'Pending', 51.00), +('Teddy', 'Hamster', 'Roborovski', 2, 'Pending', 18.00), +('Pip', 'Hamster', 'Syrian', 1, 'Pending', 33.00), +('Toffee', 'Hamster', 'Dwarf', 2, 'Pending', 55.00), +('Sprout', 'Hamster', 'Roborovski', 1, 'Pending', 44.00), +('Bean', 'Hamster', 'Syrian', 2, 'Pending', 59.00); + +INSERT INTO product (prodName, prodPrice, categoryId, prodDesc) +VALUES +('Chicken Recipe Dog Food', 42.00, 1, 'Nutritious food and treats for dogs'), +('Beef Feast Dog Food', 51.00, 1, 'Nutritious food and treats for dogs'), +('Salmon Blend Dog Food', 66.00, 1, 'Nutritious food and treats for dogs'), +('Lamb Dinner Dog Food', 78.00, 1, 'Nutritious food and treats for dogs'), +('Puppy Starter Kibble', 24.00, 1, 'Nutritious food and treats for dogs'), +('Senior Care Dog Food', 37.00, 1, 'Nutritious food and treats for dogs'), +('Small Breed Kibble', 48.00, 1, 'Nutritious food and treats for dogs'), +('Large Breed Kibble', 61.00, 1, 'Nutritious food and treats for dogs'), +('Grain Free Dog Food', 75.00, 1, 'Nutritious food and treats for dogs'), +('Turkey Rice Formula', 21.00, 1, 'Nutritious food and treats for dogs'), +('Duck Sweet Potato Meal', 37.00, 1, 'Nutritious food and treats for dogs'), +('Venison Protein Blend', 49.00, 1, 'Nutritious food and treats for dogs'), +('Healthy Weight Dog Food', 64.00, 1, 'Nutritious food and treats for dogs'), +('Sensitive Stomach Kibble', 78.00, 1, 'Nutritious food and treats for dogs'), +('High Energy Dog Food', 20.00, 1, 'Nutritious food and treats for dogs'), +('Organic Dog Biscuits', 33.00, 1, 'Nutritious food and treats for dogs'), +('Peanut Butter Dog Treats', 50.00, 1, 'Nutritious food and treats for dogs'), +('Dental Chew Sticks', 57.00, 1, 'Nutritious food and treats for dogs'), +('Training Treat Bites', 72.00, 1, 'Nutritious food and treats for dogs'), +('Soft Chicken Treats', 17.00, 1, 'Nutritious food and treats for dogs'), +('Pumpkin Fiber Treats', 31.00, 1, 'Nutritious food and treats for dogs'), +('Joint Support Biscuits', 46.00, 1, 'Nutritious food and treats for dogs'), +('Mini Breed Dinner', 54.00, 1, 'Nutritious food and treats for dogs'), +('Farmhouse Dog Meal', 68.00, 1, 'Nutritious food and treats for dogs'), +('Feather Teaser Wand', 8.00, 2, 'Play items for active cats'), +('Catnip Mouse Toy', 18.00, 2, 'Play items for active cats'), +('Jingle Ball Set', 30.00, 2, 'Play items for active cats'), +('Scratching Post Small', 20.00, 2, 'Play items for active cats'), +('Crinkle Tunnel', 26.00, 2, 'Play items for active cats'), +('Laser Pointer Toy', 13.00, 2, 'Play items for active cats'), +('Plush Fish Toy', 23.00, 2, 'Play items for active cats'), +('Spring Coil Pack', 9.00, 2, 'Play items for active cats'), +('Hanging Door Toy', 22.00, 2, 'Play items for active cats'), +('Interactive Puzzle Toy', 12.00, 2, 'Play items for active cats'), +('Catnip Kicker Toy', 20.00, 2, 'Play items for active cats'), +('Rolling Bell Ball', 4.00, 2, 'Play items for active cats'), +('Ribbon Chase Toy', 16.00, 2, 'Play items for active cats'), +('Mini Plush Mouse', 29.00, 2, 'Play items for active cats'), +('Treat Dispensing Ball', 18.00, 2, 'Play items for active cats'), +('Double Pom Toy', 24.00, 2, 'Play items for active cats'), +('Window Perch Toy', 10.00, 2, 'Play items for active cats'), +('Scratch Pad Refill', 25.00, 2, 'Play items for active cats'), +('Rainbow Wand Toy', 7.00, 2, 'Play items for active cats'), +('Carpet Scratcher', 20.00, 2, 'Play items for active cats'), +('Bird Perch Set', 41.00, 3, 'Care supplies for pet birds'), +('Parakeet Seed Mix', 57.00, 3, 'Care supplies for pet birds'), +('Canary Food Blend', 70.00, 3, 'Care supplies for pet birds'), +('Mineral Cuttlebone', 84.00, 3, 'Care supplies for pet birds'), +('Bird Ladder Toy', 94.00, 3, 'Care supplies for pet birds'), +('Mirror Bell Combo', 109.00, 3, 'Care supplies for pet birds'), +('Clip On Food Cup', 121.00, 3, 'Care supplies for pet birds'), +('Bird Cage Liner Pack', 18.00, 3, 'Care supplies for pet birds'), +('Nesting Material Pack', 32.00, 3, 'Care supplies for pet birds'), +('Treat Spray Millet', 42.00, 3, 'Care supplies for pet birds'), +('Wooden Swing Perch', 55.00, 3, 'Care supplies for pet birds'), +('Foraging Ball Toy', 67.00, 3, 'Care supplies for pet birds'), +('Cage Cleaning Spray', 82.00, 3, 'Care supplies for pet birds'), +('Parrot Rope Perch', 93.00, 3, 'Care supplies for pet birds'), +('Bird Bath Dish', 103.00, 3, 'Care supplies for pet birds'), +('Songbird Vitamin Drops', 124.00, 3, 'Care supplies for pet birds'), +('Aquarium Filter Cartridge', 58.00, 4, 'Essential aquarium equipment and accessories'), +('Decorative Aquarium Gravel', 72.00, 4, 'Essential aquarium equipment and accessories'), +('Fish Net Medium', 74.00, 4, 'Essential aquarium equipment and accessories'), +('Water Conditioner', 89.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Thermometer', 105.00, 4, 'Essential aquarium equipment and accessories'), +('LED Tank Light', 112.00, 4, 'Essential aquarium equipment and accessories'), +('Air Stone Pack', 125.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Heater 50W', 143.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Heater 100W', 157.00, 4, 'Essential aquarium equipment and accessories'), +('Fish Flake Food', 165.00, 4, 'Essential aquarium equipment and accessories'), +('Algae Scraper', 176.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Plant Set', 194.00, 4, 'Essential aquarium equipment and accessories'), +('Bubble Curtain Kit', 207.00, 4, 'Essential aquarium equipment and accessories'), +('Breeder Box Insert', 14.00, 4, 'Essential aquarium equipment and accessories'), +('Filter Sponge Pack', 27.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Background Roll', 46.00, 4, 'Essential aquarium equipment and accessories'), +('Glass Lid Clips', 50.00, 4, 'Essential aquarium equipment and accessories'), +('Submersible Pump', 64.00, 4, 'Essential aquarium equipment and accessories'), +('Hamster Bedding Pack', 60.00, 5, 'Supplies for small pets'), +('Rabbit Hay Bundle', 6.00, 5, 'Supplies for small pets'), +('Guinea Pig Pellets', 20.00, 5, 'Supplies for small pets'), +('Small Pet Water Bottle', 37.00, 5, 'Supplies for small pets'), +('Hamster Hideout Hut', 47.00, 5, 'Supplies for small pets'), +('Chew Stick Bundle', 58.00, 5, 'Supplies for small pets'), +('Rabbit Litter Tray', 8.00, 5, 'Supplies for small pets'), +('Exercise Ball Large', 22.00, 5, 'Supplies for small pets'), +('Small Pet Food Bowl', 35.00, 5, 'Supplies for small pets'), +('Timothy Hay Cubes', 46.00, 5, 'Supplies for small pets'), +('Guinea Pig Tunnel', 59.00, 5, 'Supplies for small pets'), +('Hamster Nesting Fluff', 12.00, 5, 'Supplies for small pets'), +('Rabbit Grooming Brush', 25.00, 5, 'Supplies for small pets'), +('Small Pet Carrier', 34.00, 5, 'Supplies for small pets'), +('Hay Rack Feeder', 45.00, 5, 'Supplies for small pets'), +('Wooden Chew Blocks', 61.00, 5, 'Supplies for small pets'); + +INSERT INTO productSupplier (supId, prodId, cost) +VALUES +(1, 7, 26.04), +(2, 8, 33.15), +(3, 9, 44.88), +(4, 10, 55.38), +(5, 11, 17.76), +(1, 12, 22.94), +(2, 13, 31.20), +(3, 14, 41.48), +(4, 15, 53.25), +(5, 16, 15.54), +(1, 17, 22.94), +(2, 18, 31.85), +(3, 19, 43.52), +(4, 20, 55.38), +(5, 21, 14.80), +(1, 22, 20.46), +(2, 23, 32.50), +(3, 24, 38.76), +(4, 25, 51.12), +(5, 26, 12.58), +(1, 27, 19.22), +(2, 28, 29.90), +(3, 29, 36.72), +(4, 30, 48.28), +(5, 31, 5.92), +(1, 32, 11.16), +(2, 33, 19.50), +(3, 34, 13.60), +(4, 35, 18.46), +(5, 36, 9.62), +(1, 37, 14.26), +(2, 38, 5.85), +(3, 39, 14.96), +(4, 40, 8.52), +(5, 41, 14.80), +(1, 42, 2.48), +(2, 43, 10.40), +(3, 44, 19.72), +(4, 45, 12.78), +(5, 46, 17.76), +(1, 47, 6.20), +(2, 48, 16.25), +(3, 49, 4.76), +(4, 50, 14.20), +(5, 51, 30.34), +(1, 52, 35.34), +(2, 53, 45.50), +(3, 54, 57.12), +(4, 55, 66.74), +(5, 56, 80.66), +(1, 57, 75.02), +(2, 58, 11.70), +(3, 59, 21.76), +(4, 60, 29.82), +(5, 61, 40.70), +(1, 62, 41.54), +(2, 63, 53.30), +(3, 64, 63.24), +(4, 65, 73.13), +(5, 66, 91.76), +(1, 67, 35.96), +(2, 68, 46.80), +(3, 69, 50.32), +(4, 70, 63.19), +(5, 71, 77.70), +(1, 72, 69.44), +(2, 73, 81.25), +(3, 74, 97.24), +(4, 75, 111.47), +(5, 76, 122.10), +(1, 77, 109.12), +(2, 78, 126.10), +(3, 79, 140.76), +(4, 80, 9.94), +(5, 81, 19.98), +(1, 82, 28.52), +(2, 83, 32.50), +(3, 84, 43.52), +(4, 85, 42.60), +(5, 86, 4.44), +(1, 87, 12.40), +(2, 88, 24.05), +(3, 89, 31.96), +(4, 90, 41.18), +(5, 91, 5.92), +(1, 92, 13.64), +(2, 93, 22.75), +(3, 94, 31.28), +(4, 95, 41.89), +(5, 96, 8.88), +(1, 97, 15.50), +(2, 98, 22.10), +(3, 99, 30.60), +(4, 100, 43.31); + +INSERT INTO inventory (prodId, quantity) +VALUES +(7, 120), +(8, 137), +(9, 154), +(10, 171), +(11, 128), +(12, 145), +(13, 162), +(14, 179), +(15, 136), +(16, 153), +(17, 170), +(18, 127), +(19, 144), +(20, 161), +(21, 178), +(22, 135), +(23, 152), +(24, 169), +(25, 126), +(26, 143), +(27, 160), +(28, 177), +(29, 134), +(30, 151), +(31, 228), +(32, 185), +(33, 202), +(34, 219), +(35, 236), +(36, 193), +(37, 210), +(38, 227), +(39, 184), +(40, 201), +(41, 218), +(42, 235), +(43, 192), +(44, 209), +(45, 226), +(46, 183), +(47, 200), +(48, 217), +(49, 234), +(50, 191), +(51, 98), +(52, 115), +(53, 72), +(54, 89), +(55, 106), +(56, 123), +(57, 80), +(58, 97), +(59, 114), +(60, 71), +(61, 88), +(62, 105), +(63, 122), +(64, 79), +(65, 96), +(66, 113), +(67, 45), +(68, 62), +(69, 79), +(70, 96), +(71, 53), +(72, 70), +(73, 87), +(74, 104), +(75, 61), +(76, 78), +(77, 95), +(78, 52), +(79, 69), +(80, 86), +(81, 103), +(82, 60), +(83, 77), +(84, 94), +(85, 101), +(86, 118), +(87, 135), +(88, 152), +(89, 109), +(90, 126), +(91, 143), +(92, 100), +(93, 117), +(94, 134), +(95, 151), +(96, 108), +(97, 125), +(98, 142), +(99, 99), +(100, 116); From d5fdee10d5d219e28689521919bcdd8c653d7ae4 Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Sun, 29 Mar 2026 22:54:25 -0600 Subject: [PATCH 2/3] Add pet product filters --- .../controller/CategoryController.java | 3 +- .../backend/controller/PetController.java | 4 +- .../backend/controller/ProductController.java | 3 +- .../repository/CategoryRepository.java | 6 +-- .../backend/repository/PetRepository.java | 8 ++-- .../backend/repository/ProductRepository.java | 6 +-- .../backend/service/CategoryService.java | 19 ++++---- .../petshop/backend/service/PetService.java | 19 ++++---- .../backend/service/ProductService.java | 19 ++++---- .../petshopdesktop/api/endpoints/PetApi.java | 12 ++++- .../api/endpoints/ProductApi.java | 9 +++- .../controllers/PetController.java | 39 +++++++++++++-- .../controllers/ProductController.java | 47 +++++++++++++++++-- .../petshopdesktop/modelviews/pet-view.fxml | 17 ++++--- .../modelviews/product-view.fxml | 16 ++++--- 15 files changed, 166 insertions(+), 61 deletions(-) diff --git a/backend/src/main/java/com/petshop/backend/controller/CategoryController.java b/backend/src/main/java/com/petshop/backend/controller/CategoryController.java index fb938dd9..bbce6ec9 100644 --- a/backend/src/main/java/com/petshop/backend/controller/CategoryController.java +++ b/backend/src/main/java/com/petshop/backend/controller/CategoryController.java @@ -25,8 +25,9 @@ public class CategoryController { @GetMapping public ResponseEntity> getAllCategories( @RequestParam(required = false) String q, + @RequestParam(required = false) String type, Pageable pageable) { - return ResponseEntity.ok(categoryService.getAllCategories(q, pageable)); + return ResponseEntity.ok(categoryService.getAllCategories(q, type, pageable)); } @GetMapping("/{id}") diff --git a/backend/src/main/java/com/petshop/backend/controller/PetController.java b/backend/src/main/java/com/petshop/backend/controller/PetController.java index 259b0f89..9fb93f0b 100644 --- a/backend/src/main/java/com/petshop/backend/controller/PetController.java +++ b/backend/src/main/java/com/petshop/backend/controller/PetController.java @@ -25,8 +25,10 @@ public class PetController { @GetMapping public ResponseEntity> getAllPets( @RequestParam(required = false) String q, + @RequestParam(required = false) String species, + @RequestParam(required = false) String status, Pageable pageable) { - return ResponseEntity.ok(petService.getAllPets(q, pageable)); + return ResponseEntity.ok(petService.getAllPets(q, species, status, pageable)); } @GetMapping("/{id}") diff --git a/backend/src/main/java/com/petshop/backend/controller/ProductController.java b/backend/src/main/java/com/petshop/backend/controller/ProductController.java index 6531c72d..418d113a 100644 --- a/backend/src/main/java/com/petshop/backend/controller/ProductController.java +++ b/backend/src/main/java/com/petshop/backend/controller/ProductController.java @@ -25,8 +25,9 @@ public class ProductController { @GetMapping public ResponseEntity> getAllProducts( @RequestParam(required = false) String q, + @RequestParam(required = false) Long categoryId, Pageable pageable) { - return ResponseEntity.ok(productService.getAllProducts(q, pageable)); + return ResponseEntity.ok(productService.getAllProducts(q, categoryId, pageable)); } @GetMapping("/{id}") diff --git a/backend/src/main/java/com/petshop/backend/repository/CategoryRepository.java b/backend/src/main/java/com/petshop/backend/repository/CategoryRepository.java index ceb30e53..b1871d1f 100644 --- a/backend/src/main/java/com/petshop/backend/repository/CategoryRepository.java +++ b/backend/src/main/java/com/petshop/backend/repository/CategoryRepository.java @@ -16,7 +16,7 @@ public interface CategoryRepository extends JpaRepository { Optional findByCategoryName(String categoryName); @Query("SELECT c FROM Category c WHERE " + - "LOWER(c.categoryName) LIKE LOWER(CONCAT('%', :q, '%')) OR " + - "LOWER(c.categoryType) LIKE LOWER(CONCAT('%', :q, '%'))") - Page searchCategories(@Param("q") String query, Pageable pageable); + "(:q IS NULL OR LOWER(c.categoryName) LIKE LOWER(CONCAT('%', :q, '%')) OR LOWER(c.categoryType) LIKE LOWER(CONCAT('%', :q, '%'))) AND " + + "(:type IS NULL OR LOWER(c.categoryType) = LOWER(:type))") + Page searchCategories(@Param("q") String query, @Param("type") String type, Pageable pageable); } diff --git a/backend/src/main/java/com/petshop/backend/repository/PetRepository.java b/backend/src/main/java/com/petshop/backend/repository/PetRepository.java index fa9aa5e7..a474fa8b 100644 --- a/backend/src/main/java/com/petshop/backend/repository/PetRepository.java +++ b/backend/src/main/java/com/petshop/backend/repository/PetRepository.java @@ -12,8 +12,8 @@ import org.springframework.stereotype.Repository; public interface PetRepository extends JpaRepository { @Query("SELECT p FROM Pet p WHERE " + - "LOWER(p.petName) LIKE LOWER(CONCAT('%', :q, '%')) OR " + - "LOWER(p.petSpecies) LIKE LOWER(CONCAT('%', :q, '%')) OR " + - "LOWER(p.petBreed) LIKE LOWER(CONCAT('%', :q, '%'))") - Page searchPets(@Param("q") String query, Pageable pageable); + "(:q IS NULL OR LOWER(p.petName) LIKE LOWER(CONCAT('%', :q, '%')) OR LOWER(p.petSpecies) LIKE LOWER(CONCAT('%', :q, '%')) OR LOWER(p.petBreed) LIKE LOWER(CONCAT('%', :q, '%'))) AND " + + "(:species IS NULL OR LOWER(p.petSpecies) = LOWER(:species)) AND " + + "(:status IS NULL OR LOWER(p.petStatus) = LOWER(:status))") + Page searchPets(@Param("q") String query, @Param("species") String species, @Param("status") String status, Pageable pageable); } diff --git a/backend/src/main/java/com/petshop/backend/repository/ProductRepository.java b/backend/src/main/java/com/petshop/backend/repository/ProductRepository.java index 94f7fb81..7122e6ea 100644 --- a/backend/src/main/java/com/petshop/backend/repository/ProductRepository.java +++ b/backend/src/main/java/com/petshop/backend/repository/ProductRepository.java @@ -12,7 +12,7 @@ import org.springframework.stereotype.Repository; public interface ProductRepository extends JpaRepository { @Query("SELECT p FROM Product p WHERE " + - "LOWER(p.prodName) LIKE LOWER(CONCAT('%', :q, '%')) OR " + - "LOWER(p.prodDesc) LIKE LOWER(CONCAT('%', :q, '%'))") - Page searchProducts(@Param("q") String query, Pageable pageable); + "(:q IS NULL OR LOWER(p.prodName) LIKE LOWER(CONCAT('%', :q, '%')) OR LOWER(COALESCE(p.prodDesc, '')) LIKE LOWER(CONCAT('%', :q, '%'))) AND " + + "(:categoryId IS NULL OR p.category.categoryId = :categoryId)") + Page searchProducts(@Param("q") String query, @Param("categoryId") Long categoryId, Pageable pageable); } diff --git a/backend/src/main/java/com/petshop/backend/service/CategoryService.java b/backend/src/main/java/com/petshop/backend/service/CategoryService.java index 3da87dd0..1bf175c7 100644 --- a/backend/src/main/java/com/petshop/backend/service/CategoryService.java +++ b/backend/src/main/java/com/petshop/backend/service/CategoryService.java @@ -20,14 +20,9 @@ public class CategoryService { this.categoryRepository = categoryRepository; } - public Page getAllCategories(String query, Pageable pageable) { - Page categories; - if (query != null && !query.trim().isEmpty()) { - categories = categoryRepository.searchCategories(query, pageable); - } else { - categories = categoryRepository.findAll(pageable); - } - return categories.map(this::mapToResponse); + public Page getAllCategories(String query, String type, Pageable pageable) { + return categoryRepository.searchCategories(normalizeFilter(query), normalizeFilter(type), pageable) + .map(this::mapToResponse); } public CategoryResponse getCategoryById(Long id) { @@ -80,4 +75,12 @@ public class CategoryService { category.getUpdatedAt() ); } + + private String normalizeFilter(String value) { + if (value == null) { + return null; + } + String trimmed = value.trim(); + return trimmed.isEmpty() ? null : trimmed; + } } diff --git a/backend/src/main/java/com/petshop/backend/service/PetService.java b/backend/src/main/java/com/petshop/backend/service/PetService.java index 5c35dfd1..4672ee85 100644 --- a/backend/src/main/java/com/petshop/backend/service/PetService.java +++ b/backend/src/main/java/com/petshop/backend/service/PetService.java @@ -33,14 +33,9 @@ public class PetService { this.catalogImageStorageService = catalogImageStorageService; } - public Page getAllPets(String query, Pageable pageable) { - Page pets; - if (query != null && !query.trim().isEmpty()) { - pets = petRepository.searchPets(query, pageable); - } else { - pets = petRepository.findAll(pageable); - } - return pets.map(this::mapToResponse); + public Page getAllPets(String query, String species, String status, Pageable pageable) { + return petRepository.searchPets(normalizeFilter(query), normalizeFilter(species), normalizeFilter(status), pageable) + .map(this::mapToResponse); } public PetResponse getPetById(Long id) { @@ -182,6 +177,14 @@ public class PetService { return status == null ? "" : status.trim(); } + private String normalizeFilter(String value) { + if (value == null) { + return null; + } + String trimmed = value.trim(); + return trimmed.isEmpty() ? null : trimmed; + } + private PetResponse mapToResponse(Pet pet) { return new PetResponse( pet.getPetId(), diff --git a/backend/src/main/java/com/petshop/backend/service/ProductService.java b/backend/src/main/java/com/petshop/backend/service/ProductService.java index 0473a8eb..8d4b1da2 100644 --- a/backend/src/main/java/com/petshop/backend/service/ProductService.java +++ b/backend/src/main/java/com/petshop/backend/service/ProductService.java @@ -32,14 +32,9 @@ public class ProductService { this.catalogImageStorageService = catalogImageStorageService; } - public Page getAllProducts(String query, Pageable pageable) { - Page products; - if (query != null && !query.trim().isEmpty()) { - products = productRepository.searchProducts(query, pageable); - } else { - products = productRepository.findAll(pageable); - } - return products.map(this::mapToResponse); + public Page getAllProducts(String query, Long categoryId, Pageable pageable) { + return productRepository.searchProducts(normalizeFilter(query), categoryId, pageable) + .map(this::mapToResponse); } public ProductResponse getProductById(Long id) { @@ -168,4 +163,12 @@ public class ProductService { public record ImagePayload(Resource resource, MediaType mediaType) { } + + private String normalizeFilter(String value) { + if (value == null) { + return null; + } + String trimmed = value.trim(); + return trimmed.isEmpty() ? null : trimmed; + } } diff --git a/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/PetApi.java b/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/PetApi.java index f96372e8..92fa28c9 100644 --- a/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/PetApi.java +++ b/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/PetApi.java @@ -24,11 +24,17 @@ public class PetApi { return INSTANCE; } - public List listPets(String query) throws Exception { + public List listPets(String query, String species, String status) throws Exception { String path = "/api/v1/pets?page=0&size=1000"; if (query != null && !query.isEmpty()) { path += "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8); } + if (species != null && !species.isEmpty()) { + path += "&species=" + URLEncoder.encode(species, StandardCharsets.UTF_8); + } + if (status != null && !status.isEmpty()) { + path += "&status=" + URLEncoder.encode(status, StandardCharsets.UTF_8); + } String response = apiClient.getRawResponse(path); PageResponse pageResponse = apiClient.getObjectMapper().readValue( response, @@ -40,6 +46,10 @@ public class PetApi { return pageResponse.getContent(); } + public List listPets(String query) throws Exception { + return listPets(query, null, null); + } + public PetResponse createPet(PetRequest request) throws Exception { return apiClient.post("/api/v1/pets", request, PetResponse.class); } diff --git a/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/ProductApi.java b/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/ProductApi.java index 4b8c89f4..c5ec100d 100644 --- a/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/ProductApi.java +++ b/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/ProductApi.java @@ -24,11 +24,14 @@ public class ProductApi { return INSTANCE; } - public List listProducts(String query) throws Exception { + public List listProducts(String query, Long categoryId) throws Exception { String path = "/api/v1/products?page=0&size=1000"; if (query != null && !query.isEmpty()) { path += "&q=" + URLEncoder.encode(query, StandardCharsets.UTF_8); } + if (categoryId != null) { + path += "&categoryId=" + categoryId; + } String response = apiClient.getRawResponse(path); PageResponse pageResponse = apiClient.getObjectMapper().readValue( response, @@ -40,6 +43,10 @@ public class ProductApi { return pageResponse.getContent(); } + public List listProducts(String query) throws Exception { + return listProducts(query, null); + } + public ProductResponse createProduct(ProductRequest request) throws Exception { return apiClient.post("/api/v1/products", request, ProductResponse.class); } diff --git a/desktop/src/main/java/org/example/petshopdesktop/controllers/PetController.java b/desktop/src/main/java/org/example/petshopdesktop/controllers/PetController.java index 88928cb5..7c5d13c8 100644 --- a/desktop/src/main/java/org/example/petshopdesktop/controllers/PetController.java +++ b/desktop/src/main/java/org/example/petshopdesktop/controllers/PetController.java @@ -64,6 +64,12 @@ public class PetController { @FXML private TableView tvPets; + @FXML + private ComboBox cbSpeciesFilter; + + @FXML + private ComboBox cbStatusFilter; + @FXML private TextField txtSearch; @@ -150,6 +156,12 @@ public class PetController { colPetPrice.setCellValueFactory(new PropertyValueFactory("petPrice")); configureImageColumn(colPetImage); + cbSpeciesFilter.setItems(FXCollections.observableArrayList("All Species", "Dog", "Cat", "Bird", "Fish", "Rabbit", "Hamster")); + cbSpeciesFilter.getSelectionModel().selectFirst(); + + cbStatusFilter.setItems(FXCollections.observableArrayList("All Statuses", "Available", "Adopted", "Pending")); + cbStatusFilter.getSelectionModel().selectFirst(); + displayPets(); tvPets.getSelectionModel().selectedItemProperty().addListener( @@ -159,9 +171,12 @@ public class PetController { }); txtSearch.textProperty().addListener((observable, oldValue, newValue) -> { - displayFilteredPet(newValue); + applyFilters(); }); + cbSpeciesFilter.valueProperty().addListener((observable, oldValue, newValue) -> applyFilters()); + cbStatusFilter.valueProperty().addListener((observable, oldValue, newValue) -> applyFilters()); + //EventListener for DELETE key tvPets.setOnKeyPressed(event -> { if (event.getCode() == javafx.scene.input.KeyCode.DELETE) { @@ -173,12 +188,14 @@ public class PetController { } private void displayFilteredPet(String filter) { - if (txtSearch.getText() == null || txtSearch.getText().isEmpty()){ + String species = selectedSpecies(); + String status = selectedStatus(); + if ((filter == null || filter.isEmpty()) && species == null && status == null){ displayPets(); } else { new Thread(() -> { try { - List pets = PetApi.getInstance().listPets(filter); + List pets = PetApi.getInstance().listPets(filter, species, status); List petList = pets.stream() .map(this::mapToPet) .collect(Collectors.toList()); @@ -203,7 +220,7 @@ public class PetController { private void displayPets() { new Thread(() -> { try { - List pets = PetApi.getInstance().listPets(null); + List pets = PetApi.getInstance().listPets(null, selectedSpecies(), selectedStatus()); List petList = pets.stream() .map(this::mapToPet) .collect(Collectors.toList()); @@ -224,6 +241,20 @@ public class PetController { }).start(); } + private void applyFilters() { + displayFilteredPet(txtSearch.getText()); + } + + private String selectedSpecies() { + String value = cbSpeciesFilter.getValue(); + return value == null || value.equals("All Species") ? null : value; + } + + private String selectedStatus() { + String value = cbStatusFilter.getValue(); + return value == null || value.equals("All Statuses") ? null : value; + } + private void openDialog(Pet pet, String mode){ //Get new view FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/org/example/petshopdesktop/dialogviews/pet-dialog-view.fxml")); diff --git a/desktop/src/main/java/org/example/petshopdesktop/controllers/ProductController.java b/desktop/src/main/java/org/example/petshopdesktop/controllers/ProductController.java index 053e0105..8bb51296 100644 --- a/desktop/src/main/java/org/example/petshopdesktop/controllers/ProductController.java +++ b/desktop/src/main/java/org/example/petshopdesktop/controllers/ProductController.java @@ -16,6 +16,8 @@ import javafx.stage.Modality; import javafx.stage.Stage; import org.example.petshopdesktop.DTOs.ProductDTO; import org.example.petshopdesktop.api.dto.product.ProductResponse; +import org.example.petshopdesktop.api.dto.common.DropdownOption; +import org.example.petshopdesktop.api.endpoints.DropdownApi; import org.example.petshopdesktop.api.endpoints.ProductApi; import org.example.petshopdesktop.controllers.dialogcontrollers.ProductDialogController; import org.example.petshopdesktop.util.ActivityLogger; @@ -62,6 +64,9 @@ public class ProductController { @FXML private TableView tvProducts; + @FXML + private ComboBox cbCategoryFilter; + @FXML private TextField txtSearch; @@ -87,6 +92,7 @@ public class ProductController { colProductCategory.setCellValueFactory(new PropertyValueFactory("categoryName")); colProductDesc.setCellValueFactory(new PropertyValueFactory("prodDesc")); configureImageColumn(colProductImage); + loadCategoryFilter(); displayProduct(); @@ -100,9 +106,11 @@ public class ProductController { //EventListener to search when text is changed on searchbar txtSearch.textProperty().addListener((observable, oldValue, newValue) -> { - displayFilteredProduct(newValue); + applyFilters(); }); + cbCategoryFilter.valueProperty().addListener((observable, oldValue, newValue) -> applyFilters()); + //EventListener for DELETE key press tvProducts.setOnKeyPressed(event -> { if (event.getCode() == javafx.scene.input.KeyCode.DELETE) { @@ -120,7 +128,7 @@ public class ProductController { private void displayProduct(){ new Thread(() -> { try { - List products = ProductApi.getInstance().listProducts(null); + List products = ProductApi.getInstance().listProducts(null, selectedCategoryId()); List productDTOs = products.stream() .map(this::mapToProductDTO) .collect(Collectors.toList()); @@ -222,12 +230,12 @@ public class ProductController { * @param filter word to filter table */ private void displayFilteredProduct(String filter){ - if (txtSearch.getText() == null || txtSearch.getText().isEmpty()){ + if ((txtSearch.getText() == null || txtSearch.getText().isEmpty()) && selectedCategoryId() == null){ displayProduct(); } else { new Thread(() -> { try { - List products = ProductApi.getInstance().listProducts(filter); + List products = ProductApi.getInstance().listProducts(filter, selectedCategoryId()); List productDTOs = products.stream() .map(this::mapToProductDTO) .collect(Collectors.toList()); @@ -249,6 +257,37 @@ public class ProductController { } } + private void applyFilters() { + displayFilteredProduct(txtSearch.getText()); + } + + private void loadCategoryFilter() { + new Thread(() -> { + try { + List options = new ArrayList<>(); + DropdownOption all = new DropdownOption(); + all.setId(null); + all.setLabel("All Categories"); + options.add(all); + options.addAll(DropdownApi.getInstance().getCategories()); + Platform.runLater(() -> { + cbCategoryFilter.setItems(FXCollections.observableArrayList(options)); + cbCategoryFilter.getSelectionModel().selectFirst(); + }); + } catch (Exception e) { + Platform.runLater(() -> ActivityLogger.getInstance().logException( + "ProductController.loadCategoryFilter", + e, + "Loading category filter options")); + } + }).start(); + } + + private Long selectedCategoryId() { + DropdownOption option = cbCategoryFilter.getValue(); + return option == null ? null : option.getId(); + } + /** * Function to open the new Dialog for edit or adding * depending on the mode given diff --git a/desktop/src/main/resources/org/example/petshopdesktop/modelviews/pet-view.fxml b/desktop/src/main/resources/org/example/petshopdesktop/modelviews/pet-view.fxml index b4fcc592..c8e77504 100644 --- a/desktop/src/main/resources/org/example/petshopdesktop/modelviews/pet-view.fxml +++ b/desktop/src/main/resources/org/example/petshopdesktop/modelviews/pet-view.fxml @@ -2,6 +2,7 @@ + @@ -59,13 +60,15 @@ - - - - - - - + + + + + + + + + diff --git a/desktop/src/main/resources/org/example/petshopdesktop/modelviews/product-view.fxml b/desktop/src/main/resources/org/example/petshopdesktop/modelviews/product-view.fxml index b5392be9..eeff74b4 100644 --- a/desktop/src/main/resources/org/example/petshopdesktop/modelviews/product-view.fxml +++ b/desktop/src/main/resources/org/example/petshopdesktop/modelviews/product-view.fxml @@ -2,6 +2,7 @@ + @@ -58,13 +59,14 @@ - - - - - - - + + + + + + + + From b18599c280a567e98cc7be51b709a4a28b39d442 Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Sun, 29 Mar 2026 23:07:16 -0600 Subject: [PATCH 3/3] Tighten seed filters --- .../petshop/backend/DevStackApplication.java | 1 + .../config/LocalCatalogSeedInitializer.java | 37 ++ .../controller/DropdownController.java | 23 ++ .../V11__expand_pet_product_seed.sql | 389 ------------------ .../resources/dev/expand_pet_product_seed.sql | 226 ++++++++++ .../api/endpoints/DropdownApi.java | 16 + .../controllers/PetController.java | 25 +- .../controllers/ProductController.java | 2 +- .../ProductDialogController.java | 2 +- 9 files changed, 328 insertions(+), 393 deletions(-) create mode 100644 backend/src/main/java/com/petshop/backend/config/LocalCatalogSeedInitializer.java delete mode 100644 backend/src/main/resources/db/migration/V11__expand_pet_product_seed.sql create mode 100644 backend/src/main/resources/dev/expand_pet_product_seed.sql diff --git a/backend/src/main/java/com/petshop/backend/DevStackApplication.java b/backend/src/main/java/com/petshop/backend/DevStackApplication.java index 38846aaa..27933d4b 100644 --- a/backend/src/main/java/com/petshop/backend/DevStackApplication.java +++ b/backend/src/main/java/com/petshop/backend/DevStackApplication.java @@ -33,6 +33,7 @@ public class DevStackApplication { docker.ensureDockerAvailable(); docker.startDatabase(); context = new SpringApplicationBuilder(BackendApplication.class) + .profiles("local") .initializers(new FlywayContextInitializer()) .run(args); context.addApplicationListener(event -> { diff --git a/backend/src/main/java/com/petshop/backend/config/LocalCatalogSeedInitializer.java b/backend/src/main/java/com/petshop/backend/config/LocalCatalogSeedInitializer.java new file mode 100644 index 00000000..18e64f05 --- /dev/null +++ b/backend/src/main/java/com/petshop/backend/config/LocalCatalogSeedInitializer.java @@ -0,0 +1,37 @@ +package com.petshop.backend.config; + +import com.petshop.backend.repository.PetRepository; +import com.petshop.backend.repository.ProductRepository; +import org.springframework.boot.CommandLineRunner; +import org.springframework.context.annotation.Profile; +import org.springframework.core.io.ClassPathResource; +import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; +import org.springframework.stereotype.Component; + +import javax.sql.DataSource; + +@Component +@Profile("local") +public class LocalCatalogSeedInitializer implements CommandLineRunner { + + private final DataSource dataSource; + private final PetRepository petRepository; + private final ProductRepository productRepository; + + public LocalCatalogSeedInitializer(DataSource dataSource, PetRepository petRepository, ProductRepository productRepository) { + this.dataSource = dataSource; + this.petRepository = petRepository; + this.productRepository = productRepository; + } + + @Override + public void run(String... args) { + if (petRepository.count() > 6 || productRepository.count() > 6) { + return; + } + + ResourceDatabasePopulator populator = new ResourceDatabasePopulator(false, false, "UTF-8", + new ClassPathResource("dev/expand_pet_product_seed.sql")); + populator.execute(dataSource); + } +} diff --git a/backend/src/main/java/com/petshop/backend/controller/DropdownController.java b/backend/src/main/java/com/petshop/backend/controller/DropdownController.java index 16763b8a..c942eae8 100644 --- a/backend/src/main/java/com/petshop/backend/controller/DropdownController.java +++ b/backend/src/main/java/com/petshop/backend/controller/DropdownController.java @@ -82,6 +82,29 @@ public class DropdownController { ); } + @GetMapping("/product-categories") + public ResponseEntity> getProductCategories() { + return ResponseEntity.ok( + categoryRepository.findAll().stream() + .filter(c -> "product".equalsIgnoreCase(c.getCategoryType())) + .map(c -> new DropdownOption(c.getCategoryId(), c.getCategoryName())) + .collect(Collectors.toList()) + ); + } + + @GetMapping("/pet-species") + public ResponseEntity> getPetSpecies() { + return ResponseEntity.ok( + petRepository.findAll().stream() + .map(p -> p.getPetSpecies()) + .filter(species -> species != null && !species.isBlank()) + .distinct() + .sorted(String.CASE_INSENSITIVE_ORDER) + .map(species -> new DropdownOption(null, species)) + .collect(Collectors.toList()) + ); + } + @GetMapping("/stores") public ResponseEntity> getStores() { return ResponseEntity.ok( diff --git a/backend/src/main/resources/db/migration/V11__expand_pet_product_seed.sql b/backend/src/main/resources/db/migration/V11__expand_pet_product_seed.sql deleted file mode 100644 index f2ca3259..00000000 --- a/backend/src/main/resources/db/migration/V11__expand_pet_product_seed.sql +++ /dev/null @@ -1,389 +0,0 @@ --- Expand pet and product seed data - -INSERT INTO pet (petName, petSpecies, petBreed, petAge, petStatus, petPrice) -VALUES -('Rocky', 'Dog', 'German Shepherd', 1, 'Available', 475.00), -('Daisy', 'Dog', 'Poodle', 2, 'Available', 512.00), -('Cooper', 'Dog', 'Bulldog', 3, 'Available', 560.00), -('Ruby', 'Dog', 'Boxer', 4, 'Available', 575.00), -('Tucker', 'Dog', 'Dachshund', 5, 'Available', 634.00), -('Rosie', 'Dog', 'Shih Tzu', 1, 'Available', 660.00), -('Bear', 'Dog', 'Rottweiler', 2, 'Available', 686.00), -('Maggie', 'Dog', 'Corgi', 3, 'Available', 745.00), -('Leo', 'Dog', 'Husky', 4, 'Available', 749.00), -('Penny', 'Dog', 'Border Collie', 5, 'Available', 808.00), -('Jax', 'Dog', 'German Shepherd', 1, 'Available', 823.00), -('Nala', 'Dog', 'Poodle', 2, 'Available', 871.00), -('Finn', 'Dog', 'Bulldog', 3, 'Available', 447.00), -('Sadie', 'Dog', 'Boxer', 4, 'Available', 495.00), -('Ace', 'Dog', 'Dachshund', 5, 'Available', 510.00), -('Zoe', 'Dog', 'Shih Tzu', 1, 'Available', 547.00), -('Ollie', 'Dog', 'Rottweiler', 2, 'Available', 606.00), -('Millie', 'Dog', 'Corgi', 3, 'Available', 654.00), -('Murphy', 'Dog', 'Husky', 4, 'Available', 691.00), -('Willow', 'Dog', 'Border Collie', 5, 'Available', 728.00), -('Bentley', 'Dog', 'German Shepherd', 1, 'Available', 776.00), -('Lily', 'Dog', 'Poodle', 2, 'Available', 780.00), -('Scout', 'Dog', 'Bulldog', 3, 'Available', 828.00), -('Gracie', 'Dog', 'Boxer', 4, 'Available', 876.00), -('Ranger', 'Dog', 'Dachshund', 5, 'Available', 452.00), -('Hazel', 'Dog', 'Shih Tzu', 1, 'Available', 478.00), -('Moose', 'Dog', 'Rottweiler', 2, 'Available', 515.00), -('Mia', 'Dog', 'Corgi', 3, 'Available', 530.00), -('Simba', 'Cat', 'Ragdoll', 1, 'Available', 295.00), -('Cleo', 'Cat', 'Bengal', 2, 'Available', 321.00), -('Oreo', 'Cat', 'British Shorthair', 3, 'Available', 358.00), -('Pepper', 'Cat', 'Sphynx', 4, 'Available', 417.00), -('Jasper', 'Cat', 'Scottish Fold', 5, 'Available', 454.00), -('Phoebe', 'Cat', 'Russian Blue', 1, 'Available', 491.00), -('Shadow', 'Cat', 'Abyssinian', 2, 'Available', 528.00), -('Mochi', 'Cat', 'Birman', 3, 'Available', 554.00), -('Louie', 'Cat', 'Ragdoll', 4, 'Available', 591.00), -('Ivy', 'Cat', 'Bengal', 5, 'Available', 606.00), -('Theo', 'Cat', 'British Shorthair', 1, 'Available', 654.00), -('Piper', 'Cat', 'Sphynx', 2, 'Available', 251.00), -('Nova', 'Cat', 'Scottish Fold', 3, 'Available', 277.00), -('Archie', 'Cat', 'Russian Blue', 4, 'Available', 336.00), -('Olive', 'Cat', 'Abyssinian', 5, 'Available', 362.00), -('Boots', 'Cat', 'Birman', 1, 'Available', 399.00), -('Maple', 'Cat', 'Ragdoll', 2, 'Available', 436.00), -('Gizmo', 'Cat', 'Bengal', 3, 'Available', 473.00), -('Nina', 'Cat', 'British Shorthair', 4, 'Available', 499.00), -('Salem', 'Cat', 'Sphynx', 5, 'Available', 547.00), -('Stella', 'Cat', 'Scottish Fold', 1, 'Available', 595.00), -('Kiki', 'Cat', 'Russian Blue', 2, 'Available', 610.00), -('Sunny', 'Cat', 'Abyssinian', 3, 'Available', 658.00), -('Mabel', 'Cat', 'Birman', 4, 'Available', 244.00), -('Coco', 'Bird', 'Cockatiel', 1, 'Available', 119.00), -('Sky', 'Bird', 'Parakeet', 2, 'Available', 145.00), -('Sunny', 'Bird', 'Canary', 3, 'Available', 204.00), -('Kiwi', 'Bird', 'Lovebird', 1, 'Available', 230.00), -('Pico', 'Bird', 'Finch', 2, 'Available', 81.00), -('Blue', 'Bird', 'Conure', 3, 'Available', 118.00), -('Rio', 'Bird', 'Cockatiel', 1, 'Available', 144.00), -('Angel', 'Bird', 'Parakeet', 2, 'Available', 203.00), -('Chirpy', 'Bird', 'Canary', 3, 'Available', 251.00), -('Peach', 'Bird', 'Lovebird', 1, 'Available', 91.00), -('Mango', 'Bird', 'Finch', 2, 'Available', 128.00), -('Pearl', 'Bird', 'Conure', 3, 'Available', 165.00), -('Bubbles', 'Fish', 'Goldfish', 1, 'Available', 30.00), -('Splash', 'Fish', 'Betta', 2, 'Available', 56.00), -('Coral', 'Fish', 'Guppy', 1, 'Available', 23.00), -('Neptune', 'Fish', 'Molly', 2, 'Available', 23.00), -('Marlin', 'Fish', 'Tetra', 1, 'Available', 49.00), -('Finley', 'Fish', 'Angelfish', 2, 'Available', 27.00), -('Pebble', 'Fish', 'Goldfish', 1, 'Available', 64.00), -('Wave', 'Fish', 'Betta', 2, 'Available', 20.00), -('Aqua', 'Fish', 'Guppy', 1, 'Available', 57.00), -('Flash', 'Fish', 'Molly', 2, 'Available', 46.00), -('Nemo', 'Fish', 'Tetra', 1, 'Available', 13.00), -('Pearl', 'Fish', 'Angelfish', 2, 'Available', 61.00), -('Thumper', 'Rabbit', 'Mini Lop', 1, 'Available', 147.00), -('Clover', 'Rabbit', 'Netherland Dwarf', 2, 'Available', 173.00), -('Biscuit', 'Rabbit', 'Lionhead', 3, 'Adopted', 110.00), -('Hazel', 'Rabbit', 'Rex', 1, 'Adopted', 125.00), -('Juniper', 'Rabbit', 'Mini Lop', 2, 'Adopted', 73.00), -('Poppy', 'Rabbit', 'Netherland Dwarf', 3, 'Adopted', 88.00), -('Snowball', 'Rabbit', 'Lionhead', 1, 'Adopted', 158.00), -('Maple', 'Rabbit', 'Rex', 2, 'Adopted', 162.00), -('Peanut', 'Hamster', 'Syrian', 1, 'Adopted', 36.00), -('Nibbles', 'Hamster', 'Dwarf', 2, 'Adopted', 36.00), -('Pumpkin', 'Hamster', 'Roborovski', 1, 'Adopted', 25.00), -('Mocha', 'Hamster', 'Syrian', 2, 'Adopted', 40.00), -('Buttons', 'Hamster', 'Dwarf', 1, 'Pending', 51.00), -('Teddy', 'Hamster', 'Roborovski', 2, 'Pending', 18.00), -('Pip', 'Hamster', 'Syrian', 1, 'Pending', 33.00), -('Toffee', 'Hamster', 'Dwarf', 2, 'Pending', 55.00), -('Sprout', 'Hamster', 'Roborovski', 1, 'Pending', 44.00), -('Bean', 'Hamster', 'Syrian', 2, 'Pending', 59.00); - -INSERT INTO product (prodName, prodPrice, categoryId, prodDesc) -VALUES -('Chicken Recipe Dog Food', 42.00, 1, 'Nutritious food and treats for dogs'), -('Beef Feast Dog Food', 51.00, 1, 'Nutritious food and treats for dogs'), -('Salmon Blend Dog Food', 66.00, 1, 'Nutritious food and treats for dogs'), -('Lamb Dinner Dog Food', 78.00, 1, 'Nutritious food and treats for dogs'), -('Puppy Starter Kibble', 24.00, 1, 'Nutritious food and treats for dogs'), -('Senior Care Dog Food', 37.00, 1, 'Nutritious food and treats for dogs'), -('Small Breed Kibble', 48.00, 1, 'Nutritious food and treats for dogs'), -('Large Breed Kibble', 61.00, 1, 'Nutritious food and treats for dogs'), -('Grain Free Dog Food', 75.00, 1, 'Nutritious food and treats for dogs'), -('Turkey Rice Formula', 21.00, 1, 'Nutritious food and treats for dogs'), -('Duck Sweet Potato Meal', 37.00, 1, 'Nutritious food and treats for dogs'), -('Venison Protein Blend', 49.00, 1, 'Nutritious food and treats for dogs'), -('Healthy Weight Dog Food', 64.00, 1, 'Nutritious food and treats for dogs'), -('Sensitive Stomach Kibble', 78.00, 1, 'Nutritious food and treats for dogs'), -('High Energy Dog Food', 20.00, 1, 'Nutritious food and treats for dogs'), -('Organic Dog Biscuits', 33.00, 1, 'Nutritious food and treats for dogs'), -('Peanut Butter Dog Treats', 50.00, 1, 'Nutritious food and treats for dogs'), -('Dental Chew Sticks', 57.00, 1, 'Nutritious food and treats for dogs'), -('Training Treat Bites', 72.00, 1, 'Nutritious food and treats for dogs'), -('Soft Chicken Treats', 17.00, 1, 'Nutritious food and treats for dogs'), -('Pumpkin Fiber Treats', 31.00, 1, 'Nutritious food and treats for dogs'), -('Joint Support Biscuits', 46.00, 1, 'Nutritious food and treats for dogs'), -('Mini Breed Dinner', 54.00, 1, 'Nutritious food and treats for dogs'), -('Farmhouse Dog Meal', 68.00, 1, 'Nutritious food and treats for dogs'), -('Feather Teaser Wand', 8.00, 2, 'Play items for active cats'), -('Catnip Mouse Toy', 18.00, 2, 'Play items for active cats'), -('Jingle Ball Set', 30.00, 2, 'Play items for active cats'), -('Scratching Post Small', 20.00, 2, 'Play items for active cats'), -('Crinkle Tunnel', 26.00, 2, 'Play items for active cats'), -('Laser Pointer Toy', 13.00, 2, 'Play items for active cats'), -('Plush Fish Toy', 23.00, 2, 'Play items for active cats'), -('Spring Coil Pack', 9.00, 2, 'Play items for active cats'), -('Hanging Door Toy', 22.00, 2, 'Play items for active cats'), -('Interactive Puzzle Toy', 12.00, 2, 'Play items for active cats'), -('Catnip Kicker Toy', 20.00, 2, 'Play items for active cats'), -('Rolling Bell Ball', 4.00, 2, 'Play items for active cats'), -('Ribbon Chase Toy', 16.00, 2, 'Play items for active cats'), -('Mini Plush Mouse', 29.00, 2, 'Play items for active cats'), -('Treat Dispensing Ball', 18.00, 2, 'Play items for active cats'), -('Double Pom Toy', 24.00, 2, 'Play items for active cats'), -('Window Perch Toy', 10.00, 2, 'Play items for active cats'), -('Scratch Pad Refill', 25.00, 2, 'Play items for active cats'), -('Rainbow Wand Toy', 7.00, 2, 'Play items for active cats'), -('Carpet Scratcher', 20.00, 2, 'Play items for active cats'), -('Bird Perch Set', 41.00, 3, 'Care supplies for pet birds'), -('Parakeet Seed Mix', 57.00, 3, 'Care supplies for pet birds'), -('Canary Food Blend', 70.00, 3, 'Care supplies for pet birds'), -('Mineral Cuttlebone', 84.00, 3, 'Care supplies for pet birds'), -('Bird Ladder Toy', 94.00, 3, 'Care supplies for pet birds'), -('Mirror Bell Combo', 109.00, 3, 'Care supplies for pet birds'), -('Clip On Food Cup', 121.00, 3, 'Care supplies for pet birds'), -('Bird Cage Liner Pack', 18.00, 3, 'Care supplies for pet birds'), -('Nesting Material Pack', 32.00, 3, 'Care supplies for pet birds'), -('Treat Spray Millet', 42.00, 3, 'Care supplies for pet birds'), -('Wooden Swing Perch', 55.00, 3, 'Care supplies for pet birds'), -('Foraging Ball Toy', 67.00, 3, 'Care supplies for pet birds'), -('Cage Cleaning Spray', 82.00, 3, 'Care supplies for pet birds'), -('Parrot Rope Perch', 93.00, 3, 'Care supplies for pet birds'), -('Bird Bath Dish', 103.00, 3, 'Care supplies for pet birds'), -('Songbird Vitamin Drops', 124.00, 3, 'Care supplies for pet birds'), -('Aquarium Filter Cartridge', 58.00, 4, 'Essential aquarium equipment and accessories'), -('Decorative Aquarium Gravel', 72.00, 4, 'Essential aquarium equipment and accessories'), -('Fish Net Medium', 74.00, 4, 'Essential aquarium equipment and accessories'), -('Water Conditioner', 89.00, 4, 'Essential aquarium equipment and accessories'), -('Aquarium Thermometer', 105.00, 4, 'Essential aquarium equipment and accessories'), -('LED Tank Light', 112.00, 4, 'Essential aquarium equipment and accessories'), -('Air Stone Pack', 125.00, 4, 'Essential aquarium equipment and accessories'), -('Aquarium Heater 50W', 143.00, 4, 'Essential aquarium equipment and accessories'), -('Aquarium Heater 100W', 157.00, 4, 'Essential aquarium equipment and accessories'), -('Fish Flake Food', 165.00, 4, 'Essential aquarium equipment and accessories'), -('Algae Scraper', 176.00, 4, 'Essential aquarium equipment and accessories'), -('Aquarium Plant Set', 194.00, 4, 'Essential aquarium equipment and accessories'), -('Bubble Curtain Kit', 207.00, 4, 'Essential aquarium equipment and accessories'), -('Breeder Box Insert', 14.00, 4, 'Essential aquarium equipment and accessories'), -('Filter Sponge Pack', 27.00, 4, 'Essential aquarium equipment and accessories'), -('Aquarium Background Roll', 46.00, 4, 'Essential aquarium equipment and accessories'), -('Glass Lid Clips', 50.00, 4, 'Essential aquarium equipment and accessories'), -('Submersible Pump', 64.00, 4, 'Essential aquarium equipment and accessories'), -('Hamster Bedding Pack', 60.00, 5, 'Supplies for small pets'), -('Rabbit Hay Bundle', 6.00, 5, 'Supplies for small pets'), -('Guinea Pig Pellets', 20.00, 5, 'Supplies for small pets'), -('Small Pet Water Bottle', 37.00, 5, 'Supplies for small pets'), -('Hamster Hideout Hut', 47.00, 5, 'Supplies for small pets'), -('Chew Stick Bundle', 58.00, 5, 'Supplies for small pets'), -('Rabbit Litter Tray', 8.00, 5, 'Supplies for small pets'), -('Exercise Ball Large', 22.00, 5, 'Supplies for small pets'), -('Small Pet Food Bowl', 35.00, 5, 'Supplies for small pets'), -('Timothy Hay Cubes', 46.00, 5, 'Supplies for small pets'), -('Guinea Pig Tunnel', 59.00, 5, 'Supplies for small pets'), -('Hamster Nesting Fluff', 12.00, 5, 'Supplies for small pets'), -('Rabbit Grooming Brush', 25.00, 5, 'Supplies for small pets'), -('Small Pet Carrier', 34.00, 5, 'Supplies for small pets'), -('Hay Rack Feeder', 45.00, 5, 'Supplies for small pets'), -('Wooden Chew Blocks', 61.00, 5, 'Supplies for small pets'); - -INSERT INTO productSupplier (supId, prodId, cost) -VALUES -(1, 7, 26.04), -(2, 8, 33.15), -(3, 9, 44.88), -(4, 10, 55.38), -(5, 11, 17.76), -(1, 12, 22.94), -(2, 13, 31.20), -(3, 14, 41.48), -(4, 15, 53.25), -(5, 16, 15.54), -(1, 17, 22.94), -(2, 18, 31.85), -(3, 19, 43.52), -(4, 20, 55.38), -(5, 21, 14.80), -(1, 22, 20.46), -(2, 23, 32.50), -(3, 24, 38.76), -(4, 25, 51.12), -(5, 26, 12.58), -(1, 27, 19.22), -(2, 28, 29.90), -(3, 29, 36.72), -(4, 30, 48.28), -(5, 31, 5.92), -(1, 32, 11.16), -(2, 33, 19.50), -(3, 34, 13.60), -(4, 35, 18.46), -(5, 36, 9.62), -(1, 37, 14.26), -(2, 38, 5.85), -(3, 39, 14.96), -(4, 40, 8.52), -(5, 41, 14.80), -(1, 42, 2.48), -(2, 43, 10.40), -(3, 44, 19.72), -(4, 45, 12.78), -(5, 46, 17.76), -(1, 47, 6.20), -(2, 48, 16.25), -(3, 49, 4.76), -(4, 50, 14.20), -(5, 51, 30.34), -(1, 52, 35.34), -(2, 53, 45.50), -(3, 54, 57.12), -(4, 55, 66.74), -(5, 56, 80.66), -(1, 57, 75.02), -(2, 58, 11.70), -(3, 59, 21.76), -(4, 60, 29.82), -(5, 61, 40.70), -(1, 62, 41.54), -(2, 63, 53.30), -(3, 64, 63.24), -(4, 65, 73.13), -(5, 66, 91.76), -(1, 67, 35.96), -(2, 68, 46.80), -(3, 69, 50.32), -(4, 70, 63.19), -(5, 71, 77.70), -(1, 72, 69.44), -(2, 73, 81.25), -(3, 74, 97.24), -(4, 75, 111.47), -(5, 76, 122.10), -(1, 77, 109.12), -(2, 78, 126.10), -(3, 79, 140.76), -(4, 80, 9.94), -(5, 81, 19.98), -(1, 82, 28.52), -(2, 83, 32.50), -(3, 84, 43.52), -(4, 85, 42.60), -(5, 86, 4.44), -(1, 87, 12.40), -(2, 88, 24.05), -(3, 89, 31.96), -(4, 90, 41.18), -(5, 91, 5.92), -(1, 92, 13.64), -(2, 93, 22.75), -(3, 94, 31.28), -(4, 95, 41.89), -(5, 96, 8.88), -(1, 97, 15.50), -(2, 98, 22.10), -(3, 99, 30.60), -(4, 100, 43.31); - -INSERT INTO inventory (prodId, quantity) -VALUES -(7, 120), -(8, 137), -(9, 154), -(10, 171), -(11, 128), -(12, 145), -(13, 162), -(14, 179), -(15, 136), -(16, 153), -(17, 170), -(18, 127), -(19, 144), -(20, 161), -(21, 178), -(22, 135), -(23, 152), -(24, 169), -(25, 126), -(26, 143), -(27, 160), -(28, 177), -(29, 134), -(30, 151), -(31, 228), -(32, 185), -(33, 202), -(34, 219), -(35, 236), -(36, 193), -(37, 210), -(38, 227), -(39, 184), -(40, 201), -(41, 218), -(42, 235), -(43, 192), -(44, 209), -(45, 226), -(46, 183), -(47, 200), -(48, 217), -(49, 234), -(50, 191), -(51, 98), -(52, 115), -(53, 72), -(54, 89), -(55, 106), -(56, 123), -(57, 80), -(58, 97), -(59, 114), -(60, 71), -(61, 88), -(62, 105), -(63, 122), -(64, 79), -(65, 96), -(66, 113), -(67, 45), -(68, 62), -(69, 79), -(70, 96), -(71, 53), -(72, 70), -(73, 87), -(74, 104), -(75, 61), -(76, 78), -(77, 95), -(78, 52), -(79, 69), -(80, 86), -(81, 103), -(82, 60), -(83, 77), -(84, 94), -(85, 101), -(86, 118), -(87, 135), -(88, 152), -(89, 109), -(90, 126), -(91, 143), -(92, 100), -(93, 117), -(94, 134), -(95, 151), -(96, 108), -(97, 125), -(98, 142), -(99, 99), -(100, 116); diff --git a/backend/src/main/resources/dev/expand_pet_product_seed.sql b/backend/src/main/resources/dev/expand_pet_product_seed.sql new file mode 100644 index 00000000..63736dda --- /dev/null +++ b/backend/src/main/resources/dev/expand_pet_product_seed.sql @@ -0,0 +1,226 @@ +-- Expand pet and product seed data + +INSERT INTO pet (petName, petSpecies, petBreed, petAge, petStatus, petPrice) +VALUES +('Rocky', 'Dog', 'German Shepherd', 1, 'Available', 475.00), +('Daisy', 'Dog', 'Poodle', 2, 'Available', 512.00), +('Cooper', 'Dog', 'Bulldog', 3, 'Available', 560.00), +('Ruby', 'Dog', 'Boxer', 4, 'Available', 575.00), +('Tucker', 'Dog', 'Dachshund', 5, 'Available', 634.00), +('Rosie', 'Dog', 'Shih Tzu', 1, 'Available', 660.00), +('Bear', 'Dog', 'Rottweiler', 2, 'Available', 686.00), +('Maggie', 'Dog', 'Corgi', 3, 'Available', 745.00), +('Leo', 'Dog', 'Husky', 4, 'Available', 749.00), +('Penny', 'Dog', 'Border Collie', 5, 'Available', 808.00), +('Jax', 'Dog', 'German Shepherd', 1, 'Available', 823.00), +('Nala', 'Dog', 'Poodle', 2, 'Available', 871.00), +('Finn', 'Dog', 'Bulldog', 3, 'Available', 447.00), +('Sadie', 'Dog', 'Boxer', 4, 'Available', 495.00), +('Ace', 'Dog', 'Dachshund', 5, 'Available', 510.00), +('Zoe', 'Dog', 'Shih Tzu', 1, 'Available', 547.00), +('Ollie', 'Dog', 'Rottweiler', 2, 'Available', 606.00), +('Millie', 'Dog', 'Corgi', 3, 'Available', 654.00), +('Murphy', 'Dog', 'Husky', 4, 'Available', 691.00), +('Willow', 'Dog', 'Border Collie', 5, 'Available', 728.00), +('Bentley', 'Dog', 'German Shepherd', 1, 'Available', 776.00), +('Lily', 'Dog', 'Poodle', 2, 'Available', 780.00), +('Scout', 'Dog', 'Bulldog', 3, 'Available', 828.00), +('Gracie', 'Dog', 'Boxer', 4, 'Available', 876.00), +('Ranger', 'Dog', 'Dachshund', 5, 'Available', 452.00), +('Hazel', 'Dog', 'Shih Tzu', 1, 'Available', 478.00), +('Moose', 'Dog', 'Rottweiler', 2, 'Available', 515.00), +('Mia', 'Dog', 'Corgi', 3, 'Available', 530.00), +('Simba', 'Cat', 'Ragdoll', 1, 'Available', 295.00), +('Cleo', 'Cat', 'Bengal', 2, 'Available', 321.00), +('Oreo', 'Cat', 'British Shorthair', 3, 'Available', 358.00), +('Pepper', 'Cat', 'Sphynx', 4, 'Available', 417.00), +('Jasper', 'Cat', 'Scottish Fold', 5, 'Available', 454.00), +('Phoebe', 'Cat', 'Russian Blue', 1, 'Available', 491.00), +('Shadow', 'Cat', 'Abyssinian', 2, 'Available', 528.00), +('Mochi', 'Cat', 'Birman', 3, 'Available', 554.00), +('Louie', 'Cat', 'Ragdoll', 4, 'Available', 591.00), +('Ivy', 'Cat', 'Bengal', 5, 'Available', 606.00), +('Theo', 'Cat', 'British Shorthair', 1, 'Available', 654.00), +('Piper', 'Cat', 'Sphynx', 2, 'Available', 251.00), +('Nova', 'Cat', 'Scottish Fold', 3, 'Available', 277.00), +('Archie', 'Cat', 'Russian Blue', 4, 'Available', 336.00), +('Olive', 'Cat', 'Abyssinian', 5, 'Available', 362.00), +('Boots', 'Cat', 'Birman', 1, 'Available', 399.00), +('Maple', 'Cat', 'Ragdoll', 2, 'Available', 436.00), +('Gizmo', 'Cat', 'Bengal', 3, 'Available', 473.00), +('Nina', 'Cat', 'British Shorthair', 4, 'Available', 499.00), +('Salem', 'Cat', 'Sphynx', 5, 'Available', 547.00), +('Stella', 'Cat', 'Scottish Fold', 1, 'Available', 595.00), +('Kiki', 'Cat', 'Russian Blue', 2, 'Available', 610.00), +('Sunny', 'Cat', 'Abyssinian', 3, 'Available', 658.00), +('Mabel', 'Cat', 'Birman', 4, 'Available', 244.00), +('Coco', 'Bird', 'Cockatiel', 1, 'Available', 119.00), +('Sky', 'Bird', 'Parakeet', 2, 'Available', 145.00), +('Sunny', 'Bird', 'Canary', 3, 'Available', 204.00), +('Kiwi', 'Bird', 'Lovebird', 1, 'Available', 230.00), +('Pico', 'Bird', 'Finch', 2, 'Available', 81.00), +('Blue', 'Bird', 'Conure', 3, 'Available', 118.00), +('Rio', 'Bird', 'Cockatiel', 1, 'Available', 144.00), +('Angel', 'Bird', 'Parakeet', 2, 'Available', 203.00), +('Chirpy', 'Bird', 'Canary', 3, 'Available', 251.00), +('Peach', 'Bird', 'Lovebird', 1, 'Available', 91.00), +('Mango', 'Bird', 'Finch', 2, 'Available', 128.00), +('Pearl', 'Bird', 'Conure', 3, 'Available', 165.00), +('Bubbles', 'Fish', 'Goldfish', 1, 'Available', 30.00), +('Splash', 'Fish', 'Betta', 2, 'Available', 56.00), +('Coral', 'Fish', 'Guppy', 1, 'Available', 23.00), +('Neptune', 'Fish', 'Molly', 2, 'Available', 23.00), +('Marlin', 'Fish', 'Tetra', 1, 'Available', 49.00), +('Finley', 'Fish', 'Angelfish', 2, 'Available', 27.00), +('Pebble', 'Fish', 'Goldfish', 1, 'Available', 64.00), +('Wave', 'Fish', 'Betta', 2, 'Available', 20.00), +('Aqua', 'Fish', 'Guppy', 1, 'Available', 57.00), +('Flash', 'Fish', 'Molly', 2, 'Available', 46.00), +('Nemo', 'Fish', 'Tetra', 1, 'Available', 13.00), +('Pearl', 'Fish', 'Angelfish', 2, 'Available', 61.00), +('Thumper', 'Rabbit', 'Mini Lop', 1, 'Adopted', 147.00), +('Clover', 'Rabbit', 'Netherland Dwarf', 2, 'Adopted', 138.00), +('Biscuit', 'Rabbit', 'Lionhead', 3, 'Adopted', 177.00), +('Hazel', 'Rabbit', 'Rex', 1, 'Adopted', 91.00), +('Juniper', 'Rabbit', 'Mini Lop', 2, 'Adopted', 83.00), +('Poppy', 'Rabbit', 'Netherland Dwarf', 3, 'Adopted', 111.00), +('Snowball', 'Rabbit', 'Lionhead', 1, 'Adopted', 172.00), +('Maple', 'Rabbit', 'Rex', 2, 'Adopted', 150.00), +('Peanut', 'Hamster', 'Syrian', 1, 'Adopted', 29.00), +('Nibbles', 'Hamster', 'Dwarf', 2, 'Adopted', 42.00), +('Pumpkin', 'Hamster', 'Roborovski', 1, 'Pending', 49.00), +('Mocha', 'Hamster', 'Syrian', 2, 'Pending', 48.00), +('Buttons', 'Hamster', 'Dwarf', 1, 'Pending', 61.00), +('Teddy', 'Hamster', 'Roborovski', 2, 'Pending', 35.00), +('Pip', 'Hamster', 'Syrian', 1, 'Pending', 39.00), +('Toffee', 'Hamster', 'Dwarf', 2, 'Pending', 52.00), +('Sprout', 'Hamster', 'Roborovski', 1, 'Available', 26.00), +('Bean', 'Hamster', 'Syrian', 2, 'Available', 28.00); + +INSERT INTO product (prodName, prodPrice, categoryId, prodDesc) +VALUES +('Chicken Recipe Dog Food', 42.00, 1, 'Nutritious food and treats for dogs'), +('Beef Feast Dog Food', 51.00, 1, 'Nutritious food and treats for dogs'), +('Salmon Blend Dog Food', 17.00, 1, 'Nutritious food and treats for dogs'), +('Lamb Dinner Dog Food', 28.00, 1, 'Nutritious food and treats for dogs'), +('Puppy Starter Kibble', 39.00, 1, 'Nutritious food and treats for dogs'), +('Senior Care Dog Food', 40.00, 1, 'Nutritious food and treats for dogs'), +('Small Breed Kibble', 44.00, 1, 'Nutritious food and treats for dogs'), +('Large Breed Kibble', 57.00, 1, 'Nutritious food and treats for dogs'), +('Grain Free Dog Food', 68.00, 1, 'Nutritious food and treats for dogs'), +('Turkey Rice Formula', 79.00, 1, 'Nutritious food and treats for dogs'), +('Duck Sweet Potato Meal', 25.00, 1, 'Nutritious food and treats for dogs'), +('Venison Protein Blend', 36.00, 1, 'Nutritious food and treats for dogs'), +('Healthy Weight Dog Food', 48.00, 1, 'Nutritious food and treats for dogs'), +('Sensitive Stomach Kibble', 62.00, 1, 'Nutritious food and treats for dogs'), +('High Energy Dog Food', 72.00, 1, 'Nutritious food and treats for dogs'), +('Organic Dog Biscuits', 18.00, 1, 'Nutritious food and treats for dogs'), +('Peanut Butter Dog Treats', 33.00, 1, 'Nutritious food and treats for dogs'), +('Dental Chew Sticks', 38.00, 1, 'Nutritious food and treats for dogs'), +('Training Treat Bites', 48.00, 1, 'Nutritious food and treats for dogs'), +('Soft Chicken Treats', 57.00, 1, 'Nutritious food and treats for dogs'), +('Pumpkin Fiber Treats', 70.00, 1, 'Nutritious food and treats for dogs'), +('Joint Support Biscuits', 14.00, 1, 'Nutritious food and treats for dogs'), +('Mini Breed Dinner', 17.00, 1, 'Nutritious food and treats for dogs'), +('Farmhouse Dog Meal', 30.00, 1, 'Nutritious food and treats for dogs'), +('Feather Teaser Wand', 30.00, 2, 'Play items for active cats'), +('Catnip Mouse Toy', 24.00, 2, 'Play items for active cats'), +('Jingle Ball Set', 18.00, 2, 'Play items for active cats'), +('Scratching Post Small', 6.00, 2, 'Play items for active cats'), +('Crinkle Tunnel', 31.00, 2, 'Play items for active cats'), +('Laser Pointer Toy', 6.00, 2, 'Play items for active cats'), +('Plush Fish Toy', 19.00, 2, 'Play items for active cats'), +('Spring Coil Pack', 20.00, 2, 'Play items for active cats'), +('Hanging Door Toy', 12.00, 2, 'Play items for active cats'), +('Interactive Puzzle Toy', 22.00, 2, 'Play items for active cats'), +('Catnip Kicker Toy', 20.00, 2, 'Play items for active cats'), +('Rolling Bell Ball', 20.00, 2, 'Play items for active cats'), +('Ribbon Chase Toy', 19.00, 2, 'Play items for active cats'), +('Mini Plush Mouse', 21.00, 2, 'Play items for active cats'), +('Treat Dispensing Ball', 16.00, 2, 'Play items for active cats'), +('Double Pom Toy', 12.00, 2, 'Play items for active cats'), +('Window Perch Toy', 10.00, 2, 'Play items for active cats'), +('Scratch Pad Refill', 8.00, 2, 'Play items for active cats'), +('Rainbow Wand Toy', 23.00, 2, 'Play items for active cats'), +('Carpet Scratcher', 23.00, 2, 'Play items for active cats'), +('Bird Perch Set', 27.00, 3, 'Care supplies for pet birds'), +('Parakeet Seed Mix', 40.00, 3, 'Care supplies for pet birds'), +('Canary Food Blend', 53.00, 3, 'Care supplies for pet birds'), +('Mineral Cuttlebone', 57.00, 3, 'Care supplies for pet birds'), +('Bird Ladder Toy', 68.00, 3, 'Care supplies for pet birds'), +('Mirror Bell Combo', 80.00, 3, 'Care supplies for pet birds'), +('Clip On Food Cup', 92.00, 3, 'Care supplies for pet birds'), +('Bird Cage Liner Pack', 108.00, 3, 'Care supplies for pet birds'), +('Nesting Material Pack', 121.00, 3, 'Care supplies for pet birds'), +('Treat Spray Millet', 8.00, 3, 'Care supplies for pet birds'), +('Wooden Swing Perch', 22.00, 3, 'Care supplies for pet birds'), +('Foraging Ball Toy', 32.00, 3, 'Care supplies for pet birds'), +('Cage Cleaning Spray', 47.00, 3, 'Care supplies for pet birds'), +('Parrot Rope Perch', 54.00, 3, 'Care supplies for pet birds'), +('Bird Bath Dish', 54.00, 3, 'Care supplies for pet birds'), +('Songbird Vitamin Drops', 78.00, 3, 'Care supplies for pet birds'), +('Aquarium Filter Cartridge', 36.00, 4, 'Essential aquarium equipment and accessories'), +('Decorative Aquarium Gravel', 49.00, 4, 'Essential aquarium equipment and accessories'), +('Fish Net Medium', 34.00, 4, 'Essential aquarium equipment and accessories'), +('Water Conditioner', 45.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Thermometer', 59.00, 4, 'Essential aquarium equipment and accessories'), +('LED Tank Light', 67.00, 4, 'Essential aquarium equipment and accessories'), +('Air Stone Pack', 76.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Heater 50W', 92.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Heater 100W', 106.00, 4, 'Essential aquarium equipment and accessories'), +('Fish Flake Food', 95.00, 4, 'Essential aquarium equipment and accessories'), +('Algae Scraper', 105.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Plant Set', 122.00, 4, 'Essential aquarium equipment and accessories'), +('Bubble Curtain Kit', 136.00, 4, 'Essential aquarium equipment and accessories'), +('Breeder Box Insert', 149.00, 4, 'Essential aquarium equipment and accessories'), +('Filter Sponge Pack', 164.00, 4, 'Essential aquarium equipment and accessories'), +('Aquarium Background Roll', 183.00, 4, 'Essential aquarium equipment and accessories'), +('Glass Lid Clips', 174.00, 4, 'Essential aquarium equipment and accessories'), +('Submersible Pump', 191.00, 4, 'Essential aquarium equipment and accessories'), +('Hamster Bedding Pack', 50.00, 5, 'Supplies for small pets'), +('Rabbit Hay Bundle', 49.00, 5, 'Supplies for small pets'), +('Guinea Pig Pellets', 15.00, 5, 'Supplies for small pets'), +('Small Pet Water Bottle', 31.00, 5, 'Supplies for small pets'), +('Hamster Hideout Hut', 40.00, 5, 'Supplies for small pets'), +('Chew Stick Bundle', 48.00, 5, 'Supplies for small pets'), +('Rabbit Litter Tray', 58.00, 5, 'Supplies for small pets'), +('Exercise Ball Large', 68.00, 5, 'Supplies for small pets'), +('Small Pet Food Bowl', 20.00, 5, 'Supplies for small pets'), +('Timothy Hay Cubes', 28.00, 5, 'Supplies for small pets'), +('Guinea Pig Tunnel', 38.00, 5, 'Supplies for small pets'), +('Hamster Nesting Fluff', 47.00, 5, 'Supplies for small pets'), +('Rabbit Grooming Brush', 60.00, 5, 'Supplies for small pets'), +('Small Pet Carrier', 7.00, 5, 'Supplies for small pets'), +('Hay Rack Feeder', 11.00, 5, 'Supplies for small pets'), +('Wooden Chew Blocks', 27.00, 5, 'Supplies for small pets'); + +INSERT INTO productSupplier (supId, prodId, cost) +SELECT CASE MOD(p.prodId - 7, 5) + WHEN 0 THEN 1 + WHEN 1 THEN 2 + WHEN 2 THEN 3 + WHEN 3 THEN 4 + ELSE 5 + END, + p.prodId, + ROUND(p.prodPrice * (0.62 + (MOD(p.prodId - 7, 5) * 0.03)), 2) +FROM product p +WHERE p.prodId >= 7 + AND NOT EXISTS ( + SELECT 1 FROM productSupplier ps WHERE ps.prodId = p.prodId + ); + +INSERT INTO inventory (prodId, quantity) +SELECT p.prodId, + CASE p.categoryId + WHEN 1 THEN 120 + MOD((p.prodId - 7) * 17, 60) + WHEN 2 THEN 180 + MOD((p.prodId - 7) * 17, 60) + WHEN 3 THEN 70 + MOD((p.prodId - 7) * 17, 60) + WHEN 4 THEN 45 + MOD((p.prodId - 7) * 17, 60) + ELSE 95 + MOD((p.prodId - 7) * 17, 60) + END +FROM product p +WHERE p.prodId >= 7 + AND NOT EXISTS ( + SELECT 1 FROM inventory i WHERE i.prodId = p.prodId + ); diff --git a/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/DropdownApi.java b/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/DropdownApi.java index 6c20526e..30fcb0b8 100644 --- a/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/DropdownApi.java +++ b/desktop/src/main/java/org/example/petshopdesktop/api/endpoints/DropdownApi.java @@ -26,6 +26,22 @@ public class DropdownApi { return apiClient.getObjectMapper().readValue(response, new TypeReference>() {}); } + public List getProductCategories() throws Exception { + String response = apiClient.getRawResponse("/api/v1/dropdowns/product-categories"); + if (response == null || response.isEmpty()) { + throw new IllegalStateException("Empty response from product categories endpoint"); + } + return apiClient.getObjectMapper().readValue(response, new TypeReference>() {}); + } + + public List getPetSpecies() throws Exception { + String response = apiClient.getRawResponse("/api/v1/dropdowns/pet-species"); + if (response == null || response.isEmpty()) { + throw new IllegalStateException("Empty response from pet species endpoint"); + } + return apiClient.getObjectMapper().readValue(response, new TypeReference>() {}); + } + public List getProducts() throws Exception { String response = apiClient.getRawResponse("/api/v1/dropdowns/products"); if (response == null || response.isEmpty()) { diff --git a/desktop/src/main/java/org/example/petshopdesktop/controllers/PetController.java b/desktop/src/main/java/org/example/petshopdesktop/controllers/PetController.java index 7c5d13c8..bd76c9ce 100644 --- a/desktop/src/main/java/org/example/petshopdesktop/controllers/PetController.java +++ b/desktop/src/main/java/org/example/petshopdesktop/controllers/PetController.java @@ -15,6 +15,8 @@ import javafx.scene.layout.StackPane; import javafx.stage.Modality; import javafx.stage.Stage; import org.example.petshopdesktop.api.dto.pet.PetResponse; +import org.example.petshopdesktop.api.dto.common.DropdownOption; +import org.example.petshopdesktop.api.endpoints.DropdownApi; import org.example.petshopdesktop.api.endpoints.PetApi; import org.example.petshopdesktop.controllers.dialogcontrollers.PetDialogController; import org.example.petshopdesktop.models.Pet; @@ -156,8 +158,7 @@ public class PetController { colPetPrice.setCellValueFactory(new PropertyValueFactory("petPrice")); configureImageColumn(colPetImage); - cbSpeciesFilter.setItems(FXCollections.observableArrayList("All Species", "Dog", "Cat", "Bird", "Fish", "Rabbit", "Hamster")); - cbSpeciesFilter.getSelectionModel().selectFirst(); + loadSpeciesFilter(); cbStatusFilter.setItems(FXCollections.observableArrayList("All Statuses", "Available", "Adopted", "Pending")); cbStatusFilter.getSelectionModel().selectFirst(); @@ -245,6 +246,26 @@ public class PetController { displayFilteredPet(txtSearch.getText()); } + private void loadSpeciesFilter() { + new Thread(() -> { + try { + List values = DropdownApi.getInstance().getPetSpecies().stream() + .map(DropdownOption::getLabel) + .collect(Collectors.toList()); + values.add(0, "All Species"); + Platform.runLater(() -> { + cbSpeciesFilter.setItems(FXCollections.observableArrayList(values)); + cbSpeciesFilter.getSelectionModel().selectFirst(); + }); + } catch (Exception e) { + Platform.runLater(() -> ActivityLogger.getInstance().logException( + "PetController.loadSpeciesFilter", + e, + "Loading species filter options")); + } + }).start(); + } + private String selectedSpecies() { String value = cbSpeciesFilter.getValue(); return value == null || value.equals("All Species") ? null : value; diff --git a/desktop/src/main/java/org/example/petshopdesktop/controllers/ProductController.java b/desktop/src/main/java/org/example/petshopdesktop/controllers/ProductController.java index 8bb51296..84cfb8ce 100644 --- a/desktop/src/main/java/org/example/petshopdesktop/controllers/ProductController.java +++ b/desktop/src/main/java/org/example/petshopdesktop/controllers/ProductController.java @@ -269,7 +269,7 @@ public class ProductController { all.setId(null); all.setLabel("All Categories"); options.add(all); - options.addAll(DropdownApi.getInstance().getCategories()); + options.addAll(DropdownApi.getInstance().getProductCategories()); Platform.runLater(() -> { cbCategoryFilter.setItems(FXCollections.observableArrayList(options)); cbCategoryFilter.getSelectionModel().selectFirst(); diff --git a/desktop/src/main/java/org/example/petshopdesktop/controllers/dialogcontrollers/ProductDialogController.java b/desktop/src/main/java/org/example/petshopdesktop/controllers/dialogcontrollers/ProductDialogController.java index 7b354a9d..2a51e42a 100644 --- a/desktop/src/main/java/org/example/petshopdesktop/controllers/dialogcontrollers/ProductDialogController.java +++ b/desktop/src/main/java/org/example/petshopdesktop/controllers/dialogcontrollers/ProductDialogController.java @@ -89,7 +89,7 @@ public class ProductDialogController { //Set up combobox for selecting category try { - List categories = DropdownApi.getInstance().getCategories(); + List categories = DropdownApi.getInstance().getProductCategories(); if (categories != null) { ObservableList categoriesObs = FXCollections.observableArrayList(categories); cbProdCategory.setItems(categoriesObs);