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>
This commit is contained in:
co-authored by
Oli Juhl
parent
6b0b3fed7a
commit
479a8b82a9
@@ -0,0 +1,31 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user