Skip to content

feat: add vendor trust score endpoint and leaderboard#64

Merged
jpdevhub merged 3 commits into
jpdevhub:mainfrom
Aharshi3614:feature/h05-vendor-trust-score
Jun 3, 2026
Merged

feat: add vendor trust score endpoint and leaderboard#64
jpdevhub merged 3 commits into
jpdevhub:mainfrom
Aharshi3614:feature/h05-vendor-trust-score

Conversation

@Aharshi3614
Copy link
Copy Markdown
Contributor

Description

Closes #45

This PR adds vendor trust score functionality and a public leaderboard.

Changes

  • Added vendor trust score API endpoints

  • GET /api/v1/vendors/leaderboard

  • GET /api/v1/vendors/{vendor_id}/trust-score

  • POST /api/v1/vendors/{vendor_id}/recalculate

  • Added vendor trust score calculation logic

  • Added trust badge and trend computation

  • Added SQL migration for vendor trust score fields

  • Added leaderboard frontend page

  • Registered vendor routes in the FastAPI backend

Notes

While testing locally, I encountered project import-path issues when running the backend with uvicorn backend.main:app. The feature implementation itself is included in this PR, but additional package import adjustments may be required depending on the project's preferred backend execution method.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

🎉 Thank you for your Pull Request! We're thrilled to have your contribution to FreshScan AI.

Before we review, please make sure you have:

  • Followed the CONTRIBUTING.md guidelines.
  • Ensured all automated CI checks (linting, tests) are passing.
  • Checked that your commit messages follow the Conventional Commits format.

A maintainer will review your code as soon as possible!

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

@Aharshi3614 is attempting to deploy a commit to the karan3431's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Aharshi3614
Copy link
Copy Markdown
Contributor Author

CI is now green locally after fixing ruff + excluding notebook. Ready for review

@jpdevhub
Copy link
Copy Markdown
Owner

jpdevhub commented Jun 3, 2026

The backend ci is still failing as per my review the frontend styling is perfect and leaderboard looks perfect and completely aligns with our design system now. however the two small fixes first pull the main if any recent commits you are behind or something. Issues to be fix before merging:

  1. The GitHub Actions job is failing due to formatting errors in backend/vendors.py (missing newline at the end of the file). You can easily fix this by running ruff check --fix backend/vendors.py.

  2. Backend Import Crash: In backend/main.py, you imported the router using from backend.vendors import .... Because our local environment starts from inside the backend folder (cd backend && uvicorn main:app), Python throws a ModuleNotFoundError. Please change this to from vendors import ... so it resolves correctly.

  3. SQL migration is placed in backend/migrations/add_vendor_trust_score.sql. Because we use Supabase, this file will be completely ignored. It MUST be placed inside the backend/supabase/migrations/ directory and have a timestamp prefix (e.g., 20240201000000_add_vendor_trust_score.sql) so Supabase knows to execute it.

  4. Any particular reason to delete the training notebook is that causing any error ?
    with some fixes we are ready to go for merge!

@jpdevhub jpdevhub self-requested a review June 3, 2026 16:08
@Aharshi3614
Copy link
Copy Markdown
Contributor Author

Fixed all 4 issues raised in the review:

1.Import path: Changed from backend.vendors to from vendors in main.py so it resolves correctly when running from inside the backend folder
2.Migration directory: Moved SQL file to backend/supabase/migrations/ with timestamp prefix 20240201000000_add_vendor_trust_score.sql
3.Ruff formatting: Fixed missing newline at end of backend/vendors.py using ruff check --fix
4.Training Notebook: Restored — it was accidentally excluded in the previous commit

@Aharshi3614
Copy link
Copy Markdown
Contributor Author

Aharshi3614 commented Jun 3, 2026

All CI checks are now passing. I think its ready for final review and merge.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fresh-scan-ai Ready Ready Preview, Comment Jun 3, 2026 4:39pm

Copy link
Copy Markdown
Owner

@jpdevhub jpdevhub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its perfect as i expected!

@jpdevhub jpdevhub merged commit 3f07dec into jpdevhub:main Jun 3, 2026
7 checks passed
@jpdevhub
Copy link
Copy Markdown
Owner

jpdevhub commented Jun 3, 2026

One last thing for future pr
image
I noticed there were a lot of formatting-only changes in this diff (like indentation and spacing changes in backend/router.py that weren't related to the feature).

In the future, please try to avoid auto-formatting parts of the codebase that aren't directly related to your feature. It creates a very "noisy" diff which makes it difficult for me to track the actual logic changes. We want to keep our PR diffs as clean and focused as possible!

Great work overall looking forward for your next contributions! Dont forget to star the repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

H-05: Vendor Trust Score & Public Leaderboard

2 participants