contracts/user/v1/user.proto

68 lines
1.4 KiB
Protocol Buffer
Raw Normal View History

2024-08-16 10:54:17 +00:00
syntax = "proto3";
2024-08-16 12:58:13 +00:00
package user.v1;
2024-08-16 10:54:17 +00:00
import "google/protobuf/timestamp.proto";
import "google/protobuf/empty.proto";
service UserService {
rpc CreateUser (CreateUserRequest) returns (CreateUserResponse);
rpc ReadUser (ReadUserRequest) returns (ReadUserResponse);
rpc UpdateUser (UpdateUserRequest) returns (google.protobuf.Empty);
rpc DeleteUser (DeleteUserRequest) returns (google.protobuf.Empty);
}
enum Role {
ROLE_SPECTATOR_UNSPECIFIED = 0;
ROLE_PARTICIPANT = 1;
ROLE_MODERATOR = 2;
ROLE_ADMIN = 3;
}
message CreateUserRequest {
message User {
string username = 1;
string password = 2;
reserved 3;
optional google.protobuf.Timestamp expires_at = 4;
Role role = 5;
}
2024-10-09 17:11:40 +00:00
User user = 1;
2024-08-16 10:54:17 +00:00
}
message CreateUserResponse {
int32 id = 1;
}
message ReadUserRequest {
2024-10-09 17:11:40 +00:00
int32 id = 1;
2024-08-16 10:54:17 +00:00
}
message ReadUserResponse {
message User {
int32 id = 1;
string username = 2;
reserved 3;
string password = 4;
google.protobuf.Timestamp expires_at = 5;
google.protobuf.Timestamp created_at = 6;
Role role = 7;
}
User user = 1;
}
message UpdateUserRequest {
message User {
int32 id = 1;
optional string username = 2;
reserved 3;
optional string password = 4;
optional google.protobuf.Timestamp expires_at = 5;
optional Role role = 6;
}
2024-10-09 17:11:40 +00:00
User user = 1;
2024-08-16 10:54:17 +00:00
}
message DeleteUserRequest {
2024-10-09 17:11:40 +00:00
int32 id = 1;
2024-08-16 10:54:17 +00:00
}