Skip to main content

All Friends Report (Report All Friends)

Overview

This is the platform's primary report: a table of every LINE friend belonging to an OA, with selectable attribute columns. It is used to survey the friend base, filter it by any supported condition, and export the results as CSV.

It also covers friend import history, showing how many records each import run succeeded or failed on.

The module reuses the query builder from the lineuser module so that the filters available here match the friend search screen exactly.

note

The actual module in code is internal/modules/report and the system module name is report-all-friends. This documentation page uses the all-friend-listing slug due to file-naming constraints in the documentation repository.

Business Flow

  1. View the reportGET /api/report/all-friend returns paginated data.
    • Filtering uses FilterGetLineUserDto, the same DTO as GET /api/line-users/search
    • The available attribute columns come from GET /api/attribute-master/reportable
  2. Export to CSVGET /api/report/all-friend/export applies the same conditions as above but streams the result directly to the response with no page limit. This endpoint requires the export policy, which is separate from readAll.
  3. View import historyGET /api/report/import-history reads from line_user_import and line_user_import_detail and reports the outcome of each import run, covering both LINE User Management and Import Mapping. If the read fails, the system responds with the message Failed to find all line user import as an HTTP 500, matching the legacy behaviour.

Key Files & Functions

The code lives in internal/modules/report/, comprising controller.go, service.go, dto.go and module.go.

All routes are registered on authed.Group("/report") and wrapped in modulegate.ModuleGate(d, "report-all-friends").

MethodRouteHandlerPolicy
GET/api/report/all-friendsvc.getReportAllFriendHandlerreadAll report-all-friends
GET/api/report/all-friend/exportsvc.getExportReportAllFriendHandlerexport report-all-friends
GET/api/report/import-historysvc.getImportHistoryHandlerreadAll report-all-friends

The variable governing the error behaviour is errFindAllLineUserImport in service.go.

Connections to Other Services

  • Permissions — requires ModuleGate("report-all-friends") and carries PolicyModuleReportAllFriends as metadata.
  • Tablesline_user, line_user_import, line_user_import_detail, attribute_master, system_attribute and line_oa.
  • Cross-module — imports internal/modules/lineuser to share its query builder, and uses internal/core/validation to validate query parameters.
  • CSV export — results are streamed to the response, the same approach used for audience exports.
  • Related modules — LINE User Management, Attribute Master, Import Mapping, Audience Management and Dashboard.