mirror of
https://github.com/better-auth/better-auth.git
synced 2026-10-25 10:13:54 -05:00
fix: resolve field naming inconsistency in account listing endpoint (#4175)
This commit is contained in:
@@ -349,9 +349,9 @@ describe("account", async () => {
|
||||
|
||||
const accountToUnlink = previousAccounts.data![0];
|
||||
const unlinkAccountId = accountToUnlink.accountId;
|
||||
const providerId = accountToUnlink.provider;
|
||||
const providerId = accountToUnlink.providerId;
|
||||
const accountsWithSameProvider = previousAccounts.data!.filter(
|
||||
(account) => account.provider === providerId,
|
||||
(account) => account.providerId === providerId,
|
||||
);
|
||||
if (accountsWithSameProvider.length <= 1) {
|
||||
return;
|
||||
@@ -412,7 +412,7 @@ describe("account", async () => {
|
||||
});
|
||||
|
||||
const googleAccounts = previousAccounts.data!.filter(
|
||||
(account) => account.provider === "google",
|
||||
(account) => account.providerId === "google",
|
||||
);
|
||||
expect(googleAccounts.length).toBeGreaterThan(1);
|
||||
|
||||
@@ -434,7 +434,7 @@ describe("account", async () => {
|
||||
});
|
||||
|
||||
const remainingGoogleAccounts = accountsAfterUnlink.data!.filter(
|
||||
(account) => account.provider === "google",
|
||||
(account) => account.providerId === "google",
|
||||
);
|
||||
expect(remainingGoogleAccounts.length).toBe(1);
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ export const listUserAccounts = createAuthEndpoint(
|
||||
id: {
|
||||
type: "string",
|
||||
},
|
||||
provider: {
|
||||
providerId: {
|
||||
type: "string",
|
||||
},
|
||||
createdAt: {
|
||||
@@ -47,25 +47,25 @@ export const listUserAccounts = createAuthEndpoint(
|
||||
type: "string",
|
||||
format: "date-time",
|
||||
},
|
||||
},
|
||||
accountId: {
|
||||
type: "string",
|
||||
},
|
||||
scopes: {
|
||||
type: "array",
|
||||
items: {
|
||||
accountId: {
|
||||
type: "string",
|
||||
},
|
||||
scopes: {
|
||||
type: "array",
|
||||
items: {
|
||||
type: "string",
|
||||
},
|
||||
},
|
||||
},
|
||||
required: [
|
||||
"id",
|
||||
"providerId",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
"accountId",
|
||||
"scopes",
|
||||
],
|
||||
},
|
||||
required: [
|
||||
"id",
|
||||
"provider",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
"accountId",
|
||||
"scopes",
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -82,7 +82,7 @@ export const listUserAccounts = createAuthEndpoint(
|
||||
return c.json(
|
||||
accounts.map((a) => ({
|
||||
id: a.id,
|
||||
provider: a.providerId,
|
||||
providerId: a.providerId,
|
||||
createdAt: a.createdAt,
|
||||
updatedAt: a.updatedAt,
|
||||
accountId: a.accountId,
|
||||
|
||||
Reference in New Issue
Block a user