Skip to content

Commit 57a8044

Browse files
committed
fix: return "JobCandidate.id" for team jobs
ref issue #25
1 parent d426d0a commit 57a8044

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

docs/swagger.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2110,6 +2110,14 @@ components:
21102110
- $ref: '#/components/schemas/User'
21112111
type: object
21122112
properties:
2113+
id:
2114+
type: string
2115+
format: uuid
2116+
description: "The job cadidate id."
2117+
userId:
2118+
type: string
2119+
format: uuid
2120+
description: "User id."
21132121
resumeLink:
21142122
type: string
21152123
format: url

src/services/TeamService.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,13 @@ async function getTeamJob (currentUser, id, jobId) {
296296
for (const item of candidates) {
297297
item.resumeLink = null
298298
const candidate = _.find(job.candidates, { userId: item.id })
299+
// TODO this logic should be vice-verse, we should loop trough candidates and populate users data if found,
300+
// not loop through users and populate candidates data if found
299301
if (candidate) {
300302
item.status = candidate.status
303+
// return User id as `userId` and JobCandidate id as `id`
304+
item.userId = item.id
305+
item.id = candidate.id
301306
}
302307
const findMember = _.find(members, { handleLower: item.handle.toLowerCase() })
303308
if (findMember && findMember.photoURL) {

0 commit comments

Comments
 (0)