feat: add syncrhonize typsense command
This commit is contained in:
parent
d8f7ac38f1
commit
eaa769f46e
74
fresh.gen.ts
74
fresh.gen.ts
@ -18,24 +18,25 @@ import * as $12 from "./routes/api/movies/[name].ts";
|
||||
import * as $13 from "./routes/api/movies/enhance/[name].ts";
|
||||
import * as $14 from "./routes/api/movies/index.ts";
|
||||
import * as $15 from "./routes/api/query/index.ts";
|
||||
import * as $16 from "./routes/api/recipes/[name].ts";
|
||||
import * as $17 from "./routes/api/recipes/index.ts";
|
||||
import * as $18 from "./routes/api/resources.ts";
|
||||
import * as $19 from "./routes/api/series/[name].ts";
|
||||
import * as $20 from "./routes/api/series/enhance/[name].ts";
|
||||
import * as $21 from "./routes/api/series/index.ts";
|
||||
import * as $22 from "./routes/api/tmdb/[id].ts";
|
||||
import * as $23 from "./routes/api/tmdb/credits/[id].ts";
|
||||
import * as $24 from "./routes/api/tmdb/query.ts";
|
||||
import * as $25 from "./routes/articles/[name].tsx";
|
||||
import * as $26 from "./routes/articles/index.tsx";
|
||||
import * as $27 from "./routes/index.tsx";
|
||||
import * as $28 from "./routes/movies/[name].tsx";
|
||||
import * as $29 from "./routes/movies/index.tsx";
|
||||
import * as $30 from "./routes/recipes/[name].tsx";
|
||||
import * as $31 from "./routes/recipes/index.tsx";
|
||||
import * as $32 from "./routes/series/[name].tsx";
|
||||
import * as $33 from "./routes/series/index.tsx";
|
||||
import * as $16 from "./routes/api/query/sync.ts";
|
||||
import * as $17 from "./routes/api/recipes/[name].ts";
|
||||
import * as $18 from "./routes/api/recipes/index.ts";
|
||||
import * as $19 from "./routes/api/resources.ts";
|
||||
import * as $20 from "./routes/api/series/[name].ts";
|
||||
import * as $21 from "./routes/api/series/enhance/[name].ts";
|
||||
import * as $22 from "./routes/api/series/index.ts";
|
||||
import * as $23 from "./routes/api/tmdb/[id].ts";
|
||||
import * as $24 from "./routes/api/tmdb/credits/[id].ts";
|
||||
import * as $25 from "./routes/api/tmdb/query.ts";
|
||||
import * as $26 from "./routes/articles/[name].tsx";
|
||||
import * as $27 from "./routes/articles/index.tsx";
|
||||
import * as $28 from "./routes/index.tsx";
|
||||
import * as $29 from "./routes/movies/[name].tsx";
|
||||
import * as $30 from "./routes/movies/index.tsx";
|
||||
import * as $31 from "./routes/recipes/[name].tsx";
|
||||
import * as $32 from "./routes/recipes/index.tsx";
|
||||
import * as $33 from "./routes/series/[name].tsx";
|
||||
import * as $34 from "./routes/series/index.tsx";
|
||||
import * as $$0 from "./islands/Counter.tsx";
|
||||
import * as $$1 from "./islands/IngredientsList.tsx";
|
||||
import * as $$2 from "./islands/KMenu.tsx";
|
||||
@ -66,24 +67,25 @@ const manifest = {
|
||||
"./routes/api/movies/enhance/[name].ts": $13,
|
||||
"./routes/api/movies/index.ts": $14,
|
||||
"./routes/api/query/index.ts": $15,
|
||||
"./routes/api/recipes/[name].ts": $16,
|
||||
"./routes/api/recipes/index.ts": $17,
|
||||
"./routes/api/resources.ts": $18,
|
||||
"./routes/api/series/[name].ts": $19,
|
||||
"./routes/api/series/enhance/[name].ts": $20,
|
||||
"./routes/api/series/index.ts": $21,
|
||||
"./routes/api/tmdb/[id].ts": $22,
|
||||
"./routes/api/tmdb/credits/[id].ts": $23,
|
||||
"./routes/api/tmdb/query.ts": $24,
|
||||
"./routes/articles/[name].tsx": $25,
|
||||
"./routes/articles/index.tsx": $26,
|
||||
"./routes/index.tsx": $27,
|
||||
"./routes/movies/[name].tsx": $28,
|
||||
"./routes/movies/index.tsx": $29,
|
||||
"./routes/recipes/[name].tsx": $30,
|
||||
"./routes/recipes/index.tsx": $31,
|
||||
"./routes/series/[name].tsx": $32,
|
||||
"./routes/series/index.tsx": $33,
|
||||
"./routes/api/query/sync.ts": $16,
|
||||
"./routes/api/recipes/[name].ts": $17,
|
||||
"./routes/api/recipes/index.ts": $18,
|
||||
"./routes/api/resources.ts": $19,
|
||||
"./routes/api/series/[name].ts": $20,
|
||||
"./routes/api/series/enhance/[name].ts": $21,
|
||||
"./routes/api/series/index.ts": $22,
|
||||
"./routes/api/tmdb/[id].ts": $23,
|
||||
"./routes/api/tmdb/credits/[id].ts": $24,
|
||||
"./routes/api/tmdb/query.ts": $25,
|
||||
"./routes/articles/[name].tsx": $26,
|
||||
"./routes/articles/index.tsx": $27,
|
||||
"./routes/index.tsx": $28,
|
||||
"./routes/movies/[name].tsx": $29,
|
||||
"./routes/movies/index.tsx": $30,
|
||||
"./routes/recipes/[name].tsx": $31,
|
||||
"./routes/recipes/index.tsx": $32,
|
||||
"./routes/series/[name].tsx": $33,
|
||||
"./routes/series/index.tsx": $34,
|
||||
},
|
||||
islands: {
|
||||
"./islands/Counter.tsx": $$0,
|
||||
|
@ -68,6 +68,18 @@ export const menus: Record<string, Menu> = {
|
||||
return !!getCookie("session_cookie");
|
||||
},
|
||||
},
|
||||
{
|
||||
title: "Sync Typesense",
|
||||
icon: "IconStarFilled",
|
||||
cb: () => {
|
||||
fetch("/api/query/sync", {
|
||||
method: "POST",
|
||||
});
|
||||
},
|
||||
visible: () => {
|
||||
return !!getCookie("session_cookie");
|
||||
},
|
||||
},
|
||||
addSeriesInfo,
|
||||
createNewArticle,
|
||||
createNewMovie,
|
||||
|
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");
|
||||
},
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user