diff --git a/src/utils/relation.ts b/src/utils/relation.ts index b5ac523..fde2c6d 100644 --- a/src/utils/relation.ts +++ b/src/utils/relation.ts @@ -27,3 +27,7 @@ export function whereAddressQuery(query: string) { { subDistrict: { zipCode: { contains: query } } }, ]; } + +export function queryOrNot(query: string, where: T): T | undefined { + return !!query ? where : undefined; +}