feat: add merchant profile edit, keys dialog, and publish to Nostr
- Add PATCH endpoint for updating merchant profile config - Add website field to MerchantProfile model - Fix to_nostr_event to include all profile fields (display_name, banner, website, nip05, lud16) - Always publish merchant profile (kind 0) when publishing to Nostr - Extract edit-profile-dialog and nostr-keys-dialog into separate components - Fix profile avatar alignment to match original design - Simplify keys dialog to show only npub QR code (no nsec QR) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
c3dea9f01d
commit
a21b5289c1
12 changed files with 635 additions and 109 deletions
30
views_api.py
30
views_api.py
|
|
@ -62,6 +62,7 @@ from .models import (
|
|||
DirectMessage,
|
||||
DirectMessageType,
|
||||
Merchant,
|
||||
MerchantConfig,
|
||||
Order,
|
||||
OrderReissue,
|
||||
OrderStatusUpdate,
|
||||
|
|
@ -192,6 +193,35 @@ async def api_delete_merchant(
|
|||
await subscribe_to_all_merchants()
|
||||
|
||||
|
||||
@nostrmarket_ext.patch("/api/v1/merchant/{merchant_id}")
|
||||
async def api_update_merchant(
|
||||
merchant_id: str,
|
||||
config: MerchantConfig,
|
||||
wallet: WalletTypeInfo = Depends(require_admin_key),
|
||||
):
|
||||
try:
|
||||
merchant = await get_merchant_for_user(wallet.wallet.user)
|
||||
assert merchant, "Merchant cannot be found"
|
||||
assert merchant.id == merchant_id, "Wrong merchant ID"
|
||||
|
||||
updated_merchant = await update_merchant(
|
||||
wallet.wallet.user, merchant_id, config
|
||||
)
|
||||
return updated_merchant
|
||||
|
||||
except AssertionError as ex:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
detail=str(ex),
|
||||
) from ex
|
||||
except Exception as ex:
|
||||
logger.warning(ex)
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
|
||||
detail="Cannot update merchant",
|
||||
) from ex
|
||||
|
||||
|
||||
@nostrmarket_ext.put("/api/v1/merchant/{merchant_id}/nostr")
|
||||
async def api_republish_merchant(
|
||||
merchant_id: str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue