-
Notifications
You must be signed in to change notification settings - Fork 0
♻️ refactor(moderations): rename repository functions to PascalCase factory pattern #1081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
douglasduteil
merged 14 commits into
master
from
douglasduteil/-recycle-refactor-moderations-rename-repository-functions-to-PascalCase-factory-pattern
Sep 9, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…pository - Move get_moderation from context files to repository as specialized functions - GetModerationWithDetails: returns full moderation with organization and user details - GetModerationForEmail: returns minimal data for email context (ticket_id, user.email) - Update all imports and references to use new repository functions - Remove duplicate local functions from context files
aafacb4
to
b57177f
Compare
- Add test coverage for GetModeration, GetModerationWithDetails, GetModerationForEmail - Add test coverage for GetDuplicateModerations and GetModerationsList - Test success paths, error handling, and edge cases - Fix database transaction usage in GetModerationsList - Use proper beforeEach(empty_database) pattern for test isolation
- Create GetOrganizationMember factory function in organizations repository - Update moderations context to use new repository function - Remove local get_organization_member from context files - Clean up unused imports - Follows established PascalCase factory pattern
- Add GetOrganizationMember test with proper user-organization relationship setup - Add get_organizations_by_user_id test with pagination and edge cases - Add get_user_by_id test covering user retrieval and null handling - Add find_users_by_name test with case-insensitive search validation - All tests follow established patterns with proper database setup and cleanup
- Add GetDomainCount factory function with comprehensive test - Add GetOrganizationsList factory function following established pattern - Add GetUserById factory function for user retrieval - Add FindUsersByName factory function for name-based search - Update repository indexes to export new factory functions - All functions follow consistent PascalCase factory pattern established in moderations - Maintains backward compatibility while establishing new standard
…version - Add GetOrganizationMembersCount factory function for member counting - Add GetDomains factory function for organization domain retrieval - Add GetUsersByOrganizationId factory function with pagination support - Add GetEmailsByOrganizationId factory function with family name matching - Update repository indexes to export all new factory functions - Maintain consistent PascalCase factory pattern across all domains - All functions provide proper TypeScript typing and handler interfaces
Replace old snake_case function imports with new PascalCase factory pattern imports: - GetUsersByOrganizationId replaces get_users_by_organization_id - GetOrganizationsList replaces get_organizations_list - GetDomainCount replaces get_domain_count - GetOrganizationMembersCount replaces get_organization_members_count Update function calls to use factory pattern with database injection. Update TypeScript types to use new PascalCase naming conventions.
Create PascalCase factory functions for organizations repository: - GetOrganizationsByUserId replaces get_organizations_by_user_id - AddMemberToOrganization replaces add_member_to_organization - AddVerifiedDomain replaces add_verified_domain Update repository index to export both old and new functions for backward compatibility. Add comprehensive test coverage for all new factory functions.
Update test imports to use correct identite-proconnect database testing utilities: - Replace @~/app.database/seed_data with @~/identite-proconnect.database/seed - Add proper database migration and cleanup in beforeEach hooks - Use create_adora_pony_user and create_unicorn_organization helpers Tests need further debugging but core functionality verified.
Fix test implementations with proper setup and inline snapshots: - GetOrganizationsByUserId: Use proper user-organization creation pattern - AddMemberToOrganization: Fix empty columns selection, add id field - AddVerifiedDomain: Update to async function and return statement - Remove describe blocks to match coding style - Add proper database setup with migrate/empty_database hooks - Generate inline snapshots for all tests - Fix TypeScript exports in repository index
Removed duplicate files after PascalCase migration: - Organizations: removed 8 snake_case files with PascalCase equivalents - Users: removed 4 snake_case files with PascalCase equivalents - Removed all corresponding test files and snapshots File renames for consistency: - get_organization_by_id.ts → GetOrganizationById.ts - get_member.ts → GetMember.ts - Updated repository index exports ✅ All tests passing (10/10) ✅ TypeScript compilation successful ✅ Clean repository with consistent PascalCase factory pattern
04872db
to
6b9e33b
Compare
🚀 This pull request is included in v2025.9.0. See Release 2025.9.0 for release notes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
📚 lib
🗄️ database
🌐 api
Global, connected routes handling requests.
scope: app
scope: moderations
scope: organizations
scope: users
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactors the moderations repository functions to use a consistent PascalCase factory pattern:
get_moderation
→GetModeration
factory returningget_moderation
handlerget_duplicate_moderations
→GetDuplicateModerations
factoryget_moderations_list
→GetModerationsList
factoryget_*_dto
toGet*Dto
The factory pattern provides better dependency injection and follows the established PascalCase naming convention used elsewhere in the codebase.