feat: init multi server feature

This commit is contained in:
Mauricio Siu
2024-09-08 01:45:39 -06:00
parent 0b18f86a91
commit bd0bbdea26
37 changed files with 12476 additions and 212 deletions

View File

@@ -22,6 +22,8 @@ import superjson from "superjson";
import { ZodError } from "zod";
import { validateRequest } from "../auth/auth";
import { validateBearerToken } from "../auth/token";
import { findAdminByAuthId } from "./services/admin";
import { findUserByAuthId } from "./services/user";
/**
* 1. CONTEXT
@@ -32,7 +34,7 @@ import { validateBearerToken } from "../auth/token";
*/
interface CreateContextOptions {
user: (User & { authId: string }) | null;
user: (User & { authId: string; adminId: string }) | null;
session: Session | null;
req: CreateNextContextOptions["req"];
res: CreateNextContextOptions["res"];
@@ -86,6 +88,7 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => {
rol: user.rol,
id: user.id,
secret: user.secret,
adminId: user.adminId,
},
}) || {
user: null,