filter nodes by hardware model

This commit is contained in:
liamcottle
2024-09-07 23:36:09 +12:00
parent 3532b25cd7
commit 042b81b3bc

View File

@ -115,8 +115,15 @@ app.get('/api', async (req, res) => {
app.get('/api/v1/nodes', async (req, res) => { app.get('/api/v1/nodes', async (req, res) => {
try { try {
// get query params
const hardwareModel = req.query.hardware_model ? parseInt(req.query.hardware_model) : undefined;
// get nodes from db // get nodes from db
const nodes = await prisma.node.findMany(); const nodes = await prisma.node.findMany({
where: {
hardware_model: hardwareModel,
},
});
const nodesWithInfo = []; const nodesWithInfo = [];
for(const node of nodes){ for(const node of nodes){