This commit is contained in:
Ulf Gebhardt 2022-02-02 17:42:20 +01:00
parent 3bfa230833
commit 107d92eef6
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
4 changed files with 0 additions and 24 deletions

View File

@ -1 +0,0 @@
export { LoginUserRoles } from './0003-login_server_tables/LoginUserRoles'

View File

@ -2,7 +2,6 @@ import { Balance } from './Balance'
import { LoginElopageBuys } from './LoginElopageBuys'
import { LoginEmailOptIn } from './LoginEmailOptIn'
import { LoginUser } from './LoginUser'
import { LoginUserRoles } from './LoginUserRoles'
import { LoginUserBackup } from './LoginUserBackup'
import { Migration } from './Migration'
import { ServerUser } from './ServerUser'
@ -20,7 +19,6 @@ export const entities = [
LoginElopageBuys,
LoginEmailOptIn,
LoginUser,
LoginUserRoles,
LoginUserBackup,
Migration,
ServerUser,

View File

@ -1,16 +0,0 @@
import Faker from 'faker'
import { define } from 'typeorm-seeding'
import { LoginUserRoles } from '../../entity/LoginUserRoles'
import { LoginUserRolesContext } from '../interface/UserContext'
define(LoginUserRoles, (faker: typeof Faker, context?: LoginUserRolesContext) => {
if (!context) context = {}
if (!context.userId) throw new Error('LoginUserRoles: No userId present!')
if (!context.roleId) throw new Error('LoginUserRoles: No roleId present!')
const userRoles = new LoginUserRoles()
userRoles.userId = context.userId
userRoles.roleId = context.roleId
return userRoles
})

View File

@ -17,7 +17,6 @@ import { User } from '../../../entity/User'
import { LoginUser } from '../../../entity/LoginUser'
import { LoginUserBackup } from '../../../entity/LoginUserBackup'
import { ServerUser } from '../../../entity/ServerUser'
import { LoginUserRoles } from '../../../entity/LoginUserRoles'
import { Balance } from '../../../entity/Balance'
import { Transaction } from '../../../entity/Transaction'
import { TransactionSignature } from '../../../entity/TransactionSignature'
@ -33,10 +32,6 @@ export const userSeeder = async (factory: Factory, userData: UserInterface): Pro
if (userData.isAdmin) {
await factory(ServerUser)(createServerUserContext(userData)).create()
// This is crazy: we just need the relation to roleId but no role at all
// It works with LoginRoles empty!!
await factory(LoginUserRoles)(createLoginUserRolesContext(loginUser)).create()
}
if (userData.addBalance) {