feat: Add inbox-label matrix report endpoint (#13394)
This PR added new API endpoint GET /api/v2/accounts/:account_id/reports/inbox_label_matrix that returns conversation counts grouped by inbox and label in a matrix format. Supports optional filtering by date range, inbox_ids, and label_ids. --------- Co-authored-by: Pranav <pranav@chatwoot.com>
This commit is contained in:
@@ -62,6 +62,14 @@ class Api::V2::Accounts::ReportsController < Api::V1::Accounts::BaseController
|
||||
render json: bot_metrics
|
||||
end
|
||||
|
||||
def inbox_label_matrix
|
||||
builder = V2::Reports::InboxLabelMatrixBuilder.new(
|
||||
account: Current.account,
|
||||
params: inbox_label_matrix_params
|
||||
)
|
||||
render json: builder.build
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def generate_csv(filename, template)
|
||||
@@ -139,4 +147,13 @@ class Api::V2::Accounts::ReportsController < Api::V1::Accounts::BaseController
|
||||
def conversation_metrics
|
||||
V2::ReportBuilder.new(Current.account, conversation_params).conversation_metrics
|
||||
end
|
||||
|
||||
def inbox_label_matrix_params
|
||||
{
|
||||
since: params[:since],
|
||||
until: params[:until],
|
||||
inbox_ids: params[:inbox_ids],
|
||||
label_ids: params[:label_ids]
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user