Skip to content

Commit

Permalink
Merge pull request #674 from judehung/issue-673
Browse files Browse the repository at this point in the history
fix(data): Add reading id mapping during conversion
  • Loading branch information
cloudxxx8 authored Oct 19, 2021
2 parents 3eb1cdc + fcb12ca commit 06c8706
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions dtos/reading.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ func (b BaseReading) Validate() error {
func ToReadingModel(r BaseReading) models.Reading {
var readingModel models.Reading
br := models.BaseReading{
Id: r.Id,
Origin: r.Origin,
DeviceName: r.DeviceName,
ResourceName: r.ResourceName,
Expand Down
2 changes: 2 additions & 0 deletions dtos/reading_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
)

var testSimpleReading = BaseReading{
Id: TestUUID,
DeviceName: TestDeviceName,
ResourceName: TestReadingName,
ProfileName: TestDeviceProfileName,
Expand All @@ -31,6 +32,7 @@ func Test_ToReadingModel(t *testing.T) {
valid := testSimpleReading
expectedSimpleReading := models.SimpleReading{
BaseReading: models.BaseReading{
Id: TestUUID,
DeviceName: TestDeviceName,
ResourceName: TestReadingName,
ProfileName: TestDeviceProfileName,
Expand Down
1 change: 1 addition & 0 deletions dtos/requests/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ func Test_AddEventReqToEventModels(t *testing.T) {
valid := eventRequestData()
s := models.SimpleReading{
BaseReading: models.BaseReading{
Id: ExampleUUID,
DeviceName: TestDeviceName,
ResourceName: TestDeviceResourceName,
ProfileName: TestDeviceProfileName,
Expand Down

0 comments on commit 06c8706

Please sign in to comment.