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