Skip to content

Role full implementation + member associations#202

Merged
scraft-official merged 14 commits intorelease/0.26from
feature/role-full-impl
Jan 10, 2026
Merged

Role full implementation + member associations#202
scraft-official merged 14 commits intorelease/0.26from
feature/role-full-impl

Conversation

@scraft-official
Copy link
Copy Markdown
Collaborator

This pull request introduces major enhancements and refactoring to the member and role management APIs in the backend. The key updates include the addition of endpoints for adding members to projects and channels, a comprehensive new RoleController with full CRUD and batch operations, improved exception handling, and a consistent approach to mapping and request/response objects. These changes improve the modularity, error handling, and extensibility of the API layer.

Member Management Enhancements:

  • Added endpoints to allow adding members to projects and channels via MemberController, with corresponding request and mapper classes (MemberAddRequest, MemberAddMapper). [1] [2] [3]
  • Updated role assignment request and response objects to use UUID instead of HUID for role IDs, improving consistency and interoperability. [1] [2]

Role Management Refactor and Expansion:

  • Introduced a new RoleController implementing endpoints for role CRUD, patch, batch fetch, and organization-wide role listing, leveraging new mappers and request/response types.
  • Added a comprehensive set of role-related mappers using MapStruct for request/response and domain object mapping, including RoleMapper, RoleCreateMapper, RoleFetchMapper, and RolePatchMapper. [1] [2] [3] [4]

Error Handling Improvements:

  • Improved global exception handling by adding specific handlers for JwtException, IllegalArgumentException, and a generic catch-all handler that logs stack traces and returns a standardized error response. [1] [2] [3]

These updates collectively make the API more robust, maintainable, and ready for further feature development.

Introduced RoleEntity, RoleEntityMeta, RoleEntityMapper, and RoleEntityRepository for role persistence. Refactored RoleRepositoryImpl to use new infrastructure classes and mapping. Updated TaskEntityMeta and TaskEntityRepository for improved validation and query formatting.
Added specific exception handlers for JwtException and IllegalArgumentException in BaseControllerAdvice, and enabled a generic exception handler for improved error responses. Updated the Role class to use Lombok annotations for builder pattern, all-args constructor, and toString method.
Updated the @column annotation for the 'meta' field in multiple entity classes to specify a length of 65,535. This change ensures consistent column sizing for metadata storage across all relevant entities.
Refactored ChannelAccessControl and ProjectAccessControl to handle missing member associations gracefully by returning AccessLevel.NONE. Updated method parameter order in ChannelDeleteUseCase and ChannelFetchUseCase for consistency. Added superPrivileged flag to default admin, project manager, and lead roles in InitialSetupUseCase to grant elevated permissions.
Removed AccessControlService and updated all use cases to use specific access control implementations (OrganizationAccessControl, ProjectAccessControl, ChannelAccessControl, etc.). This improves separation of concerns and clarifies dependencies for each use case. Also updated method signatures to consistently use (organizationId, memberId, entityId, level) parameter order.
Standardized the order of parameters for access control methods across use cases, placing organizationId before memberId and resourceId. This improves consistency and reduces potential confusion when invoking access control checks.
Introduces command and use case classes for role creation, fetching, and batch fetching, along with a custom role creation meta implementation. Refines ViewController endpoint mapping and adds @nonnull annotations to ViewRepositoryImpl methods for better null safety. Also corrects a query in ViewEntityRepository to remove an unnecessary condition.
Updated service and repository methods for batch fetching entities (channels, projects, roles, tasks, views) to accept Set<HUID> instead of List<HUID> for improved uniqueness and performance. Renamed and refactored related use cases and commands for roles, and added StreamUtils for stream distinct operations. Also added @nonnull annotations to repository implementations for better null safety.
Added support for cascading role deletion, including reassigning affected member associations to a fallback default role. Introduced new command, use case, and meta classes for role deletion, updated repository interfaces and implementations, and extended the shared deletion service to handle member association updates during role removal. Also added utility methods for member association scope checks.
Replaced deletion logic with exception throwing when member association is missing in channel and project role assignment use cases. Improved error message for system default role deletion. Fixed typo in method name from findBydRoleId to findByRoleId in MemberAssociationRepository and its implementation.
Introduces MemberAddToProjectCommand, MemberAddToChannelCommand, and their respective use cases to handle adding members to projects and channels with default role assignment. Also improves exception formatting in MemberAssignProjectRoleUseCase.
Introduced new endpoints in MemberController for adding members to projects and channels. Added MemberAddRequest DTO and MemberAddMapper for mapping requests to commands. This enhances the API to support member addition operations for both projects and channels.
Introduces patching support for roles, including new request, response, command, and use case classes. Adds mappers for create, fetch, and patch operations, and updates service and domain logic to support role modification and inheritance. Transactional annotations added to relevant use cases for consistency.
Introduces batch fetch and list endpoints for roles, including new request and response DTOs and mappers. Refactors role-related mappers to extend a common interface and updates controller logic to use UUIDs instead of HUIDs in API layer. Fixes a bug in ProjectPatchUseCase operation checks, adds missing @Getter to TasksBatchFetchRequest, and updates repository methods to use Set instead of List for IDs.
@scraft-official scraft-official merged commit 4355d3e into release/0.26 Jan 10, 2026
2 checks passed
scraft-official added a commit that referenced this pull request Jan 13, 2026
* Add role entity infrastructure and repository

Introduced RoleEntity, RoleEntityMeta, RoleEntityMapper, and RoleEntityRepository for role persistence. Refactored RoleRepositoryImpl to use new infrastructure classes and mapping. Updated TaskEntityMeta and TaskEntityRepository for improved validation and query formatting.

* Enhance exception handling and add Lombok to Role

Added specific exception handlers for JwtException and IllegalArgumentException in BaseControllerAdvice, and enabled a generic exception handler for improved error responses. Updated the Role class to use Lombok annotations for builder pattern, all-args constructor, and toString method.

* Set meta column length to 65535 in entity classes

Updated the @column annotation for the 'meta' field in multiple entity classes to specify a length of 65,535. This change ensures consistent column sizing for metadata storage across all relevant entities.

* Improve access control and setup super privileged roles

Refactored ChannelAccessControl and ProjectAccessControl to handle missing member associations gracefully by returning AccessLevel.NONE. Updated method parameter order in ChannelDeleteUseCase and ChannelFetchUseCase for consistency. Added superPrivileged flag to default admin, project manager, and lead roles in InitialSetupUseCase to grant elevated permissions.

* Refactor access control to use specific control classes

Removed AccessControlService and updated all use cases to use specific access control implementations (OrganizationAccessControl, ProjectAccessControl, ChannelAccessControl, etc.). This improves separation of concerns and clarifies dependencies for each use case. Also updated method signatures to consistently use (organizationId, memberId, entityId, level) parameter order.

* Refactor access control method parameter order

Standardized the order of parameters for access control methods across use cases, placing organizationId before memberId and resourceId. This improves consistency and reduces potential confusion when invoking access control checks.

* Add role command/usecase classes and improve view handling

Introduces command and use case classes for role creation, fetching, and batch fetching, along with a custom role creation meta implementation. Refines ViewController endpoint mapping and adds @nonnull annotations to ViewRepositoryImpl methods for better null safety. Also corrects a query in ViewEntityRepository to remove an unnecessary condition.

* Refactor batch fetch methods to use Set for IDs

Updated service and repository methods for batch fetching entities (channels, projects, roles, tasks, views) to accept Set<HUID> instead of List<HUID> for improved uniqueness and performance. Renamed and refactored related use cases and commands for roles, and added StreamUtils for stream distinct operations. Also added @nonnull annotations to repository implementations for better null safety.

* Implement role cascade deletion with fallback assignment

Added support for cascading role deletion, including reassigning affected member associations to a fallback default role. Introduced new command, use case, and meta classes for role deletion, updated repository interfaces and implementations, and extended the shared deletion service to handle member association updates during role removal. Also added utility methods for member association scope checks.

* Refactor role/member association methods and error handling

Replaced deletion logic with exception throwing when member association is missing in channel and project role assignment use cases. Improved error message for system default role deletion. Fixed typo in method name from findBydRoleId to findByRoleId in MemberAssociationRepository and its implementation.

* Add use cases for adding members to projects and channels

Introduces MemberAddToProjectCommand, MemberAddToChannelCommand, and their respective use cases to handle adding members to projects and channels with default role assignment. Also improves exception formatting in MemberAssignProjectRoleUseCase.

* Add endpoints to add members to projects and channels

Introduced new endpoints in MemberController for adding members to projects and channels. Added MemberAddRequest DTO and MemberAddMapper for mapping requests to commands. This enhances the API to support member addition operations for both projects and channels.

* Add role patching and mapping functionality

Introduces patching support for roles, including new request, response, command, and use case classes. Adds mappers for create, fetch, and patch operations, and updates service and domain logic to support role modification and inheritance. Transactional annotations added to relevant use cases for consistency.

* Add batch and list role APIs, refactor role mappers

Introduces batch fetch and list endpoints for roles, including new request and response DTOs and mappers. Refactors role-related mappers to extend a common interface and updates controller logic to use UUIDs instead of HUIDs in API layer. Fixes a bug in ProjectPatchUseCase operation checks, adds missing @Getter to TasksBatchFetchRequest, and updates repository methods to use Set instead of List for IDs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants