Fix report filters and zod resolver
This commit is contained in:
parent
5b22065609
commit
06fdb54480
12 changed files with 79 additions and 26 deletions
|
|
@ -1422,6 +1422,8 @@ export async function ticketsByMachineAndCategoryHandler(
|
|||
companyId,
|
||||
machineId,
|
||||
userId,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
}: {
|
||||
tenantId: string
|
||||
viewerId: Id<"users">
|
||||
|
|
@ -1429,10 +1431,12 @@ export async function ticketsByMachineAndCategoryHandler(
|
|||
companyId?: Id<"companies">
|
||||
machineId?: Id<"machines">
|
||||
userId?: Id<"users">
|
||||
dateFrom?: string
|
||||
dateTo?: string
|
||||
}
|
||||
) {
|
||||
const viewer = await requireStaff(ctx, viewerId, tenantId)
|
||||
const { startMs, endMs, days } = resolveRangeWindow(range, undefined, undefined, 90)
|
||||
const { startMs, endMs, days } = resolveRangeWindow(range, dateFrom, dateTo, 90)
|
||||
|
||||
const tickets =
|
||||
days === 0
|
||||
|
|
@ -1584,6 +1588,8 @@ export async function hoursByMachineHandler(
|
|||
companyId,
|
||||
machineId,
|
||||
userId,
|
||||
dateFrom,
|
||||
dateTo,
|
||||
}: {
|
||||
tenantId: string
|
||||
viewerId: Id<"users">
|
||||
|
|
@ -1591,12 +1597,14 @@ export async function hoursByMachineHandler(
|
|||
companyId?: Id<"companies">
|
||||
machineId?: Id<"machines">
|
||||
userId?: Id<"users">
|
||||
dateFrom?: string
|
||||
dateTo?: string
|
||||
}
|
||||
) {
|
||||
const viewer = await requireStaff(ctx, viewerId, tenantId)
|
||||
const tickets = await fetchScopedTickets(ctx, tenantId, viewer)
|
||||
|
||||
const { startMs, endMs, days } = resolveRangeWindow(range, undefined, undefined, 90)
|
||||
const { startMs, endMs, days } = resolveRangeWindow(range, dateFrom, dateTo, 90)
|
||||
|
||||
const machinesById = new Map<string, Doc<"machines"> | null>()
|
||||
const companiesById = new Map<string, Doc<"companies"> | null>()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue