Skip to content

Commit c3dd7e7

Browse files
committed
feat(history): return request metadata
1 parent e068fd0 commit c3dd7e7

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

features/HistoricalRequest.feature.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ Soon I should receive a message on the websocket that is equal to
6565
{
6666
"@context": "https://github.com/hello-nrfcloud/proto/historical-data-response",
6767
"@id": "420eac59-5ce8-4751-b7d1-217811382095",
68+
"type": "lastHour",
69+
"message": "gain",
6870
"attributes": {
6971
"avgMA": [
7072
{
@@ -140,6 +142,8 @@ Soon I should receive a message on the websocket that is equal to
140142
{
141143
"@context": "https://github.com/hello-nrfcloud/proto/historical-data-response",
142144
"@id": "b42b7880-0217-484f-8e72-380950ffae46",
145+
"type": "lastHour",
146+
"message": "battery",
143147
"attributes": {
144148
"minBat": [
145149
{
@@ -267,6 +271,8 @@ Soon I should receive a message on the websocket that matches
267271
{
268272
"@context": "https://github.com/hello-nrfcloud/proto/historical-data-response",
269273
"@id": "ce324e8e-2aac-4525-b763-5c036148c167",
274+
"type": "lastHour",
275+
"message": "location",
270276
"attributes": [
271277
{
272278
"lat": 63.42061758,

historicalData/historicalDataRepository.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,14 @@ export const historicalDataRepository = ({
153153
}
154154
}
155155

156-
return {
156+
const response: HistoricalResponse = {
157157
'@context': Context.historicalDataResponse.toString(),
158158
'@id': request['@id'],
159-
attributes,
160-
} as HistoricalResponse
159+
attributes: attributes as HistoricalResponse['attributes'],
160+
type: request.type,
161+
message: request.message,
162+
}
163+
164+
return response
161165
},
162166
})

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"prettier": "@nordicsemiconductor/asset-tracker-cloud-code-style/.prettierrc",
118118
"dependencies": {
119119
"@aws-lambda-powertools/metrics": "1.11.1",
120-
"@hello.nrfcloud.com/proto": "3.0.1",
120+
"@hello.nrfcloud.com/proto": "3.0.3",
121121
"@middy/core": "4.5.5",
122122
"@nordicsemiconductor/from-env": "2.0.0",
123123
"@nordicsemiconductor/timestream-helpers": "5.0.0",

0 commit comments

Comments
 (0)