fix: tRPC router type adjustments (celulares, red)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
|
import { TipoDispositivo } from '@prisma/client'
|
||||||
import { router, protectedProcedure, adminProcedure } from '../trpc'
|
import { router, protectedProcedure, adminProcedure } from '../trpc'
|
||||||
import { HeadwindClient } from '@/server/services/headwind/client'
|
import { HeadwindClient } from '@/server/services/headwind/client'
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ export const celularesRouter = router({
|
|||||||
const { clienteId, estado, search, page = 1, limit = 20 } = input || {}
|
const { clienteId, estado, search, page = 1, limit = 20 } = input || {}
|
||||||
|
|
||||||
const where = {
|
const where = {
|
||||||
tipo: { in: ['CELULAR', 'TABLET'] as const },
|
tipo: { in: ['CELULAR', 'TABLET'] as TipoDispositivo[] },
|
||||||
...(ctx.user.clienteId ? { clienteId: ctx.user.clienteId } : {}),
|
...(ctx.user.clienteId ? { clienteId: ctx.user.clienteId } : {}),
|
||||||
...(clienteId ? { clienteId } : {}),
|
...(clienteId ? { clienteId } : {}),
|
||||||
...(estado ? { estado } : {}),
|
...(estado ? { estado } : {}),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import { TRPCError } from '@trpc/server'
|
import { TRPCError } from '@trpc/server'
|
||||||
|
import { TipoDispositivo } from '@prisma/client'
|
||||||
import { router, protectedProcedure } from '../trpc'
|
import { router, protectedProcedure } from '../trpc'
|
||||||
import { LibreNMSClient } from '@/server/services/librenms/client'
|
import { LibreNMSClient } from '@/server/services/librenms/client'
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ export const redRouter = router({
|
|||||||
.query(async ({ ctx, input }) => {
|
.query(async ({ ctx, input }) => {
|
||||||
const { clienteId, tipo, estado, search, page = 1, limit = 20 } = input || {}
|
const { clienteId, tipo, estado, search, page = 1, limit = 20 } = input || {}
|
||||||
|
|
||||||
const tiposRed = ['ROUTER', 'SWITCH', 'FIREWALL', 'AP', 'IMPRESORA', 'OTRO'] as const
|
const tiposRed: TipoDispositivo[] = ['ROUTER', 'SWITCH', 'FIREWALL', 'AP', 'IMPRESORA', 'OTRO']
|
||||||
|
|
||||||
const where = {
|
const where = {
|
||||||
tipo: tipo ? { equals: tipo } : { in: tiposRed },
|
tipo: tipo ? { equals: tipo } : { in: tiposRed },
|
||||||
@@ -289,7 +290,7 @@ export const redRouter = router({
|
|||||||
const clienteId = ctx.user.clienteId || input.clienteId
|
const clienteId = ctx.user.clienteId || input.clienteId
|
||||||
|
|
||||||
const where = {
|
const where = {
|
||||||
tipo: { in: ['ROUTER', 'SWITCH', 'FIREWALL', 'AP', 'IMPRESORA', 'OTRO'] as const },
|
tipo: { in: ['ROUTER', 'SWITCH', 'FIREWALL', 'AP', 'IMPRESORA', 'OTRO'] as TipoDispositivo[] },
|
||||||
...(clienteId ? { clienteId } : {}),
|
...(clienteId ? { clienteId } : {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user