Skip to content

Commit 365d510

Browse files
(#200) correcao findAll
1 parent 102a0ab commit 365d510

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/rotina/rotina.service.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ import { InjectRepository } from '@nestjs/typeorm';
33
import { Repository } from 'typeorm';
44
import { Ordering } from '../shared/decorators/ordenate.decorator';
55
import { Pagination } from '../shared/decorators/paginate.decorator';
6-
import {
7-
getWhereClauseBoolean,
8-
getWhereClauseNumber,
9-
} from '../shared/helpers/sql-query-helper';
6+
import { getWhereClauseNumber } from '../shared/helpers/sql-query-helper';
107
import { ResponsePaginate } from '../shared/interfaces/response-paginate.interface';
118
import { CreateRotinaDto } from './dto/create-rotina.dto';
129
import { UpdateRotinaDto } from './dto/update-rotina.dto';
@@ -70,7 +67,6 @@ export class RotinaService {
7067

7168
whereClause += getWhereClauseNumber(filter.id, 'id');
7269
whereClause += getWhereClauseNumber(filter.idIdoso, '"idIdoso"');
73-
whereClause += getWhereClauseBoolean(filter.notificacao, '"notificacao"');
7470
whereClause += this.getWhereClauseDate(filter.dataHora);
7571

7672
return whereClause;
@@ -114,7 +110,7 @@ export class RotinaService {
114110
return this._repository
115111
.createQueryBuilder('rotinas')
116112
.where(
117-
`(("dataHora"::date BETWEEN '${startString}'::date AND '${endString}'::date) OR (dias && '{${weekday}}'::rotina_dias_enum[])) AND lpad(date_part('hour', "dataHora")::text, 2, '0') || ':' || lpad(date_part('minute', "dataHora")::text, 2, '0') = '${time}'`,
113+
`"notificacao" = ${true} AND (("dataHora"::date BETWEEN '${startString}'::date AND '${endString}'::date) OR (dias && '{${weekday}}'::rotina_dias_enum[])) AND lpad(date_part('hour', "dataHora")::text, 2, '0') || ':' || lpad(date_part('minute', "dataHora")::text, 2, '0') = '${time}'`,
118114
)
119115
.getMany();
120116
}

0 commit comments

Comments
 (0)