Refactor UserId property handling and clean up Protobuf file formatting

This commit is contained in:
masoodafar-web
2025-11-21 04:19:33 +03:30
parent 447625079c
commit 724f7a2348
3 changed files with 72 additions and 72 deletions

View File

@@ -19,7 +19,7 @@ public class AddNewUserCartCommandHandler : IRequestHandler<AddNewUserCartComman
{ {
ProductId = request.ProductId, ProductId = request.ProductId,
Count = request.Count, Count = request.Count,
UserId = _currentUserService.UserId.Value UserId = _currentUserService.UserId.Value,
}, cancellationToken: cancellationToken); }, cancellationToken: cancellationToken);
return new Unit(); return new Unit();
} }

View File

@@ -13,7 +13,7 @@ public class CurrentUserService : ICurrentUserService
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
} }
public long? UserId => long.Parse(_httpContextAccessor.HttpContext?.User.FindFirstValue(ClaimTypes.NameIdentifier)) ; public long? UserId =>_httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier)==null?null: long.Parse(_httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier)) ;
public string? FirstName => _httpContextAccessor.HttpContext?.User?.FindFirstValue("FirstName"); public string? FirstName => _httpContextAccessor.HttpContext?.User?.FindFirstValue("FirstName");
public string? LastName => _httpContextAccessor.HttpContext?.User?.FindFirstValue("LastName"); public string? LastName => _httpContextAccessor.HttpContext?.User?.FindFirstValue("LastName");
public string? MobileNumber => _httpContextAccessor.HttpContext?.User?.FindFirstValue("MobileNumber"); public string? MobileNumber => _httpContextAccessor.HttpContext?.User?.FindFirstValue("MobileNumber");

View File

@@ -84,14 +84,14 @@ message GetAllProductsByFilterResponseModel
int32 remaining_count = 13; int32 remaining_count = 13;
} }
message PaginationState message PaginationState
{ {
int32 page_number = 1; int32 page_number = 1;
int32 page_size = 2; int32 page_size = 2;
} }
message MetaData message MetaData
{ {
int64 current_page = 1; int64 current_page = 1;
int64 total_page = 2; int64 total_page = 2;
@@ -103,12 +103,12 @@ message GetAllProductsByFilterResponseModel
bool has_previous = 5; bool has_previous = 5;
bool has_next = 6; bool has_next = 6;
} }
message DecimalValue message DecimalValue
{ {
int64 units = 1; int64 units = 1;
sfixed32 nanos = 2; sfixed32 nanos = 2;
} }