feat: add syncrhonize typsense command

This commit is contained in:
2023-08-10 19:39:10 +02:00
parent d8f7ac38f1
commit eaa769f46e
3 changed files with 66 additions and 36 deletions

16
routes/api/query/sync.ts Normal file
View File

@ -0,0 +1,16 @@
import { AccessDeniedError } from "@lib/errors.ts";
import { Handlers } from "$fresh/server.ts";
import { synchronize } from "@lib/typesense.ts";
export const handler: Handlers = {
POST(_, ctx) {
const session = ctx.state.session;
if (!session) {
throw new AccessDeniedError();
}
synchronize();
return new Response("OK");
},
};