Skip to content

feat: add points system for scan types with shop purchases#112

Open
axv2655 wants to merge 5 commits into
mainfrom
feat/scan-points
Open

feat: add points system for scan types with shop purchases#112
axv2655 wants to merge 5 commits into
mainfrom
feat/scan-points

Conversation

@axv2655

@axv2655 axv2655 commented Jul 25, 2026

Copy link
Copy Markdown
Collaborator
image image image

Summary

  • Add a points system to scans: each scan type has configurable points that are awarded on scan. Admins can see/edit points per scan type in the scan types table.
  • Add a new "shop" scan category that deducts points from a user's balance (repeatable, with atomic balance checking via advisory locks). Returns 402 if insufficient points.
  • Add a configurable points name setting (super admin) so the display label (e.g. "HackBucks") is customizable. Shown in the scanner dialog after scans.
  • Display user point balances in the applications table, application detail panel, and hacker profile page.

Backend changes

  • New points column on scans table (migration 24), repeatable boolean + partial unique index (migration 25)
  • CreatePurchase store method with pg_advisory_xact_lock for atomic balance verification
  • GetTotalPointsByUserID store method for balance lookups
  • GetPointsName / SetPointsName settings endpoints (/points-name, /superadmin/settings/points-name)
  • Application endpoints now include points in responses

Frontend changes

  • Scan types table: editable points column
  • PointsNameCard: inline editor for super admins to rename the points system
  • ScannerDialog: shows points awarded/deducted and remaining balance after scan
  • Applications table & detail panel: points badge
  • Hacker profile page: points display

@axv2655
axv2655 marked this pull request as ready for review July 25, 2026 02:41
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.

1 participant