@@ -29,6 +29,14 @@ const PROJECT_ATTACHMENT_ATTRIBUTES = _.without(
29
29
_ . keys ( models . ProjectAttachment . rawAttributes ) ,
30
30
'deletedAt' ,
31
31
) ;
32
+ const PROJECT_PHASE_ATTRIBUTES = _ . without (
33
+ _ . keys ( models . ProjectPhase . rawAttributes ) ,
34
+ 'deletedAt' ,
35
+ ) ;
36
+ const PROJECT_PHASE_PRODUCTS_ATTRIBUTES = _ . without (
37
+ _ . keys ( models . PhaseProduct . rawAttributes ) ,
38
+ 'deletedAt' ,
39
+ ) ;
32
40
33
41
34
42
const escapeEsKeyword = keyword => keyword . replace ( / [ + - = > < ! | ( ) { } [ & \] ^ " ~ * ? : \\ / ] / g, '\\\\$&' ) ;
@@ -60,6 +68,14 @@ const parseElasticSearchCriteria = (criteria, fields, order) => {
60
68
const memberFields = _ . get ( fields , 'project_members' ) ;
61
69
sourceInclude = sourceInclude . concat ( _ . map ( memberFields , single => `members.${ single } ` ) ) ;
62
70
}
71
+ if ( _ . get ( fields , 'project_phases' , null ) ) {
72
+ const phaseFields = _ . get ( fields , 'project_phases' ) ;
73
+ sourceInclude = sourceInclude . concat ( _ . map ( phaseFields , single => `phases.${ single } ` ) ) ;
74
+ }
75
+ if ( _ . get ( fields , 'project_phases_products' , null ) ) {
76
+ const phaseFields = _ . get ( fields , 'project_phases_products' ) ;
77
+ sourceInclude = sourceInclude . concat ( _ . map ( phaseFields , single => `phases.products.${ single } ` ) ) ;
78
+ }
63
79
sourceInclude = sourceInclude . concat ( _ . map ( PROJECT_ATTACHMENT_ATTRIBUTES , single => `attachments.${ single } ` ) ) ;
64
80
65
81
if ( sourceInclude ) {
@@ -180,6 +196,8 @@ const retrieveProjects = (req, criteria, sort, ffields) => {
180
196
fields = util . parseFields ( fields , {
181
197
projects : PROJECT_ATTRIBUTES ,
182
198
project_members : PROJECT_MEMBER_ATTRIBUTES ,
199
+ project_phases : PROJECT_PHASE_ATTRIBUTES ,
200
+ project_phases_products : PROJECT_PHASE_PRODUCTS_ATTRIBUTES ,
183
201
} ) ;
184
202
// make sure project.id is part of fields
185
203
if ( _ . indexOf ( fields . projects , 'id' ) < 0 ) {
0 commit comments