Skip to content

Commit

Permalink
fix(backend): Fix minor misalignment's with the User FAPI and BAPI cl…
Browse files Browse the repository at this point in the history
…asses (#2493)

* fix(backend): Fix minor misalignment's with the User FAPI and BAPI classes

* fix(backend): Fix minor misalignment's with the User FAPI and BAPI classes

* fix(backend): Rollback unnecessary changes
  • Loading branch information
panteliselef committed Jan 10, 2024
1 parent 74daf06 commit 448e02e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-carpets-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@clerk/backend': minor
---

Add fullName, primaryEmailAddress, primaryPhoneNumber, primaryWeb3Wallet to User class.
16 changes: 16 additions & 0 deletions packages/backend/src/api/resources/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,20 @@ export class User {
data.create_organization_enabled,
);
}

get primaryEmailAddress() {
return this.emailAddresses.find(({ id }) => id === this.primaryEmailAddressId) ?? null;
}

get primaryPhoneNumber() {
return this.phoneNumbers.find(({ id }) => id === this.primaryPhoneNumberId) ?? null;
}

get primaryWeb3Wallet() {
return this.web3Wallets.find(({ id }) => id === this.primaryWeb3WalletId) ?? null;
}

get fullName() {
return [this.firstName, this.lastName].join(' ').trim() || null;
}
}

0 comments on commit 448e02e

Please sign in to comment.