Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(api): improve query validation and update API URL structure

Andrej Acevskife306d831ed6
diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts
index 2d66dcbc4..2c67abf0c 100644
--- a/apps/api/src/index.ts
+++ b/apps/api/src/index.ts
@@ -90,8 +90,7 @@ api.get(
},
servers: [
{
- url:
- `${process.env.KANEO_API_URL}/api` || "http://localhost:1337/api",
+ url: process.env.KANEO_API_URL || "http://localhost:1337",
description: "Kaneo API Server",
},
],
diff --git a/apps/api/src/search/index.ts b/apps/api/src/search/index.ts
index be598100a..1f99d3dec 100644
--- a/apps/api/src/search/index.ts
+++ b/apps/api/src/search/index.ts
@@ -45,7 +45,10 @@ const search = new Hono<{
validator(
"query",
v.object({
- q: v.string([v.minLength(1)]),
+ q: v.pipe(
+ v.string(),
+ v.minLength(1, "Query must be at least 1 character"),
+ ),
type: v.optional(
v.picklist([
"all",
@@ -63,7 +66,7 @@ const search = new Hono<{
v.pipe(
v.string(),
v.transform(Number),
- v.number([v.minValue(1), v.maxValue(50)]),
+ v.minValue(1, "Limit must be at least 1"),
),
"20",
),