Do not distribute
This commit is contained in:
parent
986dccfd90
commit
b856c62616
|
@ -3,7 +3,6 @@ import { Request, Response, Router } from 'express'
|
||||||
import { hasRolesMiddleware } from '../middlewares/hasRolesMiddleware.js'
|
import { hasRolesMiddleware } from '../middlewares/hasRolesMiddleware.js'
|
||||||
import { prisma } from '../prisma.js'
|
import { prisma } from '../prisma.js'
|
||||||
|
|
||||||
import { distributedCopy } from '../utils/distributedCopy.js'
|
|
||||||
import { PrinterStatusService } from '../services/PrinterStatusService.js'
|
import { PrinterStatusService } from '../services/PrinterStatusService.js'
|
||||||
import log from '../log.js'
|
import log from '../log.js'
|
||||||
|
|
||||||
|
@ -52,7 +51,7 @@ class PrinterController {
|
||||||
|
|
||||||
static async show(req: Request, res: Response) {
|
static async show(req: Request, res: Response) {
|
||||||
const { serialNumber } = req.params
|
const { serialNumber } = req.params
|
||||||
const { take = 32, days = 60 } = req.query
|
const { days = 60 } = req.query
|
||||||
|
|
||||||
const gte = new Date(Date.now() - 1000 * 60 * 60 * 24 * Number(days))
|
const gte = new Date(Date.now() - 1000 * 60 * 60 * 24 * Number(days))
|
||||||
|
|
||||||
|
@ -82,7 +81,7 @@ class PrinterController {
|
||||||
res.json({
|
res.json({
|
||||||
...printer,
|
...printer,
|
||||||
avgMonthPrint,
|
avgMonthPrint,
|
||||||
status: distributedCopy(printer.status, Number(take))
|
status: printer.status
|
||||||
})
|
})
|
||||||
} else res.status(400).json({ error: 'Printer not found' })
|
} else res.status(400).json({ error: 'Printer not found' })
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { Router, Request, Response } from 'express'
|
||||||
import { prisma } from '../prisma.js'
|
import { prisma } from '../prisma.js'
|
||||||
import { PrinterStatusService } from '../services/PrinterStatusService.js'
|
import { PrinterStatusService } from '../services/PrinterStatusService.js'
|
||||||
import { hasRolesMiddleware } from '../middlewares/hasRolesMiddleware.js'
|
import { hasRolesMiddleware } from '../middlewares/hasRolesMiddleware.js'
|
||||||
import { distributedCopy } from '../utils/distributedCopy.js'
|
|
||||||
|
|
||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
|
@ -20,7 +19,7 @@ class PrinterStatusController {
|
||||||
static async status(req: Request, res: Response) {
|
static async status(req: Request, res: Response) {
|
||||||
const { printerId } = req.params
|
const { printerId } = req.params
|
||||||
|
|
||||||
const { take = 32, days = 60 } = req.query
|
const { days = 60 } = req.query
|
||||||
|
|
||||||
const gte = new Date(Date.now() - 1000 * 60 * 60 * 24 * Number(days))
|
const gte = new Date(Date.now() - 1000 * 60 * 60 * 24 * Number(days))
|
||||||
|
|
||||||
|
@ -34,9 +33,7 @@ class PrinterStatusController {
|
||||||
orderBy: { timestamp: 'desc' }
|
orderBy: { timestamp: 'desc' }
|
||||||
})
|
})
|
||||||
|
|
||||||
const distributedStatus = distributedCopy(status, Number(take))
|
res.json(status)
|
||||||
|
|
||||||
res.json(distributedStatus)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user