Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/karate/features/apartments/get_one_rest.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Scenario: returns 401 without token
Given url apiBase + '/api/apartments/00000000-0000-0000-0000-000000000000'
When method get
Then status 401
And match response == { error: 'Unauthorized: No token provided' }
And match response == { error: 'Unauthorized', message: 'Missing or malformed Authorization header' }

Scenario: returns 404 when apartment does not exist
Given url apiBase + '/api/apartments/00000000-0000-0000-0000-000000000000'
Expand Down
2 changes: 1 addition & 1 deletion tests/karate/features/auth/sync-wallet.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feature: POST /api/auth/sync-wallet
* def rows = db.query("SELECT * FROM public.user_wallets WHERE wallet_address = '" + stellarAddress + "'")
And match rows[0].user_id == testUid
And match rows[0].chain_type == 'STELLAR'
And match rows[0].is_primary == 'true'
And match rows[0].is_primary == '#? _ == "true" || _ == "t" || _ == true'

Scenario: Upsert same address updates user_id and is_primary
# Pre-seed the address under tenant-456, then reassign it to testUid via the endpoint
Expand Down
6 changes: 5 additions & 1 deletion webhook/src/routes/auth/sync-wallet.handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const UPSERT_WALLET = `
INSERT INTO public.user_wallets (user_id, wallet_address, chain_type, is_primary)
VALUES ($1, $2, $3, $4)
ON CONFLICT (wallet_address)
DO UPDATE SET user_id = $1, is_primary = $4, updated_at = NOW()
DO UPDATE SET
user_id = EXCLUDED.user_id,
chain_type = EXCLUDED.chain_type,
is_primary = EXCLUDED.is_primary,
updated_at = NOW()
RETURNING id, wallet_address, chain_type, is_primary
`;

Expand Down