mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 14:03:45 +03:00
[hw-8] add: comment service
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "validate/validate.proto";
|
||||
import "google/api/annotations.proto";
|
||||
import "protoc-gen-openapiv2/options/annotations.proto";
|
||||
@@ -24,27 +25,28 @@ message Comment {
|
||||
int64 user_id = 2 [(validate.rules).int64 = {gt: 0}];
|
||||
int64 sku = 3 [(validate.rules).int64 = {gt: 0}];
|
||||
string text = 4 [(validate.rules).string = {min_len:1, max_len:255}];
|
||||
string created_at = 5; // RFC3339 with ms
|
||||
google.protobuf.Timestamp created_at = 5;
|
||||
}
|
||||
|
||||
message CreateCommentRequest {
|
||||
int64 user_id = 1 [(validate.rules).int64 = {gt: 0}];
|
||||
int64 sku = 2 [(validate.rules).int64 = {gt: 0}];
|
||||
string text = 3 [(validate.rules).string = {min_len:1, max_len:255}];
|
||||
int64 user_id = 1 [(validate.rules).int64 = {gt: 0}];
|
||||
int64 sku = 2 [(validate.rules).int64 = {gt: 0}];
|
||||
string comment = 3 [(validate.rules).string = {min_len:1, max_len:255}];
|
||||
}
|
||||
message CreateCommentResponse {
|
||||
int64 id = 1;
|
||||
}
|
||||
message CreateCommentResponse { Comment comment = 1; }
|
||||
|
||||
message GetCommentRequest {
|
||||
int64 id = 1 [(validate.rules).int64 = {gt:0}];
|
||||
}
|
||||
message GetCommentResponse { Comment comment = 1; }
|
||||
|
||||
message UpdateCommentRequest {
|
||||
int64 id = 1 [(validate.rules).int64 = {gt:0}];
|
||||
int64 user_id = 2 [(validate.rules).int64 = {gt: 0}];
|
||||
string text = 3 [(validate.rules).string = {min_len:1, max_len:255}];
|
||||
message EditCommentRequest {
|
||||
int64 user_id = 1 [(validate.rules).int64 = {gt:0}];
|
||||
int64 comment_id = 2 [(validate.rules).int64 = {gt: 0}];
|
||||
string new_comment = 3 [(validate.rules).string = {min_len:1, max_len:255}];
|
||||
}
|
||||
message UpdateCommentResponse { Comment comment = 1; }
|
||||
|
||||
message ListBySkuRequest {
|
||||
int64 sku = 1 [(validate.rules).int64 = {gt:0}];
|
||||
@@ -65,35 +67,35 @@ service Comments {
|
||||
}
|
||||
};
|
||||
|
||||
rpc Add(CreateCommentRequest) returns (CreateCommentResponse) {
|
||||
rpc CommentAdd(CreateCommentRequest) returns (CreateCommentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/comment/add"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc GetById(GetCommentRequest) returns (GetCommentResponse) {
|
||||
rpc CommentGetByID(GetCommentRequest) returns (GetCommentResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/comment/get-by-id"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc Edit(UpdateCommentRequest) returns (UpdateCommentResponse) {
|
||||
rpc CommentEdit(EditCommentRequest) returns (google.protobuf.Empty) {
|
||||
option (google.api.http) = {
|
||||
post: "/comment/edit"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListBySku(ListBySkuRequest) returns (ListBySkuResponse) {
|
||||
rpc CommentListBySKU(ListBySkuRequest) returns (ListBySkuResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/comment/list-by-sku"
|
||||
body: "*"
|
||||
};
|
||||
}
|
||||
|
||||
rpc ListByUser(ListByUserRequest) returns (ListByUserResponse) {
|
||||
rpc CommentListByUser(ListByUserRequest) returns (ListByUserResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/comment/list-by-user"
|
||||
body: "*"
|
||||
|
||||
Reference in New Issue
Block a user