-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from Code-Hammers/CHE-30/subtask/Design-And-Im…
…plement-Profile-Model [CHE-30] Design And Implement Profile Model
- Loading branch information
Showing
9 changed files
with
244 additions
and
77 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,71 @@ | ||
interface ISocial { | ||
linkedIn?: string; | ||
github?: string; | ||
import { Document, ObjectId } from "mongoose"; | ||
|
||
interface ISocialLinks { | ||
twitter?: string; | ||
facebook?: string; | ||
instagram?: string; | ||
blog?: string; | ||
other?: string[]; | ||
} | ||
|
||
interface IProject { | ||
name: string; | ||
description?: string; | ||
link?: string; | ||
} | ||
|
||
interface IJob { | ||
interface ICareerPosition { | ||
title?: string; | ||
company?: string; | ||
description?: string; | ||
date?: Date; | ||
startDate?: Date; | ||
endDate?: Date; | ||
} | ||
|
||
interface IEducation { | ||
institution: string; | ||
degree?: string; | ||
fieldOfStudy?: string; | ||
startDate?: Date; | ||
endDate?: Date; | ||
} | ||
|
||
interface ITestimonial { | ||
from: string; | ||
relation?: string; | ||
text: string; | ||
} | ||
|
||
interface IBlogOrWriting { | ||
title: string; | ||
link: string; | ||
} | ||
|
||
export interface IProfile { | ||
user: string; | ||
firstName: string; | ||
lastName: string; | ||
bio?: string; | ||
job?: IJob; | ||
socials?: ISocial; | ||
export interface IProfile extends Document { | ||
user: ObjectId; | ||
fullName: string; | ||
profilePhoto?: string; | ||
cohort?: string; | ||
graduationYear?: number; | ||
email?: string; | ||
linkedInProfile?: string; | ||
professionalSummary?: string; | ||
skills?: string[]; | ||
specializations?: string[]; | ||
careerInformation?: { | ||
currentPosition?: { | ||
title?: string; | ||
company?: string; | ||
}; | ||
pastPositions?: ICareerPosition[]; | ||
}; | ||
education?: IEducation[]; | ||
projects?: IProject[]; | ||
personalBio?: string; | ||
testimonials?: ITestimonial[]; | ||
socialMediaLinks?: ISocialLinks; | ||
availabilityForNetworking?: boolean; | ||
bootcampExperience?: string; | ||
achievementsAndCertifications?: string[]; | ||
volunteerWork?: string[]; | ||
eventParticipation?: string[]; | ||
gallery?: string[]; | ||
blogOrWriting?: IBlogOrWriting[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,75 @@ | ||
import mongoose from "mongoose"; | ||
// profileModel.ts | ||
import mongoose, { Schema } from "mongoose"; | ||
import { IProfile } from "../types/profile"; | ||
|
||
const profileSchema = new mongoose.Schema<IProfile>({ | ||
user: { | ||
type: mongoose.Schema.Types.ObjectId, | ||
ref: "User", | ||
required: true, | ||
}, | ||
bio: { | ||
type: String, | ||
}, | ||
firstName: { | ||
type: String, | ||
}, | ||
lastName: { | ||
type: String, | ||
}, | ||
job: { | ||
title: String, | ||
company: String, | ||
description: String, | ||
date: Date, | ||
}, | ||
socials: { | ||
linkedIn: { | ||
type: String, | ||
}, | ||
github: { | ||
type: String, | ||
const profileSchema = new Schema<IProfile>({ | ||
user: { type: Schema.Types.ObjectId, ref: "User", required: true }, | ||
fullName: { type: String, required: true }, | ||
profilePhoto: String, | ||
cohort: String, | ||
graduationYear: Number, | ||
email: String, | ||
linkedInProfile: String, | ||
professionalSummary: String, | ||
skills: [String], | ||
specializations: [String], | ||
careerInformation: { | ||
currentPosition: { | ||
title: String, | ||
company: String, | ||
}, | ||
twitter: { | ||
type: String, | ||
pastPositions: [ | ||
{ | ||
title: String, | ||
company: String, | ||
startDate: Date, | ||
endDate: Date, | ||
}, | ||
], | ||
}, | ||
education: [ | ||
{ | ||
institution: String, | ||
degree: String, | ||
fieldOfStudy: String, | ||
startDate: Date, | ||
endDate: Date, | ||
}, | ||
facebook: { | ||
type: String, | ||
], | ||
projects: [ | ||
{ | ||
name: String, | ||
description: String, | ||
link: String, | ||
}, | ||
instagram: { | ||
type: String, | ||
], | ||
personalBio: String, | ||
testimonials: [ | ||
{ | ||
from: String, | ||
relation: String, | ||
text: String, | ||
}, | ||
], | ||
socialMediaLinks: { | ||
twitter: String, | ||
blog: String, | ||
other: [String], | ||
}, | ||
availabilityForNetworking: Boolean, | ||
bootcampExperience: String, | ||
achievementsAndCertifications: [String], | ||
volunteerWork: [String], | ||
eventParticipation: [String], | ||
gallery: [String], | ||
blogOrWriting: [ | ||
{ | ||
title: String, | ||
link: String, | ||
}, | ||
], | ||
}); | ||
|
||
const Profile = mongoose.model("Profile", profileSchema); | ||
const Profile = mongoose.model<IProfile>("profiles", profileSchema); | ||
|
||
export default Profile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.