Skip to content
Snippets Groups Projects
Commit e66c2c2f authored by Hamer Iboshi's avatar Hamer Iboshi
Browse files

Update the begining of my feature

parent f198f763
No related branches found
No related tags found
3 merge requests!116Release v1.0.0,!47School number count,!44Feature multiple where
Pipeline #
......@@ -210,6 +210,12 @@ class ReqQueryFields {
// Se o valor é um campo a ser incluído no SELECT
if(typeof field.field !== 'undefined' && field.field) {
log.debug('SELECT');
// if (Array.isArray(value.tableField)) {
// value.tableField.forEach((f, i) => {
// req.sql.field(value.table+'.'+f, value.resultField[i] || f)
// .group(value.table+'.'+f);
// })
// }
req.sql.field(value.table+'.'+value.tableField, value.resultField || value.tableField)
.group(value.table+'.'+value.tableField)
.order(value.table+'.'+value.tableField);
......@@ -218,6 +224,12 @@ class ReqQueryFields {
if(typeof field.where !== 'undefined' && field.where) {
log.debug('WHERE');
// Valor do where
//multiple where
// if (Array.isArray(value.tableField)){
//
// }
let whereValue = param[k];
// Valor sempre vem como string, necessário fazer parse para o banco
if(value.where.type === 'integer') whereValue = parseInt(whereValue, 10);
......
......@@ -487,6 +487,17 @@ rqfCount.addField({
type: 'boolean',
field: 'local_func_predio_escolar'
}
}).addValue({
name: 'library_and_reading_room',
table: 'escola',
tableField: ['biblioteca', 'sala_leitura', 'biblioteca_sala_leitura'],
resultField: 'library_and_reading_room',
where: {
relation: '=',
type: 'boolean',
condition: 'or',
field: 'local_func_predio_escolar'
}
});
schoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment