Skip to content

Conversation

@Kanishkavijay39
Copy link
Contributor

  • Add DATA_SCHEMAS configuration per opportunity type (8 types defined)
  • Add Joi validation schemas for data structure consistency
  • Add projection configurations for API minimal/summary views
  • Add field transformers for data transformation
  • Add URL extraction logic per opportunity type
  • Add comprehensive JSDoc documentation
  • Add 100% test coverage for new functionality

Benefits:

  • Single source of truth for suggestion data structure
  • Enable data validation in audit-worker before DB writes
  • Enable schema-driven API projections (replaces hardcoded field lists)
  • Graceful fallback for undefined opportunity types
  • Uses OPPORTUNITY_TYPES enum for type safety

Files:

  • suggestion.data-schemas.js: Type-specific Joi schemas & projections
  • suggestion.projection-utils.js: Reusable transformers & fallback config
  • suggestion.model.js: getProjection(), extractUrl(), validateData() methods

Please ensure your pull request adheres to the following guidelines:

  • make sure to link the related issues in this description
  • when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes

Related Issues

Thanks for contributing!

@Kanishkavijay39 Kanishkavijay39 force-pushed the feat/suggestion-data-schemas branch from 25bbd29 to 94e646f Compare January 27, 2026 11:23
@github-actions
Copy link

This PR will trigger a minor release when merged.

…URL extraction

- Remove extractUrl() method and urlExtraction config (unused in production)
- Reduce FALLBACK_PROJECTION from 25 fields to 14 URL-only fields
- Remove urlExtraction property from all opportunity type schemas
- Update tests to reflect simplified implementation

This change reduces complexity by removing speculative features that were only used in tests, following YAGNI principle and Single Responsibility Principle.
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.

2 participants