Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: username undefined #3318

Merged
merged 1 commit into from
Oct 11, 2023
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
11 changes: 0 additions & 11 deletions core/api/src/app/accounts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,3 @@ export const hasPermissions = async (
export const getBusinessMapMarkers = async () => {
return accounts.listBusinessesForMap()
}

export const getUsernameFromWalletId = async (
walletId: WalletId,
): Promise<Username | ApplicationError> => {
const wallet = await WalletsRepository().findById(walletId)
if (wallet instanceof Error) return wallet

const account = await accounts.findById(wallet.accountId)
if (account instanceof Error) return account
return account.username
}
2 changes: 1 addition & 1 deletion core/api/src/app/payments/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const recipientDetailsFromInvoice = async <R extends WalletCurrency>(
recipientWalletDescriptors: AccountWalletDescriptors
pubkey: Pubkey
usdPaymentAmount: UsdPaymentAmount | undefined
username: Username
username: Username | undefined
userId: UserId
}
| ApplicationError
Expand Down
2 changes: 1 addition & 1 deletion core/api/src/domain/accounts/index.types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type AccountStatusHistory = Array<{
type Account = {
readonly id: AccountId
readonly createdAt: Date
username: Username
username?: Username | undefined
defaultWalletId: WalletId
withdrawFee: Satoshis // TODO: make it optional. only save when not default value from yaml
level: AccountLevel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dedent from "dedent"

import { Accounts, Payments } from "@/app"
import { Payments } from "@/app"
import { checkedToWalletId } from "@/domain/wallets"
import { mapAndParseErrorForGqlResponse } from "@/graphql/error-map"
import { GT } from "@/graphql/index"
Expand Down Expand Up @@ -48,14 +48,6 @@ const IntraLedgerPaymentSendMutation = GT.Field<null, GraphQLPublicContextAuth>(
return { errors: [mapAndParseErrorForGqlResponse(recipientWalletIdChecked)] }
}

// TODO: confirm whether we need to check for username here
const recipientUsername = await Accounts.getUsernameFromWalletId(
recipientWalletIdChecked,
)
if (recipientUsername instanceof Error) {
return { errors: [mapAndParseErrorForGqlResponse(recipientUsername)] }
}

const status = await Payments.intraledgerPaymentSendWalletIdForBtcWallet({
recipientWalletId,
memo,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dedent from "dedent"

import { Accounts, Payments } from "@/app"
import { Payments } from "@/app"
import { checkedToWalletId } from "@/domain/wallets"
import { mapAndParseErrorForGqlResponse } from "@/graphql/error-map"
import { GT } from "@/graphql/index"
Expand Down Expand Up @@ -48,14 +48,6 @@ const IntraLedgerUsdPaymentSendMutation = GT.Field<null, GraphQLPublicContextAut
return { errors: [mapAndParseErrorForGqlResponse(recipientWalletIdChecked)] }
}

// TODO: confirm whether we need to check for username here
const recipientUsername = await Accounts.getUsernameFromWalletId(
recipientWalletIdChecked,
)
if (recipientUsername instanceof Error) {
return { errors: [mapAndParseErrorForGqlResponse(recipientUsername)] }
}

const status = await Payments.intraledgerPaymentSendWalletIdForUsdWallet({
recipientWalletId,
memo,
Expand Down