Add Geographic Models: Province, Location, and Address (#194)

Commit: 8d3f7e24647b2e9dfec243a4f0be371de273e750
Date: 2025-07-06 10:00:28 +0000
Author: PascalHavelange

Commit Message

Add Geographic Models: Province, Location, and Address (#194)

* feat: add geographic models Province, Location, and Address with internationalization

- Add Province model with UUID primary key, country relationship, and multi-language support
- Add Location model with UUID primary key, country/province relationships, and multi-language support
- Add Address model with UUID primary key, country relationship, and multi-language support
- Create ProvinceLanguage, LocationLanguage, and AddressLanguage pivot models for internationalization
- Implement six new migrations with proper foreign key constraints and indexing
- Add API resources for Province, Location, and Address with language data inclusion
- Create full CRUD controllers for all three models with validation and error handling
- Build factories and seeders for all models ensuring proper relationship generation
- Register new seeders in DatabaseSeeder for database population
- Add comprehensive API routes for all three models following RESTful conventions
- Implement 120+ new tests (unit and feature) ensuring complete functionality coverage
- Update documentation with new models, API endpoints, and relationship diagrams

API Endpoints Added:
Province: GET/POST/PUT/DELETE /api/provinces
Location: GET/POST/PUT/DELETE /api/locations
Address: GET/POST/PUT/DELETE /api/addresses

Key Features:
- Geographic hierarchy: Country → Province → Location, with Address linked to Country
- Full internationalization support via pivot tables
- UUID primary keys for scalability and security
- Required country relationships for all models
- Consistent API patterns following Contact model structure
- Comprehensive validation and error handling
- backward_compatibility and internal_name fields for data migration
- Complete test coverage including anonymous access, CRUD operations, and relationships

Database Schema:
- provinces: id (UUID), country_id (required), internal_name, timestamps
- locations: id (UUID), country_id (required), province_id (required), internal_name, timestamps
- addresses: id (UUID), country_id (required), internal_name, timestamps
- province_language: province_id + language_id (composite PK), name, description
- location_language: location_id + language_id (composite PK), name, description
- address_language: address_id + language_id (composite PK), address, description

Documentation Updates:
- CHANGELOG.md with detailed feature descriptions
- docs/api-models.md with comprehensive model documentation
- API relationship diagrams and endpoint specifications
- Internationalization pattern documentation

* api.json

---------

Co-authored-by: Pascal HAVELANGE <havelangep@hotmail.com>

Files Changed


This documentation was automatically generated from Git commit data.