Commit graph

49 commits

Author SHA1 Message Date
3fad912025
refactor: reduce nesting depth in regenerate_cycles_on_type_change
Split the function into smaller, focused functions to reduce nesting depth
2025-12-15 13:35:48 +01:00
2f83f35bcc
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-15 13:35:42 +01:00
b81ed99571
fix: prevent deadlocks by detecting existing transactions 2025-12-15 12:41:00 +01:00
1e5f84fd88
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-15 12:38:40 +01:00
e9c53cc520 refactor: reduce nesting depth and improve code readability
All checks were successful
continuous-integration/drone/push Build is passing
- 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-15 11:50:08 +01:00
06324d77c5
feat: regenerate cycles when membership fee type changes (same interval)
Some checks failed
continuous-integration/drone/push Build is failing
- 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-15 11:39:26 +01:00
7994303166
feat: add validation for same-interval membership fee type changes 2025-12-15 11:35:48 +01:00
6763d4f2eb
feat: add cycle status calculations to Member resource 2025-12-15 11:35:47 +01:00
2e8c9eeccb 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-12 16:09:37 +01:00
7e4d3e0a60 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-12 16:05:39 +01:00
162d06da21
feat: implement automatic cycle generation for members
All checks were successful
continuous-integration/drone/push Build is passing
- 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-11 21:26:58 +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
f0613fe1e5 Merge branch 'main' into feature/209_hide_field_dropdown
Some checks failed
continuous-integration/drone/push Build is failing
2025-12-03 12:52:12 +01:00
c8968636a8 feat: remove birth_date field from Member resource
All checks were successful
continuous-integration/drone/push Build is passing
Users who need birthday data can use custom fields instead.
Closes #161
2025-12-02 14:58:50 +01:00
13f77b5c0a
Refactor column visibility logic
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-02 14:18:27 +01:00
dce2053ce7 formatting and refactor member fields constant 2025-12-02 14:17:53 +01:00
397cbde9d6 feat: adds member visibility settings 2025-12-02 14:16:02 +01:00
d039e4bb7d formatting and refactor member fields constant
All checks were successful
continuous-integration/drone/push Build is passing
2025-12-02 10:02:52 +01:00
82e41916d2 feat: adds member visibility settings 2025-12-02 09:23:23 +01:00
df05eafc99 refactor: simplify Member.available_for_linking action to 9 lines
Extract filter logic into apply_linking_filters/3 helper, add Credo disable for fuzzy search complexity
2025-11-20 21:44:29 +01:00
9a03485604
refactor: add typespecs and module constants
- Add @spec for public functions in Member and UserLive.Form
- Replace magic numbers with module constants:
  - @member_search_limit = 10
  - @default_similarity_threshold = 0.2
- Add comprehensive @doc for filter_by_email_match and fuzzy_search
2025-11-20 16:51:45 +01:00
39b285a714
feat: add member fuzzy search for linking (#168) 2025-11-20 16:51:43 +01:00
8400e727a7
refactor: Rename Property/PropertyType to CustomFieldValue/CustomField
All checks were successful
continuous-integration/drone/push Build is passing
Complete refactoring of resources, database tables, code references, tests, and documentation for improved naming consistency.
2025-11-13 18:04:53 +01:00
8fd981806e
docs: add @moduledoc to core membership resources
Add comprehensive module documentation to Member, Property, PropertyType, and Email.
Improves code discoverability and enables ExDoc generation.
2025-11-13 11:20:32 +01:00
a69ccf0ff9 fix: added email serach and ommitted fields 2025-11-12 11:55:35 +01:00
0c75776915 formatting
All checks were successful
continuous-integration/drone/push Build is passing
2025-10-30 17:20:07 +01:00
3481b9dadf fix: updated fuzzy search after merge with sorting
Some checks failed
continuous-integration/drone/push Build is failing
2025-10-30 17:16:23 +01:00
f6bfeadb7b feat(member). added search action to ressource 2025-10-30 16:48:45 +01:00
001fca1d16
refactor: email sync changes 2025-10-23 13:13:28 +02:00
39afaf3999
feat: email uniqueness constraint between user and member 2025-10-23 13:13:27 +02:00
5a0a261cd6
add action changes for email sync 2025-10-23 13:13:27 +02:00
d8ec828df0
feat: make member emails unique 2025-10-16 12:30:01 +02:00
72a8415cb3
feat: member user relation 2025-10-16 12:30:01 +02:00
02b3084789 formatting 2025-09-17 14:37:04 +02:00
dd03000428 chore: adds tsvector to members 2025-09-17 13:34:14 +02:00
db3485af66
fix: formatting
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-02 15:56:12 +02:00
7f034740b0 review: removed leftovers and ash use builtin validation functions 2025-06-20 08:21:10 +02:00
2ab3332941
chore: fix linting
Some checks failed
continuous-integration/drone/push Build is failing
2025-06-18 23:35:26 +02:00
6f88a635cc
fix member deletion: property delete on cascade 2025-06-18 23:35:26 +02:00
abfc94473f
Member fields 2025-06-18 23:35:25 +02:00
505f5535ea
feat(ash): member and properties 2025-05-14 18:12:16 +02:00