File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -53,8 +53,7 @@ function QueryBuilder() {
53
53
. map ( ( name ) => name . replace ( `${ association . as } .` , '' ) )
54
54
. filter ( ( fieldName ) => targetFields . includes ( fieldName ) ) ;
55
55
56
- if ( ! fieldNamesRequested
57
- || fieldNamesRequested . includes ( association . as )
56
+ if ( fieldNamesRequested ?. includes ( association . as )
58
57
|| explicitAttributes . length ) {
59
58
// NOTICE: For performance reasons, we only request the keys
60
59
// as they're the only needed fields for the interface
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ class QueryOptions {
74
74
get _sequelizeInclude ( ) {
75
75
const fields = [ ...this . _requestedFields , ...this . _requestedRelations , ...this . _neededFields ] ;
76
76
const include = [
77
- ...new QueryBuilder ( ) . getIncludes ( this . _model , fields . length ? fields : null ) ,
77
+ ...new QueryBuilder ( ) . getIncludes ( this . _model , fields ) ,
78
78
...this . _customerIncludes ,
79
79
] ;
80
80
@@ -83,7 +83,7 @@ class QueryOptions {
83
83
84
84
/** Compute sequelize query `.order` property */
85
85
get _sequelizeOrder ( ) {
86
- if ( isMSSQL ( this . _model . sequelize ) && this . _sequelizeInclude ?. length ) {
86
+ if ( isMSSQL ( this . _model . sequelize ) ) {
87
87
// Work around sequelize bug: https://github.com/sequelize/sequelize/issues/11258
88
88
const primaryKeys = Object . keys ( this . _model . primaryKeys ) ;
89
89
return this . _order . filter ( ( order ) => ! primaryKeys . includes ( order [ 0 ] ) ) ;
Original file line number Diff line number Diff line change @@ -59,7 +59,10 @@ class ResourcesGetter {
59
59
const scopeFilters = await scopeManager . getScopeForUser ( this . _user , this . _model . name , true ) ;
60
60
61
61
const requestedFields = extractRequestedFields ( fields , this . _model , Schemas . schemas ) ;
62
- const queryOptions = new QueryOptions ( this . _model , { tableAlias } ) ;
62
+ const queryOptions = new QueryOptions ( this . _model , {
63
+ tableAlias,
64
+ includeRelations : searchExtended ,
65
+ } ) ;
63
66
if ( ! forCount ) await queryOptions . requireFields ( requestedFields ) ;
64
67
await queryOptions . search ( search , searchExtended ) ;
65
68
await queryOptions . filterByConditionTree ( filters , timezone ) ;
You can’t perform that action at this time.
0 commit comments