-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4eb1abd
commit dfd324b
Showing
7 changed files
with
4,275 additions
and
2,579 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodeLinker: node-modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* eslint-disable camelcase */ | ||
const express = require('express'); | ||
|
||
const theory1router = express.Router(); | ||
const pool = require('../server/db'); | ||
|
||
require('dotenv').config(); | ||
|
||
theory1router.use(express.json()); | ||
|
||
// Notice how we're using a get (But there's also others like post, put/patch, delete) | ||
theory1router.get('/easy', async (req, res) => { | ||
try { | ||
// SELECT * | ||
// FROM theories | ||
// WHERE title = 'There is a CTC to FAANG pipeline'; | ||
const events = await pool.query( | ||
"SELECT * FROM theories WHERE title = 'There is a CTC to FAANG pipeline';", | ||
); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
|
||
theory1router.get('/medium', async (req, res) => { | ||
try { | ||
const events = await pool.query('SELECT AVG(believability_score) FROM believability;'); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
|
||
theory1router.get('/hard', async (req, res) => { | ||
try { | ||
const events = await pool.query( | ||
"SELECT believability_score FROM believability AS b JOIN theories AS t ON t.id = b.id WHERE t.title = 'There is a CTC to FAANG pipeline';", | ||
); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
|
||
// IMPORTANT: This is how you export your router in order to make it importable in app.js | ||
module.exports = theory1router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* eslint-disable camelcase */ | ||
const express = require('express'); | ||
|
||
const uselessRouter = express.Router(); | ||
const pool = require('../server/db'); | ||
|
||
require('dotenv').config(); | ||
|
||
uselessRouter.use(express.json()); | ||
|
||
// Notice how we're using a get (But there's also others like post, put/patch, delete) | ||
uselessRouter.get('/easy', async (req, res) => { | ||
try { | ||
const events = await pool.query( | ||
'SELECT evidence_text' + | ||
'FROM evidence AS e' + | ||
'JOIN theories AS t ON e.id = t.id' + | ||
"WHERE title = 'Kevin has a crippling league addiction';", | ||
); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
uselessRouter.get('/medium', async (req, res) => { | ||
try { | ||
const events = await pool.query( | ||
'SELECT COUNT(evidence_text)' + | ||
'FROM evidence AS e' + | ||
'JOIN theories AS t ON e.id = t.id' + | ||
"WHERE title = 'Kevin has a crippling league addiction';", | ||
); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
uselessRouter.get('/hard', async (req, res) => { | ||
try { | ||
const events = await pool.query( | ||
'SELECT MIN(b) FROM (SELECT AVG(believability_score) as b FROM believability);', | ||
); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
|
||
// IMPORTANT: This is how you export your router in order to make it importable in app.js | ||
module.exports = uselessRouter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-disable camelcase */ | ||
const express = require('express'); | ||
|
||
const theory1router = express.Router(); | ||
const pool = require('../server/db'); | ||
|
||
require('dotenv').config(); | ||
|
||
theory1router.use(express.json()); | ||
|
||
// Notice how we're using a get (But there's also others like post, put/patch, delete) | ||
theory1router.get('/easy', async (req, res) => { | ||
try { | ||
const events = await pool.query( | ||
'SELECT b.submitter FROM believability AS b' + | ||
"JOIN theories AS t ON t.id = b.theory_id WHERE t.title = 'CTC devs will be replaced by AI in the future';", | ||
); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
|
||
theory1router.get('/medium', async (req, res) => { | ||
try { | ||
const events = await pool.query( | ||
'SELECT b.submitter FROM believability AS b' + | ||
'JOIN theories AS t ON t.id = b.theory_id' + | ||
"WHERE t.title = 'CTC devs will be replaced by AI in the future' AND b.believability_score > 4;", | ||
); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
|
||
theory1router.get('/hard', async (req, res) => { | ||
try { | ||
const events = await pool.query( | ||
'SELECT AVG(believability_score)' + | ||
'FROM believability' + | ||
'WHERE believability_score > 1 AND believability_score < 10;', | ||
); | ||
res.status(200).json(events.rows); | ||
} catch (err) { | ||
res.status(500).json(err.message); | ||
} | ||
}); | ||
|
||
// IMPORTANT: This is how you export your router in order to make it importable in app.js | ||
module.exports = theory1router; |
Oops, something went wrong.