MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / post

Function post

pages/api/files/search.ts:17–39  ·  view source on GitHub ↗
({ request, user }: RequestHandlerParams)

Source from the content-addressed store, hash-verified

15}
16
17async function post({ request, user }: RequestHandlerParams) {
18 if (
19 !(await AppConfig.isAppEnabled('files')) && !(await AppConfig.isAppEnabled('photos')) &&
20 !(await AppConfig.isAppEnabled('notes'))
21 ) {
22 return new Response('Forbidden', { status: 403 });
23 }
24
25 const requestBody = await request.clone().json() as RequestBody;
26
27 if (!requestBody.searchTerm?.trim()) {
28 return new Response('Bad Request', { status: 400 });
29 }
30
31 const result = await searchFilesAndDirectories(
32 user!.id,
33 requestBody.searchTerm.trim(),
34 );
35
36 const responseBody: ResponseBody = { ...result };
37
38 return new Response(JSON.stringify(responseBody));
39}
40
41export default page({
42 post,

Callers

nothing calls this directly

Calls 3

isAppEnabledMethod · 0.80
cloneMethod · 0.80

Tested by

no test coverage detected