* 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>
32 lines
593 B
TypeScript
32 lines
593 B
TypeScript
import { SqlEntityManager } from "@mikro-orm/postgresql"
|
|
import { AuthUser } from "@models"
|
|
|
|
export async function createAuthUsers(
|
|
manager: SqlEntityManager,
|
|
userData: any[] = [
|
|
{
|
|
id: "test-id",
|
|
provider: "manual",
|
|
},
|
|
{
|
|
id: "test-id-1",
|
|
provider: "manual",
|
|
},
|
|
{
|
|
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
|
|
}
|