# Key Components

#### **Directory Structure Breakdown:**

**1. constants/**

This folder contains constants used throughout the module. It centralizes fixed values like error messages, user roles, or other predefined parameters, making them reusable across controllers and services.

* **Purpose**: To store values that are used repeatedly within the User module.

**2. controllers/**

Controllers in this folder handle incoming HTTP requests related to user data management. Each controller corresponds to a specific feature of user information.

* **`bank-account.controller.ts`**: Manages user bank account-related actions, including adding, updating, or deleting bank account details.
* **`partner.controller.ts`**: Handles partner-related functionalities, such as linking partners to the user's account or retrieving partner data.
* **`preference.controller.ts`**: Manages user preferences (e.g., language, notifications) and updates related to user settings.
* **`profile.controller.ts`**: Responsible for retrieving and updating user profile information, such as personal details, contact information, etc.
* **`user-data.controller.ts`**: General user data management controller for retrieving or updating various pieces of information about the user.
* **`user.controller.ts`**: The main controller responsible for handling user-related actions like retrieving the user’s general information or updating user data.

**3. decorators/**

This folder contains custom decorators used to add metadata or additional logic to various parts of the User module. These decorators are used for validation, logging, and enhancing functionality.

* **Purpose**: To inject metadata into methods, handle validations, or execute pre- and post-processing logic.

**4. dto/ (Data Transfer Objects)**

DTOs are used to define the structure of data transferred between the client and server. They ensure that user input is validated and standardized before being processed by the application.

* **Purpose**: To enforce structured and consistent data communication between services, controllers, and other components of the system.

**5. services/**

Services provide the business logic for various user-related features, such as handling email verification, managing bank account data, or processing user preferences. These services are used by controllers to handle backend operations.

* **`additional-info.service.ts`**: Manages additional user information, including extended profile details or other supplementary data.
* **`bank-account.service.ts`**: Handles business logic for managing user bank accounts, including linking accounts and retrieving account data.
* **`email.service.ts`**: Responsible for sending email notifications, including verification or password reset emails.
* **`language.service.ts`**: Manages user language preferences and localization settings.
* **`partner-link.service.ts`**: Manages linking users with external partners or services.
* **`partner.service.ts`**: Handles logic related to partner data management and interactions with external partner systems.
* **`password.service.ts`**: Manages password changes, resets, and validation.
* **`phone.service.ts`**: Handles phone number management and verification, including sending SMS verification codes.
* **`preference.service.ts`**: Manages user preferences, including settings for notifications, themes, language, and other customizable aspects.
* **`profile.service.ts`**: Contains the logic for managing and updating the user’s profile, including personal details.
* **`user-data.service.ts`**: Handles the logic for retrieving and updating general user data, such as user-specific attributes or other data.
* **`user-old.service.ts`**: This service might be used for handling legacy user data or processes related to older user data management workflows.
* **`validate-user-info.service.ts`**: Validates user information during registration or profile updates, ensuring data integrity and consistency.
* **`validation-code.service.ts`**: Responsible for handling the process of sending and verifying validation codes (e.g., email verification, two-factor authentication).

**6. user.module.ts**

The **user.module.ts** file is the main module file that imports all necessary services, controllers, and other dependencies related to the User module. It ensures that the module functions cohesively, making the necessary components available for the rest of the application.

* **Purpose**:
  * Brings together all user-related components (controllers, services, guards, etc.).
  * Ensures proper integration of the User module with other modules like Auth, allowing for secure user data management.
  * Provides an organized structure for adding more user-related features in the future.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-affiliates.inlaze.com/architecture/initial-folders-estructure/modules/client/user/folder-structure/key-components.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
