feat: testing v2 architecture changes and corrections as needed

This commit is contained in:
=
2024-07-30 23:19:06 +05:30
parent b7b0e60b1d
commit 4a06e3e712
13 changed files with 83 additions and 151 deletions
+9
View File
@@ -12,3 +12,12 @@ export const stripUndefinedInWhere = <T extends object>(val: T): Exclude<T, unde
});
return copy as Exclude<T, undefined>;
};
// if its undefined its skipped in knex
// if its empty string its set as null
// else pass to the required one
export const setKnexStringValue = <T>(value: string | null | undefined, cb: (arg: string) => T) => {
if (typeof value === "undefined") return;
if (value === "" || value === null) return null;
return cb(value);
};