From 5d04ef4697ebd428c247958d68b9480017c953bd Mon Sep 17 00:00:00 2001 From: jask1m Date: Tue, 17 Mar 2026 15:04:46 -0700 Subject: [PATCH] create alumni schema for sce linked-in project --- api/main_endpoints/models/Alumni.js | 78 +++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 api/main_endpoints/models/Alumni.js diff --git a/api/main_endpoints/models/Alumni.js b/api/main_endpoints/models/Alumni.js new file mode 100644 index 000000000..b5ae23839 --- /dev/null +++ b/api/main_endpoints/models/Alumni.js @@ -0,0 +1,78 @@ +const mongoose = require('mongoose'); +const Schema = mongoose.Schema; + +const ExperienceSchema = new Schema({ + company: { + type: String, + required: true + }, + title: { + type: String, + required: true + }, + startDate: { + type: Date + }, + endDate: { + type: Date + }, + isCurrent: { + type: Boolean, + default: false + }, + description: { + type: String, + default: '' + } +}); + +const AlumniSchema = new Schema( + { + userId: { + type: Schema.Types.ObjectId, + ref: 'User', + required: true, + unique: true + }, + bio: { + type: String, + default: '' + }, + headline: { + type: String, + default: '' + }, + profilePhotoUrl: { + type: String, + default: '' + }, + linkedInUrl: { + type: String, + default: '' + }, + startYear: { + type: Number + }, + graduationYear: { + type: Number + }, + degree: { + type: String, + enum: ['BS', 'MS'], + default: '' + }, + experiences: { + type: [ExperienceSchema], + default: [] + } + }, + { + collection: 'AlumniProfile', + timestamps: true + } +); + +module.exports = + mongoose.models && mongoose.models.Alumni + ? mongoose.models.Alumni + : mongoose.model('Alumni', AlumniSchema);