Resolved exception where readWithoutUserData was not defined (#145)

This commit is contained in:
2022-09-25 13:39:23 +02:00
committed by GitHub
parent 6732ed988d
commit 2b6ad301a8
2 changed files with 6 additions and 5 deletions

View File

@@ -33,7 +33,8 @@ class RequestRepository {
// downloaded: "(select status from requests where id is request.id and type is request.type limit 1)",
// deluge: '(select status from deluge_torrent where id is request.id and type is request.type limit 1)',
// fetchAllFilterStatus: 'select * from request where '
// readWithoutUserData: "select id, title, year, type, status, date from requests where id is ? and type is ?",
readWithoutUserData:
"select id, title, year, type, status, date from requests where id is ? and type is ?",
read: "select id, title, year, type, status, requested_by, ip, date, user_agent from requests where id is ? and type is ?"
};
}
@@ -83,16 +84,16 @@ class RequestRepository {
return this.database
.get(this.queries.readWithoutUserData, [id, type])
.then(row => {
if (!row) return null;
if (!row) return Promise.resolve(null);
return {
return Promise.resolve({
id: row.id,
title: row.title,
year: row.year,
type: row.type,
status: row.status,
requested_date: new Date(row.date)
};
});
});
}

View File

@@ -12,7 +12,7 @@ function fetchAllRequests(req, res) {
const { id } = req.params;
const { type } = req.query;
request
return request
.getRequestByIdAndType(id, type)
.then(result => {
if (!result) {