diff --git a/src/controllers/PrinterController.ts b/src/controllers/PrinterController.ts index de0cca9..8ef9b6d 100644 --- a/src/controllers/PrinterController.ts +++ b/src/controllers/PrinterController.ts @@ -24,7 +24,13 @@ class PrinterController { shortName: String(campus) } }, - include: { network: true } + include: { + network: true, + status: { + orderBy: { timestamp: 'desc' }, + take: 1 + } + } }) return res.json(printers) @@ -32,7 +38,7 @@ class PrinterController { static async show(req: Request, res: Response) { const { id } = req.params - const { take = 64, days = 60 } = req.query + const { take = 32, days = 60 } = req.query const gte = new Date(Date.now() - 1000 * 60 * 60 * 24 * Number(days)) diff --git a/src/server.ts b/src/server.ts index 392611c..72c9dd5 100644 --- a/src/server.ts +++ b/src/server.ts @@ -14,12 +14,11 @@ import PrinterDiscoveryRouter from './controllers/PrinterDiscoveryController.js' export const app = express() app.use(cors()) +app.use(populateUserMiddleware) app.use(loggerMiddleware) app.use('/api', bodyParser.json()) -app.use('/api', populateUserMiddleware) - app.use('/api/login', LoginRouter) app.use('/api/printer', PrinterRouter) app.use('/api/printer-status', PrinterStatusRouter) diff --git a/web/public/img/ECOSYS M2040dn.png b/web/public/img/ECOSYS M2040dn.png index 9621a42..5d3a73f 100644 Binary files a/web/public/img/ECOSYS M2040dn.png and b/web/public/img/ECOSYS M2040dn.png differ diff --git a/web/public/img/ECOSYS M3655idn.png b/web/public/img/ECOSYS M3655idn.png index e364070..16e80f6 100644 Binary files a/web/public/img/ECOSYS M3655idn.png and b/web/public/img/ECOSYS M3655idn.png differ diff --git a/web/public/img/ECOSYS P6235cdn.png b/web/public/img/ECOSYS P6235cdn.png index aae09bd..6491e4c 100644 Binary files a/web/public/img/ECOSYS P6235cdn.png and b/web/public/img/ECOSYS P6235cdn.png differ diff --git a/web/src/App.vue b/web/src/App.vue index 949148a..0218a93 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -5,9 +5,10 @@ +./store/appStore diff --git a/web/src/components/PrinterCard.vue b/web/src/components/PrinterCard.vue index e21eb1f..c3bafdc 100644 --- a/web/src/components/PrinterCard.vue +++ b/web/src/components/PrinterCard.vue @@ -1,18 +1,95 @@ + + diff --git a/web/src/components/PrinterImg.vue b/web/src/components/PrinterImg.vue index 5bf96ac..e775d6f 100644 --- a/web/src/components/PrinterImg.vue +++ b/web/src/components/PrinterImg.vue @@ -1,16 +1,16 @@ diff --git a/web/src/layouts/default/View.vue b/web/src/layouts/default/View.vue index 167a6be..76cf4b8 100644 --- a/web/src/layouts/default/View.vue +++ b/web/src/layouts/default/View.vue @@ -44,7 +44,7 @@ +@/store/appStore diff --git a/web/src/store/app.ts b/web/src/store/appStore.ts similarity index 92% rename from web/src/store/app.ts rename to web/src/store/appStore.ts index ab938a3..fe546ba 100644 --- a/web/src/store/app.ts +++ b/web/src/store/appStore.ts @@ -2,14 +2,14 @@ import { defineStore } from 'pinia' import { api } from '@/api' import { useRouter } from 'vue-router' -import { Printer, User } from '@prisma/client' +import type { Printer, User, Network } from '@prisma/client' const router = useRouter() export const useAppStore = defineStore('app', { state: () => ({ me: null as User | null, - printers: [] as Printer[], + printers: [] as any[], printerFilter: '', onlyMyCampus: true, loadingPrinters: false @@ -19,7 +19,7 @@ export const useAppStore = defineStore('app', { async fetchPrinters() { this.loadingPrinters = true try { - this.printers = await api( + this.printers = await api( `printer?${new URLSearchParams({ campus: this.onlyMyCampus ? this.me?.campus || '' : '' })}`, diff --git a/web/src/views/Home.vue b/web/src/views/Home.vue index e7e787a..c005b9e 100644 --- a/web/src/views/Home.vue +++ b/web/src/views/Home.vue @@ -1,13 +1,7 @@ +@/store/appStore