Skip to main content

System-level Attributes (System Attribute)

Overview

System Attributes are the standard attributes defined centrally by the platform rather than by customers. That makes them distinct from Attribute Master, which holds custom attributes scoped to a single LINE OA.

They provide the baseline set of attributes shared by every OA — standard LINE profile fields, for instance, and the attributes that make up the system merge tags in Template Message.

Structurally this is a straightforward CRUD module with just four endpoints.

Business Flow

  1. ListGET /api/system-attribute returns every system attribute. GORM appends deleted_date IS NULL automatically because the entity declares gorm.DeletedAt.
  2. CreatePOST /api/system-attribute creates a new system attribute from a CreateSystemAttributeDto.
  3. UpdatePUT /api/system-attribute/:id must use Unscoped(), because the original TypeORM implementation's update() call did not apply a soft-delete filter. Matching that behaviour is required for parity.
  4. DeleteDELETE /api/system-attribute/:id performs a soft delete.
  5. Downstream use — the results feed two places: the GET /api/template-message/merge-tags?showSystem=true endpoint, which folds system attributes into the merge tag list, and form and report building, where they are combined with custom attributes.

Key Files & Functions

The code lives in internal/modules/systemattribute/, split across controller.go, service.go and dto.go.

All routes are registered on authed.Group("/system-attribute").

MethodRouteHandlerPolicy
GET/api/system-attributeh.findAllread system-attribute
POST/api/system-attributeh.createcreate system-attribute
PUT/api/system-attribute/:idh.updateupdate system-attribute
DELETE/api/system-attribute/:idh.removedelete system-attribute

This module has neither ModuleGate nor SuperAdminGuard — callers only need to pass the global JwtAuth.

Connections to Other Services

  • Permissions — requires the global JwtAuth, which mandates a lineOaId in the token. PolicyModuleSystemAttribute is metadata only and is not yet enforced.
  • Tablessystem_attribute, which soft-deletes via gorm.DeletedAt.
  • Consumers — Template Message (system merge tags), Form Builder, and the all-friends report.
  • Comparison — Attribute Master serves the same purpose for per-OA custom attributes.