<commit_before>/**
 * Module dependancies
 */

var express = require('express')
  , models = require('../../models');

var router     = express.Router() 
  , Applicant  = models.applicant()
  , JobPosting = models.jobPosting();

var ObjectIdBase64Conv = require('./util').ObjectIdBase64Conv
  , objectIdToBase64 = ObjectIdBase64Conv.objectIdToBase64
  , base64ToObjectId = ObjectIdBase64Conv.base64ToObjectId;

/**
 * Add job posting id to applicants bookmarks
 * @req id {String} encoded job posting id
 */

router.post('/add', function(req, res, next){
    var applicantId = req.session.applicantUserId;

    // User can't save bookmark if they arn't logged in
    if (!applicantId){
        var Err = new Error();
        Err.status = 403;
        return next(Err);
    }

    var postId = req.body.id;
    // Response must have a post id
    if (!postId){
        var Err = new Error();
        Err.status = 400;
        return next(Err);
    }

    Applicant.findById(applicantId, function(err, applicant){
        if (err) {
            return next(err);
        }
        if (!applicant){<commit_msg>Fixed Util path in bookmark.js<commit_after>/**
 * Module dependancies
 */

var express = require('express')
  , models = require('../../models');

var router     = express.Router() 
  , Applicant  = models.applicant()
  , JobPosting = models.jobPosting();

var ObjectIdBase64Conv = require('../../util').ObjectIdBase64Conv
  , objectIdToBase64 = ObjectIdBase64Conv.objectIdToBase64
  , base64ToObjectId = ObjectIdBase64Conv.base64ToObjectId;

/**
 * Add job posting id to applicants bookmarks
 * @req id {String} encoded job posting id
 */

router.post('/add', function(req, res, next){
    var applicantId = req.session.applicantUserId;

    // User can't save bookmark if they arn't logged in
    if (!applicantId){
        var Err = new Error();
        Err.status = 403;
        return next(Err);
    }

    var postId = req.body.id;
    // Response must have a post id
    if (!postId){
        var Err = new Error();
        Err.status = 400;
        return next(Err);
    }

    Applicant.findById(applicantId, function(err, applicant){
        if (err) {
            return next(err);
        }
        if (!applicant){
{'fraction_non_alphanumeric': 0.12751677852348994, 'fraction_numerical': 0.019686800894854587, 'mean_word_length': 2.6655737704918034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6411652', 'n_tokens_mistral': 733, 'n_tokens_neox': 676, 'n_words': 183}