Skip to content

Commit

Permalink
merge from staging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayobami6 committed Oct 7, 2023
2 parents 73a2fb6 + b87bfb1 commit d268c7d
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 2 deletions.
2 changes: 2 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
.prettierrc
4 changes: 2 additions & 2 deletions server/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dotenv from 'dotenv';
import express from 'express';
import bodyParser from 'body-parser';
import mongoose from 'mongoose';
import mongoose, { ConnectOptions } from 'mongoose';
import employerRoutes from './routes/employerRoute';

dotenv.config();
Expand All @@ -25,7 +25,7 @@ app.get('/', (req, res) => {
});

mongoose
.connect(dbConnString, { useNewUrlParser: true })
.connect(dbConnString, { useNewUrlParser: true } as ConnectOptions)
.then(() => {
console.log('Database Connected');
app.listen(PORT, () => {
Expand Down
49 changes: 49 additions & 0 deletions server/interfaces/talentInterface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
export interface Talent {
name: string;
email: string;
hashedPassword: string;
experience?: Array<Experience>;
skill?: Array<string>;
education?: Array<Education>;
hasOffer: boolean;
rank: number;
socials?: Array<string>;
github?: string;
bio?: string;
profileImg?: string;
certifications?: Array<Certification>;
projects?: Array<Project>;
createdAt?: Date;
updatedAt?: Date;
}

export interface Experience {
jobTitle: string;
city: string;
country: string;
employer?: string;
startDate: Date;
endDate?: Date;
description?: string;
}

export interface Education {
degree: string;
school: string;
country: string;
city: string;
description: string;
startDate: Date;
endDate?: Date;
}

export interface Certification {
title: string;
link: string;
}

export interface Project {
name: string;
description: string;
link: string;
}
62 changes: 62 additions & 0 deletions server/models/talentModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { model, Schema } from 'mongoose';
import {
Certification,
Education,
Experience,
Project,
Talent,
} from '../interfaces/talentInterface';

const experienceSchema = new Schema<Experience>(
{
jobTitle: String,
description: String,
employer: String,
city: String,
country: String,
startDate: Schema.Types.Date,
endDate: Schema.Types.Date,
},
{ _id: false },
);
const educationSchema = new Schema<Education>(
{
degree: String,
description: String,
city: String,
country: String,
startDate: Schema.Types.Date,
endDate: Schema.Types.Date,
school: String,
},
{ _id: false },
);
const certificationSchema = new Schema<Certification>(
{ link: String, title: String },
{ _id: false },
);
const projectSchema = new Schema<Project>(
{ name: String, description: String, link: String },
{ _id: false },
);

const talentSchema = new Schema<Talent>({
name: { type: String, required: true },
email: { type: String, required: true },
hashedPassword: { type: String, required: true },
experience: [experienceSchema],
skill: [String],
education: [educationSchema],
bio: String,
certifications: [certificationSchema],
github: String,
socials: [String],
hasOffer: { type: Boolean, default: false },
profileImg: String,
rank: { type: Number, default: 0 },
projects: [projectSchema],
});

const Talent = model<Talent>('talents', talentSchema);

export default Talent;

0 comments on commit d268c7d

Please sign in to comment.