protobufs/transactions.proto
2024-07-15 14:43:31 -07:00

77 lines
1.4 KiB
Protocol Buffer

syntax = "proto3";
option go_package = "git.itzana.me/strafesnet/go-grpc/transactions";
package transactions;
import "users.proto";
import "google/protobuf/struct.proto";
service TransactionsService {
rpc Create(TransactionCreate) returns (IdMessage);
rpc Update(TransactionUpdate) returns (NullResponse);
rpc Delete(IdMessage) returns (NullResponse);
rpc Balance(UserIdMessage) returns (BalanceResponse);
rpc Get(IdMessage) returns (TransactionItem);
rpc List(ListRequest) returns (TransactionList);
}
message TransactionCreate {
string ID = 1;
int64 UserID = 2;
int64 Value = 3;
int32 StateID = 4;
google.protobuf.Struct Data = 5;
}
message TransactionUpdate {
string ID = 1;
optional int64 Value = 2;
optional int32 StateID = 3;
optional google.protobuf.Struct Data = 4;
}
message TransactionItem {
string ID = 1;
users.UserResponse User = 2;
int64 Value = 3;
int32 StateID = 4;
int64 Created = 5;
int64 Updated = 6;
google.protobuf.Struct Data = 7;
}
message TransactionFilter {
optional int64 UserID = 1;
optional int32 StateID = 2;
}
message ListRequest {
TransactionFilter Filter = 1;
Pagination Page = 2;
}
message Pagination {
int32 Size = 1;
int32 Number = 2;
}
message TransactionList {
repeated TransactionItem Transactions = 1;
}
message BalanceResponse {
int64 Balance = 1;
}
message IdMessage {
string ID = 1;
}
message UserIdMessage {
int64 UserID = 1;
}
message NullResponse {
}