From cf873b1a574c94655093838a60d02e2c43bca80e Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Sun, 15 Nov 2020 23:57:25 +0530 Subject: [PATCH] :recycle: Use colon instead of space in order-by pipe --- src/pipes/order-by.pipe.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipes/order-by.pipe.ts b/src/pipes/order-by.pipe.ts index 9fea8cf5c..461dbb7e3 100644 --- a/src/pipes/order-by.pipe.ts +++ b/src/pipes/order-by.pipe.ts @@ -19,7 +19,7 @@ export class OrderByPipe implements PipeTransform { const rules = value.split(',').map((val) => val.trim()); const orderBy: Record = {}; rules.forEach((rule) => { - const [key, order] = rule.split(' ') as [string, 'asc' | 'desc']; + const [key, order] = rule.split(':') as [string, 'asc' | 'desc']; if (!['asc', 'desc'].includes(order.toLocaleLowerCase())) throw new BadGatewayException(ORDER_BY_ASC_DESC); orderBy[key] = order.toLocaleLowerCase() as 'asc' | 'desc';