mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-13 19:29:54 +00:00
Merge pull request #4574 from Infisical/secret-update-request-fixes
fix(secret-change-requests): various UPDATE change request fixes
This commit is contained in:
@@ -16,8 +16,12 @@ export const stripUndefinedInWhere = <T extends object>(val: T): Exclude<T, unde
|
||||
// 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) => {
|
||||
export const setKnexStringValue = <T>(
|
||||
value: string | null | undefined,
|
||||
cb: (arg: string) => T,
|
||||
allowEmptyString?: boolean
|
||||
) => {
|
||||
if (typeof value === "undefined") return;
|
||||
if (value === "" || value === null) return null;
|
||||
if ((value === "" && !allowEmptyString) || value === null) return null;
|
||||
return cb(value);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user