Resolved exception where readWithoutUserData was not defined #145
| @@ -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) | ||||
|         }; | ||||
|         }); | ||||
|       }); | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user