Skip to content

Feat/asset tag service#578

Open
Yusufolosun wants to merge 2 commits into
StellaBridge:mainfrom
Yusufolosun:feat/asset-tag-service
Open

Feat/asset tag service#578
Yusufolosun wants to merge 2 commits into
StellaBridge:mainfrom
Yusufolosun:feat/asset-tag-service

Conversation

@Yusufolosun
Copy link
Copy Markdown
Contributor

Closes #509

Summary

Implements the internal Asset Tag Service with full CRUD operations, bulk assignment, audit logging, search integration, and API endpoints.

Changes

Database

  • Added 027_asset_tag_service.ts migration defining tags and asset_tags schemas with UUID constraints, unique keys, cascaded deletions, and index mappings

Model

  • Added tag.model.ts with Knex-based CRUD helpers

Business Logic

  • Added assetTag.service.ts with validation logic, database queries, bulk transactions, and auditService integration
  • Updated audit.service.ts to support tag audit action type safety

Search & Filtering

  • Modified search.service.ts to index asset tags into search documents and enable JSONB filtering by single or multiple tags

API Routes

  • Modified assets.ts to expose:
    • Public: GET /tags, GET /tags/:id, GET /:symbol/tags
    • Authorized: POST /tags, PUT /tags/:id, DELETE /tags/:id, POST /tags/bulk-assign, POST /:symbol/tags, DELETE /:symbol/tags/:tagName
  • Mapped incoming API key source ("api-key" | "bootstrap") to audit log actorType ("api_key" | "system")

Testing

  • assetTag.service.test.ts — 9/9 unit tests pass (CRUD, validation, bulk assignment, audit triggers)
  • assetTags.test.ts — 11/11 integration tests pass (routes, auth, public permissions, param validation)
  • npx tsc --noEmit — 0 compilation errors

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

@Yusufolosun Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

metadata: { name: tag.name },
});

logger.info({ tagId: tag.id, name: tag.name, performedBy }, "Asset tag created successfully");
metadata: { changes: updateData },
});

logger.info({ tagId: id, performedBy }, "Asset tag updated successfully");
metadata: { name: existing.name },
});

logger.info({ tagId: id, name: existing.name, performedBy }, "Asset tag deleted successfully");
metadata: { assetSymbol, tagId: tag.id, tagName: tag.name },
});

logger.info({ assetSymbol, tagName: tag.name, performedBy }, "Asset tag assigned successfully");
resourceId: asset.id,
metadata: { assetSymbol, tagId: tag.id, tagName: tag.name },
});
logger.info({ assetSymbol, tagName: tag.name, performedBy }, "Asset tag unassigned successfully");
});

logger.info(
{ assetSymbolsCount: assetSymbols.length, tagNamesCount: tagNames.length, assignedCount, performedBy },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Asset Tag Service

2 participants