From e6b083fb7441ebdf65230517509af3c55c0c808c Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Fri, 06 Jun 2025 17:03:02 +0000
Subject: [PATCH] GS-2147

---
 app.js |   37 +++++++++++++++++++------------------
 1 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/app.js b/app.js
index 7b99446..92b42ee 100644
--- a/app.js
+++ b/app.js
@@ -32,11 +32,28 @@
    }
 })
 
+/////// SEARCH ////////////////////////////////////////////////////////////////
+
+const searchLib = require("./lib/search")
+searchLib.doIndex().catch(console.error)
+fastify.get("/api/search/user", async function (req, res) {
+   console.log(req.query)
+   const search = req.query?.search
+   if (!search) {
+      return res.code(422).send({status: "error", msg: "no search"})
+   }
+   else {
+      console.log(search)
+      const data = await searchLib.search(search)
+      return res.send(data)
+   }
+})
+
 fastify
    /////// USER ////////////////////////////////////////////////////////////////
    .get('/api/users', async function (req, res) {
-      const {offset, limit} = req.query
-      const users = await db.getUsers(offset, limit)
+      const {offset, limit, search} = req.query
+      const users = await db.getUsers(offset, limit, search)
       return res.send(users)
    })
    .get("/api/users/count", async function (req, res) {
@@ -156,22 +173,6 @@
       }
    })
 
-/////// SEARCH ////////////////////////////////////////////////////////////////
-
-const searchLib = require("./lib/search")
-searchLib.doIndex().catch(console.error)
-fastify.get("/api/search/user", async function (req, res) {
-   console.log(req.query)
-   const search = req.query?.search
-   if (!search) {
-      return res.code(422).send({status: "error", msg: "no search"})
-   }
-   else {
-      console.log(search)
-      const data = await searchLib.search(search)
-      return res.send(data)
-   }
-})
 
 /////// STATIC ////////////////////////////////////////////////////////////////
 

--
Gitblit v1.8.0