Account Settings V2 (AccountSettingsController) Controller
Namespace: CXT.IO.Dashboard.Api.ControllersRoute: api/v{version:apiVersion}/account-settingsAPI Version: 2 (Primary focus)
This controller acts as a Backend-for-Frontend (BFF) for the V2 account visibility settings. It exposes endpoints consumed by client applications (e.g., web dashboards) and orchestrates calls to IAccountSettingsV2Service to manage these settings.
Purpose
- Provides versioned API endpoints for managing V2 account settings.
- Handles retrieving and saving account visibility preferences.
- Abstracts client applications from the direct complexities of the core Account Settings API.
Dependencies
ILogger<AccountSettingsController>: Standard ASP.NET Core logging.IAccountSettingsV2Service: The primary dependency for V2 operations, encapsulating the business logic for fetching and saving account settings.
Endpoints
Retrieve V2 account settings
[HttpGet]
public async Task<BaseResponseModel<List<AccountSettingsV2ResponseModel>>> GetAccountSettingsV2Async(CancellationToken cancellationToken)- Description: Retrieves the account visibility settings for the authenticated client. The client's GCN is typically derived from the authenticated user's claims.
- Logic: Calls
_accountSettingServiceV2.GetAccountSettings(ClientGcn, cancellationToken). - Responses:
Status Code Response Type Description 200 OKBaseResponseModel<List<AccountSettingsV2ResponseModel>>Success. The Dataproperty contains the list of account settings.401 Unauthorized- The client is not authenticated. 500 InternalServerError- An unexpected error occurred in the service layer.
Save V2 account settings
[HttpPost]
public async Task<BaseResponseModel<string>> SaveAccountSettingsV2Async([FromBody] AccountSettingsV2SaveRequestModel request, CancellationToken cancellationToken)Description: Saves or updates the account visibility settings for the authenticated client.
Logic: Calls
_accountSettingServiceV2.SaveAccountSettings(ClientGcn, request, cancellationToken).Request Body:
Parameter Type Description requestAccountSettingsV2SaveRequestModelAn object containing the account settings to be saved. Responses:
Status Code Response Type Description 204 No Content- The settings were saved successfully. 400 Bad RequestBaseResponseModel<string>The request model is invalid or failed validation. 401 Unauthorized- The client is not authenticated. 500 InternalServerError- An unexpected error occurred in the service layer. cURL Example:
bashcurl -X POST \ 'https://your-dashboard-api.com/api/v2/account-settings' \ -H 'Authorization: Bearer YOUR_JWT_TOKEN' \ -H 'Content-Type: application/json' \ -d '{ "accountSettings": [ { "accountNumber": "123456789012", "accountName": "My Primary Account", "accountHidden": true }, { "accountNumber": "098765432109", "accountName": "My Other Account", "accountHidden": false } ] }'
V1 Endpoints (Legacy)
This controller also contains V1 endpoints for backward compatibility, which use a IMediator pattern (GetAccountSettingsByGcnQuery, SaveAccountSettingsCommand). These are considered legacy and are not the focus of this documentation.