File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/routes/copilotRequest Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,11 @@ module.exports = [
3131 if ( _ . indexOf ( sortableProps , sort ) < 0 ) {
3232 return util . handleError ( 'Invalid sort criteria' , null , req , next ) ;
3333 }
34- const sortParams = sort . split ( ' ' ) ;
34+ let sortParams = sort . split ( ' ' ) ;
35+ let order = [ [ sortParams [ 0 ] , sortParams [ 1 ] ] ]
36+ if ( sortParams [ 0 ] === 'projectName' ) {
37+ order = [ [ { model : models . Project , as : 'project' } , 'name' , sortParams [ 1 ] ] ]
38+ }
3539
3640 const whereCondition = projectId ? { projectId } : { } ;
3741
@@ -41,7 +45,7 @@ module.exports = [
4145 { model : models . CopilotOpportunity , as : 'copilotOpportunity' , required : false } ,
4246 { model : models . Project , as : 'project' , required : false } ,
4347 ] ,
44- order : [ [ sortParams [ 0 ] , sortParams [ 1 ] ] ] ,
48+ order,
4549 limit : pageSize ,
4650 offset,
4751 distinct : true ,
You can’t perform that action at this time.
0 commit comments