Commit Graph

352 Commits

Author SHA1 Message Date
319293a59d Fix backend validation 2026-03-10 17:15:26 -06:00
a12e23a713 Clean imports 2026-03-10 16:47:09 -06:00
fad80e436f Backend correctness fixes 2026-03-10 16:47:04 -06:00
c56fb9ab00 Backend fixes 2026-03-10 16:05:05 -06:00
89d3accabc Add seed data migration and fix schema NOT NULL constraints 2026-03-10 13:10:52 -06:00
8b10696c84 Fix backend security, validation, and API contracts 2026-03-10 13:03:14 -06:00
93b587cd9c Fix .gitignore to exclude user-specific files
- Remove tracked .idea/vcs.xml (user-specific VCS settings)
- Use whitelist approach for .idea/ directory (consistent with backend)
- Improve log file patterns (*.log)
- Remove redundant .idea/workspace.xml pattern (covered by wildcard)
2026-03-10 00:03:22 -06:00
e6e44f70d8 Fix .gitignore to exclude user-specific files
- Remove tracked .idea/dataSources.xml (user-specific DB config)
- Remove tracked .idea/vcs.xml (user-specific VCS settings)
- Use whitelist approach for .idea/ directory
- Add patterns for temp/backup files (*.backup*, *.py, temp_*.json, etc.)
2026-03-10 00:03:15 -06:00
1c4f13dc75 Ignore log files 2026-03-09 23:59:41 -06:00
Alex
03ce5ca090 add pet profile to pet list 2026-03-09 22:38:56 -06:00
7db2e63b79 Create 3 simple cross-platform run configurations
1. Pet Shop Application - Run Spring Boot (main run config)
2. Database - Start database containers
3. Reset Database - Clean volumes and restart (Maven-based, auto-stops)

All use IntelliJ Docker/Spring Boot/Maven integration (Windows/Mac/Linux).
Reset Database uses exec-maven-plugin to run docker compose down -v.
Stops automatically when complete.
2026-03-09 22:01:42 -06:00
015bb574b8 Add validation tests to detect run configuration drift
- Add spring-boot-starter-test dependency for JUnit Jupiter
- Validate main class exists and matches run config reference
- Validate module name matches pom.xml artifactId
- Validate schema.sql contains active column
- Prevents configuration breakage from refactoring
- Fails with clear messages pointing to which configs need updates

All 5 tests passing.
2026-03-09 22:01:42 -06:00
a1be1a5688 Improve Docker healthcheck to validate schema initialization
- Check for 'users' table existence instead of just mysqladmin ping
- Ensures schema.sql has executed before marking as healthy
- Add 40s start_period for initial schema load
- Prevents Spring Boot from connecting to uninitialized database
2026-03-09 22:01:42 -06:00
56bb4f19e8 Merge branch 'main' of github.com:RecentRunner/group-2-threaded-project-petshop-backend 2026-03-09 20:45:42 -06:00
2521806dea Add database auto-start configuration for development 2026-03-09 20:38:38 -06:00
a93846e2d1 Merge pull request #33 from RecentRunner/api-migration
Api migration
2026-03-09 16:27:30 -06:00
4a2cdbe9c5 Complete desktop DTO integration and controller fixes
**Critical DTO Fixes:**
- ServiceResponse/Request: id → serviceId, price → servicePrice, description → serviceDesc
- SaleItemRequest: productId → prodId, removed unitPrice (backend doesn't require)
- SaleItemResponse: id → saleItemId, added prodId, removed lineTotal (calculated locally)
- TopProduct: added productId, quantitySold Integer → Long, totalRevenue → revenue
- DailySales: date LocalDate → String, totalSales → revenue, added salesCount

**Controller Updates:**
- Updated 17+ controllers and dialog controllers to use renamed DTO fields
- Fixed AnalyticsController to use nested SalesSummary and InventorySummary structures
- Fixed ServiceController/ServiceDialogController to use serviceDuration
- Fixed LoginController CUSTOMER rejection to use lblError instead of missing showError()
- Updated all ProductResponse, SupplierResponse, PetResponse, AdoptionResponse, etc. usages

**Files Changed:**
- 6 DTO classes (service, sale, analytics)
- 17+ controller classes across main and dialog controllers

**Verification:**
- Desktop project compiles successfully with mvn clean compile
- All critical JSON mapping misalignments resolved
- Phase 6, 7, and 8 complete
2026-03-09 11:57:05 -06:00
Alex
2628f63f8c Updated design to look like JavaFX project
- updated the fxml file to have the same theming as desktop project
- removed old unused files to project neatness

TODO:
-hook up backend to application
-complete CRUD for each entity
- change text so it uses String.xml values
-add more info to profile if needed
-give pets their own profile
-fix small bug with status bar color not changing
2026-03-09 04:10:00 -06:00
6f87763a6d Complete final DTO verification and alignment
Changes:
- PetRequest: Fixed all field names to match backend contract
  - species → petSpecies
  - breed → petBreed
  - price → petPrice
  - dateOfBirth/gender/color → petAge (backend uses Integer age)
- PetResponse: Fixed all field names to match backend contract
  - id → petId
  - species → petSpecies
  - breed → petBreed
  - price → petPrice
  - Removed desktop-only fields (dateOfBirth, gender, color)
  - Added backend fields (petAge, createdAt, updatedAt)
- InventoryRequest: Fixed all field names to match backend contract
  - productId → prodId
  - stockQuantity → quantity
  - Removed desktop-only fields (storeId, reorderLevel)
- InventoryResponse: Fixed all field names to match backend contract
  - id → inventoryId
  - stockQuantity → quantity
  - Removed desktop-only fields (storeName, reorderLevel)
  - Added backend fields (prodId, createdAt, updatedAt)

All DTOs now use proper types (BigDecimal for prices, LocalDate/LocalDateTime for dates).
Desktop DTOs are fully aligned with backend contracts.
2026-03-09 01:35:48 -06:00
37327742ae Fix desktop UX and configuration
Changes:
- MainLayoutController: Analytics access restricted to ADMIN only
  - STAFF users default to Sales view instead of Analytics
  - Logo click redirects STAFF to Sales, ADMIN to Analytics
  - Analytics button hidden for STAFF users
- LoginController: Added CUSTOMER login rejection with clear message
  - CUSTOMER role users are now rejected at login with helpful error
  - Directs customers to use web/mobile applications instead
- Configuration cleanup: Removed connectionpetstore.properties from project root
  - Config file remains in src/main/resources for proper packaging
  - ApiConfig already loads from classpath correctly

These changes ensure proper role-based access control and clean configuration management.
2026-03-09 01:32:40 -06:00
90a6d5d464 Fix desktop structural DTO changes
Changes:
- PurchaseOrderResponse: id → purchaseOrderId
- SaleResponse: id → saleId
- DashboardResponse: restructured to use nested SalesSummary and InventorySummary classes matching backend structure
- Added TopProduct and DailySales support
- Inventory DTOs review pending (storeName/reorderLevel fields may need manual UI check)

These changes align desktop response DTOs with backend structural requirements.
2026-03-09 01:30:49 -06:00
3096b52cbb Merge pull request #2 from RecentRunner/customer
Fixes
2026-03-09 01:25:43 -06:00
1fb7da3800 Align desktop DTOs to match backend field names
Phase 5: Simple DTO field renames

AdoptionResponse:
- id → adoptionId

AppointmentResponse:
- id → appointmentId
- petNames: String → List<String>

ProductResponse/ProductRequest:
- id → prodId
- productName → prodName
- description → prodDesc
- price → prodPrice

ServiceResponse:
- description → serviceDesc
- price → servicePrice
- Added serviceDuration field

SupplierResponse/SupplierRequest:
- id → supId
- supplierName → supCompany
- contactPerson → supContactFirstName
- Added supContactLastName field
- email → supEmail
- phone → supPhone

UserRequest/UserResponse already use fullName (no changes needed)

All field names now match backend DTOs exactly.
Controllers and views may need updates to reference new field names.

Phase 5
2026-03-09 01:24:55 -06:00
64e6019d40 Fix Postman collection request bodies and add missing auth endpoints
Added missing authentication endpoints:
- POST /api/v1/auth/me/avatar (Upload Avatar)
- GET /api/v1/auth/me/avatar (Get Avatar)
- DELETE /api/v1/auth/me/avatar (Delete Avatar)
- POST /api/v1/auth/logout (Logout)

Fixed request body DTOs to match backend:
- ProductSupplier: Use 'cost' field, composite key bulk delete structure
- Appointment: Remove storeId/notes, add appointmentStatus and petIds
- Adoption: Add adoptionStatus field
- Refund: Remove amount field (only saleId and reason)
- Customer: Remove address field
- Store: Use address/phone/email (not storeAddress/storePhone)
- Inventory: Use prodId (not productId)
- Supplier: Split contact into supContactFirstName and supContactLastName

All 107 requests verified against backend controllers and DTOs.
JSON validation passed. Collection is production-ready.

Phase 3B
2026-03-09 01:24:23 -06:00
dec0986830 Fix ChatService customer ID domain logic
- FIXED: ChatService now uses customer.customerId instead of users.id for CUSTOMER role
- getConversations(): Resolve Customer entity to get customerId for filtering
- getConversation(): Verify ownership using customer.customerId
- sendMessage(): Updated signature to accept role parameter for staff assignment logic
- getMessages(): Verify conversation ownership using customer.customerId
- ChatController: Updated sendMessage call to pass user.getRole()

This fixes the domain bug where conversation.customerId (references customer table)
was being incorrectly populated with users.id instead of customer.customerId.

Phase 3B
2026-03-09 01:24:10 -06:00
000c1f8859 Align desktop user contract with backend
- Replace firstName and lastName with fullName and email in UserRequest
- Add email and updatedAt to UserResponse
- Update StaffRegisterDialogController to build fullName from firstName + lastName
- Update StaffRegisterDialogController to include email validation and send email
- Update StaffAccountsController to use backend email from UserResponse instead of hardcoding blank
2026-03-08 22:02:28 -06:00
d4e532a798 Fix desktop ProductSupplier to use composite keys
- Remove id field from ProductSupplierResponse
- Rename supplierPrice to cost in ProductSupplierResponse and ProductSupplierRequest
- Update ProductSupplierApi to use composite keys (productId, supplierId) for update and delete
- Update ProductSupplierController delete logic to iterate and delete with composite keys
- Update ProductSupplierController mapping to use getCost() instead of getSupplierPrice()
- Update ProductSupplierDialogController to pass both productId and supplierId to update
- Update ProductSupplierDialogController to use setCost() instead of setSupplierPrice()
- Remove unused selectedId field from ProductSupplierDialogController
2026-03-08 22:01:10 -06:00
a0c782f4cc Fix backend business logic and remove hardcoded IDs
- Add customerId to SaleRequest DTO
- Update SaleService to use AuthenticationHelper for employee attribution
- Populate sale.customer when customerId provided in request
- Fix AdoptionController to use authenticated customer instead of hardcoded ID 1
- Fix AppointmentController to use authenticated customer instead of hardcoded ID 1
- Fix RefundController to use authenticated customer instead of hardcoded ID 1
- Update data.sql sales to include customer linkage for refund testing
- Update Postman collection sale creation with customerId and items
2026-03-08 21:58:50 -06:00
a0d14e493f Fix backend user contract and add User-Employee-Customer linkage
- Add active field to User entity and users table
- Add userId linkage to Employee and Customer entities with unique constraints and FKs
- Add repository methods findByUserId and findAllByEmail
- Create UserBusinessLinkageService for shared employee/customer creation logic
- Create AuthenticationHelper utility for resolving authenticated users
- Update UserService to persist all user fields and create linked business entities
- Update AuthController register to set active and create linked customer
- Update DataInitializer to be idempotent and use shared linkage service
- Update Postman collection user endpoints with fullName, email, and active
2026-03-08 21:56:04 -06:00
d86652b462 Reorganize Postman collection by resource 2026-03-08 15:39:50 -06:00
4394e96329 Filter appointments and adoptions by customer 2026-03-08 15:38:52 -06:00
d7d294130f Complete Postman collection with all endpoints 2026-03-08 15:23:16 -06:00
68087c8f82 Allow public GET access to services and categories 2026-03-08 15:17:49 -06:00
992e610e4b Fix DataInitializer and make products publicly accessible 2026-03-08 14:38:52 -06:00
cce4de566c Fix JPA schema validation to allow backend startup 2026-03-08 13:41:15 -06:00
2dedd5508f Add customer registration, profile management and refunds 2026-03-08 10:50:03 -06:00
6b182f2cc2 Fix Pet entity ID mapping for JPA compatibility 2026-03-08 10:14:08 -06:00
59de8ae1aa Fix null pointers and unsafe parsing bugs 2026-03-08 10:05:09 -06:00
ad81bd031d Allow public viewing of pets and sales 2026-03-08 09:39:37 -06:00
3a93fea34f Fix database seeding, add security and complete missing endpoints 2026-03-08 09:11:26 -06:00
Alex
55f545b380 Added Profile page
- Changed layout of profile page
- made it so we can edit phone and email on profile page
- can take photos or use gallery to change profile photo

TODO:
- change theme of app to stay consistent with desktop app
- change text so it uses String.xml values
-add more info to profile if needed
-give pets their own profile
-connect to backend when its ready
2026-03-08 01:51:22 -07:00
aa011205a0 Configure Jackson to ignore unknown properties 2026-03-07 17:53:41 -07:00
2bf09ea76d Remove docker configs and database run configuration 2026-03-07 17:47:09 -07:00
b5084c6d2e Remove database package and references 2026-03-07 17:45:12 -07:00
a6e424de41 Fix compilation errors in controllers 2026-03-07 17:07:43 -07:00
0e8ec35995 Remove mysql-connector-j dependency 2026-03-07 17:04:46 -07:00
8f88cc41a8 Complete InventoryDialogController migration 2026-03-07 17:04:24 -07:00
2b8cd22204 Migrate all controllers to REST API 2026-03-07 17:02:53 -07:00
87f616d08e Migrate Pet controllers to REST API 2026-03-07 13:28:45 -07:00
58e29f307e Migrate Product controllers to REST API 2026-03-07 13:23:16 -07:00