factory for login user backup

This commit is contained in:
Moriz Wahl 2021-11-23 11:49:06 +01:00
parent a518ed5096
commit 8f066595fc

View File

@ -0,0 +1,18 @@
import Faker from 'faker'
import { define } from 'typeorm-seeding'
import { LoginUserBackup } from '../../entity/LoginUserBackup'
interface LoginUserBackupContext {
passphrase?: string
mnemonicType?: number
}
define(LoginUserBackup, (faker: typeof Faker, context?: LoginUserBackupContext) => {
if (!context) context = {}
const userBackup = new LoginUserBackup()
userBackup.passphrase = context.passphrase ? context.passphrase : faker.random.words(24)
userBackup.mnemonicType = context.mnemonicType ? context.mnemonicType : 2
return userBackup
})