CelestiumX / CelestiumX/SkillChain-Backend
Implement Reputation Scoring
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## 📚 Overview
Design and implement the backend reputation algorithm based on contract outcomes, reviews, and disputes.
If you need coordination or clarification, use the project’s [[Telegram Group](https://t.me/+YZEXOc_LOzIyYTgx)](https://t.me/+YZEXOc_LOzIyYTgx).
---
## 🤔 Why This Matters
Trust in the marketplace is driven by transparent and fair reputation metrics. A well-designed reputation system increases user confidence and supports the long-term success of the SkillChain ecosystem.
---
## 🛠 Requirements
- Schedule a daily CRON job to compute updated reputation scores
- Track historical scores using Prisma
- Reputation score formula:
```ts
const score = (completionRate * 0.6) + (avgRating * 0.3) - (disputes * 0.1);
```
- Ensure all data inputs (`completionRate`, `avgRating`, `disputes`) are pulled reliably from the database
---
## 🔧 Implementation Plan
### 1. Create Feature Branch
```bash
git checkout -b feature-reputation-algorithm-[issue-number]
```
### 2. Prisma Setup
- Create a new model for historical reputation tracking
- Add necessary fields to associate scores with users and timestamps
### 3. Score Calculation Logic
- Implement score logic in a reusable function `calculateReputation(userId)`
- Use PostgreSQL queries or Prisma aggregations to get necessary inputs
### 4. CRON Job Setup
- Use `node-cron` or equivalent
- Schedule to run daily at midnight UTC
- Log status of job and number of users processed
### 5. Testing
- Unit tests for score calculation function (≥ 90% coverage)
- Tests for edge cases (e.g., no reviews, maximum disputes)
### 6. Commit and Push
```bash
git add .
git commit -m "Feature: Reputation scoring system with historical tracking"
git push origin feature-reputation-algorithm-[issue-number]
```
---
## ✅ Definition of Done
- [ ] Scores update daily via CRON job
- [ ] Historical records persist correctly
- [ ] Score calculation unit tests (≥ 90% coverage)
- [ ] Pull request meets template standards
---
## 📆 Timeframe
2 days
Contributor guide
No contributing guide indexed for this repository
Research direction
The issue names no files; begin by locating the Prisma schema, the scheduled-job entry point, and the test setup. Then trace the database sources for completion rates, ratings, and disputes before defining the reusable calculateReputation(userId) path. Done means daily UTC updates, persisted historical records, and unit tests covering the formula and listed edge cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, postgresql, typescript
- Domain
- backend, database, devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100