PointsHistory - IEEE-Team-3/map GitHub Wiki
The Points History keeps track of all points awarded to users throughout the app. It allows users and admins to view the total points earned and the reasons for those points.
- User ID: The ID of the user receiving the points
- Points: The amount of points awarded
- Type: The type of points (task, bonus, penalty, etc.)
- Reason: The reason for awarding the points
- Date: The date and time when the points were awarded
const PointsHistorySchema = new Schema({
userId: { type: Schema.Types.ObjectId, ref: 'User' },
points: { type: Number, required: true },
type: { type: String, enum: ['task', 'bonus', 'penalty', 'achievement'] },
reason: String,
createdAt: { type: Date, default: Date.now }
});
Users can view their points history through their profile, providing transparency on why they earned points.
function getPointsHistory(userId) {
return PointsHistory.find({ userId });
}