improvement: added types to ListTicketService

This commit is contained in:
canove
2020-09-24 14:15:06 -03:00
parent f6b5ed389a
commit e1db12d545

View File

@@ -1,4 +1,4 @@
import { Op, fn, where, col } from "sequelize"; import { Op, fn, where, col, Filterable, Includeable } from "sequelize";
import { startOfDay, endOfDay, parseISO } from "date-fns"; import { startOfDay, endOfDay, parseISO } from "date-fns";
import Ticket from "../../models/Ticket"; import Ticket from "../../models/Ticket";
@@ -28,8 +28,8 @@ const ListTicketsService = async ({
showAll, showAll,
userId userId
}: Request): Promise<Response> => { }: Request): Promise<Response> => {
let whereCondition = {}; let whereCondition: Filterable["where"];
let includeCondition = []; let includeCondition: Includeable[];
includeCondition = [ includeCondition = [
{ {
@@ -97,7 +97,7 @@ const ListTicketsService = async ({
whereCondition = { whereCondition = {
...whereCondition, ...whereCondition,
createdAt: { createdAt: {
[Op.between]: [startOfDay(parseISO(date)), endOfDay(parseISO(date))] [Op.between]: [+startOfDay(parseISO(date)), +endOfDay(parseISO(date))]
} }
}; };
} }