Download src/models/SkillGap.ts from simhaa-hat/ai-learning-dashboard-api: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/spaces/simhaa-hat/ai-learning-dashboard-api/resolve/main/src/models/SkillGap.ts
- Command line
-
hf download hf://spaces/simhaa-hat/ai-learning-dashboard-api/src/models/SkillGap.ts
-
curl -L -o SkillGap.ts https://huggingface.co/spaces/simhaa-hat/ai-learning-dashboard-api/resolve/main/src/models/SkillGap.ts
1.23 kB
| import mongoose, { Schema } from 'mongoose'; | |
| import { ISkillGap } from '../types'; | |
| const skillGapSchema = new Schema<ISkillGap>( | |
| { | |
| userId: { | |
| type: Schema.Types.ObjectId, | |
| ref: 'User', | |
| required: true, | |
| unique: true, | |
| }, | |
| skills: [ | |
| { | |
| topic: { type: String, required: true }, | |
| currentLevel: { type: Number, min: 0, max: 100, required: true }, | |
| targetLevel: { type: Number, min: 0, max: 100, default: 100 }, | |
| gap: { type: Number, min: 0, max: 100 }, | |
| priority: { | |
| type: String, | |
| enum: ['high', 'medium', 'low'], | |
| default: 'medium', | |
| }, | |
| }, | |
| ], | |
| lastAssessmentDate: { | |
| type: Date, | |
| default: Date.now, | |
| }, | |
| }, | |
| { | |
| timestamps: true, | |
| } | |
| ); | |
| // Calculate gap before saving | |
| skillGapSchema.pre('save', function (next) { | |
| this.skills.forEach((skill) => { | |
| skill.gap = skill.targetLevel - skill.currentLevel; | |
| }); | |
| next(); | |
| }); | |
| const SkillGap = mongoose.model<ISkillGap>('SkillGap', skillGapSchema); | |
| export default SkillGap; | |