diff --git a/crud.py b/crud.py
index 55cf4ae..0f52c67 100644
--- a/crud.py
+++ b/crud.py
@@ -141,7 +141,7 @@ async def get_stall(user_id: str, stall_id: str) -> Optional[Stall]:
async def get_stalls(user_id: str) -> List[Stall]:
- rows = await db.fetchone(
+ rows = await db.fetchall(
"SELECT * FROM nostrmarket.stalls WHERE user_id = ?",
(user_id,),
)
diff --git a/static/components/stall-list/stall-list.html b/static/components/stall-list/stall-list.html
index 03e8ba2..a039c30 100644
--- a/static/components/stall-list/stall-list.html
+++ b/static/components/stall-list/stall-list.html
@@ -35,73 +35,65 @@
-->
-
+
+
+ {{props.row.config.description}}
+
+
+
+ {{props.row.shipping_zones.filter(z => !!z.name).map(z =>
+ z.name).join(', ')}}
+
+
+
+
+
+
+
+
-
-
-
- {% endraw %}
-
- -->
+
+
+
+
+
+
diff --git a/static/components/stall-list/stall-list.js b/static/components/stall-list/stall-list.js
index 352bcf1..1ca67fe 100644
--- a/static/components/stall-list/stall-list.js
+++ b/static/components/stall-list/stall-list.js
@@ -20,7 +20,44 @@ async function stallList(path) {
shippingZones: []
}
},
- zoneOptions: []
+ zoneOptions: [],
+ stallsTable: {
+ columns: [
+ {
+ name: '',
+ align: 'left',
+ label: '',
+ field: ''
+ },
+ {
+ name: 'id',
+ align: 'left',
+ label: 'Name',
+ field: 'id'
+ },
+ // {
+ // name: 'toggle',
+ // align: 'left',
+ // label: 'Active',
+ // field: ''
+ // },
+ {
+ name: 'description',
+ align: 'left',
+ label: 'Description',
+ field: 'description'
+ },
+ {
+ name: 'shippingZones',
+ align: 'left',
+ label: 'Shipping Zones',
+ field: 'shippingZones'
+ }
+ ],
+ pagination: {
+ rowsPerPage: 10
+ }
+ }
}
},
computed: {
@@ -72,6 +109,19 @@ async function stallList(path) {
LNbits.utils.notifyApiError(error)
}
},
+ getStalls: async function () {
+ try {
+ const {data} = await LNbits.api.request(
+ 'GET',
+ '/nostrmarket/api/v1/stall',
+ this.inkey
+ )
+ console.log('### stalls', data)
+ this.stalls = data.map(s => ({...s, expanded: false}))
+ } catch (error) {
+ LNbits.utils.notifyApiError(error)
+ }
+ },
getZones: async function () {
try {
const {data} = await LNbits.api.request(
@@ -105,6 +155,7 @@ async function stallList(path) {
}
},
created: async function () {
+ await this.getStalls()
await this.getCurrencies()
await this.getZones()
}
diff --git a/views_api.py b/views_api.py
index 393c15b..de83d66 100644
--- a/views_api.py
+++ b/views_api.py
@@ -193,7 +193,7 @@ async def api_update_stall(
event.sig = merchant.sign_hash(bytes.fromhex(event.id))
data.config.event_id = event.id
- # data.config.created_at =
+ # data.config.event_created_at =
stall = await update_stall(wallet.wallet.user, data)
assert stall, "Cannot update stall"
@@ -206,7 +206,7 @@ async def api_update_stall(
logger.warning(ex)
raise HTTPException(
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
- detail="Cannot create stall",
+ detail="Cannot update stall",
)
@@ -226,7 +226,7 @@ async def api_get_stall(stall_id: str, wallet: WalletTypeInfo = Depends(get_key_
logger.warning(ex)
raise HTTPException(
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
- detail="Cannot create stall",
+ detail="Cannot get stall",
)
@@ -239,7 +239,7 @@ async def api_get_stalls(wallet: WalletTypeInfo = Depends(get_key_type)):
logger.warning(ex)
raise HTTPException(
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
- detail="Cannot create stall",
+ detail="Cannot get stalls",
)