propel_api 0.3.1.6 โ†’ 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 379048f58a88602b2417f539dc866ec9ba5464a76d0e96f0da699e6b51e5e3c6
4
- data.tar.gz: 7db7da9523b014f4ee297d7dd652ae5b273dadad23ad5eda0fceddbfd0fb1938
3
+ metadata.gz: ab74f199f5f59a6a62a0f39a8c63960a7b1339b46bd32701219a6249f6cdb5a3
4
+ data.tar.gz: c4aa9676d91f4400cd54f0aa6d5ce0a022f9b6c893ec7b3124da057f679d8770
5
5
  SHA512:
6
- metadata.gz: 36ae5f3ab7dfd0c7a8f08ca2d6271da061aefc1046cc4304d8b99a47645cccc5448d2c7186d6861f1424af81934e9f313d6eed0152a8545eaa7a7cb99791faf0
7
- data.tar.gz: 49aa423413e2b78a7d98c027b4c507dab997c3effca2b289ac3ad856272afb6ca133a9fa1556838dc749b529e412303794ce0e1e1667f6b19787f85ed70a0294
6
+ metadata.gz: 27513e98749a5b837f3f7c1e10280e49155ec5a8113c8319c1b8994e17efaf79cba9c549f74a82982a386fa30d2505d62aeadb84d7bd1af9e0debc9576a52d80
7
+ data.tar.gz: 8d1c4bc5f35ac31d8d42570c7d0829e488242512631ab5d883a382fddc77bb12f3c94daa36645b6fefbc92ab50ccad455a4464225749b047ca1dbbcc27f53fb0
data/CHANGELOG.md CHANGED
@@ -10,6 +10,89 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  ### Planned Features
11
11
  - GraphQL adapter support
12
12
 
13
+ ## [0.3.3] - 2025-01-XX
14
+
15
+ ### ๐ŸŽ‰ Major Features Added
16
+ - **Comprehensive Dynamic Filtering System**: Complete implementation of automatic URL query string filtering and scoping using the `has_scope` gem
17
+ - **Multi-Type Filtering Support**: Full filtering support across all data types (string, numeric, boolean, datetime, date, time)
18
+ - **Database-Agnostic Implementation**: Works seamlessly across SQLite, PostgreSQL, and MySQL without database-specific code
19
+ - **Automatic Scope Generation**: Dynamic scope generation based on model column types and filter operators
20
+ - **Intelligent Facet Integration**: Automatic inclusion of filterable fields in JSON facets for API responses
21
+
22
+ ### ๐Ÿ” Advanced Filtering Capabilities
23
+ - **String Filtering**: Exact match (`_eq`), contains (`_contains`), starts with (`_starts_with`), ends with (`_ends_with`), in list (`_in`)
24
+ - **Numeric Filtering**: Comparison operators (`_gt`, `_lt`, `_gte`, `_lte`), range filtering (`_range`), in list (`_in`)
25
+ - **Boolean Filtering**: Multiple value format support (`true`/`false`, `1`/`0`, `yes`/`no`, `on`/`off`)
26
+ - **DateTime Filtering**: Temporal comparisons (`_before`, `_after`), date extraction (`_year`, `_month`, `_day`), date matching (`_date`)
27
+ - **Range Filtering**: Support for both array and string formats (e.g., `"150,350"` or `[150, 350]`)
28
+
29
+ ### ๐Ÿ› ๏ธ Technical Implementation
30
+ - **PropelDynamicScopeGenerator**: New generator class for automatic scope creation based on model columns
31
+ - **PropelModelFiltersConcern**: Model concern for dynamic scope generation and filter parameter validation
32
+ - **PropelControllerFiltersConcern**: Controller concern for has_scope integration and security validation
33
+ - **PropelFilterOperators**: Configuration class defining available operators for each data type
34
+ - **Database-Agnostic Datetime Parsing**: Ruby-based datetime parsing instead of SQL extraction functions
35
+
36
+ ### ๐Ÿ”’ Security & Performance
37
+ - **Input Validation**: Comprehensive validation of filter parameters against allowed field names and operators
38
+ - **SQL Injection Protection**: All parameters properly escaped and parameterized
39
+ - **Multi-Tenancy Integration**: Automatic organization scoping for all filtered queries
40
+ - **Sensitive Field Filtering**: Automatic exclusion of sensitive fields (passwords, tokens, etc.) from filtering
41
+ - **Performance Optimization**: Efficient range queries and indexed field prioritization
42
+
43
+ ### ๐Ÿ“Š Enhanced JSON Facet System
44
+ - **Smart Field Inclusion**: Automatic inclusion of boolean and datetime fields in `:short` facets
45
+ - **Exclusion Lists**: Configurable exclusion of specific fields (e.g., `created_at`, `updated_at`, `internal_flag`)
46
+ - **Consistent Serialization**: Ensures filterable fields are available in API responses for client-side filtering
47
+
48
+ ### ๐Ÿงช Comprehensive Testing
49
+ - **Test-Driven Development**: Complete test suite with 992 tests covering all filtering scenarios
50
+ - **Fixture-Aware Testing**: Unique test data values to avoid conflicts with fixture data
51
+ - **Multi-Tenancy Testing**: Proper testing of organization-scoped filtering
52
+ - **Edge Case Coverage**: Testing of invalid inputs, empty values, and error conditions
53
+ - **Database Compatibility**: Tests pass across SQLite, PostgreSQL, and MySQL
54
+
55
+ ### ๐Ÿ“– Documentation & Examples
56
+ - **Comprehensive API Documentation**: Complete filtering documentation with examples for all operators
57
+ - **Postman Collection Ready**: Detailed query parameter examples for testing
58
+ - **Error Handling Guide**: Common error scenarios and troubleshooting tips
59
+ - **Performance Guidelines**: Optimization recommendations for large datasets
60
+
61
+ ### ๐Ÿ”ง Configuration & Customization
62
+ - **Flexible Operator Configuration**: Easy addition of new filter operators via `PropelFilterOperators`
63
+ - **Customizable Field Exclusions**: Configurable lists for fields to exclude from facets
64
+ - **Template-Based Generation**: All filtering code generated via ERB templates for easy customization
65
+ - **Backward Compatibility**: Existing applications continue to work without changes
66
+
67
+ ### ๐Ÿ› Bug Fixes
68
+ - **Template Syntax Errors**: Fixed ERB template syntax issues with `next` vs `return` in select blocks
69
+ - **Scope Generation Caching**: Resolved issues with cached scopes not updating after template changes
70
+ - **Datetime Parsing Errors**: Fixed datetime scope generation to handle multiple input formats
71
+ - **SQL Compatibility**: Resolved SQLite `EXTRACT` function compatibility issues
72
+
73
+ ## [0.3.2] - 2025-09-15
74
+
75
+ ### ๐Ÿ› Critical Bug Fixes
76
+ - **Generator Destroy/Rollback Functionality**: Fixed critical issues with resource generator destroy and rollback operations
77
+ - Fixed `propel_api:resource` generator to properly handle destroy operations and rollbacks
78
+ - Enhanced controller generator with improved destroy and rollback logic
79
+ - Completely rebuilt and improved `named_base.rb` core infrastructure with comprehensive destroy/rollback support
80
+ - Added robust error handling and cleanup procedures for failed generator operations
81
+ - Fixed edge cases where incomplete generator runs could leave orphaned files or partial configurations
82
+ - Enhanced generator infrastructure to properly track and reverse all file operations and modifications
83
+
84
+ ### ๐Ÿ› ๏ธ Generator Infrastructure Improvements
85
+ - **Enhanced Core Named Base**: Major improvements to the core generator infrastructure
86
+ - Comprehensive rebuild of generator tracking and rollback mechanisms
87
+ - Better state management for complex generator operations
88
+ - Improved error recovery and cleanup procedures
89
+ - Enhanced file operation tracking for reliable rollbacks
90
+ - **Resource Generator Robustness**: Significantly improved resource generator reliability
91
+ - Better handling of partial generation scenarios
92
+ - Enhanced error reporting and recovery mechanisms
93
+ - Improved coordination between controller, model, migration, and test generation
94
+ - More reliable cleanup of generated artifacts during rollbacks
95
+
13
96
  ## [0.3.1.6] - 2025-09-13
14
97
 
15
98
  ### ๐Ÿ”ง Enhanced Multi-Tenancy Support
data/README.md CHANGED
@@ -1,6 +1,51 @@
1
1
  # PropelApi
2
2
 
3
- A comprehensive Rails generator that creates complete API resources with models, controllers, tests, and realistic seed data. Supports both PropelFacets (JSON Facet) and Graphiti serialization engines with **fixed route insertion** and proper indentation.
3
+ A comprehensive Rails generator that creates complete API resources with models, controllers, tests, and realistic seed data. Supports both PropelFacets (JSON Facet) and Graphiti serialization engines with **fixed route insertion**, proper indentation, and **comprehensive dynamic filtering system**.
4
+
5
+ ## ๐ŸŽ‰ NEW in v0.3.3: Dynamic Filtering System
6
+
7
+ PropelApi now includes a complete automatic URL query string filtering and scoping system using the `has_scope` gem. This provides powerful, database-agnostic filtering across all data types with zero configuration required.
8
+
9
+ ### Quick Filtering Examples
10
+
11
+ ```bash
12
+ # String filtering
13
+ GET /api/v1/meetings?title_contains=Project&status_in=active,pending
14
+
15
+ # Numeric filtering
16
+ GET /api/v1/meetings?max_participants_gte=50&max_participants_lte=200
17
+
18
+ # Boolean filtering
19
+ GET /api/v1/meetings?recording_enabled_eq=true&ai_research_enabled_eq=false
20
+
21
+ # DateTime filtering
22
+ GET /api/v1/meetings?start_time_after=2024-01-01T00:00:00Z&start_time_before=2024-12-31T23:59:59Z
23
+
24
+ # Range filtering
25
+ GET /api/v1/meetings?max_participants_range=150,350
26
+
27
+ # Combined filtering with sorting and pagination
28
+ GET /api/v1/meetings?title_contains=Project&max_participants_gte=50&order_by=start_time&page=1&limit=20
29
+ ```
30
+
31
+ ### Supported Filter Operators
32
+
33
+ | Data Type | Operators | Examples |
34
+ |-----------|-----------|----------|
35
+ | **String** | `_eq`, `_contains`, `_starts_with`, `_ends_with`, `_in` | `name_eq=Acme`, `title_contains=Project` |
36
+ | **Numeric** | `_eq`, `_gt`, `_lt`, `_gte`, `_lte`, `_range`, `_in` | `max_participants_gte=50`, `price_range=100,500` |
37
+ | **Boolean** | `_eq` (supports `true`/`false`, `1`/`0`, `yes`/`no`, `on`/`off`) | `recording_enabled_eq=true` |
38
+ | **DateTime** | `_before`, `_after`, `_year`, `_month`, `_day`, `_date` | `start_time_after=2024-01-01`, `created_at_year=2024` |
39
+ | **Date** | Same as DateTime | `event_date_after=2024-01-01` |
40
+ | **Time** | Same as DateTime | `start_time_hour=14` |
41
+
42
+ ### Automatic Features
43
+
44
+ - **Zero Configuration**: Filtering works automatically for all generated resources
45
+ - **Database Agnostic**: Works with SQLite, PostgreSQL, and MySQL
46
+ - **Security Built-in**: SQL injection protection and input validation
47
+ - **Multi-tenancy Ready**: Automatic organization scoping
48
+ - **Performance Optimized**: Efficient queries with proper indexing support
4
49
 
5
50
  ## Installation
6
51
 
@@ -76,19 +76,25 @@ module PropelApi
76
76
  validate_attributes_exist unless should_auto_introspect?
77
77
  end
78
78
 
79
+ def check_dependencies_before_destroy
80
+ # Only check critical dependencies during destroy operations
81
+ check_for_critical_dependencies if behavior == :revoke
82
+ end
83
+
79
84
  def create_controller
80
- # Use shared method from Base class
81
- create_propel_controller
85
+ create_propel_controller_template
82
86
  end
83
87
 
84
- def create_routes
85
- # Use shared method from Base class
88
+ def add_routes
86
89
  create_propel_routes
87
90
  end
88
91
 
89
- def create_tests
90
- # Use shared method from Base class with controller and integration tests only
91
- create_propel_tests(test_types: [:controller, :integration])
92
+ def create_controller_test
93
+ create_propel_controller_test
94
+ end
95
+
96
+ def create_integration_test
97
+ create_propel_integration_test
92
98
  end
93
99
 
94
100
  def show_completion_message