-
Notifications
You must be signed in to change notification settings - Fork 0
/
Add_Activity.json
99 lines (99 loc) · 2.76 KB
/
Add_Activity.json
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
[
{
"id": "772d529e5bd1c7a7",
"type": "subflow",
"name": "Add activity",
"info": "When triggered the node adds a simple\nactivity log in FarmOS.\nTitle, note and days ahead is the only \nfields.",
"category": "",
"in": [
{
"x": 40,
"y": 100,
"wires": [
{
"id": "0fac84928d22f9c7"
}
]
}
],
"out": [],
"env": [
{
"name": "Days from today",
"type": "num",
"value": "1"
},
{
"name": "Title",
"type": "str",
"value": "Remember to..."
},
{
"name": "Note",
"type": "str",
"value": ""
}
],
"meta": {},
"color": "#D7D7A0",
"icon": "font-awesome/fa-leaf"
},
{
"id": "0fac84928d22f9c7",
"type": "function",
"z": "772d529e5bd1c7a7",
"name": "function 35",
"func": "var today = new Date();\nvar dager = env.get(\"Days from today\");\ntoday.setDate(today.getDate() + dager);\nvar unixTimestamp = Math.round(new Date(today).getTime() / 1000);\ntoday = unixTimestamp;\n\nmsg.payload = \n{\n \"data\": {\n \"type\": \"log--activity\",\n \"attributes\": {\n \"name\": env.get(\"Title\"),\n \"status\": \"pending\",\n \"notes\": env.get(\"Note\"),\n \"timestamp\": today,\n }\n }\n}\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 310,
"y": 100,
"wires": [
[
"7101264805454d66"
]
]
},
{
"id": "7101264805454d66",
"type": "sf:949541c9b70110d5",
"z": "772d529e5bd1c7a7",
"name": "",
"API": "log/activity",
"Method": "POST",
"x": 570,
"y": 100,
"wires": [
[]
]
},
{
"id": "3feb34aeb816bed2",
"type": "subflow:772d529e5bd1c7a7",
"z": "ae72b941.c54948",
"name": "",
"env": [
{
"name": "Days from today",
"value": "30",
"type": "num"
},
{
"name": "Title",
"value": "Fyll på salt",
"type": "str"
},
{
"name": "Dates from today",
"value": "2",
"type": "num"
}
],
"x": 630,
"y": 280,
"wires": []
}
]