* trpc procedures an middleware refactor * allow use sessionMiddleware without a req object * sync with the new tRPC structure * tRPC refactor on routing form app * import Prisma from @prisma/client * Lazy load apps from appstore * remove unrelated changes * Add types for PaymentService * type fixes * Merge branch 'main' into roae85/cal-1514-set-the-user-session-only-on-the * fix typo * remove console.log * remove explicit types from apstore object * linter fixes --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
28 lines
879 B
TypeScript
28 lines
879 B
TypeScript
import { authedAdminProcedure } from "../../../procedures/authedProcedure";
|
|
import { router } from "../../../trpc";
|
|
import { ZUpdateInputSchema } from "./update.schema";
|
|
|
|
type DeploymentSetupRouterHandlerCache = {
|
|
update?: typeof import("./update.handler").updateHandler;
|
|
};
|
|
|
|
const UNSTABLE_HANDLER_CACHE: DeploymentSetupRouterHandlerCache = {};
|
|
|
|
export const deploymentSetupRouter = router({
|
|
update: authedAdminProcedure.input(ZUpdateInputSchema).mutation(async ({ input, ctx }) => {
|
|
if (!UNSTABLE_HANDLER_CACHE.update) {
|
|
UNSTABLE_HANDLER_CACHE.update = await import("./update.handler").then((mod) => mod.updateHandler);
|
|
}
|
|
|
|
// Unreachable code but required for type safety
|
|
if (!UNSTABLE_HANDLER_CACHE.update) {
|
|
throw new Error("Failed to load handler");
|
|
}
|
|
|
|
return UNSTABLE_HANDLER_CACHE.update({
|
|
ctx,
|
|
input,
|
|
});
|
|
}),
|
|
});
|