-
Notifications
You must be signed in to change notification settings - Fork 0
/
workers.js
52 lines (47 loc) · 980 Bytes
/
workers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const {
GET_USER_INFO,
SEND_EMAIL,
SEND_SMS,
} = require("../constants");
const userInfo = () => {
return {
taskDefName: GET_USER_INFO,
execute: async ({ inputData }) => {
const userId = inputData?.userId;
return {
outputData: {
email: `${userId}@email.com`,
phoneNumber: "555-555-5555",
},
status: "COMPLETED",
};
},
};
};
const sendEmail = () => {
return {
taskDefName: SEND_EMAIL,
execute: async ({ inputData }) => {
console.log(`Sent email to: ${inputData?.email}`);
return {
status: "COMPLETED",
};
},
};
};
const sendSms = () => {
return {
taskDefName: SEND_SMS,
execute: async ({ inputData }) => {
console.log(`Sent SMS to: ${inputData?.phoneNumber}`);
return {
status: "COMPLETED",
};
},
};
};
module.exports = {
userInfoWorker: userInfo,
sendEmailWorker: sendEmail,
sendSmsWorker: sendSms,
}