Browse Source

Little fix and refactoring (#1860)

* Delete repeat setting a property in CreateOrderCommand ctor

* Fix catalogTypeName -> catalogBrandName in exception message

* Delete useless null check from ConsentController

* Add null check for subjectId
pull/1874/head
KurnakovMaksim 2 years ago
committed by GitHub
parent
commit
4ac25bf58d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 5 deletions
  1. +1
    -1
      src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs
  2. +1
    -1
      src/Services/Identity/Identity.API/Controllers/ConsentController.cs
  3. +2
    -2
      src/Services/Identity/Identity.API/Services/ProfileService.cs
  4. +0
    -1
      src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs

+ 1
- 1
src/Services/Catalog/Catalog.API/Infrastructure/CatalogContextSeed.cs View File

@ -203,7 +203,7 @@ public class CatalogContextSeed
string catalogBrandName = column[Array.IndexOf(headers, "catalogbrandname")].Trim('"').Trim();
if (!catalogBrandIdLookup.ContainsKey(catalogBrandName))
{
throw new Exception($"type={catalogTypeName} does not exist in catalogTypes");
throw new Exception($"type={catalogBrandName} does not exist in catalogTypes");
}
string priceString = column[Array.IndexOf(headers, "price")].Trim('"').Trim();


+ 1
- 1
src/Services/Identity/Identity.API/Controllers/ConsentController.cs View File

@ -58,7 +58,7 @@
response = ConsentResponse.Denied;
}
// user clicked 'yes' - validate the data
else if (model.Button == "yes" && model != null)
else if (model.Button == "yes")
{
// if the user consented to some scope, build the response model
if (model.ScopesConsented != null && model.ScopesConsented.Any())


+ 2
- 2
src/Services/Identity/Identity.API/Services/ProfileService.cs View File

@ -13,7 +13,7 @@
{
var subject = context.Subject ?? throw new ArgumentNullException(nameof(context.Subject));
var subjectId = subject.Claims.Where(x => x.Type == "sub").FirstOrDefault().Value;
var subjectId = subject.Claims.Where(x => x.Type == "sub").FirstOrDefault()?.Value;
var user = await _userManager.FindByIdAsync(subjectId);
if (user == null)
@ -27,7 +27,7 @@
{
var subject = context.Subject ?? throw new ArgumentNullException(nameof(context.Subject));
var subjectId = subject.Claims.Where(x => x.Type == "sub").FirstOrDefault().Value;
var subjectId = subject.Claims.Where(x => x.Type == "sub").FirstOrDefault()?.Value;
var user = await _userManager.FindByIdAsync(subjectId);
context.IsActive = false;


+ 0
- 1
src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs View File

@ -79,7 +79,6 @@ public class CreateOrderCommand
CardExpiration = cardExpiration;
CardSecurityNumber = cardSecurityNumber;
CardTypeId = cardTypeId;
CardExpiration = cardExpiration;
}


Loading…
Cancel
Save