Files
medusa-store/packages/authentication/integration-tests/__fixtures__/auth-provider/index.ts
Philip Korsholm 479a8b82a9 feat(authentication, types): Create authentication entities and services (#5979)
* create authentication entities

* ensure hashes are not returned

* re-add integration test argument

* update filterableprops

* update type

* pr feedback

* update serialization

* move finding existing entities and validation to service layer

* update types

* update models

* update user model

* pr feedback

* fix build

* pr feedback

* update integration test fixtures

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
2024-01-08 09:50:12 +01:00

42 lines
852 B
TypeScript

import { SqlEntityManager } from "@mikro-orm/postgresql"
import { AuthProvider } from "@models"
export async function createAuthProviders(
manager: SqlEntityManager,
providerData: any[] = [
{
provider: "manual",
name: "manual",
is_active: true,
},
{
provider: "disabled",
name: "disabled",
},
{
provider: "store",
name: "store",
domain: "store",
is_active: true,
},
{
provider: "admin",
name: "admin",
domain: "admin",
is_active: true,
},
]
): Promise<AuthProvider[]> {
const authProviders: AuthProvider[] = []
for (const provider of providerData) {
const authProvider = manager.create(AuthProvider, provider)
authProviders.push(authProvider)
}
await manager.persistAndFlush(authProviders)
return authProviders
}