-
-
Save vitiko/149ad9104f11d15e364a745522caa662 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto3"; | |
package schema; | |
import "google/protobuf/timestamp.proto"; | |
import "github.com/mwitkow/go-proto-validators/validator.proto"; | |
// Commercial Paper state entry | |
message CommercialPaper { | |
enum State { | |
ISSUED = 0; | |
TRADING = 1; | |
REDEEMED = 2; | |
} | |
// Issuer and Paper number comprises composite primary key of Commercial paper entry | |
string issuer = 1; | |
string paper_number = 2; | |
string owner = 3; | |
google.protobuf.Timestamp issue_date = 4; | |
google.protobuf.Timestamp maturity_date = 5; | |
int32 face_value = 6; | |
State state = 7; | |
// Additional unique field for entry | |
string external_id = 8; | |
} | |
// CommercialPaperId identifier part | |
message CommercialPaperId { | |
string issuer = 1; | |
string paper_number = 2; | |
} | |
// ExternalId | |
message ExternalId { | |
string id = 1; | |
} | |
// Container for returning multiple entities | |
message CommercialPaperList { | |
repeated CommercialPaper items = 1; | |
} | |
// IssueCommercialPaper event | |
message IssueCommercialPaper { | |
string issuer = 1 [(validator.field) = {string_not_empty : true}]; | |
string paper_number = 2 [(validator.field) = {string_not_empty : true}]; | |
google.protobuf.Timestamp issue_date = 3 [(validator.field) = {msg_exists : true}]; | |
google.protobuf.Timestamp maturity_date = 4 [(validator.field) = {msg_exists : true}]; | |
int32 face_value = 5 [(validator.field) = {int_gt : 0}]; | |
// external_id - once more uniq id of state entry | |
string external_id = 6 [(validator.field) = {string_not_empty : true}]; | |
} | |
// BuyCommercialPaper event | |
message BuyCommercialPaper { | |
string issuer = 1 [(validator.field) = {string_not_empty : true}]; | |
string paper_number = 2 [(validator.field) = {string_not_empty : true}]; | |
string current_owner = 3 [(validator.field) = {string_not_empty : true}]; | |
string new_owner = 4 [(validator.field) = {string_not_empty : true}]; | |
int32 price = 5 [(validator.field) = {int_gt : 0}]; | |
google.protobuf.Timestamp purchase_date = 6 [(validator.field) = {msg_exists : true}]; | |
} | |
// RedeemCommercialPaper event | |
message RedeemCommercialPaper { | |
string issuer = 1 [(validator.field) = {string_not_empty : true}]; | |
string paper_number = 2 [(validator.field) = {string_not_empty : true}]; | |
string redeeming_owner = 3 [(validator.field) = {string_not_empty : true}]; | |
google.protobuf.Timestamp redeem_date = 4 [(validator.field) = {msg_exists : true}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment