Skip to content

Commit

Permalink
Merge pull request #128 from Ignitus/develop
Browse files Browse the repository at this point in the history
Master > Develop
  • Loading branch information
divyanshu-rawat authored Mar 13, 2020
2 parents d18e476 + 4aa1675 commit 4cf342c
Show file tree
Hide file tree
Showing 50 changed files with 882 additions and 919 deletions.
11 changes: 11 additions & 0 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eslint:
enabled: true
config_file: .eslintrc

javscript:
enabled: true
config_file: .jshintrc

tslint:
enabled: true
config_file: tsconfig.json
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.npmrc
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save-exact=true
loglevel=warn
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v13.2.0
17 changes: 9 additions & 8 deletions api/Configuration/config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module.exports = {
secretKey: process.env.SECRET_KEY,
mongoUrl: process.env.DATABASE_URI,
hashingType: process.env.HASHING_TYPE,
hashingDigest: process.env.HASHING_DIGEST,
privateVapidEmail: process.env.PVT_VAPID_EMAIL,
publicVapidKey: process.env.PUBLIC_VAPID_KEY,
privateVapidKey: process.env.PRIVATE_VAPID_KEY,
export const config = {
secretKey: '3970-582578-4263-184729',
mongoUrl: 'mongodb://ig-migration:[email protected]:47566/ignitus-migration',
hashingType: 'md5',
hashingDigest: 'hex',
privateVapidEmail: '[email protected]',
publicVapidKey:
'BMRATagxJMbZdcX-a-lwaMC93vL7-Kmr3trsTc_g0HJy6C6UGCRMSKfxzJUOjAsXt3W5Ov7t_a8J9y9qROw9mFE',
privateVapidKey: 'NY_nxUlraMagPhmrwco8C-z0QH5xslPSAXP-cFk7cDM',
};
11 changes: 4 additions & 7 deletions api/Configuration/db.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
const mongoose = require('mongoose');
const config = require('./config.js');
import mongoose from 'mongoose';
import { config } from './config.js';

module.exports = function connectDB() {
return mongoose.connect(
config.mongoUrl,
);
};
const connectDB = () => mongoose.connect(config.mongoUrl);
export default connectDB;
48 changes: 0 additions & 48 deletions api/Controllers/internship.js

This file was deleted.

65 changes: 65 additions & 0 deletions api/Controllers/opportunityController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* eslint-disable no-underscore-dangle */
/* eslint-disable max-len */

import Oppurtunity from '../Models/opportunityModel.js';
import responseHandler from '../Utils/responseHandler.js';

export const addOppurtunity = (req, res) => {
Oppurtunity.create(req.body, (err, docs) => {
if (err) {
throw new Error(err);
}
return responseHandler.success(res, docs);
});
};

export const fetchAllOppurtunities = (req, res) => {
Oppurtunity.find({}, (err, docs) => {
if (err) {
throw new Error(err);
}
responseHandler.success(res, docs);
});
};

export const fetchOppurtunityByID = (req, res) => {
Oppurtunity.findById(req.params.id, (err, docs) => {
if (err) {
throw new Error(err);
}
if (!docs) {
return responseHandler.error(res, 'Oppurtunity not found!', 404);
}
return responseHandler.success(res, docs);
});
};

export const updateOppurtunity = (req, res) => {
Oppurtunity.findByIdAndUpdate(
req.params.id,
req.body,
{ new: true },
(err, docs) => {
if (err) {
throw new Error(err);
}
if (!docs) {
return responseHandler.error(res, 'Oppurtunity not found!', 404);
}
return responseHandler.success(res, docs);
}
);
};

export const deleteOppurtunity = (req, res) => {
Oppurtunity.findByIdAndRemove(req.params.id, (err, docs) => {
if (err) {
throw new Error(err);
}
if (!docs) {
return responseHandler.error(res, 'Oppurtunity not found!', 404);
}
// eslint-disable-next-line no-underscore-dangle
return responseHandler.success(res, { _id: docs._id });
});
};
15 changes: 15 additions & 0 deletions api/Controllers/professorController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable max-len */
import Professor from '../Models/professorModel.js';
import responseHandler from '../Utils/responseHandler.js';

export const professorProfile = (req, res) => {
Professor.find({ email: req.userData.email }, (err, docs) => {
if (err) {
throw new Error(err);
}
if(!docs) {
responseHandler.error(res, 'Profile not found', 404);
}
return responseHandler.success(res, docs);
});
};
13 changes: 0 additions & 13 deletions api/Controllers/professorProfile.js

This file was deleted.

14 changes: 14 additions & 0 deletions api/Controllers/studentController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Student from '../Models/studentModel.js';
import responseHandler from '../Utils/responseHandler.js';

export const studentProfile = (req, res) => {
Student.find({ email: req.userData.email }, (err, docs) => {
if (err) {
throw new Error(err);
}
if(!docs) {
responseHandler.error(res, 'Profile not found', 404);
}
return responseHandler.success(res, docs);
});
};
12 changes: 0 additions & 12 deletions api/Controllers/studentProfile.js

This file was deleted.

37 changes: 0 additions & 37 deletions api/Controllers/teamMember.js

This file was deleted.

62 changes: 62 additions & 0 deletions api/Controllers/teamMembersController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import TeamMember from '../Models/teamMembersModel.js';
import responseHandler from '../Utils/responseHandler.js';

export const fetchAllTeamMembers = (req, res) => {
TeamMember.find({}, (err, docs) => {
if (err) {
throw new Error(err);
}
return responseHandler.success(res, docs);
});
};

export const fetchTeamMemberByID = (req, res) => {
TeamMember.findById(req.params.id, (err, docs) => {
if (err) {
throw new Error(err);
}
if (!docs) {
return responseHandler.error(res, 'TeamMember not found!', 404);
}
return responseHandler.success(res, docs);
});
};

export const createTeamMember = (req, res) => {
TeamMember.create(req.body, (err, docs) => {
if (err) {
throw new Error(err);
}
return responseHandler.success(res, docs);
});
};

export const updateTeamMember = (req, res) => {
TeamMember.findByIdAndUpdate(
req.params.id,
req.body,
{ new: true },
(err, docs) => {
if (err) {
throw new Error(err);
}
if (!docs) {
return responseHandler.error(res, 'TeamMember not found!', 404);
}
return responseHandler.success(res, docs);
}
);
};

export const deleteTeamMember = (req, res) => {
TeamMember.findByIdAndRemove(req.params.id, (err, docs) => {
if (err) {
throw new Error(err);
}
if (!docs) {
return responseHandler.error(res, 'TeamMember not found!', 404);
}
// eslint-disable-next-line no-underscore-dangle
return responseHandler.success(res, { _id: docs._id });
});
};
50 changes: 0 additions & 50 deletions api/Controllers/testimonial.js

This file was deleted.

Loading

0 comments on commit 4cf342c

Please sign in to comment.