mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 04:39:20 +00:00
improvement: added types to ListTicketService
This commit is contained in:
@@ -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))]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user