filter nodes by role

This commit is contained in:
liamcottle
2024-09-07 23:39:41 +12:00
parent 042b81b3bc
commit 816193dff6

View File

@ -116,11 +116,13 @@ app.get('/api/v1/nodes', async (req, res) => {
try { try {
// get query params // get query params
const role = req.query.role ? parseInt(req.query.role) : undefined;
const hardwareModel = req.query.hardware_model ? parseInt(req.query.hardware_model) : undefined; 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: { where: {
role: role,
hardware_model: hardwareModel, hardware_model: hardwareModel,
}, },
}); });