Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent update #3

Merged
merged 53 commits into from
Apr 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
37ce183
complete work on the footer before the incident
Yigaue Apr 13, 2019
4e1ca09
added .env file
Yigaue Apr 13, 2019
60920e6
Merge remote-tracking branch 'upstream/master'
Yigaue Apr 13, 2019
ccd4858
Merge remote-tracking branch 'origin/master'
Yigaue Apr 13, 2019
ba665cf
Merge remote-tracking branch 'upstream/master'
Yigaue Apr 13, 2019
54a383d
this is the speedo two-begins here
Yigaue Apr 13, 2019
17a76f2
update on footer
Yigaue Apr 13, 2019
c1a5dce
integation of FAQs
Yigaue Apr 13, 2019
25f3149
final work for FAQs
Yigaue Apr 13, 2019
48a2bd1
the complete thing after the accident
Yigaue Apr 13, 2019
3d4a571
the last job on the faqs -- good to launch
Yigaue Apr 13, 2019
0665645
FAQs alone
Yigaue Apr 13, 2019
1ac570a
Final work on FAQ before the accident
Yigaue Apr 13, 2019
2a8df69
We revisited the FAQs
Yigaue Apr 13, 2019
6f84301
Resolved merged conflict
Yigaue Apr 13, 2019
7ef6d95
review the FE FAQs
Yigaue Apr 13, 2019
5497f34
integrated the FAQs
Yigaue Apr 13, 2019
e2b1381
The FAQs looked and worked perfectly
Yigaue Apr 13, 2019
a1cd4dc
we dont need this open
Yigaue Apr 13, 2019
c8d4d49
Merge remote-tracking branch 'upstream/master'
Yigaue Apr 15, 2019
ab81fe4
Include validation to pay an agent
hadeoh Apr 16, 2019
d4e7db8
Created user login and signup pages
Aivrie Apr 16, 2019
28af85d
Update style of user pages
Aivrie Apr 16, 2019
7c2790b
Merge pull request #25 from Yigaue/master
prismaticoder Apr 16, 2019
39dd49c
added a wiget
Yigaue Apr 16, 2019
e121444
configure tawt.to
Yigaue Apr 16, 2019
d0aba11
the widget can be found in the footer
Yigaue Apr 16, 2019
f01e79f
Add files via upload
Yigaue Apr 16, 2019
22f07c3
Merge pull request #36 from hadeoh/master
prismaticoder Apr 16, 2019
141f994
Changed comatose sponsor link FLY AFRICA to VERIFI
CodeMat17 Apr 16, 2019
8815a84
Merge pull request #40 from Mctony17/master
Shock451 Apr 16, 2019
4040ad7
Update user-login.hbs
Shock451 Apr 17, 2019
fd8036f
Merge pull request #37 from Aivrie/master
Shock451 Apr 17, 2019
c48dee4
Change the apply button to hire an agent button on individual job pag…
Bashabil Apr 17, 2019
37a79c2
Update about.hbs
Shock451 Apr 17, 2019
38b0ef4
Update www
Shock451 Apr 17, 2019
cfca9d4
Update app.js
Shock451 Apr 17, 2019
38dc19d
Added https to all links. Needs update
Shock451 Apr 17, 2019
1a71237
Merge pull request #48 from hnginternship5/https
Shock451 Apr 17, 2019
a302cf0
Merge remote-tracking branch 'upstream/master'
Yigaue Apr 17, 2019
a60c292
integration of chat system
Yigaue Apr 17, 2019
a991659
interation of chat system
Yigaue Apr 17, 2019
8fc2dad
Delete .env
Yigaue Apr 17, 2019
88c8d49
Merge pull request #49 from Yigaue/chatsystem
prismaticoder Apr 17, 2019
ad1d5b4
Added weekly email
Somtozech Apr 18, 2019
365b3f0
Updated remote_job email template
Somtozech Apr 18, 2019
f28fc0a
Update about.hbs
Shock451 Apr 18, 2019
e74b726
Test auto deploy
Shock451 Apr 18, 2019
2bc4c57
Added Applicant details for vetting
IDTitanium Apr 18, 2019
b73eca4
Merge pull request #1 from hnginternship5/master
IDTitanium Apr 18, 2019
9f2d973
Merge branch 'master' of https://github.com/IDTitanium/remote_job_alert
IDTitanium Apr 18, 2019
0da4d25
Merge pull request #50 from IDTitanium/master
Somtozech Apr 18, 2019
f51f5fb
Merge pull request #44 from Bashabil/master
Yokomon Apr 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ coverage
# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,46 @@
# Remote Job Alert

A remote job listing site for Africans

# About Remote Job Alert

Remote job alert is a service used to serve curated job listings outside of Africa for Africans living in the continent.

# Getting Started

1. Fork the repository, clone it.
2. cd (change directory) into the project folder i.e remote_job_alert.
3. Run `npm install` (on your terminal) to install the dependencies.
4. Run `npm start` (on your terminal) to run the project.
5. Go to your browser `localhost:3000` to view the project.
5. Go to your browser `localhost:3020` to view the project.
6. When you make your changes to the repo, push to master and create a pull request, make sure there are no merge conflicts.
7. Do not merge, the mentor would.
Getting Started
Getting Started

Fork the repository first and clone it

```
git clone <CLONE_URL>
```

Change into cloned repo and install dependencies

```
`npm install`

Create a .env file in the root folder and add the following:
MAILGUN_API_KEY=key-ahdhdhhd
MAILGUN_DOMAIN=any.com
```

```

Start the project
```

`npm start`

Visit `http://localhost:3000` to view the project.
Visit `https://localhost:3020` to view the project.

**NOTES:**

Expand Down
63 changes: 31 additions & 32 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,91 +1,90 @@
var mongoose = require("mongoose");
var createError = require("http-errors");
var express = require("express");
var exphbs = require("express-handlebars");
var path = require("path");
var cookieParser = require("cookie-parser");
var logger = require("morgan");
var session = require("express-session");
var flash = require("connect-flash");
var mongoose = require('mongoose');
var createError = require('http-errors');
var express = require('express');
var exphbs = require('express-handlebars');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var session = require('express-session');
var flash = require('connect-flash');
var MongoStore = require('connect-mongo')(session);
require("dotenv").config();
require('dotenv').config();
require('./schedule');

// The database setup
// we should probable store the url in .env for security reasons.
var databaseUrl =
"mongodb://job_alert_admin:#developerHNG1@ds135456.mlab.com:35456/job_alert_db";
'mongodb://job_alert_admin:#developerHNG1@ds135456.mlab.com:35456/job_alert_db';

// connect to database
mongoose.connect(databaseUrl, { useNewUrlParser: true }, function(err, client) {
if (err) console.log(err);
console.log("Connection passed");
console.log('Connection passed');
});

let db = mongoose.connection;

db.once("open", () => console.log("Connected to database"));
db.once('open', () => console.log('Connected to database'));

// checks if connection to db is a success
db.on("error", console.error.bind(console, "Database connection error:"));
db.on('error', console.error.bind(console, 'Database connection error:'));

var indexRouter = require("./routes/index");
var indexRouter = require('./routes/index');
// var usersRouter = require('./routes/users');

var app = express();

// view engine setup
app.set("views", path.join(__dirname, "views"));
app.set('views', path.join(__dirname, 'views'));

app.engine(".hbs", exphbs({ defaultLayout: "main", extname: ".hbs" }));
app.engine('.hbs', exphbs({ defaultLayout: 'main', extname: '.hbs' }));

app.set("view engine", "hbs");
app.set('view engine', 'hbs');

app.use(logger("dev"));
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, "public")));
app.use(express.static(path.join(__dirname, 'public')));

app.use(
session({
secret: "dfgdhhahg15sdff",
secret: 'dfgdhhahg15sdff',
saveUninitialized: false,
resave: true,
store: new MongoStore({
mongooseConnection: db
})
mongooseConnection: db
})
})
);

app.use(flash());

//locals
app.use(function(req, res, next) {
res.locals.success = req.flash("success");
res.locals.emailError = req.flash("emailError");
res.locals.errors = req.flash("errors");
res.locals.success = req.flash('success');
res.locals.emailError = req.flash('emailError');
res.locals.errors = req.flash('errors');
next();
});

app.use("/", indexRouter);
app.use('/', indexRouter);
// app.use('/users', usersRouter);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
res.render("404");
res.render('404');
});

console.log("Server running on PORT 3000");

// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get("env") === "development" ? err : {};
res.locals.error = req.app.get('env') === 'development' ? err : {};

// render the error page
res.status(err.status || 500);
res.render("error");
res.render('error');
});

module.exports = app;
12 changes: 4 additions & 8 deletions bin/www
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var http = require('http');
* Get port from environment and store in Express.
*/

var port = normalizePort(process.env.PORT || '3000');
var port = normalizePort('3020');
app.set('port', port);

/**
Expand All @@ -25,7 +25,7 @@ var server = http.createServer(app);
* Listen on provided port, on all network interfaces.
*/

server.listen(port);
server.listen(port, () => console.log('Server running on PORT 3020'));
server.on('error', onError);
server.on('listening', onListening);

Expand Down Expand Up @@ -58,9 +58,7 @@ function onError(error) {
throw error;
}

var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
var bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port;

// handle specific listen errors with friendly messages
switch (error.code) {
Expand All @@ -83,8 +81,6 @@ function onError(error) {

function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
var bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
debug('Listening on ' + bind);
}
2 changes: 1 addition & 1 deletion controllers/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Agent = {
first_name: req.body.first_name,
last_name: req.body.last_name,
email: req.body.email,
job_role: req.body.job_role
phone_number: req.body.phone_number
}
try {
let createdAgent = await db.create(queryText);
Expand Down
50 changes: 50 additions & 0 deletions controllers/applicant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const db = require("./promise").DbApplicant;

const validateApplicantQueryText = require('../validation/applicant');


const Applicant = {


async create_applicant(req, res){

const { errors, isValid } = validateApplicantQueryText(req.body);

// Check Validation
if (!isValid) {
req.flash("errors", "There are errors in your details filled, Retry");
}

const queryText = {
first_name: req.body.first_name,
last_name: req.body.last_name,
email: req.body.email,
number: req.body.number,
experience: req.body.experience,
tech_stack: req.body.tech_stack,
linkedin_profile: req.body.linkedin_profile,
github_profile: req.body.github_profile,
website: req.body.website
}
try {
let createdApplicant = await db.create(queryText);
req.flash("success", "Your Details have been Submitted Successfully");
return res.redirect("/");
} catch(error){
req.flash("errors", "There are errors in your details filled, Retry");
return res.send(error);
}
},
async get_all(req, res){
const queryText = {};
try {
let foundApplicant = await db.find(queryText);
return res.status(200).render('applicant_data', {content: foundApplicant});
} catch(error){
return res.status(400).send(error);
}

}
}

module.exports = Applicant;
18 changes: 18 additions & 0 deletions controllers/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ class Home {
res.render("about");
}



//User Pages
// Render user-login page
static userLogin(req, res, next) {
res.render("user-login");
}

// Render user-signup page
static userSignup(req, res, next) {
res.render("user-signup");
}



//Render contact details page
static contactUs(req, res, next) {
res.render("contact");
Expand Down Expand Up @@ -36,6 +51,9 @@ class Home {
static get_summary(req, res, next){
res.render('get-summary', { title : 'Payment Summary', reference: req.query.reference });
}
static get_applicant(req, res, next){
res.render('applicant', {title: 'Applicant Details'});
}
}

module.exports = Home;
9 changes: 5 additions & 4 deletions controllers/promise.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const Jobs = require("../models/jobs");
const Users = require("../models/user");
const Agent = require("../models/agent");
const Applicant = require("../models/applicant");

class Db {
/**
Expand Down Expand Up @@ -64,14 +65,14 @@ class Db {
}
};

class DbAgent {
class DbApplicant {
/**
* @param {string} text
* @returns {object} Return all
*/
static find(param){
return new Promise((resolve, reject) => {
Agent.find(param)
Applicant.find(param)
.then((res) => {
resolve(res);
})
Expand All @@ -82,7 +83,7 @@ class DbAgent {
}
static create(param){
return new Promise((resolve, reject) => {
Agent.create(param)
Applicant.create(param)
.then((res) => {
resolve(res);
})
Expand All @@ -95,5 +96,5 @@ class DbAgent {

module.exports = {
Db,
DbAgent
DbApplicant
};
Loading