@@ -111,7 +111,19 @@ async function getTeamDetail (currentUser, projects, isSearch = true) {
111
111
}
112
112
113
113
const usersPromises = [ ]
114
- _ . map ( rbs , ( rb ) => { usersPromises . push ( helper . getUserById ( currentUser . jwtToken , rb . userId ) ) } )
114
+ _ . map ( rbs , ( rb ) => {
115
+ usersPromises . push (
116
+ helper . getUserById ( currentUser . jwtToken , rb . userId )
117
+ . then ( user => {
118
+ // If call function is not search, add jobId field
119
+ if ( ! isSearch ) {
120
+ user . jobId = rb . jobId
121
+ user . customerRate = rb . customerRate
122
+ }
123
+ return user
124
+ } )
125
+ )
126
+ } )
115
127
const userInfos = await Promise . all ( usersPromises )
116
128
if ( userInfos && userInfos . length > 0 ) {
117
129
res . resources = userInfos
@@ -125,21 +137,6 @@ async function getTeamDetail (currentUser, projects, isSearch = true) {
125
137
if ( findMember && findMember . photoURL ) {
126
138
item . photo_url = findMember . photoURL
127
139
}
128
-
129
- if ( ! isSearch ) {
130
- // If call function is not search, add job field
131
- const findRbs = _ . find ( rbs , { userId : item . id } )
132
- if ( findRbs ) {
133
- item . customerRate = findRbs . customerRate
134
- const job = _ . find ( jobs , { id : findRbs . jobId } )
135
- if ( job ) {
136
- item . job = {
137
- id : job . id ,
138
- name : job . description
139
- }
140
- }
141
- }
142
- }
143
140
}
144
141
}
145
142
}
@@ -236,7 +233,8 @@ async function getTeamJob (currentUser, id, jobId) {
236
233
}
237
234
const result = {
238
235
id : job . id ,
239
- description : job . description
236
+ description : job . description ,
237
+ skills : job . skills
240
238
}
241
239
242
240
const jobSkills = job . skills
0 commit comments