Generator Changes at 11/17/2025 11:53:47 PM +03:30
This commit is contained in:
123
src/CMSMicroservice.Protobuf/Protos/category.proto
Normal file
123
src/CMSMicroservice.Protobuf/Protos/category.proto
Normal file
@@ -0,0 +1,123 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package category;
|
||||
|
||||
import "public_messages.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option csharp_namespace = "CMSMicroservice.Protobuf.Protos.Category";
|
||||
|
||||
service CategoryContract
|
||||
{
|
||||
rpc CreateNewCategory(CreateNewCategoryRequest) returns (CreateNewCategoryResponse){
|
||||
option (google.api.http) = {
|
||||
post: "/CreateNewCategory"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc UpdateCategory(UpdateCategoryRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
put: "/UpdateCategory"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc DeleteCategory(DeleteCategoryRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
delete: "/DeleteCategory"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc GetCategory(GetCategoryRequest) returns (GetCategoryResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetCategory"
|
||||
|
||||
};
|
||||
};
|
||||
rpc GetAllCategoryByFilter(GetAllCategoryByFilterRequest) returns (GetAllCategoryByFilterResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetAllCategoryByFilter"
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
message CreateNewCategoryRequest
|
||||
{
|
||||
string name = 1;
|
||||
string title = 2;
|
||||
google.protobuf.StringValue description = 3;
|
||||
google.protobuf.StringValue image_path = 4;
|
||||
google.protobuf.Int64Value parent_id = 5;
|
||||
bool is_active = 6;
|
||||
int32 sort_order = 7;
|
||||
}
|
||||
message CreateNewCategoryResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
}
|
||||
message UpdateCategoryRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string title = 3;
|
||||
google.protobuf.StringValue description = 4;
|
||||
google.protobuf.StringValue image_path = 5;
|
||||
google.protobuf.Int64Value parent_id = 6;
|
||||
bool is_active = 7;
|
||||
int32 sort_order = 8;
|
||||
}
|
||||
message DeleteCategoryRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
}
|
||||
message GetCategoryRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
}
|
||||
message GetCategoryResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string title = 3;
|
||||
google.protobuf.StringValue description = 4;
|
||||
google.protobuf.StringValue image_path = 5;
|
||||
google.protobuf.Int64Value parent_id = 6;
|
||||
bool is_active = 7;
|
||||
int32 sort_order = 8;
|
||||
}
|
||||
message GetAllCategoryByFilterRequest
|
||||
{
|
||||
messages.PaginationState pagination_state = 1;
|
||||
google.protobuf.StringValue sort_by = 2;
|
||||
GetAllCategoryByFilterFilter filter = 3;
|
||||
}
|
||||
message GetAllCategoryByFilterFilter
|
||||
{
|
||||
google.protobuf.Int64Value id = 1;
|
||||
google.protobuf.StringValue name = 2;
|
||||
google.protobuf.StringValue title = 3;
|
||||
google.protobuf.StringValue description = 4;
|
||||
google.protobuf.StringValue image_path = 5;
|
||||
google.protobuf.Int64Value parent_id = 6;
|
||||
google.protobuf.BoolValue is_active = 7;
|
||||
google.protobuf.Int32Value sort_order = 8;
|
||||
}
|
||||
message GetAllCategoryByFilterResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated GetAllCategoryByFilterResponseModel models = 2;
|
||||
}
|
||||
message GetAllCategoryByFilterResponseModel
|
||||
{
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
string title = 3;
|
||||
google.protobuf.StringValue description = 4;
|
||||
google.protobuf.StringValue image_path = 5;
|
||||
google.protobuf.Int64Value parent_id = 6;
|
||||
bool is_active = 7;
|
||||
int32 sort_order = 8;
|
||||
}
|
||||
98
src/CMSMicroservice.Protobuf/Protos/pruductcategory.proto
Normal file
98
src/CMSMicroservice.Protobuf/Protos/pruductcategory.proto
Normal file
@@ -0,0 +1,98 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pruductcategory;
|
||||
|
||||
import "public_messages.proto";
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
import "google/protobuf/duration.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/api/annotations.proto";
|
||||
|
||||
option csharp_namespace = "CMSMicroservice.Protobuf.Protos.PruductCategory";
|
||||
|
||||
service PruductCategoryContract
|
||||
{
|
||||
rpc CreateNewPruductCategory(CreateNewPruductCategoryRequest) returns (CreateNewPruductCategoryResponse){
|
||||
option (google.api.http) = {
|
||||
post: "/CreateNewPruductCategory"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc UpdatePruductCategory(UpdatePruductCategoryRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
put: "/UpdatePruductCategory"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc DeletePruductCategory(DeletePruductCategoryRequest) returns (google.protobuf.Empty){
|
||||
option (google.api.http) = {
|
||||
delete: "/DeletePruductCategory"
|
||||
body: "*"
|
||||
};
|
||||
};
|
||||
rpc GetPruductCategory(GetPruductCategoryRequest) returns (GetPruductCategoryResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetPruductCategory"
|
||||
|
||||
};
|
||||
};
|
||||
rpc GetAllPruductCategoryByFilter(GetAllPruductCategoryByFilterRequest) returns (GetAllPruductCategoryByFilterResponse){
|
||||
option (google.api.http) = {
|
||||
get: "/GetAllPruductCategoryByFilter"
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
message CreateNewPruductCategoryRequest
|
||||
{
|
||||
string product_id = 1;
|
||||
string category_id = 2;
|
||||
}
|
||||
message CreateNewPruductCategoryResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
}
|
||||
message UpdatePruductCategoryRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
string product_id = 2;
|
||||
string category_id = 3;
|
||||
}
|
||||
message DeletePruductCategoryRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
}
|
||||
message GetPruductCategoryRequest
|
||||
{
|
||||
int64 id = 1;
|
||||
}
|
||||
message GetPruductCategoryResponse
|
||||
{
|
||||
int64 id = 1;
|
||||
string product_id = 2;
|
||||
string category_id = 3;
|
||||
}
|
||||
message GetAllPruductCategoryByFilterRequest
|
||||
{
|
||||
messages.PaginationState pagination_state = 1;
|
||||
google.protobuf.StringValue sort_by = 2;
|
||||
GetAllPruductCategoryByFilterFilter filter = 3;
|
||||
}
|
||||
message GetAllPruductCategoryByFilterFilter
|
||||
{
|
||||
google.protobuf.Int64Value id = 1;
|
||||
google.protobuf.StringValue product_id = 2;
|
||||
google.protobuf.StringValue category_id = 3;
|
||||
}
|
||||
message GetAllPruductCategoryByFilterResponse
|
||||
{
|
||||
messages.MetaData meta_data = 1;
|
||||
repeated GetAllPruductCategoryByFilterResponseModel models = 2;
|
||||
}
|
||||
message GetAllPruductCategoryByFilterResponseModel
|
||||
{
|
||||
int64 id = 1;
|
||||
string product_id = 2;
|
||||
string category_id = 3;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Category;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Category;
|
||||
|
||||
public class CreateNewCategoryRequestValidator : AbstractValidator<CreateNewCategoryRequest>
|
||||
{
|
||||
public CreateNewCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Name)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Title)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.IsActive)
|
||||
.NotNull();
|
||||
RuleFor(model => model.SortOrder)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewCategoryRequest>.CreateWithOptions((CreateNewCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Category;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Category;
|
||||
|
||||
public class DeleteCategoryRequestValidator : AbstractValidator<DeleteCategoryRequest>
|
||||
{
|
||||
public DeleteCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeleteCategoryRequest>.CreateWithOptions((DeleteCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Category;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Category;
|
||||
|
||||
public class GetAllCategoryByFilterRequestValidator : AbstractValidator<GetAllCategoryByFilterRequest>
|
||||
{
|
||||
public GetAllCategoryByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllCategoryByFilterRequest>.CreateWithOptions((GetAllCategoryByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Category;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Category;
|
||||
|
||||
public class GetCategoryRequestValidator : AbstractValidator<GetCategoryRequest>
|
||||
{
|
||||
public GetCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetCategoryRequest>.CreateWithOptions((GetCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.Category;
|
||||
namespace CMSMicroservice.Protobuf.Validator.Category;
|
||||
|
||||
public class UpdateCategoryRequestValidator : AbstractValidator<UpdateCategoryRequest>
|
||||
{
|
||||
public UpdateCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.Name)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.Title)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.IsActive)
|
||||
.NotNull();
|
||||
RuleFor(model => model.SortOrder)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdateCategoryRequest>.CreateWithOptions((UpdateCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
|
||||
public class CreateNewPruductCategoryRequestValidator : AbstractValidator<CreateNewPruductCategoryRequest>
|
||||
{
|
||||
public CreateNewPruductCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.CategoryId)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<CreateNewPruductCategoryRequest>.CreateWithOptions((CreateNewPruductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
|
||||
public class DeletePruductCategoryRequestValidator : AbstractValidator<DeletePruductCategoryRequest>
|
||||
{
|
||||
public DeletePruductCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<DeletePruductCategoryRequest>.CreateWithOptions((DeletePruductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
|
||||
public class GetAllPruductCategoryByFilterRequestValidator : AbstractValidator<GetAllPruductCategoryByFilterRequest>
|
||||
{
|
||||
public GetAllPruductCategoryByFilterRequestValidator()
|
||||
{
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetAllPruductCategoryByFilterRequest>.CreateWithOptions((GetAllPruductCategoryByFilterRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
|
||||
public class GetPruductCategoryRequestValidator : AbstractValidator<GetPruductCategoryRequest>
|
||||
{
|
||||
public GetPruductCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<GetPruductCategoryRequest>.CreateWithOptions((GetPruductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using FluentValidation;
|
||||
using CMSMicroservice.Protobuf.Protos.PruductCategory;
|
||||
namespace CMSMicroservice.Protobuf.Validator.PruductCategory;
|
||||
|
||||
public class UpdatePruductCategoryRequestValidator : AbstractValidator<UpdatePruductCategoryRequest>
|
||||
{
|
||||
public UpdatePruductCategoryRequestValidator()
|
||||
{
|
||||
RuleFor(model => model.Id)
|
||||
.NotNull();
|
||||
RuleFor(model => model.ProductId)
|
||||
.NotEmpty();
|
||||
RuleFor(model => model.CategoryId)
|
||||
.NotEmpty();
|
||||
}
|
||||
public Func<object, string, Task<IEnumerable<string>>> ValidateValue => async (model, propertyName) =>
|
||||
{
|
||||
var result = await ValidateAsync(ValidationContext<UpdatePruductCategoryRequest>.CreateWithOptions((UpdatePruductCategoryRequest)model, x => x.IncludeProperties(propertyName)));
|
||||
if (result.IsValid)
|
||||
return Array.Empty<string>();
|
||||
return result.Errors.Select(e => e.ErrorMessage);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user