This file contains 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
export function Log(caller = "Router", ...logs) { | |
console.log( | |
`%c Notify.me %c ${caller} `, | |
"background: #a36ad8; color: #e8e8e8; border-radius: 3px 0 0 3px;", | |
"background: #6e4693; color: #e8e8e8; border-radius: 0 3px 3px 0;", | |
...logs | |
); | |
} |
This file contains 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) => { |
This file contains 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> |