feat: add pub_name to market entities

This commit is contained in:
Lucas Colombo 2024-05-23 16:00:33 -03:00
parent 507da16dea
commit 729bf7f421
Signed by: lucas
GPG Key ID: EF34786CFEFFAE35
5 changed files with 15 additions and 18 deletions

View File

@ -3,16 +3,6 @@
version: '3' version: '3'
tasks: 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: run:watch:
desc: 🚀 watch rustler desc: 🚀 watch rustler
cmds: cmds:
@ -80,7 +70,6 @@ tasks:
cmds: cmds:
- cargo release major --execute --no-confirm - cargo release major --execute --no-confirm
release: release:
aliases: aliases:
- "publish" - "publish"

View File

@ -15,6 +15,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Market::Id).string().not_null().primary_key()) .col(ColumnDef::new(Market::Id).string().not_null().primary_key())
.col(ColumnDef::new(Market::ShortName).string().not_null()) .col(ColumnDef::new(Market::ShortName).string().not_null())
.col(ColumnDef::new(Market::FullName).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::OpensFrom).unsigned().null())
.col(ColumnDef::new(Market::OpensTill).unsigned().null()) .col(ColumnDef::new(Market::OpensTill).unsigned().null())
.col(ColumnDef::new(Market::OpenTime).string().null()) .col(ColumnDef::new(Market::OpenTime).string().null())
@ -40,6 +41,9 @@ enum Market {
ShortName, ShortName,
/// Full name of the market (e.g. "New York Stock Exchange") /// Full name of the market (e.g. "New York Stock Exchange")
FullName, 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) /// Day of the week the market opens (using UTC 0-6, where 0 is Sunday)
OpensFrom, OpensFrom,
/// Day of the week the market closes (using UTC 0-6, where 0 is Sunday) /// Day of the week the market closes (using UTC 0-6, where 0 is Sunday)

View File

@ -10,6 +10,7 @@ pub struct Model {
pub id: String, pub id: String,
pub short_name: String, pub short_name: String,
pub full_name: String, pub full_name: String,
pub pub_name: Option<String>,
pub opens_from: Option<u32>, pub opens_from: Option<u32>,
pub opens_till: Option<u32>, pub opens_till: Option<u32>,
pub open_time: Option<String>, pub open_time: Option<String>,

View File

@ -13,13 +13,14 @@ message Market {
string id = 1; string id = 1;
string short_name = 2; string short_name = 2;
string full_name = 3; string full_name = 3;
optional uint32 opens_from = 4; optional string pub_name = 4;
optional uint32 opens_till = 5; optional uint32 opens_from = 5;
optional string open_time = 6; optional uint32 opens_till = 6;
optional string close_time = 7; optional string open_time = 7;
optional uint32 pre_market_offset = 8; optional string close_time = 8;
optional uint32 post_market_offset = 9; optional uint32 pre_market_offset = 9;
optional string time_zone_offset = 10; optional uint32 post_market_offset = 10;
optional string time_zone_offset = 11;
} }
message Markets { message Markets {

View File

@ -22,6 +22,7 @@ impl Market {
id: self.id, id: self.id,
short_name: self.short_name, short_name: self.short_name,
full_name: self.full_name, full_name: self.full_name,
pub_name: self.pub_name,
opens_from: self.opens_from, opens_from: self.opens_from,
opens_till: self.opens_till, opens_till: self.opens_till,
open_time: self.open_time, open_time: self.open_time,
@ -38,6 +39,7 @@ impl Market {
id: model.id, id: model.id,
short_name: model.short_name, short_name: model.short_name,
full_name: model.full_name, full_name: model.full_name,
pub_name: model.pub_name,
opens_from: model.opens_from, opens_from: model.opens_from,
opens_till: model.opens_till, opens_till: model.opens_till,
open_time: model.open_time, open_time: model.open_time,