Commit graph

92 commits

Author SHA1 Message Date
897677a782
refactor: Replace actor option patterns with ash_actor_opts helper
- Replace if actor, do: [actor: actor], else: [] with Mv.Helpers.ash_actor_opts/1
- Update email_sync/loader.ex, member validations, member.ex, cycle_generator.ex
- Consistent actor handling across non-LiveView modules
2026-01-13 15:17:06 +01:00
dbd79075f5
Pass actor parameter through cycle generation
Extract actor from changeset context in Member hooks and pass it
through all cycle generation functions to ensure proper authorization.
2026-01-13 15:15:59 +01:00
42a463f422
Security: Fix critical deny-filter bug and improve authorization
CRITICAL FIX: Deny-filter was allowing all records instead of denying
Fix: User validation in Member now uses actor from changeset.context
2026-01-13 15:01:55 +01:00
6846363132
Refactor: NoActor to SimpleCheck with compile-time environment check
This prevents security issues where :create/:read without actor would
be allowed in production. Now all operations require an actor in production.
2026-01-13 15:01:54 +01:00
4192922fd3
feat: implement authorization policies for Member resource 2026-01-13 15:01:53 +01:00
6311eebb0c fix linting
All checks were successful
continuous-integration/drone/push Build is passing
2026-01-08 11:41:24 +01:00
4a1042ab1a feat: add atomic update for single member field visibility 2026-01-08 11:28:27 +01:00
38d106a69e fix: exit date as default hidden column 2026-01-07 12:14:41 +01:00
17540c6b1d feat: removes phoen number as member field and makes name optional 2026-01-02 16:19:06 +01:00
850f00fe22 formatting
All checks were successful
continuous-integration/drone/push Build is passing
2026-01-02 13:53:24 +01:00
08f563a412 Merge branch 'main' into bugfix/274_required_custom_fields
Some checks failed
continuous-integration/drone/push Build is failing
2026-01-02 13:47:24 +01:00
5318b2c07d docs: add typespec for SetDefaultMembershipFeeType.change/3 2025-12-26 21:40:32 +01:00
d02add75ef fix: convert after_action to after_transaction for cycle generation
Replace after_action hooks with after_transaction to ensure async tasks only run after successful commit. Extract common cycle generation logic into handle_cycle_generation/2 to reduce duplication. Add structured error logging with context.
2025-12-26 21:40:22 +01:00
1dd68bcaf2 feat: coherent required boolean handling
Some checks failed
continuous-integration/drone/push Build is failing
2025-12-23 18:08:31 +01:00
e3ff3e610c feat: optimize required custom fields query 2025-12-23 17:01:50 +01:00
2d2865b5a6 feat: improve validation for custom fields 2025-12-23 17:01:21 +01:00
098b3b0a2a
Remove paid field from members
Remove paid field from Member resource, database migration,
tests, seeds, and UI. This field is no longer needed as payment
status is now tracked via membership fee cycles.
2025-12-18 15:11:02 +01:00
9a1f0fbfa6
Remove future date validation for join_date
Allow join_date to be set in the future. Only validation remaining
is that exit_date must be after join_date.
2025-12-18 15:10:36 +01:00
8f8c3f258a
Reduce function nesting depth 2025-12-18 15:10:36 +01:00
128c712dbc
fix: improve get_last_completed_cycle and fix test helpers
- Fix get_last_completed_cycle to find most recent completed cycle
- Fix create_cycle helpers to delete auto-generated cycles first
- Fix Ash.destroy return value handling
- Fix form selectors to use specific IDs
- Fix URL parameter names for filters
- Fix Ash.read_one return value expectations in tests
2025-12-18 15:10:35 +01:00
d720670fd2
fix: address notification handling review feedback
1. Fix misleading comment in async create_member path
2. Use skip_lock?: true in test case for create_member
3. Fix generate_cycles_for_all_members/1
2025-12-18 15:00:45 +01:00
c25ffdc034
refactor: implement proper notification handling via after_action hooks
Refactor notification handling according to Ash best practices
2025-12-18 15:00:44 +01:00
98b56fc406
fix: resolve notification handling and maintain after_action for cycle regeneration 2025-12-18 15:00:44 +01:00
0783a2fe18
refactor: reduce nesting depth in regenerate_cycles_on_type_change
Split the function into smaller, focused functions to reduce nesting depth
2025-12-18 15:00:44 +01:00
66d0c9a702
fix: address code review points for cycle regeneration
1. Fix critical notifications bug
2. Fix today inconsistency
3. Add advisory lock around deletion
4. Improve helper function documentation
5. Improve error message UX
2025-12-18 15:00:44 +01:00
d8e9c157bf
fix: prevent deadlocks by detecting existing transactions 2025-12-18 15:00:43 +01:00
69c9746974
fix: make cycle regeneration atomic on type change
Make cycle regeneration synchronous in the same transaction as the member
update to ensure atomicity.
2025-12-18 15:00:42 +01:00
f6e2ecd74b
refactor: reduce nesting depth and improve code readability
- Replace Enum.map |> Enum.join with Enum.map_join for efficiency
- Extract helper functions to reduce nesting depth from 4 to 2
- Rename is_current_cycle? to current_cycle? following Elixir conventions
2025-12-18 15:00:41 +01:00
b9fb115eb5
feat: regenerate cycles when membership fee type changes (same interval)
- Implemented regenerate_cycles_on_type_change helper in Member resource
- Cycles that haven't ended yet (cycle_end >= today) are deleted and regenerated
- Paid and suspended cycles remain unchanged (not deleted)
- CycleGenerator reloads member with new membership_fee_type_id
- Adjusted tests to work with current cycles only (no future cycles)
- All integration tests passing

Phase 4 completed: Cycle regeneration on type change
2025-12-18 15:00:41 +01:00
3177ea20dd
feat: add validation for same-interval membership fee type changes 2025-12-18 15:00:41 +01:00
43ec281242
feat: add cycle status calculations to Member resource 2025-12-18 15:00:41 +01:00
78b5335456 refactor: migrate MembershipFeeSettingsLive to AshPhoenix.Form 2025-12-18 11:54:23 +01:00
511f52fba8 feat: improve error handling in settings validation for default_membership_fee_type_id 2025-12-18 11:54:23 +01:00
630b51ac34 refactor: replace ContributionSettingsLive mockup with MembershipFeeSettingsLive in navigation 2025-12-18 11:54:23 +01:00
e135a6cdbf feat: implement full CRUD for membership fee types with settings UI
- Add interval immutability and deletion prevention validations
- Add settings validation for default_membership_fee_type_id
- Create MembershipFeeSettingsLive for admin UI with form handling
- Add comprehensive test coverage (unit, integration, settings)
2025-12-18 11:54:23 +01:00
6084827c73 test: updated
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-17 14:34:10 +01:00
bbc094daaa fix: add validation for required custom fields
Some checks failed
continuous-integration/drone/push Build is failing
2025-12-17 13:31:15 +01:00
e899004b3c feat: add error logging in after_action cycle generation hooks
- Log warnings when cycle generation fails in Member create/update
- Extract generate_fn to reduce code duplication
- Improves debuggability of silent failures
2025-12-16 16:40:11 +01:00
434bcd269f refactor: use sql_sandbox config instead of env for sync/async
- Replace Application.get_env(:mv, :env) with :sql_sandbox config
- Remove redundant :env config from test.exs
- More explicit and less error-prone for test environment detection
2025-12-16 16:40:11 +01:00
25cc41b02e feat: implement automatic cycle generation for members
- Add CycleGenerator module with advisory lock mechanism
- Add SetMembershipFeeStartDate change for auto-calculation
- Extend Settings with include_joining_cycle and default_membership_fee_type_id
- Add scheduled job skeleton for future Oban integration
2025-12-16 16:40:11 +01:00
8bfa5b7d1d chore: remove immutable from custom fields 2025-12-16 14:35:00 +01:00
4d1b33357e feat(membership-fees): add database schema and Ash domain structure 2025-12-11 18:46:48 +01:00
00fe471bc0 fix: custom field substring search - pass id as parameter
All checks were successful
continuous-integration/drone/push Build is passing
Fragment 'member_id = id' did not resolve correctly. Now passes id as
Ash expression. Also changed LIKE to ILIKE for case-insensitive search.
2025-12-11 14:04:13 +01:00
ca5fad0dcc
security: add input sanitization for search queries
All checks were successful
continuous-integration/drone/push Build is passing
- Escape SQL LIKE wildcards (% and _) to prevent pattern injection
- Limit search query length to 100 characters
- Apply sanitization in both :search action and linking filters
- FTS and fuzzy search use unsanitized query (wildcards not special there)
2025-12-11 13:49:07 +01:00
1ec6188884
perf: remove custom field search from user-linking autocomplete
Custom field LIKE queries on JSONB are expensive (no index).
User linking only needs name/email search for autocomplete.
Custom fields are still searchable via main member search (uses FTS index).
Remove unnecessary credo:disable as function complexity is now acceptable.
2025-12-11 13:49:07 +01:00
062dad99fb
refactor: remove unused fields parameter from fuzzy_search API
The fields parameter was accepted but never used in the :search action.
Simplify API to only accept the query parameter.
Update @doc to reflect the actual functionality.
2025-12-11 13:49:07 +01:00
12f95c1998
docs: document fuzzy search similarity threshold strategy
Explain the two-tier matching approach:
- % operator with server-wide threshold (0.3) for fast index scans
- similarity functions with configurable threshold (0.2) for edge cases
Add rationale for threshold value based on German name testing
2025-12-11 13:49:06 +01:00
add855c8cb
refactor: remove redundant ilike filter in build_substring_filter
contains(city, ^query) already produces ILIKE '%query%'
ilike(city, ^pattern) with pattern="%query%" is identical
2025-12-11 13:49:06 +01:00
265e976d94
fix: simplify JSONB extraction - remove redundant operators
- Replace 4 LIKE checks with 2 in build_custom_field_filter
- Simplify CASE blocks in migration trigger functions
- ->> operator always returns text, no need for -> + ::text fallback
- Performance improvement: 50% fewer LIKE operations
2025-12-11 13:49:05 +01:00
8c361cfc88 feat: updates query in member ressource 2025-12-11 13:44:30 +01:00