Fixed errors caught by linter
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine 2024-05-24 12:09:09 -04:00
parent 6d8965ada1
commit 93afda6d10
3 changed files with 13 additions and 13 deletions

View File

@ -8,7 +8,7 @@ const app = express();
const config = require('config');
// initialize database connection
const db = require('./src/models');
require('./src/models');
if (config.get('use_redis')) {
// initialize Redis store for session data

View File

@ -6,14 +6,14 @@ const { Op } = require('sequelize');
// GET - /search
exports.getSearch = async function(req, res) {
// decode URL search query
let query = req.query.query;
const query = req.query.query;
// fetch inventory items from database based on search query
const item_results = await Item.findAll({
const itemResults = await Item.findAll({
where: {
name: {
[Op.like]: '%' + query + '%',
}
},
},
limit: 10,
order: [
@ -22,11 +22,11 @@ exports.getSearch = async function(req, res) {
});
// fetch licenses from database based on search query
const license_results = await License.findAll({
const licenseResults = await License.findAll({
where: {
name: {
[Op.like]: '%' + query + '%',
}
},
},
limit: 10,
order: [
@ -36,7 +36,7 @@ exports.getSearch = async function(req, res) {
res.render('search.twig', {
query: query,
item_results: item_results,
license_results: license_results,
itemResults: itemResults,
licenseResults: licenseResults,
});
};

View File

@ -11,7 +11,7 @@
</div>
</header>
{% if item_results|length > 0 %}
{% if itemResults|length > 0 %}
<section id="search-results" class="row">
<div class="columns twelve">
<h3>Hardware components:</h3>
@ -24,7 +24,7 @@
</tr>
</thead>
<tbody>
{% for item in item_results %}
{% for item in itemResults %}
<tr>
<td><a href="/item/{{ item.id }}">{{ item.name }}</a></td>
<td>{{ item.type }}</td>
@ -37,7 +37,7 @@
</section>
{% endif %}
{% if license_results|length > 0 %}
{% if licenseResults|length > 0 %}
<section id="search-results" class="row">
<div class="columns twelve">
<h3>Software licenses:</h3>
@ -50,7 +50,7 @@
</tr>
</thead>
<tbody>
{% for license in license_results %}
{% for license in licenseResults %}
<tr>
<td><a href="/item/{{ license.id }}">{{ license.name }}</a></td>
<td>{{ license.manufacturer }}</td>