feat: add util function to include or not include condition

This commit is contained in:
Methapon Metanipat 2024-10-24 17:48:54 +07:00
parent 85b99bf0a1
commit b0bd401f25

View file

@ -27,3 +27,7 @@ export function whereAddressQuery(query: string) {
{ subDistrict: { zipCode: { contains: query } } },
];
}
export function queryOrNot<T>(query: string, where: T): T | undefined {
return !!query ? where : undefined;
}