-
Notifications
You must be signed in to change notification settings - Fork 2
Web API: Added Azure Authentication and Power BI to server-side code #15
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
base: main
Are you sure you want to change the base?
Conversation
… components for optional features. Needs client-side code.
mdbrooks48
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds a fair amount of code to FF that is not covered in unit tests. Please add unit tests.
| //_logger.LogError(ex, model.DisplayFailMessage); | ||
| } | ||
|
|
||
| return Task.FromResult(model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use Task.FromResult over async / await?
| model.EmbedParameters = Task.FromResult(_powerBiService.GetEmbedParams(reportGuid)).Result; | ||
| } | ||
|
|
||
| return Task.FromResult(model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue. Why use Task.FromResult vs async / await?
| { | ||
| public class GetTrustedIdentityProvidersQueryHandler : IRequestHandler<GetTrustedIdentityProvidersQuery, List<IdentityProviderEntityModel>> | ||
| { | ||
| private readonly SystemDataService _dbService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this dependency be ISystemDataService?
|
|
||
| public async Task<List<IdentityProviderEntityModel>> Handle(GetTrustedIdentityProvidersQuery request, CancellationToken cancellationToken) | ||
| { | ||
| return await Task.FromResult(_dbService.GetTrustedIdentityProviderClaimValues()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing. Do you anticipate that the ISystemDataService methods will be async? Either define the interface with async methods or remove the async / await from this method.
| { | ||
| public class CreateUserProfileCommandHandler : IRequestHandler<CreateUserProfileCommand, int> | ||
| { | ||
| private readonly SystemDataService _dbService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this dependency be on ISystemDataService?
| using System.ComponentModel.DataAnnotations.Schema; | ||
| using Microsoft.EntityFrameworkCore; | ||
|
|
||
| namespace NTNMath.Data.Models; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to fix the namespace to match the project
| @@ -0,0 +1,28 @@ | |||
| | |||
| namespace referenceApp.Common.Models.Entity | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the models in the "Common" project used for? API models should go in the API project. Persistence models in the Persistence project.
|
|
||
| [Table("Report")] | ||
| [Index("ReportSectionId", Name = "IX_Report_ReportSectionId", IsUnique = true)] | ||
| public partial class Report |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a partial class?
| // Create a request for getting Embed token | ||
| // This method works only with new Power BI V2 workspace experience | ||
| // NOTE: Must Exclude Datasets, BI Report IDs, and Roles from the EffectiveIdentity object in 'identities' token request property when BI report has a Paginated Visual. | ||
| var tokenRequest = new GenerateTokenRequestV2( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just call the GetEmbedTokenVersion2 method?
|
|
||
| #region Implementation Methods | ||
|
|
||
| public string? GetAccessToken() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use async / await instead of calling methods with ExecuteAsync().Result?
Web API: Added server-side library components, configurations, and supporting code that will save time including these two optional features in any new client project.
NOTE: Ajay will be adding the corresponding client-side code.