2020-09-03 03:47:24 -04:00
|
|
|
// Community Score
|
|
|
|
|
|
|
|
import { Document, Schema, model } from 'mongoose';
|
|
|
|
|
|
|
|
|
|
|
|
export interface ScoreInterface extends Document {
|
|
|
|
userID: string
|
|
|
|
/**
|
|
|
|
* total will be between 800-200 - 0 signfies "No Score", too little information is available or other variable are too low
|
|
|
|
* - CALCULATION: `(COMBINED SUBSCORES x 5) * 5.13; Math.floor()`
|
|
|
|
*/
|
|
|
|
total: number,
|
|
|
|
/**
|
|
|
|
* 10 - 55
|
|
|
|
*/
|
|
|
|
activity: number,
|
|
|
|
/**
|
|
|
|
* 0 - 54
|
|
|
|
*/
|
|
|
|
roles: number,
|
|
|
|
/**
|
|
|
|
* -50 - 2
|
|
|
|
* all users start out with 2 moderation points, the number of points decreases for each moderation.
|
|
|
|
*/
|
|
|
|
moderation: number,
|
|
|
|
/**
|
|
|
|
* -20 - 50
|
|
|
|
* processed by CSD
|
|
|
|
*/
|
|
|
|
cloudServices: number,
|
|
|
|
// 0 or 20, 20 points are added if the user is a staff member
|
|
|
|
staff: number,
|
2020-09-07 01:22:06 -04:00
|
|
|
inquiries: [{ name: string, reason: string, date: Date }],
|
2020-09-03 03:47:24 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
const Score: Schema = new Schema({
|
|
|
|
userID: String,
|
|
|
|
total: Number,
|
|
|
|
activity: Number,
|
|
|
|
roles: Number,
|
|
|
|
moderation: Number,
|
|
|
|
cloudServices: Number,
|
|
|
|
staff: Number,
|
|
|
|
inquiries: Array,
|
|
|
|
});
|
|
|
|
|
|
|
|
export default model<ScoreInterface>('Score', Score);
|