| syntax = "proto3"; |
| |
| option go_package = ".;proto"; |
| |
| package proto; |
| |
| import "google/protobuf/timestamp.proto"; |
| |
| // UserService handles commands dispatch and user view actions |
| service UserService { |
| rpc GetUser (GetUserRequest) returns (GetUserResponse); |
| rpc ListUsers (ListUserRequest) returns (ListUserResponse); |
| rpc CreateUser (CreateUserRequest) returns (CreateUserResponse); |
| } |
| |
| // DispatchUserCommandRequest is passed when dispatching |
| message DispatchUserCommandRequest { |
| string name = 1; |
| bytes payload = 2; |
| } |
| |
| // User object |
| message User { |
| optional string id = 1; |
| optional google.protobuf.Timestamp create_at = 2; |
| optional google.protobuf.Timestamp update_at = 3; |
| optional google.protobuf.Timestamp delete_at = 4; |
| string username = 5; |
| string password = 6; |
| optional google.protobuf.Timestamp last_password_update = 7; |
| } |
| |
| // GetUserRequest is a request data to read user |
| message GetUserRequest { |
| string id = 1; |
| } |
| |
| // GetUserResponse is a response data to read user |
| message GetUserResponse { |
| User user = 1; |
| } |
| |
| // ListUserRequest is a request data to read all user for a given page |
| message ListUserRequest { |
| int64 page = 1; |
| int64 limit = 2; |
| } |
| |
| // ListUserResponse list of all users |
| message ListUserResponse { |
| repeated User users = 1; |
| int64 page = 2; |
| int64 limit = 3; |
| int64 total = 4; |
| } |
| |
| // CreateUserRequest is a request data to create a user |
| message CreateUserRequest { |
| User user = 1; |
| } |
| |
| // CreateUserResponse is a response data to create a user |
| message CreateUserResponse { |
| User user = 1; |
| } |