Enhance branch management with foreign key relation handling
- Updated `BranchesModule` to include foreign key relations in list and write responses, ensuring they are represented as nested objects using `pickRelation`. - Introduced new `relation-response.mdc` file to define guidelines for embedding foreign key relations. - Modified `BranchesRepository` to support fetching related `division`, `createdByUser`, and `updatedByUser` data. - Updated DTOs and service methods to reflect changes in response structure, removing direct foreign key IDs. - Added unit tests to validate the new relation handling in branches service and repository. - Enhanced e2e tests to verify the correct structure of branch responses with nested relations.
This commit is contained in:
@@ -22,3 +22,13 @@ export {
|
||||
PAGINATION_DEFAULT_LIMIT,
|
||||
PAGINATION_MAX_LIMIT,
|
||||
} from './pagination.constants';
|
||||
export {
|
||||
DEFAULT_RELATION_FIELDS,
|
||||
pickDefaultRelation,
|
||||
pickRelation,
|
||||
pickUserRelation,
|
||||
USER_RELATION_FIELDS,
|
||||
type DefaultRelation,
|
||||
type UserRelation,
|
||||
} from './relation-fields';
|
||||
export { DefaultRelationDto, UserRelationDto } from './relation.dto';
|
||||
|
||||
Reference in New Issue
Block a user