Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
32b650f
add logs to email notifications scheduler
maxceem Aug 9, 2021
d7f27b2
fix handle server error text
maxceem Aug 9, 2021
61c2cc8
improved logs for email notifications
maxceem Aug 9, 2021
2d157c8
Merge pull request #459 from topcoder-platform/hotfix/send-survey-wor…
maxceem Aug 9, 2021
013c854
Stripe Config
urwithat Aug 9, 2021
ff9b65b
Merge branch 'dev' of https://github.com/topcoder-platform/taas-apis …
urwithat Aug 9, 2021
619902e
Updating amount logic
Aug 10, 2021
3d0408c
Merge remote-tracking branch 'origin/roles-checkout' into dev
Aug 10, 2021
cdfd20c
Merge pull request #464 from arpitchaudhari/dev
nikolay83 Aug 10, 2021
e7c70d6
Added scopes for calculateAmount & createPayment APIs
Aug 10, 2021
a333608
Merge pull request #467 from arpitchaudhari/dev
nikolay83 Aug 10, 2021
92b7c97
Merge pull request #465 from topcoder-platform/hotfix/send-survey-wor…
maxceem Aug 10, 2021
2583409
#443 & Stripe Connectivity Issues
Aug 11, 2021
e14172b
https://github.com/topcoder-platform/taas-app/issues/443 & Stripe Co…
Aug 11, 2021
8bb7183
Merge branch 'roles-checkout' of https://github.com/arpitchaudhari/ta…
Aug 11, 2021
198493b
Merge branch 'roles-checkout' into dev
Aug 11, 2021
9abb019
Merge pull request #472 from arpitchaudhari/dev
nikolay83 Aug 11, 2021
cdbac5e
fix: update ROLE_MATCHING_RATE to 0.66
yoution Aug 11, 2021
354b1c5
fix: taas 412 add skill and unmatch skills for role
yoution Aug 11, 2021
260244c
Merge pull request #473 from yoution/issue-412
nikolay83 Aug 11, 2021
3282d3a
fix: issue taas#462
yoution Aug 12, 2021
14a992f
Merge pull request #479 from yoution/issue-462
nikolay83 Aug 12, 2021
9cd777e
API to identify whether member is external or internal.
Aug 12, 2021
6ea9431
Merge pull request #480 from arpitchaudhari/dev
nikolay83 Aug 12, 2021
49580d9
Adding Authentication to isExternalMember API
Aug 12, 2021
abb7346
Merge pull request #481 from arpitchaudhari/dev
nikolay83 Aug 12, 2021
c8019b1
fix: issue topcoder-platform/taas-app#475
yoution Aug 13, 2021
9c31e35
Merge pull request #484 from yoution/issue-462
nikolay83 Aug 13, 2021
af3feff
fix issue topcoder-platform/taas-app#462
yoution Aug 13, 2021
7057e45
Merge pull request #485 from yoution/issue-462
nikolay83 Aug 13, 2021
d9387cf
feat(teams): accept `intakeSource` in `createTeam` request
cagdas001 Aug 13, 2021
aa470aa
Merge pull request #489 from cagdas001/dev
nikolay83 Aug 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ module.exports = {
DEFAULT_TIMELINE_TEMPLATE_ID: process.env.DEFAULT_TIMELINE_TEMPLATE_ID || '53a307ce-b4b3-4d6f-b9a1-3741a58f77e6',
DEFAULT_TRACK_ID: process.env.DEFAULT_TRACK_ID || '9b6fc876-f4d9-4ccb-9dfd-419247628825',
// the minimum matching rate when searching roles by skills
ROLE_MATCHING_RATE: process.env.ROLE_MATCHING_RATE || 0.70,
ROLE_MATCHING_RATE: process.env.ROLE_MATCHING_RATE || 0.66,
// member groups representing Wipro or TopCoder employee
INTERNAL_MEMBER_GROUPS: process.env.INTERNAL_MEMBER_GROUPS || ['20000000', '20000001', '20000003', '20000010', '20000015'],
// Topcoder skills cache time in minutes
Expand Down Expand Up @@ -265,5 +265,8 @@ module.exports = {
// The interview completed past time for fetching interviews
INTERVIEW_COMPLETED_PAST_TIME: process.env.INTERVIEW_COMPLETED_PAST_TIME || 'PT4H',
// The time before resource booking expiry when we should start sending notifications
RESOURCE_BOOKING_EXPIRY_TIME: process.env.RESOURCE_BOOKING_EXPIRY_TIME || 'P21D'
RESOURCE_BOOKING_EXPIRY_TIME: process.env.RESOURCE_BOOKING_EXPIRY_TIME || 'P21D',
// The Stripe
STRIPE_SECRET_KEY: process.env.STRIPE_SECRET_KEY,
CURRENCY: process.env.CURRENCY || 'usd'
}
69 changes: 64 additions & 5 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3538,7 +3538,56 @@ paths:
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
$ref: "#/components/schemas/Error"
/taas-teams/isExternalMember:
post:
tags:
- Teams
description: |
Finds whether member is internal or external

requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/IsExternalMemberRequestBody"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/IsExternalMemberResponse"
"400":
description: Bad request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"401":
description: Not authenticated
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"403":
description: Forbidden
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"409":
description: Conflict
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: Internal Server Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/taas-teams/members-suggest/{fragment}:
get:
tags:
Expand Down Expand Up @@ -5754,12 +5803,9 @@ components:
numberOfResources:
type: number
description: "No. of resources required."
rates:
rate:
type: number
description: "Weekly rates"
durationWeeks:
type: number
description: "No. of weeks"
CalculateAmountResponse:
properties:
totalAmount:
Expand All @@ -5775,6 +5821,16 @@ components:
paymentIntentToken:
type: string
description: " Token required by stripe for completing payment."
IsExternalMemberRequestBody:
properties:
totalAmount:
type: number
description: "Member id"
IsExternalMemberResponse:
properties:
paymentIntentToken:
type: boolean
description: "Is the user external member"
SubmitTeamRequestBody:
properties:
teamName:
Expand All @@ -5786,6 +5842,9 @@ components:
refCode:
type: string
description: "Optional referral code"
intakeSource:
type: string
description: "The source of the intake."
positions:
type: array
description: "The array of positions"
Expand Down
13 changes: 12 additions & 1 deletion src/controllers/TeamController.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,16 @@ async function createPayment(req, res) {
res.send(await service.createPayment(req.body.totalAmount));
}

/**
*
* @param req the request
* @param res the response
*/
async function isExternalMember(req, res) {
res.send(await service.isExternalMember(req.body.memberId));
}


module.exports = {
searchTeams,
getTeam,
Expand All @@ -189,5 +199,6 @@ module.exports = {
searchSkills,
suggestMembers,
createPayment,
calculateAmount
calculateAmount,
isExternalMember
}
14 changes: 13 additions & 1 deletion src/routes/TeamRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,24 @@ module.exports = {
post: {
controller: "TeamController",
method: "calculateAmount",
auth: 'jwt',
scopes: [constants.Scopes.CREATE_TAAS_TEAM]
},
},
"/taas-teams/createPayment": {
post: {
controller: "TeamController",
method: "createPayment",
auth: 'jwt',
scopes: [constants.Scopes.CREATE_TAAS_TEAM]
},
},
"/taas-teams/isExternalMember": {
post: {
controller: "TeamController",
method: "isExternalMember",
auth: 'jwt',
scopes: []
}
},
}
}
43 changes: 41 additions & 2 deletions src/services/EmailNotificationService.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function getProjectWithId (projectId) {
project = await helper.getProjectById(helper.getAuditM2Muser(), projectId)
} catch (err) {
localLogger.error(
`exception fetching project with id: ${projectId} Status Code: ${err.status} message: ${err.response.text}`, 'getProjectWithId')
`exception fetching project with id: ${projectId} Status Code: ${err.status} message: ${_.get(err, 'response.text', err.toString())}`, 'getProjectWithId')
}

return project
Expand Down Expand Up @@ -65,7 +65,7 @@ async function getUserWithId (userId) {
user = await helper.ensureUserById(userId)
} catch (err) {
localLogger.error(
`exception fetching user with id: ${userId} Status Code: ${err.status} message: ${err.response.text}`, 'getUserWithId')
`exception fetching user with id: ${userId} Status Code: ${err.status} message: ${_.get(err, 'response.text', err.toString())}`, 'getUserWithId')
}

return user
Expand Down Expand Up @@ -120,7 +120,11 @@ async function sendCandidatesAvailableEmails () {
const jobs = _.map(jobsDao, dao => dao.dataValues)

const projectIds = _.uniq(_.map(jobs, job => job.projectId))

localLogger.debug(`[sendCandidatesAvailableEmails]: Found ${projectIds.length} projects with Job Candidates awaiting for review.`)

// for each unique project id, send an email
let sentCount = 0
for (const projectId of projectIds) {
const project = await getProjectWithId(projectId)
if (!project) { continue }
Expand Down Expand Up @@ -172,7 +176,10 @@ async function sendCandidatesAvailableEmails () {
description: 'Candidates are available for review'
}
})

sentCount++
}
localLogger.debug(`[sendCandidatesAvailableEmails]: Sent notifications for ${sentCount} of ${projectIds.length} projects with Job Candidates awaiting for review.`)
}

/**
Expand Down Expand Up @@ -216,6 +223,10 @@ async function sendInterviewComingUpEmails () {
raw: true
})

localLogger.debug(`[sendInterviewComingUpEmails]: Found ${interviews.length} interviews which are coming soon.`)

let sentHostCount = 0
let sentGuestCount = 0
for (const interview of interviews) {
// send host email
const data = await getDataForInterview(interview)
Expand All @@ -233,6 +244,8 @@ async function sendInterviewComingUpEmails () {
description: 'Interview Coming Up'
}
})

sentHostCount++
} else {
localLogger.error(`Interview id: ${interview.id} host email not present`, 'sendInterviewComingUpEmails')
}
Expand All @@ -250,10 +263,14 @@ async function sendInterviewComingUpEmails () {
description: 'Interview Coming Up'
}
})

sentGuestCount++
} else {
localLogger.error(`Interview id: ${interview.id} guest emails not present`, 'sendInterviewComingUpEmails')
}
}

localLogger.debug(`[sendInterviewComingUpEmails]: Sent notifications for ${sentHostCount} hosts and ${sentGuestCount} guest of ${interviews.length} interviews which are coming soon.`)
}

/**
Expand Down Expand Up @@ -288,6 +305,9 @@ async function sendInterviewCompletedEmails () {
raw: true
})

localLogger.debug(`[sendInterviewCompletedEmails]: Found ${interviews.length} interviews which must be ended by now.`)

let sentCount = 0
for (const interview of interviews) {
if (_.isEmpty(interview.hostEmail)) {
localLogger.error(`Interview id: ${interview.id} host email not present`)
Expand All @@ -308,7 +328,11 @@ async function sendInterviewCompletedEmails () {
description: 'Interview Completed'
}
})

sentCount++
}

localLogger.debug(`[sendInterviewCompletedEmails]: Sent notifications for ${sentCount} of ${interviews.length} interviews which must be ended by now.`)
}

/**
Expand Down Expand Up @@ -341,6 +365,10 @@ async function sendPostInterviewActionEmails () {
})

const projectIds = _.uniq(_.map(jobs, job => job.projectId))

localLogger.debug(`[sendPostInterviewActionEmails]: Found ${projectIds.length} projects with ${completedJobCandidates.length} Job Candidates with interview completed awaiting for an action.`)

let sentCount = 0
for (const projectId of projectIds) {
const project = await getProjectWithId(projectId)
if (!project) { continue }
Expand Down Expand Up @@ -374,7 +402,11 @@ async function sendPostInterviewActionEmails () {
description: 'Post Interview Candidate Action Reminder'
}
})

sentCount++
}

localLogger.debug(`[sendPostInterviewActionEmails]: Sent notifications for ${sentCount} of ${projectIds.length} projects with Job Candidates with interview completed awaiting for an action.`)
}

/**
Expand Down Expand Up @@ -410,6 +442,9 @@ async function sendResourceBookingExpirationEmails () {
})
const projectIds = _.uniq(_.map(expiringResourceBookings, rb => rb.projectId))

localLogger.debug(`[sendResourceBookingExpirationEmails]: Found ${projectIds.length} projects with ${expiringResourceBookings.length} Resource Bookings expiring in less than 3 weeks.`)

let sentCount = 0
for (const projectId of projectIds) {
const project = await getProjectWithId(projectId)
if (!project) { continue }
Expand Down Expand Up @@ -447,7 +482,11 @@ async function sendResourceBookingExpirationEmails () {
description: 'Upcoming Resource Booking Expiration'
}
})

sentCount++
}

localLogger.debug(`[sendResourceBookingExpirationEmails]: Sent notifications for ${sentCount} of ${projectIds.length} projects with Resource Bookings expiring in less than 3 weeks.`)
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/services/PaymentService.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async function createChallenge (challenge, token) {
return challengeId
} catch (err) {
localLogger.error({ context: 'createChallenge', message: `Status Code: ${err.status}` })
localLogger.error({ context: 'createChallenge', message: err.response.text })
localLogger.error({ context: 'createChallenge', message: _.get(err, 'response.text', err.toString()) })
throw err
}
}
Expand Down Expand Up @@ -126,7 +126,7 @@ async function addResourceToChallenge (id, handle, token) {
}
}
localLogger.error({ context: 'addResourceToChallenge', message: `Status Code: ${err.status}` })
localLogger.error({ context: 'addResourceToChallenge', message: err.response.text })
localLogger.error({ context: 'addResourceToChallenge', message: _.get(err, 'response.text', err.toString()) })
throw err
}
}
Expand All @@ -153,7 +153,7 @@ async function activateChallenge (id, token) {
}
}
localLogger.error({ context: 'activateChallenge', message: `Status Code: ${err.status}` })
localLogger.error({ context: 'activateChallenge', message: err.response.text })
localLogger.error({ context: 'activateChallenge', message: _.get(err, 'response.text', err.toString()) })
throw err
}
}
Expand Down Expand Up @@ -189,7 +189,7 @@ async function closeChallenge (id, userId, userHandle, token) {
}
}
localLogger.error({ context: 'closeChallenge', message: `Status Code: ${err.status}` })
localLogger.error({ context: 'closeChallenge', message: err.response.text })
localLogger.error({ context: 'closeChallenge', message: _.get(err, 'response.text', err.toString()) })
throw err
}
}
Expand Down
Loading