mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-17 10:11:31 +10:00
Update ESLint configuration and schemas to use Zod library
- Changed ESLint configuration to target TypeScript files and added parser options for better integration. - Updated various schemas across the application to replace `nestjs-zod/z` imports with `zod` for consistency. - Refactored password validation in authentication schemas to use `z.string()` instead of `z.password()`. - Enhanced date handling in user and resume schemas by introducing a new `dateSchema` utility. - Updated `.ncurc.json` to target minor upgrades for dependencies.
This commit is contained in:
@ -1,4 +1,10 @@
|
||||
import dayjs from "dayjs";
|
||||
import { z } from "zod";
|
||||
|
||||
export const dateSchema = z.union([z.date(), z.string().datetime()]).transform((value) => {
|
||||
if (typeof value === "string") return dayjs(value).toDate();
|
||||
return value;
|
||||
});
|
||||
|
||||
export const sortByDate = <T>(a: T, b: T, key: keyof T, desc = true) => {
|
||||
if (!a[key] || !b[key]) return 0;
|
||||
|
||||
Reference in New Issue
Block a user