From 51e204b64a067a6a7a6416843558911e1deb3d71 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 3 Dec 2023 08:51:40 +0100 Subject: [PATCH] Add frontend for market settlement --- db/market.go | 2 +- db/types.go | 2 +- server/router/handler/market.go | 1 + vue/src/components/Market.vue | 7 +- vue/src/components/MarketSettings.vue | 95 +++++++++++++++++++++++++++ vue/src/index.css | 3 + vue/src/main.js | 4 +- 7 files changed, 110 insertions(+), 4 deletions(-) create mode 100644 vue/src/components/MarketSettings.vue diff --git a/db/market.go b/db/market.go index 54a2a03..1c7f144 100644 --- a/db/market.go +++ b/db/market.go @@ -28,7 +28,7 @@ func (db *DB) CreateMarket(tx *sql.Tx, ctx context.Context, market *Market) erro } func (db *DB) FetchMarket(marketId int, market *Market) error { - if err := db.QueryRow("SELECT id, description, end_date FROM markets WHERE id = $1", marketId).Scan(&market.Id, &market.Description, &market.EndDate); err != nil { + if err := db.QueryRow("SELECT id, description, end_date, pubkey FROM markets WHERE id = $1", marketId).Scan(&market.Id, &market.Description, &market.EndDate, &market.Pubkey); err != nil { return err } return nil diff --git a/db/types.go b/db/types.go index e319670..3b26fd0 100644 --- a/db/types.go +++ b/db/types.go @@ -29,7 +29,7 @@ type ( Id Serial `json:"id"` Description string `json:"description"` EndDate time.Time `json:"endDate"` - Pubkey string + Pubkey string `json:"pubkey"` InvoiceId UUID } Share struct { diff --git a/server/router/handler/market.go b/server/router/handler/market.go index ab71af1..d787e18 100644 --- a/server/router/handler/market.go +++ b/server/router/handler/market.go @@ -44,6 +44,7 @@ func HandleMarket(sc context.ServerContext) echo.HandlerFunc { } data = map[string]any{ "Id": market.Id, + "Pubkey": market.Pubkey, "Description": market.Description, "Shares": shares, } diff --git a/vue/src/components/Market.vue b/vue/src/components/Market.vue index 9ad3c05..ca3076a 100644 --- a/vue/src/components/Market.vue +++ b/vue/src/components/Market.vue @@ -15,27 +15,32 @@ form orders stats + settings - + + + diff --git a/vue/src/index.css b/vue/src/index.css index f6f4a29..c40aa51 100644 --- a/vue/src/index.css +++ b/vue/src/index.css @@ -21,6 +21,9 @@ button:disabled { input { color: #000; } +textarea { + color: #000; +} a { color: #8787a4; diff --git a/vue/src/main.js b/vue/src/main.js index df99e96..26358ad 100644 --- a/vue/src/main.js +++ b/vue/src/main.js @@ -17,6 +17,7 @@ import UserOrders from '@/components/UserOrders' import OrderForm from '@/components/OrderForm' import MarketOrders from '@/components/MarketOrders' import MarketStats from '@/components/MarketStats' +import MarketSettings from '@/components/MarketSettings' const routes = [ { @@ -43,7 +44,8 @@ const routes = [ children: [ { path: 'form', name: 'form', component: OrderForm }, { path: 'orders', name: 'market-orders', component: MarketOrders }, - { path: 'stats', name: 'market-stats', component: MarketStats } + { path: 'stats', name: 'market-stats', component: MarketStats }, + { path: 'settings', name: 'market-settings', component: MarketSettings } ] }, {