Refactor UserId property handling and clean up Protobuf file formatting
This commit is contained in:
@@ -19,7 +19,7 @@ public class AddNewUserCartCommandHandler : IRequestHandler<AddNewUserCartComman
|
||||
{
|
||||
ProductId = request.ProductId,
|
||||
Count = request.Count,
|
||||
UserId = _currentUserService.UserId.Value
|
||||
UserId = _currentUserService.UserId.Value,
|
||||
}, cancellationToken: cancellationToken);
|
||||
return new Unit();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class CurrentUserService : ICurrentUserService
|
||||
_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? LastName => _httpContextAccessor.HttpContext?.User?.FindFirstValue("LastName");
|
||||
public string? MobileNumber => _httpContextAccessor.HttpContext?.User?.FindFirstValue("MobileNumber");
|
||||
|
||||
@@ -4,7 +4,7 @@ package products;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
@@ -12,103 +12,103 @@ option csharp_namespace = "FrontOffice.BFF.Products.Protobuf.Protos.Products";
|
||||
|
||||
service ProductsContract
|
||||
{
|
||||
rpc GetProducts(GetProductsRequest) returns (GetProductsResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetProducts"
|
||||
|
||||
};
|
||||
rpc GetProducts(GetProductsRequest) returns (GetProductsResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetProducts"
|
||||
|
||||
};
|
||||
rpc GetAllProductsByFilter(GetAllProductsByFilterRequest) returns (GetAllProductsByFilterResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetAllProductsByFilter"
|
||||
|
||||
};
|
||||
};
|
||||
rpc GetAllProductsByFilter(GetAllProductsByFilterRequest) returns (GetAllProductsByFilterResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetAllProductsByFilter"
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
message GetProductsRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
int64 id = 1;
|
||||
}
|
||||
message GetProductsResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string description = 3;
|
||||
string short_infomation = 4;
|
||||
string full_information = 5;
|
||||
int64 price = 6;
|
||||
int32 discount = 7;
|
||||
int32 rate = 8;
|
||||
string image_path = 9;
|
||||
string thumbnail_path = 10;
|
||||
int32 sale_count = 11;
|
||||
int32 view_count = 12;
|
||||
int32 remaining_count = 13;
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string description = 3;
|
||||
string short_infomation = 4;
|
||||
string full_information = 5;
|
||||
int64 price = 6;
|
||||
int32 discount = 7;
|
||||
int32 rate = 8;
|
||||
string image_path = 9;
|
||||
string thumbnail_path = 10;
|
||||
int32 sale_count = 11;
|
||||
int32 view_count = 12;
|
||||
int32 remaining_count = 13;
|
||||
}
|
||||
message GetAllProductsByFilterRequest
|
||||
{
|
||||
PaginationState pagination_state = 1;
|
||||
google.protobuf.StringValue sort_by = 2;
|
||||
GetAllProductsByFilterFilter filter = 3;
|
||||
PaginationState pagination_state = 1;
|
||||
google.protobuf.StringValue sort_by = 2;
|
||||
GetAllProductsByFilterFilter filter = 3;
|
||||
}
|
||||
message GetAllProductsByFilterFilter
|
||||
{
|
||||
google.protobuf.Int64Value id = 1;
|
||||
google.protobuf.StringValue title = 2;
|
||||
google.protobuf.StringValue description = 3;
|
||||
google.protobuf.StringValue short_infomation = 4;
|
||||
google.protobuf.StringValue full_information = 5;
|
||||
google.protobuf.Int64Value price = 6;
|
||||
google.protobuf.Int32Value discount = 7;
|
||||
google.protobuf.Int32Value rate = 8;
|
||||
google.protobuf.Int64Value id = 1;
|
||||
google.protobuf.StringValue title = 2;
|
||||
google.protobuf.StringValue description = 3;
|
||||
google.protobuf.StringValue short_infomation = 4;
|
||||
google.protobuf.StringValue full_information = 5;
|
||||
google.protobuf.Int64Value price = 6;
|
||||
google.protobuf.Int32Value discount = 7;
|
||||
google.protobuf.Int32Value rate = 8;
|
||||
}
|
||||
message GetAllProductsByFilterResponse
|
||||
{
|
||||
MetaData meta_data = 1;
|
||||
repeated GetAllProductsByFilterResponseModel models = 2;
|
||||
MetaData meta_data = 1;
|
||||
repeated GetAllProductsByFilterResponseModel models = 2;
|
||||
}
|
||||
message GetAllProductsByFilterResponseModel
|
||||
{
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string description = 3;
|
||||
string short_infomation = 4;
|
||||
string full_information = 5;
|
||||
int64 price = 6;
|
||||
int32 discount = 7;
|
||||
int32 rate = 8;
|
||||
string image_path = 9;
|
||||
string thumbnail_path = 10;
|
||||
int32 sale_count = 11;
|
||||
int32 view_count = 12;
|
||||
int32 remaining_count = 13;
|
||||
int64 id = 1;
|
||||
string title = 2;
|
||||
string description = 3;
|
||||
string short_infomation = 4;
|
||||
string full_information = 5;
|
||||
int64 price = 6;
|
||||
int32 discount = 7;
|
||||
int32 rate = 8;
|
||||
string image_path = 9;
|
||||
string thumbnail_path = 10;
|
||||
int32 sale_count = 11;
|
||||
int32 view_count = 12;
|
||||
int32 remaining_count = 13;
|
||||
}
|
||||
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
message PaginationState
|
||||
{
|
||||
int32 page_number = 1;
|
||||
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
int32 page_size = 2;
|
||||
}
|
||||
message MetaData
|
||||
{
|
||||
int64 current_page = 1;
|
||||
|
||||
int64 total_page = 2;
|
||||
int64 total_page = 2;
|
||||
|
||||
int64 page_size = 3;
|
||||
int64 page_size = 3;
|
||||
|
||||
int64 total_count = 4;
|
||||
int64 total_count = 4;
|
||||
|
||||
bool has_previous = 5;
|
||||
bool has_previous = 5;
|
||||
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
bool has_next = 6;
|
||||
}
|
||||
message DecimalValue
|
||||
{
|
||||
|
||||
int64 units = 1;
|
||||
int64 units = 1;
|
||||
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
sfixed32 nanos = 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user