fix: add missing typings to create provider identity (#8677)

* fix: add missing typings to create provider identity

* add app_metadata to filterable fields for auth identity
This commit is contained in:
Christian
2024-08-21 07:29:31 +02:00
committed by GitHub
parent 8bd284779e
commit c999b414e7
4 changed files with 24 additions and 5 deletions
@@ -189,4 +189,6 @@ export interface FilterableAuthIdentityProps
*/ */
provider?: string provider?: string
} }
app_metadata?: Record<string, unknown>
} }
@@ -12,6 +12,9 @@ export async function createAuthIdentities(
provider: "manual", provider: "manual",
}, },
], ],
app_metadata: {
user_id: "user-1",
},
}, },
{ {
id: "test-id-1", id: "test-id-1",
@@ -67,6 +67,20 @@ moduleIntegrationTestRunner<IAuthModuleService>({
}), }),
]) ])
}) })
it("should list authIdentities by meta data", async () => {
const authIdentities = await service.listAuthIdentities({
app_metadata: {
user_id: "user-1",
},
})
expect(authIdentities).toEqual([
expect.objectContaining({
id: "test-id",
}),
])
})
}) })
describe("listAndCountAuthIdentities", () => { describe("listAndCountAuthIdentities", () => {
@@ -226,7 +240,9 @@ moduleIntegrationTestRunner<IAuthModuleService>({
const [authIdentity] = await service.listAuthIdentities({ id: [id] }) const [authIdentity] = await service.listAuthIdentities({ id: [id] })
expect(authIdentity).toEqual( expect(authIdentity).toEqual(
expect.objectContaining({ expect.objectContaining({
app_metadata: { email: "test@email.com" }, app_metadata: expect.objectContaining({
email: "test@email.com",
}),
}) })
) )
}) })
@@ -145,10 +145,8 @@ export default class AuthModuleService
) )
return await this.baseRepository_.serialize< return await this.baseRepository_.serialize<
AuthTypes.ProviderIdentityDTO[] AuthTypes.ProviderIdentityDTO | AuthTypes.ProviderIdentityDTO[]
>(providerIdentities, { >(providerIdentities)
populate: true,
})
} }
async authenticate( async authenticate(