Skip to content

Commit 8d15a8a

Browse files
committed
feat: added new ordering criteria to orders
'owner_email' 'owner_company' 'created' Change-Id: I54da4547bbd945e697ea12d7cc037e16545d4cb7
1 parent fec9f12 commit 8d15a8a

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitOrdersApiController.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ function () {
285285
'id',
286286
'number',
287287
'status',
288-
'owner_name'
288+
'owner_name',
289+
'owner_email',
290+
'owner_company',
291+
'created',
289292
];
290293
},
291294
function ($filter) use ($summit) {
@@ -344,6 +347,10 @@ function () {
344347
'id',
345348
'number',
346349
'status',
350+
'owner_name',
351+
'owner_email',
352+
'owner_company',
353+
'created',
347354
];
348355
},
349356
function ($filter) use ($summit) {
@@ -403,6 +410,10 @@ function () {
403410
'id',
404411
'number',
405412
'status',
413+
'owner_name',
414+
'owner_email',
415+
'owner_company',
416+
'created',
406417
];
407418
},
408419
function ($filter) use ($owner, $summit_id) {

app/Repositories/Summit/DoctrineSummitOrderRepository.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,17 @@ protected function getOrderMappings()
7878
'number' => 'e.number',
7979
'id' => 'e.id',
8080
'status' => 'e.status',
81-
/* 'owner_name' => <<<SQL
82-
CASE WHEN o IS NOT NULL THEN LOWER(CONCAT(o.first_name, ' ', o.last_name))
83-
ELSE LOWER(CONCAT(e.owner_first_name, ' ', e.owner_surname)) END
84-
SQL*/
85-
'owner_name' => <<<SQL
81+
'created' => 'e.created',
82+
'owner_name' => <<<SQL
8683
COALESCE(LOWER(CONCAT(o.first_name, ' ', o.last_name)), LOWER(CONCAT(e.owner_first_name, ' ', e.owner_surname)))
87-
SQL
84+
SQL,
85+
'owner_email' => <<<SQL
86+
COALESCE(LOWER(o.email), LOWER(e.owner_email))
87+
SQL,
88+
'owner_company' => <<<SQL
89+
COALESCE(LOWER(e.owner_company_name), LOWER(oc.name))
90+
SQL,
91+
8892
];
8993
}
9094

0 commit comments

Comments
 (0)