This commit is contained in:
2026-02-23 20:44:34 +03:00
parent 2d0bb1c749
commit d675d3ab9f
6 changed files with 1045 additions and 79 deletions

View File

@@ -1,10 +1,11 @@
syntax = "proto3";
option go_package = "./";
package message;
option go_package = "git.madsky.ru/lotti/message/pkg/messages/message";
import "google/protobuf/empty.proto";
import "validate/validate.proto";
service MessageService {
@@ -29,8 +30,8 @@ service MessageService {
// User
message CreateUserRequest {
string email = 1;
string name = 2;
string email = 1 [(validate.rules).string.email = true];
optional string name = 2;
}
message CreateUserResponse {
@@ -38,8 +39,8 @@ message CreateUserResponse {
}
message UpdateUserRequest {
int32 id = 1;
optional string token = 2;
int32 id = 1 [(validate.rules).int32.gt = 0];
optional string token = 2; // todo
optional string description = 3;
}
@@ -48,11 +49,11 @@ message UpdateUserResponse {
}
message GetUserByTokenRequest {
string token = 1;
string token = 1; // todo
}
message GetUserByEmailRequest {
string email = 1;
string email = 1 [(validate.rules).string.email = true];
}
message GetUserResponse {
@@ -82,6 +83,7 @@ message UserForChatResponse {
string email = 3;
optional string description = 4;
optional bool is_admin = 5;
optional string name = 6;
}
// User end
@@ -102,7 +104,11 @@ message CreateChatResponse {
}
message UpdateChatRequest {
string id = 1;
string id = 1 [(validate.rules).string = {
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
min_len: 36,
max_len: 36
}];
repeated UserForChat users = 2;
}
@@ -120,7 +126,7 @@ message GetChatResponse {
message ListChatRequest {
int32 page = 1;
int32 user_id = 2;
int32 user_id = 2 [(validate.rules).int32.gt = 0];
}
message ListChatResponse {
@@ -137,8 +143,12 @@ message Chat {
// Message
message CreateMessageRequest {
string chat_id = 2;
int32 user_id = 3;
string chat_id = 2 [(validate.rules).string = {
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
min_len: 36,
max_len: 36
}];
int32 user_id = 3 [(validate.rules).int32.gt = 0];
optional string text = 4;
optional string image = 5;
optional string video = 6;
@@ -150,8 +160,12 @@ message CreateMessageResponse {
}
message UpdateMessageRequest {
int32 id = 1;
string chat_id = 2;
int32 id = 1 [(validate.rules).int32.gt = 0];
string chat_id = 2 [(validate.rules).string = {
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
min_len: 36,
max_len: 36
}];
optional string text = 3;
optional string image = 4;
optional string video = 5;
@@ -163,7 +177,7 @@ message UpdateMessageResponse {
}
message GetMessageRequest {
int32 id = 1;
int32 id = 1 [(validate.rules).int32.gt = 0];
}
message GetMessageResponse {
@@ -172,7 +186,11 @@ message GetMessageResponse {
message ListMessageRequest {
int32 page = 1;
string chat_id = 2;
string chat_id = 2 [(validate.rules).string = {
pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",
min_len: 36,
max_len: 36
}];
}
message ListMessageResponse {