{"size": 2072, "ext": "js", "max_stars_repo_path": "src/models/Job.js", "max_stars_repo_name": "nadabenaissa1997/FullStackJSBackOffice", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/models/Job.js", "max_issues_repo_name": "nadabenaissa1997/FullStackJSBackOffice", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/models/Job.js", "max_forks_repo_name": "nadabenaissa1997/FullStackJSBackOffice", "max_forks_repo_forks_event_min_datetime": "2021-09-30T09:45:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-30T09:45:21.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 19.1851851852, "max_line_length": 60, "alphanum_fraction": 0.3870656371}
const mongoose= require('mongoose');
const PostJobSchema = new mongoose.Schema({
    title:{
        type:String,
        required:true,
        trim: true,
    },
    location:{
        type:String,
        required:true,
        trim: true,
    },
    description:{
        type:String,
        required:true,
        trim: true,
    },
    salary: {
        type:Number,
        required: true,
    },
    studyLevel:{
        type:String,
        required: true,
        trim: true,
    },
    experience:{
        type:String,
        required: true,
        trim: true,
    },
    contractType:{
        type: String,
        required: true,
        trim: true,
    },
    nbrApplied:{
        type: Number,
        default: 0
    },
    likes: [
        {
            user:{
                type: mongoose.Schema.Types.ObjectId,
                ref: 'users'
            }   
        }
    ],
    requirements: [
        {
            text: { type: String }     
        }
    ],
    skills: [
        {
            title:{
                type: String,
                trim: true
            }     
        }
    ],
    comments: [
        {
            user:{
                type: mongoose.Schema.Types.ObjectId,
                ref: 'users'
            },
            text: {
                type: String,
                required: true
            },
            firstname: {
                type: String
            },
            lastname: {
                type: String
            },
            avatar: {
                type: String
            },
            date: {
                type: Date,
                default: Date.now
            }
        }
    ],
    createdAt:{
        type : Date,
        default : Date.now
    },
    user:{
        type: mongoose.Schema.Types.ObjectId,
        ref: 'users'
    },
    company:{
        type: String
    },
    approved:{
        type: Number,
        default: 0,
    },
    activate:{
        type: Number,
        default: 1,
    }
    });

module.exports = Job = mongoose.model('Job', PostJobSchema);