96 lines
2.0 KiB
TypeScript
96 lines
2.0 KiB
TypeScript
// Community Score
|
|
|
|
import { Document, Schema, model } from 'mongoose';
|
|
|
|
export interface Inquiry {
|
|
id?: string,
|
|
name: string,
|
|
reason: string,
|
|
date: Date,
|
|
report: ScoreInterfaceRaw,
|
|
}
|
|
|
|
export interface ScoreInterfaceRaw {
|
|
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,
|
|
other: number,
|
|
notify: boolean,
|
|
locked: boolean,
|
|
inquiries: [ Inquiry ],
|
|
softInquiries: [{ name: string, date: Date }],
|
|
lastUpdate: Date,
|
|
pin: number[],
|
|
}
|
|
|
|
|
|
export interface ScoreInterface extends Document {
|
|
userID: string
|
|
total: number,
|
|
activity: number,
|
|
roles: number,
|
|
moderation: number,
|
|
cloudServices: number,
|
|
staff: number,
|
|
other: number,
|
|
notify: boolean,
|
|
locked: boolean,
|
|
inquiries: [ Inquiry ],
|
|
softInquiries: [{ name: string, date: Date }],
|
|
lastUpdate: Date,
|
|
pin: number[],
|
|
|
|
// general & media
|
|
/* generalMessagesRatio: number,
|
|
// programming-support channels and cloud-support
|
|
supportMessagesRatio: number,
|
|
totalModerations: number,
|
|
notes: number, */
|
|
}
|
|
|
|
const Score: Schema = new Schema({
|
|
userID: String,
|
|
total: Number,
|
|
activity: Number,
|
|
roles: Number,
|
|
moderation: Number,
|
|
cloudServices: Number,
|
|
staff: Number,
|
|
other: Number,
|
|
notify: Boolean,
|
|
locked: Boolean,
|
|
inquiries: Array,
|
|
softInquiries: Array,
|
|
lastUpdate: Date,
|
|
pin: Array,
|
|
/* generalMessagesRatio: Number,
|
|
supportMessagesRatio: Number,
|
|
totalModerations: Number,
|
|
notes: Number, */
|
|
});
|
|
|
|
export default model<ScoreInterface>('Score', Score);
|