Explorar el Código

Fix database value conversion

Pitu hace 6 años
padre
commit
c074b5e197
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      src/api/structures/Route.js

+ 2 - 1
src/api/structures/Route.js

@@ -25,7 +25,8 @@ const db = require('knex')({
 		const processResponse = row => {
 			Object.keys(row).forEach(key => {
 				if (booleanFields.includes(key)) {
-					row[key] = row[key] === 1 ? true : false;
+					if (row[key] === 0) row[key] = false;
+					else if (row[key] === 1) row[key] = true;
 				}
 			});
 			return row;