feat: add ContactSalesLead entity (SITES-42069)#1475
Conversation
|
This PR will trigger a minor release when merged. |
sandsinh
left a comment
There was a problem hiding this comment.
Review
1. siteId is a plain string attribute, not a reference
The PostgreSQL table has site_id UUID REFERENCES sites(id), but the schema defines siteId as a loose string rather than using .addReference(). This means no getSite() navigation method and no referential integrity at the data-access layer — inconsistent with how organizationId is handled via .addReference('belongs_to', 'Organization'). If the relationship is intentionally weak (optional, ON DELETE SET NULL), a comment in the schema explaining that choice would help.
2. No unit tests
Other entities in this package have dedicated test files. This PR adds a model, collection, and schema with none. Should include tests covering:
- Model instantiation and
STATUSESenum - Schema validation (required fields, default status)
- Collection wiring and query methods
3. PR title doesn't follow conventional commits
Current: Feature/sites 42069 contact sales api
Should be: feat: add ContactSalesLead entity (SITES-42069)
Needed for semantic-release and changelog generation.
4. addAllIndex(['email']) — clarify the usage
What query patterns require looking up leads by email alone across all orgs? If leads are always queried within an org context, allByOrganizationId() (from the belongs_to reference) is sufficient. If cross-org email lookup is needed, what's the use case? This mirrors the same question on the standalone email index in the database migration (adobe/mysticat-data-service#238).
- Replace plain siteId string attribute with addReference('belongs_to', 'Site')
for proper FK navigation (getSite()) and referential integrity
- Remove addAllIndex(['email']) as leads are queried within org context
- Add unit tests for model, collection, and schema with 100% coverage
- Remove stale ElectroDB comment from schema
- Update type declarations to include getSite() and allBySiteId()
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sandsinh Thanks for the thorough review! All 4 points addressed in 489691c:
All at 100% coverage.
Also removed a stale ElectroDB comment from the schema and updated type declarations to include getSite() and allBySiteId(). |
## [@adobe/spacecat-shared-data-access-v3.44.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.43.0...@adobe/spacecat-shared-data-access-v3.44.0) (2026-04-02) ### Features * add ContactSalesLead entity (SITES-42069) ([#1475](#1475)) ([d245781](d245781))
|
🎉 This PR is included in version @adobe/spacecat-shared-data-access-v3.44.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Refer for description: https://github.com/OneAdobe/experience-success-studio-ui/pull/1675
SITES-42069
Please ensure your pull request adheres to the following guidelines:
Related Issues
Thanks for contributing!