diff --git a/Taskfile.yaml b/Taskfile.yaml index 181b872..c7b8053 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -77,4 +77,11 @@ tasks: deps: - release:pre cmds: - - cargo release patch --execute \ No newline at end of file + - cargo release patch --execute + + fmt+lint: + desc: 🎨🧶 format and lint rustler + cmds: + - task fmt + - git add . + - task lint \ No newline at end of file diff --git a/lib/entities/migration/m20240325_200049_create_table_ticker.rs b/lib/entities/migration/m20240325_200049_create_table_ticker.rs index ab50754..5be4d44 100644 --- a/lib/entities/migration/m20240325_200049_create_table_ticker.rs +++ b/lib/entities/migration/m20240325_200049_create_table_ticker.rs @@ -14,6 +14,7 @@ impl MigrationTrait for Migration { .if_not_exists() .col(ColumnDef::new(Ticker::Id).string().not_null().primary_key()) .col(ColumnDef::new(Ticker::Symbol).string().not_null()) + .col(ColumnDef::new(Ticker::QuoteSymbol).string().null()) .col(ColumnDef::new(Ticker::MarketId).string().not_null()) .foreign_key( ForeignKey::create() @@ -45,6 +46,9 @@ enum Ticker { Id, /// Ticker symbol (e.g. "GOOGL") Symbol, + /// Quote symbol (e.g. "USD"): represents the currency in which the ticker is quoted. + /// Could be null, and it will imply USD + QuoteSymbol, /// Market ID MarketId, } diff --git a/lib/entities/orm/ticker.rs b/lib/entities/orm/ticker.rs index 6bca68e..1b341e0 100644 --- a/lib/entities/orm/ticker.rs +++ b/lib/entities/orm/ticker.rs @@ -9,6 +9,7 @@ pub struct Model { #[sea_orm(primary_key, auto_increment = false)] pub id: String, pub symbol: String, + pub quote_symbol: Option, pub market_id: String, } diff --git a/lib/grpc/proto/ticker.proto b/lib/grpc/proto/ticker.proto index cbc3bc1..7fe995f 100644 --- a/lib/grpc/proto/ticker.proto +++ b/lib/grpc/proto/ticker.proto @@ -21,7 +21,8 @@ message Empty { } message Ticker { string id = 1; string symbol = 2; - string market_id = 3; + optional string quote_symbol = 3; + string market_id = 4; } message Tickers { diff --git a/lib/grpc/services/ticker.rs b/lib/grpc/services/ticker.rs index a612291..bd1079c 100644 --- a/lib/grpc/services/ticker.rs +++ b/lib/grpc/services/ticker.rs @@ -20,6 +20,7 @@ impl Ticker { ticker::Model { id: self.id, symbol: self.symbol, + quote_symbol: self.quote_symbol, market_id: self.market_id, } } @@ -29,6 +30,7 @@ impl Ticker { Self { id: model.id, symbol: model.symbol, + quote_symbol: model.quote_symbol, market_id: model.market_id, } }