Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 25 additions & 18 deletions routes/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,34 @@ route.get('/claims/:id/update', auth.adminOnly, (req, res) => {
});

route.post('/claims/add', auth.ensureLoggedInGithub, (req, res) => {

if(process.env.BOSS_DEV === 'localhost'){
req.user = {
usergithub:{
username:'Dhroov7'

const bossEnd = Date.parse('16 Aug 2018 00:00:00 GMT+05:30')

if (bossEnd < Date.now()) {
res.send("BOSS is now over!")
}

if(process.env.BOSS_DEV === 'localhost'){
req.user = {
usergithub:{
username:'Dhroov7'
}
}
}
}

du.createClaim(
req.user.usergithub.username,
req.body.issue_url,
req.body.pull_url,
req.body.bounty,
config.CLAIM_STATUS.CLAIMED
).then(claim => {
res.send(claim)
}).catch(err => {
console.log(err);
res.send("Sorry. Could not add the claim right now.");
});
du.createClaim(
req.user.usergithub.username,
req.body.issue_url,
req.body.pull_url,
req.body.bounty,
config.CLAIM_STATUS.CLAIMED
).then(claim => {
res.send(claim)
}).catch(err => {
console.log(err);
res.send("Sorry. Could not add the claim right now.");
});

});


Expand Down
7 changes: 7 additions & 0 deletions routes/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ route.get('/claims/:id', auth.adminOnly, (req, res) => {
});

route.post('/claims/add', auth.ensureLoggedInGithub, (req, res) => {

const bossEnd = Date.parse('16 Aug 2018 00:00:00 GMT+05:30')

if (bossEnd < Date.now()) {
res.send("BOSS is now over!")
}

du.createClaim(
req.user.usergithub.username, // github username already valid
req.body.issue_url,
Expand Down