feat: add syncrhonize typsense command
This commit is contained in:
16
routes/api/query/sync.ts
Normal file
16
routes/api/query/sync.ts
Normal 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");
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user