first commit
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import type { Context } from "@wrnexus/core";
|
||||
|
||||
const teams = [
|
||||
{
|
||||
value: "design",
|
||||
label: "Design",
|
||||
description: "Product and visual design",
|
||||
icon: "icon-[lucide--palette]",
|
||||
},
|
||||
{
|
||||
value: "engineering",
|
||||
label: "Engineering",
|
||||
description: "Platform and application engineering",
|
||||
icon: "icon-[lucide--code-2]",
|
||||
},
|
||||
{
|
||||
value: "growth",
|
||||
label: "Growth",
|
||||
description: "Marketing and customer growth",
|
||||
icon: "icon-[lucide--trending-up]",
|
||||
},
|
||||
{
|
||||
value: "support",
|
||||
label: "Support",
|
||||
description: "Customer operations",
|
||||
icon: "icon-[lucide--life-buoy]",
|
||||
},
|
||||
];
|
||||
|
||||
export const GET = async (ctx: Context) => {
|
||||
const query = (ctx.url.searchParams.get("q") ?? "").trim().toLowerCase();
|
||||
const page = Math.max(1, Number(ctx.url.searchParams.get("page") ?? 1));
|
||||
const pageSize = 2;
|
||||
const matches = teams.filter((team) =>
|
||||
`${team.label} ${team.description}`.toLowerCase().includes(query),
|
||||
);
|
||||
const start = (page - 1) * pageSize;
|
||||
|
||||
return Response.json({
|
||||
items: matches.slice(start, start + pageSize),
|
||||
hasMore: start + pageSize < matches.length,
|
||||
page,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user