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)",
 | 
					      // 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)',
 | 
					      // deluge: '(select status from deluge_torrent where id is request.id and type is request.type limit 1)',
 | 
				
			||||||
      // fetchAllFilterStatus: 'select * from request where '
 | 
					      // 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 ?"
 | 
					      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
 | 
					    return this.database
 | 
				
			||||||
      .get(this.queries.readWithoutUserData, [id, type])
 | 
					      .get(this.queries.readWithoutUserData, [id, type])
 | 
				
			||||||
      .then(row => {
 | 
					      .then(row => {
 | 
				
			||||||
        if (!row) return null;
 | 
					        if (!row) return Promise.resolve(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return {
 | 
					        return Promise.resolve({
 | 
				
			||||||
          id: row.id,
 | 
					          id: row.id,
 | 
				
			||||||
          title: row.title,
 | 
					          title: row.title,
 | 
				
			||||||
          year: row.year,
 | 
					          year: row.year,
 | 
				
			||||||
          type: row.type,
 | 
					          type: row.type,
 | 
				
			||||||
          status: row.status,
 | 
					          status: row.status,
 | 
				
			||||||
          requested_date: new Date(row.date)
 | 
					          requested_date: new Date(row.date)
 | 
				
			||||||
        };
 | 
					        });
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ function fetchAllRequests(req, res) {
 | 
				
			|||||||
  const { id } = req.params;
 | 
					  const { id } = req.params;
 | 
				
			||||||
  const { type } = req.query;
 | 
					  const { type } = req.query;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  request
 | 
					  return request
 | 
				
			||||||
    .getRequestByIdAndType(id, type)
 | 
					    .getRequestByIdAndType(id, type)
 | 
				
			||||||
    .then(result => {
 | 
					    .then(result => {
 | 
				
			||||||
      if (!result) {
 | 
					      if (!result) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user