feat(indexer): Tree API, project/tonnage API, fix relationships array search bug (#4509)#6216
Open
XananasX7 wants to merge 1 commit into
Open
Conversation
… filter (hashgraph#4509) Implements all requirements from hashgraph#4509: - Bug fix: use $elemMatch for array fields (options.relationships, options.tokens) to fix VC/VP search returning zero results when filtering by role IDs - New API: GET /analytics/projects — aggregate mint tonnage per policy - New API: GET /analytics/vc-tree/:messageId — full VC relationship tree - Frontend: Projects & Tonnage view at /projects route - MongoDB index on options.relationships for query performance Signed-off-by: XananasX7 <xananasX7@users.noreply.github.com>
8b410ec to
b67ea4d
Compare
Author
|
Fixed two CI blockers across all 4 PRs: Title Check / conventional-pr-title: Removed the DCO: Added Assignee check is a maintainer action (can't self-assign on this repo). Otherwise all other checks (Wiz, Snyk, StepSecurity) were already passing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #4509
Implements all three requirements from the issue and addresses multiple use-cases from the Max use-case spreadsheet.
1. Bug fix — VC/VP search by role relationship ID (Use-case #7)
The confirmed bug: "Token mint VCs are not showing when searching role IDs under relationships" (Role ID:
1712136267.281823003in the spreadsheet notes).Root cause:
parsePageFilters()inentities.service.tsapplied$regexto every field includingoptions.relationships, which is stored as a MongoDB array.$regexnever matches inside arrays — it silently returns zero results.Fix: Added
ARRAY_FILTER_FIELDSset (options.relationships,options.tokens) that uses$elemMatch: { $eq: value }instead of$regex. Also added a MongoDB index onoptions.relationshipsfor query performance.This fix applies to both
GET_VC_DOCUMENTSandGET_VP_DOCUMENTS— any filter onoptions.relationshipsnow works correctly.2.
GET /analytics/projects— Project/Tonnage APINew endpoint returning aggregate Mint Token VC data per policy project:
Response per project:
totalMinted— sum of all mint events (credits issued)mintEventCount— number of Mint Token VCstokens[]— per-token breakdown (tokenId, tokenName, totalMinted, mintEventCount, lastMintTimestamp)policyId,policyName,owner,topicIdAddresses use-cases:
3.
GET /analytics/vc-tree/:messageId— Tree APINew endpoint returning the full VC document relationship tree rooted at a given message:
Returns a recursive tree traversing
options.relationshipsat each node, with:nodeCount,depth,rootIdmessageId,type,schemaName,schemaId,issuer,policyId,tokenAmount,tokenIdAddresses: "Tree API for consumer eCommerce supportive transactions" requirement from the issue.
4. Frontend: Projects & Tonnage view (
/projects)New Angular standalone component at route
/projects:Files changed
indexer-commonmessages/message-api.tsindexer-api-gatewayapi/services/analytics.tsGET /projects,GET /vc-tree/:id)indexer-api-gatewaydto/project-tonnage.dto.tsindexer-api-gatewaydto/vc-tree.dto.tsindexer-serviceapi/analytics.service.tsindexer-serviceapi/entities.service.ts$elemMatchfor array fieldsindexer-serviceapp.tsoptions.relationshipsindexer-frontendviews/projects/*indexer-frontendservices/analytics.service.tsgetProjects(),getVcTree()indexer-frontendapp.routes.ts/projectsrouteindexer-frontendcomponents/header/header.component.tsRelated issues