Content Manager: Added Documentation, Implemented functional approach to the HTML table generation and refactored API codes, Using DOM purifier to prevent XSS

This commit is contained in:
2024-11-29 01:40:44 +09:00
parent 234b93d711
commit 3ddcf5fa5e
45 changed files with 16953 additions and 70 deletions

View File

@@ -0,0 +1,506 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Module: utils/asyncDatabase</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">Module: utils/asyncDatabase</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="~asyncDatabaseRead"><span class="type-signature">(inner) </span>asyncDatabaseRead<span class="signature">(database, sqlQuery, callback)</span><span class="type-signature"> &rarr; {Promise.&lt;any>}</span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>database</code></td>
<td class="type">
<span class="param-type">sqlite3.Database</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>sqlQuery</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>function (rows)</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_asyncDatabase.js.html">utils/asyncDatabase.js</a>, <a href="utils_asyncDatabase.js.html#line16">line 16</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise for database operation</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;any></span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>const result = await asyncDatabaseRead(userDatabase, `SELECT * FROM users`, (rows) => {
return wrapInTable(rows);
});</code></pre>
<h4 class="name" id="~asyncDatabaseWrite"><span class="type-signature">(inner) </span>asyncDatabaseWrite<span class="signature">(database, sqlQuery, callback)</span><span class="type-signature"> &rarr; {Promise.&lt;any>}</span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>database</code></td>
<td class="type">
<span class="param-type">sqlite3.Database</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>sqlQuery</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>callback</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last"><p>function ()</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="utils_asyncDatabase.js.html">utils/asyncDatabase.js</a>, <a href="utils_asyncDatabase.js.html#line41">line 41</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Promise for database operation</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Promise.&lt;any></span>
</dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>let sqlQuery = `INSERT INTO users (id, name, age) VALUES (${genID()}, "${userName}", "${userAge}");`;
await asyncDatabaseWrite(userDatabase, sqlQuery, () => {
console.log("Added User ", userName);
});</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-api_gallery-image.html">api/gallery-image</a></li><li><a href="module-api_news.html">api/news</a></li><li><a href="module-utils_asyncDatabase.html">utils/asyncDatabase</a></li><li><a href="module-utils_tableWrapper.html">utils/tableWrapper</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Tue Nov 26 2024 23:18:12 GMT+0900 (日本標準時)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>