[MM-55726] Create batch report worker, add batch report job for exporting users to CSV (#25832)
* Split out migration logic and create generic BatchWorker * WIP * WIP * POC batch reporting * Oops * Job hookup * Working export to file * PR feedback * Merge'd * Fix error handling * Add API to start report, translations, couple fixes * Add DMs to send reports to users * Merge'd * Update types * A bit of cleanup * Some fixes * Add missing API doc * PR feedback * Fix generated * Fix bug with post creation * PR feedback * Add some tests * PR feedback * Fix lint * Some test changes * Fix tests * Add comment to explain why we forcibly stop * Rework of some tests * Batch report test * Restrict batch exports to Pro and Enterprise licenses * Fix erroneous comment --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
eac9a39677
Коммит
f7446d7443
@@ -110,13 +110,13 @@
|
||||
summary: Gets the full count of users that match the filter.
|
||||
description: >
|
||||
Get the full count of users admin reporting purposes, based on provided parameters.
|
||||
|
||||
|
||||
Must be a system admin to invoke this API.
|
||||
|
||||
##### Permissions
|
||||
|
||||
Requires `sysconsole_read_user_management_users`.
|
||||
|
||||
operationId: GetUserCountForReporting
|
||||
parameters:
|
||||
- name: role_filter
|
||||
@@ -156,6 +156,37 @@
|
||||
application/json:
|
||||
schema:
|
||||
type: number
|
||||
/api/v4/reports/users/export:
|
||||
post:
|
||||
tags:
|
||||
- reports
|
||||
summary: Starts a job to export the users to a report file.
|
||||
description: >
|
||||
Starts a job to export the users to a report file.
|
||||
|
||||
|
||||
Must be a system admin to invoke this API.
|
||||
|
||||
##### Permissions
|
||||
|
||||
Requires `sysconsole_read_user_management_users`.
|
||||
operationId: StartBatchUsersExport
|
||||
parameters:
|
||||
- name: date_range
|
||||
in: query
|
||||
description: The date range of the post statistics to display. Must be one of ("last30days", "previousmonth", "last6months", "alltime"). Will default to 'alltime' if the input is not valid.
|
||||
schema:
|
||||
type: string
|
||||
default: 'alltime'
|
||||
responses:
|
||||
"200":
|
||||
description: Job successfully started
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/UserReport"
|
||||
"400":
|
||||
$ref: "#/components/responses/BadRequest"
|
||||
"401":
|
||||
@@ -164,3 +195,42 @@
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalServerError"
|
||||
/api/v4/reports/export/{report_id}:
|
||||
get:
|
||||
tags:
|
||||
- reports
|
||||
summary: Retrieves a compiled report file for the given report_id
|
||||
description: >
|
||||
Retrieves a compiled report file for the given report_id.
|
||||
|
||||
Must be a system admin to invoke this API.
|
||||
|
||||
##### Permissions
|
||||
|
||||
Requires `sysconsole_read_user_management_users`.
|
||||
|
||||
operationId: RetrieveBatchReportFile
|
||||
parameters:
|
||||
- name: report_id
|
||||
in: path
|
||||
description: Report ID for the given batch job
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
- name: format
|
||||
in: query
|
||||
description: The format of the report generated (one of "csv")
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"400":
|
||||
$ref: "#/components/responses/BadRequest"
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
"500":
|
||||
$ref: "#/components/responses/InternalServerError"
|
||||
|
||||
Ссылка в новой задаче
Block a user