refactor(dock door scanning): fixes and final writes for the intial trial went smooth
This commit is contained in:
20
backend/dockdoorScanning/dockdoor.socket.seed.ts
Normal file
20
backend/dockdoorScanning/dockdoor.socket.seed.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { db } from "../db/db.controller.js";
|
||||
|
||||
export const getRecentDockScans = ({
|
||||
loadingOrder,
|
||||
limit = 200,
|
||||
}: {
|
||||
loadingOrder: string;
|
||||
limit?: number | undefined;
|
||||
}) => {
|
||||
return db.query.dockDoorScans.findMany({
|
||||
//where: (scans, { eq }) => eq(scans.status, "active"),
|
||||
where: (scans, { and, eq }) =>
|
||||
and(
|
||||
eq(scans.status, "active"),
|
||||
loadingOrder ? eq(scans.loadingOrder, loadingOrder) : undefined,
|
||||
),
|
||||
orderBy: (scans, { desc }) => [desc(scans.upd_date)],
|
||||
limit,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user