You are on page 1of 2

import express, { Request, Response } from "express";

import {createJob, updateJob, getAllJobs, deleteJob, searchJobs, getJobsById,


filterJobPost} from "../controllers/jobPost";
import { checkIfAuthenticated } from "../helpers/jwtHelper";
const jobsRouter = express.Router();

jobsRouter.post('/create-job',checkIfAuthenticated,createJob),
jobsRouter.post('/update-job/:id',checkIfAuthenticated, updateJob),
jobsRouter.get('/get-jobs',checkIfAuthenticated, getAllJobs),
jobsRouter.delete('/delete-Job/:id',checkIfAuthenticated, deleteJob),
jobsRouter.get('/search-Jobs', checkIfAuthenticated,searchJobs),
jobsRouter.get('/get-Jobs-ById',checkIfAuthenticated, getJobsById),
jobsRouter.get('/filterJobPost', filterJobPost)

export { jobsRouter };
import { StringUtil } from './../helpers/stringHelper';
import { IJobs } from './jobs';
import mongoose from "mongoose";

export const JobApplicationSchema = new mongoose.Schema({


jobId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'Jobs', // Reference to the Jobs model
required: true,
},
applicantId: {
type: mongoose.Schema.Types.ObjectId,
ref: 'JobSeeker', // Reference to the JobSeeker model
required: true,
},
jobTitle: {
type: mongoose.Schema.Types.String,
ref: 'Jobs', // Reference to the Jobs model
required: false,
},
location: {
type: mongoose.Schema.Types.String,
ref: 'Jobs', // Reference to the Jobs model
required: false,
},
status: {
type: String,
enum: ['pending', 'hired', 'rejected'],
default: 'pending',
},

resumePath:{
type:String,
require:false
},
applicationDate: {
type: Date,
default: Date.now,
},
});

export interface IJobApplication extends mongoose.Document {


jobId: mongoose.Types.ObjectId;
applicantId: mongoose.Types.ObjectId;
jobTitle: String;
location: String;
status: 'pending' | 'hired' | 'rejected';
applicationDate: Date;
resumePath:string;
}

const JobApplication = mongoose.model<IJobApplication>("JobApplication",


JobApplicationSchema);

export default JobApplication;

You might also like