Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
31 changed files
with
7,330 additions
and
44 deletions.
There are no files selected for viewing
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,62 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: controllers/auth.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: controllers/auth.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** | ||
* @module controllers/auth | ||
* @author Miltos Skondras | ||
* | ||
*/ | ||
|
||
const passport = require('koa-passport'); | ||
const basicAuth = require('../strategies/basic'); | ||
|
||
passport.use(basicAuth); | ||
|
||
module.exports = passport.authenticate(['basic'], {session:false});</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-controllers_auth.html">controllers/auth</a></li><li><a href="module-controllers_validation.html">controllers/validation</a></li><li><a href="module-helpers_database.html">helpers/database</a></li><li><a href="module-models_applications.html">models/applications</a></li><li><a href="module-models_users.html">models/users</a></li><li><a href="module-permissions_applications.html">permissions/applications</a></li><li><a href="module-permissions_users.html">permissions/users</a></li><li><a href="module-routes_applications.html">routes/applications</a></li><li><a href="module-routes_users.html">routes/users</a></li><li><a href="module-strategies_basic.html">strategies/basic</a></li></ul><h3>Classes</h3><ul><li><a href="module-helpers_database-DatabaseException.html">DatabaseException</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Sun Nov 28 2021 19:50:25 GMT+0000 (GMT) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
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
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,157 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: models/applications.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: models/applications.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** | ||
* Database module for the application modification | ||
* | ||
* @module models/applications | ||
* @author Miltos Skondras | ||
*/ | ||
|
||
const db = require('../helpers/database'); | ||
|
||
/** | ||
* getAll | ||
* | ||
* @description Returns all applications | ||
* @return {object} Objects containing application data | ||
*/ | ||
exports.getAll = async function getAll (page, limit, order, direction) { | ||
const offset = (page - 1) * limit; | ||
let query; | ||
if (direction === 'DESC') { | ||
query = "SELECT * FROM applications ORDER BY ?? DESC LIMIT ? OFFSET ?;"; | ||
} else { | ||
query = "SELECT * FROM applications ORDER BY ?? ASC LIMIT ? OFFSET ?;"; | ||
} | ||
const values = [order, parseInt(limit), parseInt(offset)]; | ||
const data = await db.run_query(query, values); | ||
return data; | ||
} | ||
|
||
/** | ||
* getById | ||
* | ||
* @description Returns a single application based on its ID | ||
* @param {number} id - The ID of the application | ||
* @return {object} Object containing information on that specific application | ||
*/ | ||
exports.getById = async function getById (id) { | ||
const query = "SELECT * FROM applications WHERE ID = ?;"; | ||
const values = [id]; | ||
const data = await db.run_query(query, values); | ||
return data; | ||
} | ||
|
||
/** | ||
* add | ||
* | ||
* @description Adds an application to the database | ||
* @param {object} application - Application data in JSON format | ||
* @return {object} Response from database | ||
*/ | ||
exports.add = async function add (application) { | ||
const query = "INSERT INTO applications SET ?"; | ||
const data = await db.run_query(query, application); | ||
return data; | ||
} | ||
|
||
/** | ||
* delById | ||
* | ||
* @description Deletes an application from the database based on its ID | ||
* @param {number} id - The ID of the application that will be deleted | ||
* @return {object} Response from database | ||
*/ | ||
exports.delById = async function delById (id) { | ||
const query = "DELETE FROM appications WHERE ID = ?;"; | ||
const values = [id]; | ||
const data = await db.run_query(query, values); | ||
return data; | ||
} | ||
|
||
/** | ||
* update | ||
* | ||
* @description Updates an application from the database based on its ID | ||
* @param {number} application - The ID of the application that will be updated | ||
* @return {object} Response from database | ||
*/ | ||
exports.update = async function update (appication) { | ||
const query = "UPDATE applications SET ? WHERE ID = ?;"; | ||
const values = [appication, appication.ID]; | ||
const data = await db.run_query(query, values); | ||
return data; | ||
} | ||
|
||
// get all applications with a pending status | ||
exports.getByPendingStatus = async function getByPendingStatus (applicationStatus) { | ||
const query = "SELECT * FROM applications WHERE applicationStatus = 'pending';"; | ||
const values = [applicationStatus]; | ||
const data = await db.run_query(query, values); | ||
return data; | ||
} | ||
|
||
// get all applications with an accepted status | ||
exports.getByAcceptedStatus = async function getByAcceptedStatus (currentStatus) { | ||
const query = "SELECT * FROM applications WHERE applicationStatus = 'accepted';"; | ||
const values = [applicationStatus]; | ||
const data = await db.run_query(query, values); | ||
return data; | ||
} | ||
|
||
// get all applications with a rejected status | ||
exports.getByStatusRejected = async function getByRejectedStatus (applicationStatus) { | ||
const query = "SELECT * FROM applications WHERE currentStatus = 'rejected';"; | ||
const values = [applicationStatus]; | ||
const data = await db.run_query(query, values); | ||
return data; | ||
} | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-controllers_auth.html">controllers/auth</a></li><li><a href="module-controllers_validation.html">controllers/validation</a></li><li><a href="module-helpers_database.html">helpers/database</a></li><li><a href="module-models_applications.html">models/applications</a></li><li><a href="module-models_users.html">models/users</a></li><li><a href="module-permissions_applications.html">permissions/applications</a></li><li><a href="module-permissions_users.html">permissions/users</a></li><li><a href="module-routes_applications.html">routes/applications</a></li><li><a href="module-routes_users.html">routes/users</a></li><li><a href="module-strategies_basic.html">strategies/basic</a></li></ul><h3>Classes</h3><ul><li><a href="module-helpers_database-DatabaseException.html">DatabaseException</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a> on Sun Nov 28 2021 19:50:25 GMT+0000 (GMT) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
Oops, something went wrong.