mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 06:48:02 +01:00
format
This commit is contained in:
parent
a5727a0c92
commit
a035612da3
4 changed files with 26 additions and 9 deletions
|
@ -14,10 +14,10 @@ from .models import (
|
||||||
CreateMarket,
|
CreateMarket,
|
||||||
CreateMarketStalls,
|
CreateMarketStalls,
|
||||||
Market,
|
Market,
|
||||||
|
MarketSettings,
|
||||||
OrderDetail,
|
OrderDetail,
|
||||||
Orders,
|
Orders,
|
||||||
Products,
|
Products,
|
||||||
MarketSettings,
|
|
||||||
Stalls,
|
Stalls,
|
||||||
Zones,
|
Zones,
|
||||||
createOrder,
|
createOrder,
|
||||||
|
@ -456,7 +456,9 @@ async def get_market_chat_by_merchant(ids: List[str]) -> List[ChatMessage]:
|
||||||
|
|
||||||
|
|
||||||
async def get_market_settings(user) -> Optional[MarketSettings]:
|
async def get_market_settings(user) -> Optional[MarketSettings]:
|
||||||
row = await db.fetchone("""SELECT * FROM market.settings WHERE "user" = ?""", (user,))
|
row = await db.fetchone(
|
||||||
|
"""SELECT * FROM market.settings WHERE "user" = ?""", (user,)
|
||||||
|
)
|
||||||
|
|
||||||
return MarketSettings(**row) if row else None
|
return MarketSettings(**row) if row else None
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@
|
||||||
@click="marketDialog.show = true"
|
@click="marketDialog.show = true"
|
||||||
>Create Market
|
>Create Market
|
||||||
<q-tooltip>
|
<q-tooltip>
|
||||||
Makes a simple frontend market for your stalls (not NOSTR)</q-tooltip
|
Makes a simple frontend market for your stalls (not
|
||||||
|
NOSTR)</q-tooltip
|
||||||
></q-btn
|
></q-btn
|
||||||
>
|
>
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
|
@ -596,7 +597,9 @@
|
||||||
this.$q.localStorage.set(`lnbits.market.${this.g.user.id}`, this.keys)
|
this.$q.localStorage.set(`lnbits.market.${this.g.user.id}`, this.keys)
|
||||||
},
|
},
|
||||||
restoreKeys() {
|
restoreKeys() {
|
||||||
let keys = this.$q.localStorage.getItem(`lnbits.market.${this.g.user.id}`)
|
let keys = this.$q.localStorage.getItem(
|
||||||
|
`lnbits.market.${this.g.user.id}`
|
||||||
|
)
|
||||||
if (keys) {
|
if (keys) {
|
||||||
this.keys = keys
|
this.keys = keys
|
||||||
this.stallDialog.data.publickey = this.keys.pubkey
|
this.stallDialog.data.publickey = this.keys.pubkey
|
||||||
|
@ -1027,7 +1030,11 @@
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
getMarkets() {
|
getMarkets() {
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request('GET', '/market/api/v1/markets', this.g.user.wallets[0].inkey)
|
.request(
|
||||||
|
'GET',
|
||||||
|
'/market/api/v1/markets',
|
||||||
|
this.g.user.wallets[0].inkey
|
||||||
|
)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
this.markets = response.data.map(mapMarkets)
|
this.markets = response.data.map(mapMarkets)
|
||||||
|
@ -1318,7 +1325,9 @@
|
||||||
} else {
|
} else {
|
||||||
ws_scheme = 'ws://'
|
ws_scheme = 'ws://'
|
||||||
}
|
}
|
||||||
ws = new WebSocket(ws_scheme + location.host + '/market/ws/' + room_name)
|
ws = new WebSocket(
|
||||||
|
ws_scheme + location.host + '/market/ws/' + room_name
|
||||||
|
)
|
||||||
|
|
||||||
ws.onmessage = async event => {
|
ws.onmessage = async event => {
|
||||||
let event_data = JSON.parse(event.data)
|
let event_data = JSON.parse(event.data)
|
||||||
|
@ -1359,7 +1368,9 @@
|
||||||
await this.getOrders()
|
await this.getOrders()
|
||||||
this.getMarkets()
|
this.getMarkets()
|
||||||
await this.getAllMessages()
|
await this.getAllMessages()
|
||||||
let keys = this.$q.localStorage.getItem(`lnbits.market.${this.g.user.id}`)
|
let keys = this.$q.localStorage.getItem(
|
||||||
|
`lnbits.market.${this.g.user.id}`
|
||||||
|
)
|
||||||
if (keys) {
|
if (keys) {
|
||||||
this.keys = keys
|
this.keys = keys
|
||||||
}
|
}
|
||||||
|
|
|
@ -443,7 +443,9 @@
|
||||||
} else {
|
} else {
|
||||||
ws_scheme = 'ws://'
|
ws_scheme = 'ws://'
|
||||||
}
|
}
|
||||||
ws = new WebSocket(ws_scheme + location.host + '/market/ws/' + room_name)
|
ws = new WebSocket(
|
||||||
|
ws_scheme + location.host + '/market/ws/' + room_name
|
||||||
|
)
|
||||||
|
|
||||||
ws.onmessage = event => {
|
ws.onmessage = event => {
|
||||||
let event_data = JSON.parse(event.data)
|
let event_data = JSON.parse(event.data)
|
||||||
|
|
|
@ -422,7 +422,9 @@ async def api_market_order_shipped(
|
||||||
async def api_market_markets(wallet: WalletTypeInfo = Depends(get_key_type)):
|
async def api_market_markets(wallet: WalletTypeInfo = Depends(get_key_type)):
|
||||||
# await get_market_market_stalls(market_id="FzpWnMyHQMcRppiGVua4eY")
|
# await get_market_market_stalls(market_id="FzpWnMyHQMcRppiGVua4eY")
|
||||||
try:
|
try:
|
||||||
return [market.dict() for market in await get_market_markets(wallet.wallet.user)]
|
return [
|
||||||
|
market.dict() for market in await get_market_markets(wallet.wallet.user)
|
||||||
|
]
|
||||||
except:
|
except:
|
||||||
return {"message": "We could not retrieve the markets."}
|
return {"message": "We could not retrieve the markets."}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue