Skip to content

Commit b9b57ea

Browse files
Merge branch 'main' into feat/my-issues-and-project-members
2 parents 009ad97 + ee16a17 commit b9b57ea

File tree

7 files changed

+696
-319
lines changed

7 files changed

+696
-319
lines changed

customSchemas.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { z } from "zod";
2+
import { pino } from 'pino';
3+
const DEFAULT_NULL = process.env.DEFAULT_NULL === "true";
4+
5+
6+
const logger = pino({
7+
level: process.env.LOG_LEVEL || 'info',
8+
transport: {
9+
target: 'pino-pretty',
10+
options: {
11+
colorize: true,
12+
levelFirst: true,
13+
destination: 2,
14+
},
15+
},
16+
});
17+
18+
export const flexibleBoolean = z.preprocess((val) => {
19+
if (typeof val === 'string') {
20+
return val.toLowerCase() === 'true';
21+
}
22+
return val;
23+
}, z.boolean());
24+
25+
export const flexibleBooleanNullable = DEFAULT_NULL ? flexibleBoolean.nullable().default(null) : flexibleBoolean.nullable();

0 commit comments

Comments
 (0)