This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { z } from "zod"; | |
| export type ZodPrismaSelectInnerMapper<T extends z.ZodTypeAny> = | |
| T extends z.ZodObject<infer Shape> | |
| ? { | |
| select: { | |
| [K in keyof Shape]: ZodPrismaSelectInnerMapper<Shape[K]>; | |
| }; | |
| } | |
| : T extends z.ZodArray<infer Item> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { existsSync, readFileSync } from "fs"; | |
| import { join } from "path"; | |
| export const production = process.env.NODE_ENV === 'production'; | |
| const envMap: { | |
| [key: string]: Record<string, string> | |
| } = {}; | |
| function getEnv (dirname: string, maxIteration: number = 10, currentIteration: number = 0): Record<string, string> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { FastifyInstance, RouteOptions } from "fastify"; | |
| import { join } from "path"; | |
| import { walk } from "walk"; | |
| export async function registerRoutes(server: FastifyInstance, routesDir: string = 'routes') { | |
| return await new Promise((resolve) => { | |
| const path = join(`${__dirname}/${routesDir}`); | |
| const files: string[] = []; | |
| const walker = walk(path); | |
| walker.on('file', (root, { name }, next) => { |