From cdef996ce852e58e5bc03abf9820cfe9c844b022 Mon Sep 17 00:00:00 2001 From: Julian Freeman Date: Mon, 1 Dec 2025 13:37:12 -0400 Subject: [PATCH] improve query necessary --- src/index.ts | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/index.ts b/src/index.ts index 53446b5..8257393 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,19 +29,9 @@ app.get("/api/v1/ext/query_all", (c) => { }); app.get("/api/v1/ext/query_necessary", (c) => { - // Python code fetches all columns then filters via Pydantic model. - // We can select just what we need or select all and map. - // Let's select all to be consistent with the 'all()' behavior if logic changes, - // but map to the response shape to respect the 'response_model'. - const query = db.query("SELECT * FROM extensions"); - const extensions = query.all() as ExtensionInDB[]; - - const necessary: ExtensionNecessary[] = extensions.map((ext) => ({ - ID: ext.ID, - SAFE: ext.SAFE, - })); - - return c.json(necessary); + const query = db.query("SELECT ID, SAFE FROM extensions"); + const extensions = query.all() as ExtensionNecessary[]; + return c.json(extensions); }); app.post("/api/v1/ext/add_one", async (c) => {