Skip to content

Commit

Permalink
(#200) correcao findAll
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriqueAmorim20 committed Dec 5, 2023
1 parent 102a0ab commit 365d510
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/rotina/rotina.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { Ordering } from '../shared/decorators/ordenate.decorator';
import { Pagination } from '../shared/decorators/paginate.decorator';
import {
getWhereClauseBoolean,
getWhereClauseNumber,
} from '../shared/helpers/sql-query-helper';
import { getWhereClauseNumber } from '../shared/helpers/sql-query-helper';
import { ResponsePaginate } from '../shared/interfaces/response-paginate.interface';
import { CreateRotinaDto } from './dto/create-rotina.dto';
import { UpdateRotinaDto } from './dto/update-rotina.dto';
Expand Down Expand Up @@ -70,7 +67,6 @@ export class RotinaService {

whereClause += getWhereClauseNumber(filter.id, 'id');
whereClause += getWhereClauseNumber(filter.idIdoso, '"idIdoso"');
whereClause += getWhereClauseBoolean(filter.notificacao, '"notificacao"');
whereClause += this.getWhereClauseDate(filter.dataHora);

return whereClause;
Expand Down Expand Up @@ -114,7 +110,7 @@ export class RotinaService {
return this._repository
.createQueryBuilder('rotinas')
.where(
`(("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}'`,
`"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}'`,
)
.getMany();
}
Expand Down

0 comments on commit 365d510

Please sign in to comment.