Skip to content

API Traceability (UI → API → RBAC → Data)

Mục tiêu: nhìn vào đây biết màn hình gọi gì, endpoint nào, quyền nào, entity nào. Quy ước: 1 dòng = 1 interaction quan trọng.

MiniApp V2 Packet Coverage Snapshot (2026-02-27)

  • Packet coverage: 36/36 (100%) cho toàn bộ WI-MA-S*.
  • Packet index: 02_SPECS/workitems/WI-MA_PACKET_INDEX.md.
  • Sprint execution board: 03_TRACEABILITY/WORKITEM_BOARD.md.
  • Ý nghĩa traceability: toàn bộ miniapp workitems đã có execution packet để map UI flow ↔ API contract ↔ acceptance.

WI-MA-S4-004 Closeout Contract Linkage (2026-02-27)

Workitem / ClusterImplemented Contract(s)Source of TruthEvidence
WI-SEC-001 (Guard audit)Tenant-scope API guard/permission parsing hardened via manifest generatorv2/scripts/generate_manifests.js + generated API manifest05_GENERATED/backend_api_manifest.md (missing PermissionsGuard warnings = 0), closeout: 04_OPERATIONS/16_WI-SEC-001_CLOSEOUT_2026-02-27.md
WI-IAM-001 (Tenant settings migration)Tenant settings migration contract tests + rollout checklistIAM contract specs/testsTenant-settings contract test pass (8 tests) + rollout closure: 04_OPERATIONS/17_WI-IAM-001_ROLLOUT_CHECKLIST_2026-02-27.md
WI-PB-001 (Portal + Catalog parity)Portal Product list/form mapped to real Catalog/Brand APIs (/v2/catalog/products, /v2/catalog/brands, /v2/catalog/categories)Portal app + backend catalog controllers/servicesnx test catalog PASS (11 tests) and portal compile blockers resolved (recorded on board)
File Management rollout/v2/files/* policy/entitlement/upload/asset/share + metadata update/restore + migration contractsFile-management module + generated manifestsRuntime module: v2/libs/modules/file-management/src/lib/*, manifests: 05_GENERATED/backend_api_manifest.md, 05_GENERATED/backend_entity_manifest.md, 05_GENERATED/permission_manifest.md

Closeout rule: các hợp đồng đã implement phải xuất hiện đồng thời ở ít nhất 2 lớp: code truth (controller/service/test) và generated/doc traceability (05_GENERATED/* + board/matrix notes).

Core Trace Rows

SurfaceScreen/FlowUI RouteHTTPEndpointPermission / PolicyTenant ScopeEntitiesNotes
PortalGeneral Login/loginPOST/api/v2/iam/auth/login@Public()No tenant early (DEC-001)User, IdentityReturns JWT without tenantId
PortalZalo Login/loginPOST/api/v2/iam/auth/zalo-login@Public()No tenant early (DEC-002)User, IdentityReturns JWT without tenantId
MiniAppZalo Tenant Init/authPOST/api/v2/iam/auth/zalo-tenant-login@Public()Requires tenant bind (DEC-002)User, IdentityReturns JWT with tenantId
PortalWorkspace Select/workspaceGET/api/v2/iam/tenantsTENANT_VIEWBypass (@SkipTenantCheck)Tenant, MembershipLoad list of available tenants
PortalSwitch Tenant/workspacePOST/api/v2/iam/auth/switch-tenantAuthenticatedSets active_tenantMembershipUpdates JWT context
PortalProduct Mgmt/catalog/productsGET/api/v2/catalog/productsCAT_VIEW / CAT_MANAGERequiredProduct, CategoryTenant-scoped list
MiniAppBrowse Catalog/catalogGET/api/v2/catalog/productsCAT_VIEWRequiredProductPassed via header/JWT
PortalOrders/ecommerce/ordersGET/api/v2/ecommerce/ordersORDER_VIEWRequiredOrderList all orders
MiniAppMy Orders/profile/ordersGET/api/v2/ecommerce/orders/my@Public() / CustomRequiredOrderFilter by customer ID
PortalVendors/crm/partnersGET/api/v2/crm/partnersCRM_VIEWRequiredPartnerFilter by type=vendor
PortalVouchers/marketing/vouchersGET/api/v2/marketing/vouchersVOUCHER_VIEWRequiredVoucher
MiniAppApply Voucher/checkoutPOST/api/v2/marketing/vouchers/applyVOUCHER_VIEWRequiredVoucherValidates cart state
PortalManage Plugins/admin/pluginsGET/api/v2/admin/plugins/installedPLUGIN_VIEWBypass (@SkipTenantCheck)InstalledPluginSystem Admin scoped
BackendFile Storage Policy APIn/aGET/POST/api/v2/files/policy/storage-modeFILE_POLICY_VIEW / FILE_POLICY_MANAGERequiredTenantFilePolicyPortal route chưa implement, currently API contract only
BackendFile Quota & Usage APIn/aGET/api/v2/files/usage, /api/v2/files/entitlementFILE_USAGE_VIEWRequiredFileAsset, FileUsageLedger, TenantFileEntitlementPortal route chưa implement, currently API contract only
BackendFile Asset Admin APIn/aGET/PATCH/DELETE/POST/api/v2/files/assets, /api/v2/files/assets/:id, /api/v2/files/assets/:id/restore, /api/v2/files/assets/:id/share-linkFILE_VIEW / FILE_EDIT / FILE_DELETE / FILE_RESTORERequiredFileAsset, FileShareLinkPortal route chưa implement, currently API contract only
PortalProduction Orders/production/ordersGET/POST/api/v2/supply-chain/production/work-ordersPROD_MANAGERequiredWorkOrderNEW: List + create work orders
PortalProduction Detail/production/orders/:idGET/PATCH/api/v2/supply-chain/production/work-orders/:id, .../status, .../progressPROD_MANAGERequiredWorkOrderNEW: Detail + status/progress update
PortalBalance/Wallet/balanceGET/POST/api/v2/balance/wallet, /api/v2/balance/transactions, /api/v2/balance/adjustBILLING_VIEWRequiredWallet, BalanceTransactionNEW: Wallet card + transaction history + manual adjust
PortalCustomer Loyalty/crm/loyaltyGET/POST/api/v2/crm/loyalty/conditions, /api/v2/crm/loyalty/conditions/evaluateCRM_MANAGERequiredMembershipConditionNEW: Conditions CRUD + partner eval
PortalZalo Center/marketing/zaloGET/POST/api/v2/integrations/zalo/oas, .../connect, .../zns/templates, .../zns/sendSYSTEM_ADMINRequiredConnectedOA, ZnsTemplateRefactored from hardcoded → API-driven
PortalBilling Admin/admin/billingGET/POST/DELETE/api/v2/billing/subscriptions/active, .../subscribe, .../cancel, /api/v2/billing/usage/summaryBILLING_MANAGERequiredSubscriptionRefactored from hardcoded → API-driven; usage/summary now implemented
PortalIn-App Notificationsn/a (component)GET/PATCH/api/v2/content/notifications/in-app, .../in-app/:id/read, .../in-app/read-all, .../in-app/unread-countNOTIFY_VIEWRequiredNotificationEndpoints now guarded with PermissionsGuard + PermissionString.NOTIFY_VIEW

Ghi chú: Scope Bypass nghĩa là endpoint này gọi controller decorator @SkipTenantCheck(), do đó bỏ qua TenantGuard nhưng vẫn phải có JWT (ngoại trừ @Public).


Extended Backend API Traceability (From CKB)

Rehydrated from docs_delivery_v2/08_TRACEABILITY/API_TRACEABILITY_EXTENDED.md

IAM APIs (CP-01)

MethodEndpointGuard ChainPermissionEntityEventSpecStatus
POST/api/v2/iam/auth/login@Public()UserFR-AUTH-01
POST/api/v2/iam/auth/login/zalo@Public()UserFR-AUTH-02
POST/api/v2/iam/auth/refresh@Public(refresh)FR-AUTH-04
POST/api/v2/iam/auth/logoutJwtAuthFR-AUTH-05
POST/api/v2/iam/auth/register@Public()User, Membershipiam.member.acceptedFR-AUTH-08
POST/api/v2/iam/auth/switch-tenantJwtAuthMembershipFR-AUTH-06
GET/api/v2/iam/tenantsJwtAuth+AdminSystemAdminTenantFR-TENANT-01
POST/api/v2/iam/tenantsJwtAuth+AdminSystemAdminTenant, Roleiam.tenant.createdFR-TENANT-01
POST/api/v2/iam/tenants/register@Public()User, Tenant, Role, Membershipiam.tenant.created, iam.user.createdFR-TENANT-02
GET/api/v2/iam/tenants/:id/provisioningJwtAuthTENANT_CREATE_OPENTenantProvisionJobiam.tenant.provisionedFR-TENANT-02
GET/api/v2/iam/tenants/:idJwtAuth+TenantTENANT_VIEWTenantFR-TENANT-03
PATCH/api/v2/iam/tenants/:idJwtAuth+TenantTENANT_MANAGETenantiam.tenant.updatedFR-TENANT-04
GET/api/v2/iam/tenants/:id/settingsJwtAuth+TenantTENANT_VIEWTenantSettingsFR-TN-02
PATCH/api/v2/iam/tenants/:id/settingsJwtAuth+TenantTENANT_MANAGETenantSettingsiam.tenant.settings_updatedFR-TN-02
PATCH/api/v2/iam/tenants/:id/suspendJwtAuth+AdminSystemAdminTenantiam.tenant.suspendedFR-TN-03
GET/api/v2/iam/tenants/:tid/membersJwtAuth+TenantMEMBER_VIEWMembershipFR-MEMBER-01
POST/api/v2/iam/tenants/:tid/members/inviteJwtAuth+TenantMEMBER_MANAGEMembershipiam.member.invitedFR-MEMBER-02
PATCH/api/v2/iam/members/:id/roleJwtAuth+TenantMEMBER_MANAGEMembershipiam.member.role_changedFR-MEMBER-04
DELETE/api/v2/iam/members/:idJwtAuth+TenantMEMBER_MANAGEMembershipiam.member.removedFR-MEMBER-05
GET/api/v2/iam/tenants/:tid/rolesJwtAuth+TenantROLE_VIEWRoleFR-ROLE-01
POST/api/v2/iam/tenants/:tid/rolesJwtAuth+TenantROLE_MANAGERoleiam.role.createdFR-ROLE-02
PATCH/api/v2/iam/roles/:idJwtAuth+TenantROLE_MANAGERoleiam.role.updatedFR-ROLE-03
DELETE/api/v2/iam/roles/:idJwtAuth+TenantROLE_MANAGERoleiam.role.deletedFR-ROLE-04

Commerce APIs

MethodEndpointPermissionEntityEventSpecStatus
GET/api/v2/catalog/categoriesCAT_VIEWCategoryFR-CT-01🟡
POST/api/v2/catalog/categoriesCAT_MANAGECategorycatalog.category.createdFR-CT-01🟡
GET/api/v2/catalog/productsPROD_VIEWProductFR-CT-02🟡
POST/api/v2/catalog/productsPROD_MANAGEProductcatalog.product.createdFR-CT-02🟡
POST/api/v2/catalog/products/importPROD_MANAGEProductFR-CT-06
GET/api/v2/ecommerce/ordersORDER_VIEWOrderFR-OR-07
POST/api/v2/ecommerce/ordersORDER_MANAGEOrderorder.createdFR-OR-02
PATCH/api/v2/ecommerce/orders/:id/statusORDER_MANAGEOrderorder.FR-OR-01
POST/api/v2/ecommerce/orders/:id/refundORDER_MANAGERefundorder.refund.requestedFR-OR-06
POST/api/v2/marketing/vouchers/validateVoucherFR-VO-01
POST/api/v2/marketing/vouchers/applyVoucherRedemptionvoucher.redeemedFR-VO-01

Loyalty & CRM APIs

MethodEndpointPermissionEntityEventSpecStatus
GET/loyalty/points-ledgerLOYALTY_VIEWPointTransactionFR-LY-01
GET/loyalty/payoutsLOYALTY_VIEWPayoutFR-LY-02
GET/crm/loyalty/conditionsCRM_VIEWMembershipConditionFR-CL-01
POST/crm/loyalty/conditionsCRM_MANAGEMembershipConditionFR-CL-02
POST/crm/loyalty/conditions/evaluateCRM_MANAGEMembershipConditionFR-CL-03

Supply Chain APIs

MethodEndpointPermissionEntityEventSpecStatus
GET/api/v2/supply-chain/production/work-ordersPROD_MANAGEWorkOrder
POST/api/v2/supply-chain/production/work-ordersPROD_MANAGEWorkOrderproduction.order.created
GET/api/v2/supply-chain/production/work-orders/:idPROD_MANAGEWorkOrder
PATCH/api/v2/supply-chain/production/work-orders/:id/statusPROD_MANAGEWorkOrderproduction.order.status_changed
PATCH/api/v2/supply-chain/production/work-orders/:id/progressPROD_MANAGEWorkOrder

Balance/Billing APIs

MethodEndpointPermissionEntityEventSpecStatus
GET/api/v2/balance/walletBILLING_VIEWWallet
GET/api/v2/balance/transactionsBILLING_VIEWBalanceTransaction
POST/api/v2/balance/adjustBILLING_MANAGEBalanceTransactionbalance.adjusted
GET/api/v2/billing/subscriptions/activeBILLING_VIEWSubscription
POST/api/v2/billing/subscribeBILLING_MANAGESubscriptionbilling.subscribed
DELETE/api/v2/billing/cancelBILLING_MANAGESubscriptionbilling.cancelled
GET/api/v2/billing/usage/summaryBILLING_VIEWUsageSummary

Notification APIs

MethodEndpointPermissionEntityEventSpecStatus
GET/api/v2/content/notifications/in-appNOTIFY_VIEWNotification
PATCH/api/v2/content/notifications/in-app/:id/readNOTIFY_VIEWNotificationnotification.read
PATCH/api/v2/content/notifications/in-app/read-allNOTIFY_VIEWNotification
GET/api/v2/content/notifications/in-app/unread-countNOTIFY_VIEWNotification

Zalo Integration APIs

MethodEndpointPermissionEntityEventSpecStatus
GET/api/v2/integrations/zalo/oasSYSTEM_ADMINConnectedOA
POST/api/v2/integrations/zalo/connectSYSTEM_ADMINConnectedOAzalo.oa.connected
GET/api/v2/integrations/zalo/zns/templatesSYSTEM_ADMINZnsTemplate
POST/api/v2/integrations/zalo/zns/sendSYSTEM_ADMINZnsTemplatezalo.zns.sent

Supply Chain + Other APIs (Each module's API details are in their respective CKB 30_API_CONTRACT section)

FitZalo Platform Documentation