You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
692 B
20 lines
692 B
import { listDocuments, type AgentDocumentType } from "../../service/agent-document";
|
|
import { requireUser } from "#server/utils/context";
|
|
|
|
export default defineWrappedResponseHandler(async (event) => {
|
|
const user = await requireUser(event);
|
|
const query = getQuery(event);
|
|
const page = Math.max(1, parseInt(String(query.page || "1")));
|
|
const pageSize = Math.min(100, Math.max(1, parseInt(String(query.pageSize || "20"))));
|
|
const type = query.type as AgentDocumentType | undefined;
|
|
const keyword = query.keyword as string | undefined;
|
|
|
|
const result = await listDocuments({
|
|
userId: user.id,
|
|
type,
|
|
keyword,
|
|
page,
|
|
pageSize,
|
|
});
|
|
return R.success(result);
|
|
});
|
|
|