Skip to content

Commit 03f5bf5

Browse files
committed
Send Email Template Fix's
1 parent 48225d8 commit 03f5bf5

File tree

5 files changed

+46
-40
lines changed

5 files changed

+46
-40
lines changed

app-constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ const Interviews = {
6464
},
6565
// key: template name in x.ai, value: duration
6666
XaiTemplate: {
67-
'30-minutes': 30,
68-
'60-minutes': 60
67+
'interview-30': 30,
68+
'interview-60': 60
6969
}
7070
}
7171

config/email_template.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ module.exports = {
6363

6464
/* Request interview for a job candidate
6565
*
66-
* - interviewType: the x.ai interview type. Example: "30-minutes"
66+
* - interviewType: the x.ai interview type. Example: "interview-30"
6767
* - interviewRound: the round of the interview. Example: 2
6868
* - interviewDuration: duration of the interview, in minutes. Example: 30
6969
* - interviewerList: The list of interviewer email addresses. Example: "first@attendee.com, second@attendee.com"

docs/Topcoder-bookings-api.postman_collection.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,7 +3217,7 @@
32173217
],
32183218
"body": {
32193219
"mode": "raw",
3220-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"status\": \"Completed\"\r\n}",
3220+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"status\": \"Completed\"\r\n}",
32213221
"options": {
32223222
"raw": {
32233223
"language": "json"
@@ -3270,7 +3270,7 @@
32703270
],
32713271
"body": {
32723272
"mode": "raw",
3273-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"attendeesList\": [\"attendee1@yopmail.com\", \"attendee2@yopmail.com\"],\r\n \"status\": \"Scheduling\"\r\n}",
3273+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"attendeesList\": [\"attendee1@yopmail.com\", \"attendee2@yopmail.com\"],\r\n \"status\": \"Scheduling\"\r\n}",
32743274
"options": {
32753275
"raw": {
32763276
"language": "json"
@@ -3321,7 +3321,7 @@
33213321
],
33223322
"body": {
33233323
"mode": "raw",
3324-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
3324+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
33253325
"options": {
33263326
"raw": {
33273327
"language": "json"
@@ -3373,7 +3373,7 @@
33733373
],
33743374
"body": {
33753375
"mode": "raw",
3376-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
3376+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
33773377
"options": {
33783378
"raw": {
33793379
"language": "json"
@@ -3422,7 +3422,7 @@
34223422
],
34233423
"body": {
34243424
"mode": "raw",
3425-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"status\": \"xxxx\"\r\n}",
3425+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"status\": \"xxxx\"\r\n}",
34263426
"options": {
34273427
"raw": {
34283428
"language": "json"
@@ -3472,7 +3472,7 @@
34723472
],
34733473
"body": {
34743474
"mode": "raw",
3475-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"attendeesList\": [\"attendee1@yopmail.com\", \"attendee2@yopmail.com\"]\r\n}",
3475+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"attendeesList\": [\"attendee1@yopmail.com\", \"attendee2@yopmail.com\"]\r\n}",
34763476
"options": {
34773477
"raw": {
34783478
"language": "json"
@@ -3521,7 +3521,7 @@
35213521
],
35223522
"body": {
35233523
"mode": "raw",
3524-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"attendeesList\": \"asddd\"\r\n}",
3524+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"attendeesList\": \"asddd\"\r\n}",
35253525
"options": {
35263526
"raw": {
35273527
"language": "json"
@@ -3570,7 +3570,7 @@
35703570
],
35713571
"body": {
35723572
"mode": "raw",
3573-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"attendeesList\": [\"asdas\"]\r\n}",
3573+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"attendeesList\": [\"asdas\"]\r\n}",
35743574
"options": {
35753575
"raw": {
35763576
"language": "json"
@@ -3619,7 +3619,7 @@
36193619
],
36203620
"body": {
36213621
"mode": "raw",
3622-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"round\": 1\r\n}",
3622+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"round\": 1\r\n}",
36233623
"options": {
36243624
"raw": {
36253625
"language": "json"
@@ -3668,7 +3668,7 @@
36683668
],
36693669
"body": {
36703670
"mode": "raw",
3671-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"startTimestamp\": \"2021-04-17\"\r\n}",
3671+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"startTimestamp\": \"2021-04-17\"\r\n}",
36723672
"options": {
36733673
"raw": {
36743674
"language": "json"
@@ -3748,7 +3748,7 @@
37483748
"pm.test('Status code is 400', function () {\r",
37493749
" pm.response.to.have.status(400);\r",
37503750
" const response = pm.response.json()\r",
3751-
" pm.expect(response.message).to.eq(\"\\\"interview.xaiTemplate\\\" must be one of [30-minutes, 60-minutes]\")\r",
3751+
" pm.expect(response.message).to.eq(\"\\\"interview.xaiTemplate\\\" must be one of [interview-30, interview-60]\")\r",
37523752
"});"
37533753
],
37543754
"type": "text/javascript"
@@ -3815,7 +3815,7 @@
38153815
],
38163816
"body": {
38173817
"mode": "raw",
3818-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
3818+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
38193819
"options": {
38203820
"raw": {
38213821
"language": "json"
@@ -3864,7 +3864,7 @@
38643864
],
38653865
"body": {
38663866
"mode": "raw",
3867-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
3867+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
38683868
"options": {
38693869
"raw": {
38703870
"language": "json"
@@ -3911,7 +3911,7 @@
39113911
],
39123912
"body": {
39133913
"mode": "raw",
3914-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
3914+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
39153915
"options": {
39163916
"raw": {
39173917
"language": "json"
@@ -3958,7 +3958,7 @@
39583958
],
39593959
"body": {
39603960
"mode": "raw",
3961-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
3961+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
39623962
"options": {
39633963
"raw": {
39643964
"language": "json"
@@ -4005,7 +4005,7 @@
40054005
],
40064006
"body": {
40074007
"mode": "raw",
4008-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4008+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
40094009
"options": {
40104010
"raw": {
40114011
"language": "json"
@@ -4052,7 +4052,7 @@
40524052
],
40534053
"body": {
40544054
"mode": "raw",
4055-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4055+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
40564056
"options": {
40574057
"raw": {
40584058
"language": "json"
@@ -4101,7 +4101,7 @@
41014101
],
41024102
"body": {
41034103
"mode": "raw",
4104-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4104+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
41054105
"options": {
41064106
"raw": {
41074107
"language": "json"
@@ -4150,7 +4150,7 @@
41504150
],
41514151
"body": {
41524152
"mode": "raw",
4153-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4153+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
41544154
"options": {
41554155
"raw": {
41564156
"language": "json"
@@ -4199,7 +4199,7 @@
41994199
],
42004200
"body": {
42014201
"mode": "raw",
4202-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4202+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
42034203
"options": {
42044204
"raw": {
42054205
"language": "json"
@@ -4248,7 +4248,7 @@
42484248
],
42494249
"body": {
42504250
"mode": "raw",
4251-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4251+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
42524252
"options": {
42534253
"raw": {
42544254
"language": "json"
@@ -4297,7 +4297,7 @@
42974297
],
42984298
"body": {
42994299
"mode": "raw",
4300-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4300+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
43014301
"options": {
43024302
"raw": {
43034303
"language": "json"
@@ -4340,7 +4340,7 @@
43404340
"header": [],
43414341
"body": {
43424342
"mode": "raw",
4343-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4343+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
43444344
"options": {
43454345
"raw": {
43464346
"language": "json"
@@ -4389,7 +4389,7 @@
43894389
],
43904390
"body": {
43914391
"mode": "raw",
4392-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\"\r\n}",
4392+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\"\r\n}",
43934393
"options": {
43944394
"raw": {
43954395
"language": "json"
@@ -5312,7 +5312,7 @@
53125312
"pm.test('Status code is 400', function () {\r",
53135313
" pm.response.to.have.status(400);\r",
53145314
" const response = pm.response.json()\r",
5315-
" pm.expect(response.message).to.eq(\"\\\"data.xaiTemplate\\\" must be one of [30-minutes, 60-minutes]\")\r",
5315+
" pm.expect(response.message).to.eq(\"\\\"data.xaiTemplate\\\" must be one of [interview-30, interview-60]\")\r",
53165316
"});"
53175317
],
53185318
"type": "text/javascript"
@@ -19449,7 +19449,7 @@
1944919449
],
1945019450
"body": {
1945119451
"mode": "raw",
19452-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
19452+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
1945319453
"options": {
1945419454
"raw": {
1945519455
"language": "json"
@@ -21389,7 +21389,7 @@
2138921389
],
2139021390
"body": {
2139121391
"mode": "raw",
21392-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
21392+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
2139321393
"options": {
2139421394
"raw": {
2139521395
"language": "json"
@@ -21440,7 +21440,7 @@
2144021440
],
2144121441
"body": {
2144221442
"mode": "raw",
21443-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
21443+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
2144421444
"options": {
2144521445
"raw": {
2144621446
"language": "json"
@@ -23544,7 +23544,7 @@
2354423544
],
2354523545
"body": {
2354623546
"mode": "raw",
23547-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
23547+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
2354823548
"options": {
2354923549
"raw": {
2355023550
"language": "json"
@@ -23595,7 +23595,7 @@
2359523595
],
2359623596
"body": {
2359723597
"mode": "raw",
23598-
"raw": "{\r\n \"xaiTemplate\": \"30-minutes\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
23598+
"raw": "{\r\n \"xaiTemplate\": \"interview-30\",\r\n \"googleCalendarId\": \"dummyId\",\r\n \"customMessage\": \"This is a custom message\",\r\n \"status\": \"Scheduling\"\r\n}",
2359923599
"options": {
2360023600
"raw": {
2360123601
"language": "json"

docs/swagger.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ info:
55
version: 1.0.0
66
servers:
77
- url: /api/{apiVersion}/
8+
- url: https://api.topcoder-dev.com/{apiVersion}/
89
variables:
910
apiVersion:
1011
default: "v5"
@@ -3455,8 +3456,8 @@ components:
34553456
description: "The google calendar id."
34563457
xaiTemplate:
34573458
type: string
3458-
example: "30-minutes"
3459-
enum: ["30-minutes", "60-minutes"]
3459+
example: "interview-30"
3460+
enum: ["interview-30", "interview-60"]
34603461
description: "The x.ai template name"
34613462
customMessage:
34623463
type: string
@@ -3510,8 +3511,8 @@ components:
35103511
description: "The custom message."
35113512
xaiTemplate:
35123513
type: string
3513-
enum: ["30-minutes", "60-minutes"]
3514-
example: "30-minutes"
3514+
enum: ["interview-30", "interview-60"]
3515+
example: "interview-30"
35153516
description: "The x.ai template name"
35163517
attendeesList:
35173518
type: array
@@ -3535,8 +3536,8 @@ components:
35353536
description: "The custom message."
35363537
xaiTemplate:
35373538
type: string
3538-
enum: ["30-minutes", "60-minutes"]
3539-
example: "30-minutes"
3539+
enum: ["interview-30", "interview-60"]
3540+
example: "interview-30"
35403541
description: "The x.ai template name"
35413542
attendeesList:
35423543
type: array

src/services/TeamService.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,13 @@ async function sendEmail (currentUser, data) {
326326
recipients: _.uniq([...dataRecipients, ...templateRecipients]),
327327
cc: _.uniq([...dataCC, ...templateCC])
328328
};
329+
let emailStringProps = {
330+
from: emailProps.from.join(','),
331+
recipients: emailProps.recipients.join(','),
332+
cc: emailProps.cc.join(',')
333+
};
329334
let emailData = {
330-
data: { ...data.data, ...emailProps },
335+
data: { ...data.data, ...emailStringProps },
331336
sendgrid_template_id: template.sendgridTemplateId,
332337
version: 'v3'
333338
}

0 commit comments

Comments
 (0)