Feat(auth): Rename authentication to auth (#6229)

**What**
- rename `authenticationModule` -> `authModule`
This commit is contained in:
Philip Korsholm authored and GitHub committed 2024-01-29 10:19:30 +00:00
1 parent a41aad4bea
commit 512b041929
70 files changed
+245 -147

No files matched your search

@@ -0,0 +1,41 @@
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
}
@@ -0,0 +1,34 @@
import { SqlEntityManager } from "@mikro-orm/postgresql"
import { AuthUser } from "@models"
export async function createAuthUsers(
manager: SqlEntityManager,
userData: any[] = [
{
id: "test-id",
entity_id: "test-id",
provider: "manual",
},
{
id: "test-id-1",
entity_id: "test-id-1",
provider: "manual",
},
{
entity_id: "test-id-2",
provider: "store",
},
]
): Promise<AuthUser[]> {
const authUsers: AuthUser[] = []
for (const user of userData) {
const authUser = manager.create(AuthUser, user)
authUsers.push(authUser)
}
await manager.persistAndFlush(authUsers)
return authUsers
}