magellan.js
3.91 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
module.exports.getAccountDestination = async (req, res) => {
console.log('===== GET getAccountDestination =====')
console.log('url', req.originalUrl);
console.log('headers', req.headers);
console.log('query', req.query);
console.log('params', req.params);
console.log('body', req.body);
let response = {
"DestinationInfo": [
{
"DestinationId": "61236752144b7900018138c4",
"AccountId": "60e6e33ae5f6facdc31b5a6d",
"DestinationName": "destination",
"DestinationUrl": "http://routeapi.quasar.svc.cluster.local/services/destination",
"DestinationStatus": "Enabled",
"Mode": "Raw",
"PickOutSensor": [],
"EventType": [
"Report",
"Desire",
"Connection"
],
"CustomHeaders": {
"x-ais-AccountKey": "60e6e33ae5f6facdc31b5a6d"
},
"Things": [
"60e80fdd252ddf0001b25180",
"611b93e7af8b3f0001e0acc7"
],
"QueueStorageStatus": "Disabled",
"LastQueueStorageStatusTimestamp": "0001-01-01T06:43:00+06:43",
"ErrorCount": 0,
"CustomProperties": {
"ForwardDetail": {
"ThingId": true,
"ThingName": true,
"ThingToken": true,
"ThingIdentifier": true,
"IMEI": true,
"ThingCustomDetails": true
}
},
"Authentications": {
"AuthenType": "NONE"
},
"CreatedDatetime": "2021-07-09T15:55:17+07:00",
"LastUpdatedTimestamp": "2021-08-20T21:25:19+07:00"
},
{
"DestinationId": "61166341144b7900017e5630",
"AccountId": "60e6e33ae5f6facdc31b5a6d",
"DestinationName": "cdddddddddddddddddddddddddddddddd",
"DestinationUrl": "https://mg-iot.siamimo.com/provisioningmessagesharingapis/index.html",
"DestinationStatus": "Enabled",
"Mode": "Raw",
"PickOutSensor": [],
"EventType": [
"NONE"
],
"CustomHeaders": {},
"Things": [
"611a21caaf8b3f0001dd63f4"
],
"QueueStorageStatus": "Disabled",
"LastQueueStorageStatusTimestamp": "0001-01-01T06:43:00+06:43",
"ErrorCount": 0,
"CustomProperties": {
"ForwardDetail": {
"ThingId": true,
"ThingName": true,
"ThingToken": true,
"ThingIdentifier": true,
"IMEI": true,
"ThingCustomDetails": true
}
},
"Authentications": {
"AuthenType": "NONE"
},
"CreatedDatetime": "2021-08-13T19:19:13+07:00",
"LastUpdatedTimestamp": "2021-08-13T23:22:13+07:00"
}
],
"@Metadata": {
"CurrentPage": 1,
"TotalPages": 18,
"Top": 10,
"TotalCount": 172,
"HasPrevious": false,
"HasNext": true
},
"OperationStatus": {
"Code": "20000",
"DeveloperMessage": "The requested operation was successfully."
}
}
res.status(200).send(response)
}
module.exports.getAccountThings = async (req, res) => {
console.log('===== GET getAccountThings =====')
console.log('url', req.originalUrl);
console.log('headers', req.headers);
console.log('query', req.query);
console.log('params', req.params);
console.log('body', req.body);
let response = {
"ThingInfo": [
{
"ThingId": "60e80fdd252ddf0001b25180",
"ThingName": "xNubula."
},
{
"ThingId": "611b93e7af8b3f0001e0acc7",
"ThingName": "xNubula.2"
},
{
"ThingId": "611a21caaf8b3f0001dd63f4",
"ThingName": "xName 01"
}
],
"@Metadata": {
"CurrentPage": 1,
"TotalPages": 1,
"Top": 10,
"TotalCount": 3,
"HasPrevious": false,
"HasNext": false
},
"OperationStatus": {
"Code": "20000",
"DeveloperMessage": "The requested operation was successfully."
}
}
res.status(200).send(response)
}