From 729bf7f421a8c13248cfd39e5bc1a6dc7628c5a4 Mon Sep 17 00:00:00 2001 From: Lucas Colombo Date: Thu, 23 May 2024 16:00:33 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20add=20pub=5Fname=20to=20mar?= =?UTF-8?q?ket=20entities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Taskfile.yaml | 11 ----------- .../m20220101_000001_create_table_market.rs | 4 ++++ lib/entities/orm/market.rs | 1 + lib/grpc/proto/market.proto | 15 ++++++++------- lib/grpc/services/market.rs | 2 ++ 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Taskfile.yaml b/Taskfile.yaml index 987674a..181b872 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -3,16 +3,6 @@ version: '3' tasks: - db:up: - desc: 🗃️ run database migrations (up) - cmds: - - sea migrate up - - db:down: - desc: 🗃️ run database migrations (down) - cmds: - - sea migrate down - run:watch: desc: 🚀 watch rustler cmds: @@ -80,7 +70,6 @@ tasks: cmds: - cargo release major --execute --no-confirm - release: aliases: - "publish" diff --git a/lib/entities/migration/m20220101_000001_create_table_market.rs b/lib/entities/migration/m20220101_000001_create_table_market.rs index a3514bd..6efdae2 100644 --- a/lib/entities/migration/m20220101_000001_create_table_market.rs +++ b/lib/entities/migration/m20220101_000001_create_table_market.rs @@ -15,6 +15,7 @@ impl MigrationTrait for Migration { .col(ColumnDef::new(Market::Id).string().not_null().primary_key()) .col(ColumnDef::new(Market::ShortName).string().not_null()) .col(ColumnDef::new(Market::FullName).string().not_null()) + .col(ColumnDef::new(Market::PubName).string().null()) .col(ColumnDef::new(Market::OpensFrom).unsigned().null()) .col(ColumnDef::new(Market::OpensTill).unsigned().null()) .col(ColumnDef::new(Market::OpenTime).string().null()) @@ -40,6 +41,9 @@ enum Market { ShortName, /// Full name of the market (e.g. "New York Stock Exchange") FullName, + /// Optional name used only as publishing key (public name of the market that, when provided, + /// will replace the short name in the API responses) + PubName, /// Day of the week the market opens (using UTC 0-6, where 0 is Sunday) OpensFrom, /// Day of the week the market closes (using UTC 0-6, where 0 is Sunday) diff --git a/lib/entities/orm/market.rs b/lib/entities/orm/market.rs index 3812041..e7ac722 100644 --- a/lib/entities/orm/market.rs +++ b/lib/entities/orm/market.rs @@ -10,6 +10,7 @@ pub struct Model { pub id: String, pub short_name: String, pub full_name: String, + pub pub_name: Option, pub opens_from: Option, pub opens_till: Option, pub open_time: Option, diff --git a/lib/grpc/proto/market.proto b/lib/grpc/proto/market.proto index c72a099..e0a68c4 100644 --- a/lib/grpc/proto/market.proto +++ b/lib/grpc/proto/market.proto @@ -13,13 +13,14 @@ message Market { string id = 1; string short_name = 2; string full_name = 3; - optional uint32 opens_from = 4; - optional uint32 opens_till = 5; - optional string open_time = 6; - optional string close_time = 7; - optional uint32 pre_market_offset = 8; - optional uint32 post_market_offset = 9; - optional string time_zone_offset = 10; + optional string pub_name = 4; + optional uint32 opens_from = 5; + optional uint32 opens_till = 6; + optional string open_time = 7; + optional string close_time = 8; + optional uint32 pre_market_offset = 9; + optional uint32 post_market_offset = 10; + optional string time_zone_offset = 11; } message Markets { diff --git a/lib/grpc/services/market.rs b/lib/grpc/services/market.rs index 59b3d15..1d78935 100644 --- a/lib/grpc/services/market.rs +++ b/lib/grpc/services/market.rs @@ -22,6 +22,7 @@ impl Market { id: self.id, short_name: self.short_name, full_name: self.full_name, + pub_name: self.pub_name, opens_from: self.opens_from, opens_till: self.opens_till, open_time: self.open_time, @@ -38,6 +39,7 @@ impl Market { id: model.id, short_name: model.short_name, full_name: model.full_name, + pub_name: model.pub_name, opens_from: model.opens_from, opens_till: model.opens_till, open_time: model.open_time,