Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework device models/command controllers to use database #1226 #1241

Merged

Conversation

hocinehacherouf
Copy link
Contributor

@hocinehacherouf hocinehacherouf commented Sep 14, 2022

Description

What's new?

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Tests
  • Other

@codecov
Copy link

codecov bot commented Sep 14, 2022

Codecov Report

Base: 87.96% // Head: 88.24% // Increases project coverage by +0.28% 🎉

Coverage data is based on head (87db024) compared to base (60780fa).
Patch coverage: 97.87% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1241      +/-   ##
==========================================
+ Coverage   87.96%   88.24%   +0.28%     
==========================================
  Files         217      222       +5     
  Lines        6920     6830      -90     
==========================================
- Hits         6087     6027      -60     
+ Misses        833      803      -30     
Impacted Files Coverage Δ
...b.Portal/Client/Validators/DeviceModelValidator.cs 100.00% <ø> (ø)
...ient/Validators/LoRaDeviceModelCommandValidator.cs 100.00% <ø> (ø)
...trollers/v1.0/LoRaWAN/LoRaWANCommandsController.cs 100.00% <ø> (ø)
...hared/Models/v1.0/LoRaWAN/DeviceModelCommandDto.cs 100.00% <ø> (ø)
...c/AzureIoTHubPortal.Domain/Entities/DeviceModel.cs 100.00% <ø> (+100.00%) ⬆️
...Portal/Client/Pages/Devices/CreateDevicePage.razor 70.74% <50.00%> (ø)
...ent/Pages/DeviceModels/DeviceModelDetailPage.razor 69.44% <81.81%> (ø)
...ent/Pages/DeviceModels/CreateDeviceModelPage.razor 65.33% <91.66%> (ø)
...ub.Portal/Server/Services/LoRaWANCommandService.cs 94.87% <96.55%> (-2.39%) ⬇️
...cture/Repositories/DeviceModelCommandRepository.cs 100.00% <100.00%> (ø)
... and 28 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

var deviceModelId = Fixture.Create<string>();

_ = this.mockDeviceModelRepository.Setup(repository => repository.GetByIdAsync(deviceModelId))
.ReturnsAsync((DeviceModel)null);

Check warning

Code scanning / CodeQL

Useless upcast

There is no need to upcast from [null](1) to [DeviceModel](2) - the conversion can be done implicitly.
_ = this.mockDeviceProvisioningServiceManager.Setup(manager =>
manager.CreateEnrollmentGroupFromModelAsync(deviceModelDto.ModelId, deviceModelDto.Name,
It.IsAny<TwinCollection>()))
.ReturnsAsync((EnrollmentGroup)null);

Check warning

Code scanning / CodeQL

Useless upcast

There is no need to upcast from [null](1) to [EnrollmentGroup](2) - the conversion can be done implicitly.
@hocinehacherouf hocinehacherouf force-pushed the feature/1226_devices_models_listing_should_use_database branch from 9920025 to 17b7f18 Compare September 15, 2022 15:35
_ = this.mockDeviceProvisioningServiceManager.Setup(manager =>
manager.CreateEnrollmentGroupFromModelAsync(deviceModelDto.ModelId, deviceModelDto.Name,
It.IsAny<TwinCollection>()))
.ReturnsAsync((EnrollmentGroup)null);

Check warning

Code scanning / CodeQL

Useless upcast

There is no need to upcast from [null](1) to [EnrollmentGroup](2) - the conversion can be done implicitly.
var deviceModelDto = Fixture.Create<DeviceModelDto>();

_ = this.mockDeviceModelRepository.Setup(repository => repository.GetByIdAsync(deviceModelDto.ModelId))
.ReturnsAsync((DeviceModel)null);

Check warning

Code scanning / CodeQL

Useless upcast

There is no need to upcast from [null](1) to [DeviceModel](2) - the conversion can be done implicitly.
var deviceModelDto = Fixture.Create<DeviceModelDto>();

_ = this.mockDeviceModelRepository.Setup(repository => repository.GetByIdAsync(deviceModelDto.ModelId))
.ReturnsAsync((DeviceModel)null);

Check warning

Code scanning / CodeQL

Useless upcast

There is no need to upcast from [null](1) to [DeviceModel](2) - the conversion can be done implicitly.
@hocinehacherouf hocinehacherouf marked this pull request as ready for review September 15, 2022 16:42
@hocinehacherouf hocinehacherouf requested a review from a team as a code owner September 15, 2022 16:42
@kbeaugrand kbeaugrand merged commit 4a4354f into main Sep 15, 2022
@kbeaugrand kbeaugrand deleted the feature/1226_devices_models_listing_should_use_database branch September 15, 2022 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Devices models listing should use database Refactor DeviceModelControllerBase
2 participants