Skip to content

Commit d337e83

Browse files
committed
Merge branch 'dev' into feature/notifications-api
# Conflicts: # src/routes/TeamRoutes.js
2 parents 8e8830e + aa470aa commit d337e83

File tree

5 files changed

+92
-6
lines changed

5 files changed

+92
-6
lines changed

docs/swagger.yaml

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3593,7 +3593,56 @@ paths:
35933593
content:
35943594
application/json:
35953595
schema:
3596-
$ref: "#/components/schemas/Error"
3596+
$ref: "#/components/schemas/Error"
3597+
/taas-teams/isExternalMember:
3598+
post:
3599+
tags:
3600+
- Teams
3601+
description: |
3602+
Finds whether member is internal or external
3603+
3604+
requestBody:
3605+
content:
3606+
application/json:
3607+
schema:
3608+
$ref: "#/components/schemas/IsExternalMemberRequestBody"
3609+
responses:
3610+
"200":
3611+
description: OK
3612+
content:
3613+
application/json:
3614+
schema:
3615+
$ref: "#/components/schemas/IsExternalMemberResponse"
3616+
"400":
3617+
description: Bad request
3618+
content:
3619+
application/json:
3620+
schema:
3621+
$ref: "#/components/schemas/Error"
3622+
"401":
3623+
description: Not authenticated
3624+
content:
3625+
application/json:
3626+
schema:
3627+
$ref: "#/components/schemas/Error"
3628+
"403":
3629+
description: Forbidden
3630+
content:
3631+
application/json:
3632+
schema:
3633+
$ref: "#/components/schemas/Error"
3634+
"409":
3635+
description: Conflict
3636+
content:
3637+
application/json:
3638+
schema:
3639+
$ref: "#/components/schemas/Error"
3640+
"500":
3641+
description: Internal Server Error
3642+
content:
3643+
application/json:
3644+
schema:
3645+
$ref: "#/components/schemas/Error"
35973646
/taas-teams/members-suggest/{fragment}:
35983647
get:
35993648
tags:
@@ -5830,6 +5879,16 @@ components:
58305879
paymentIntentToken:
58315880
type: string
58325881
description: " Token required by stripe for completing payment."
5882+
IsExternalMemberRequestBody:
5883+
properties:
5884+
totalAmount:
5885+
type: number
5886+
description: "Member id"
5887+
IsExternalMemberResponse:
5888+
properties:
5889+
paymentIntentToken:
5890+
type: boolean
5891+
description: "Is the user external member"
58335892
SubmitTeamRequestBody:
58345893
properties:
58355894
teamName:
@@ -5841,6 +5900,9 @@ components:
58415900
refCode:
58425901
type: string
58435902
description: "Optional referral code"
5903+
intakeSource:
5904+
type: string
5905+
description: "The source of the intake."
58445906
positions:
58455907
type: array
58465908
description: "The array of positions"

src/controllers/TeamController.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,15 @@ async function createPayment (req, res) {
173173
res.send(await service.createPayment(req.body.totalAmount))
174174
}
175175

176+
/**
177+
*
178+
* @param req the request
179+
* @param res the response
180+
*/
181+
async function isExternalMember (req, res) {
182+
res.send(await service.isExternalMember(req.body.memberId))
183+
}
184+
176185
module.exports = {
177186
searchTeams,
178187
getTeam,
@@ -189,5 +198,6 @@ module.exports = {
189198
searchSkills,
190199
suggestMembers,
191200
createPayment,
192-
calculateAmount
201+
calculateAmount,
202+
isExternalMember
193203
}

src/routes/TeamRoutes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,5 +123,13 @@ module.exports = {
123123
auth: 'jwt',
124124
scopes: [constants.Scopes.CREATE_TAAS_TEAM]
125125
}
126+
},
127+
'/taas-teams/isExternalMember': {
128+
post: {
129+
controller: 'TeamController',
130+
method: 'isExternalMember',
131+
auth: 'jwt',
132+
scopes: []
133+
}
126134
}
127135
}

src/services/JobCandidateService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,5 +410,5 @@ module.exports = {
410410
fullyUpdateJobCandidate,
411411
deleteJobCandidate,
412412
searchJobCandidates,
413-
downloadJobCandidateResume
413+
downloadJobCandidateResume
414414
}

src/services/TeamService.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,8 @@ async function getRoleBySkills (skills) {
794794
where: { listOfSkills: { [Op.overlap]: skills } },
795795
raw: true
796796
}
797-
const roles = await Role.findAll(queryCriteria)
797+
let roles = await Role.findAll(queryCriteria)
798+
roles = _.filter(roles, role => _.find(role.rates, r => r.global && r.rate20Global && r.rate30Global))
798799
if (roles.length > 0) {
799800
let result = _.each(roles, role => {
800801
// role matched skills list
@@ -813,7 +814,10 @@ async function getRoleBySkills (skills) {
813814
}
814815
}
815816
// if no matching role found then return Custom role or empty object
816-
return await Role.findOne({ where: { name: { [Op.iLike]: 'Custom' } }, raw: true }) || {}
817+
const customRole = await Role.findOne({ where: { name: { [Op.iLike]: 'Custom' } }, raw: true }) || {}
818+
customRole.rates[0].rate30Global = customRole.rates[0].global * 0.75
819+
customRole.rates[0].rate20Global = customRole.rates[0].global * 0.5
820+
return customRole
817821
}
818822

819823
getRoleBySkills.schema = Joi.object()
@@ -1035,7 +1039,8 @@ async function createTeam (currentUser, data) {
10351039
details: {
10361040
positions: data.positions,
10371041
utm: {
1038-
code: data.refCode
1042+
code: data.refCode,
1043+
intakeSource: data.intakeSource
10391044
}
10401045
}
10411046
}
@@ -1075,6 +1080,7 @@ createTeam.schema = Joi.object()
10751080
teamName: Joi.string().required(),
10761081
teamDescription: Joi.string(),
10771082
refCode: Joi.string(),
1083+
intakeSource: Joi.string(),
10781084
positions: Joi.array().items(
10791085
Joi.object().keys({
10801086
roleName: Joi.string().required(),

0 commit comments

Comments
 (0)