seed decay start block

This commit is contained in:
Moriz Wahl 2021-11-30 11:14:53 +01:00
parent 43b9f9394b
commit 964b974142
3 changed files with 20 additions and 1 deletions

View File

@ -10,7 +10,7 @@ define(Transaction, (faker: typeof Faker, context?: TransactionContext) => {
const transaction = new Transaction()
transaction.transactionTypeId = context.transactionTypeId ? context.transactionTypeId : 2
transaction.txHash = context.txHash ? context.txHash : randomBytes(48)
transaction.memo = context.memo ? context.memo : faker.lorem.sentence()
transaction.memo = context.memo || context.memo === '' ? context.memo : faker.lorem.sentence()
transaction.received = context.received ? context.received : new Date()
transaction.blockchainTypeId = context.blockchainTypeId ? context.blockchainTypeId : 1
if (context.transactionSendCoin) transaction.transactionSendCoin = context.transactionSendCoin

View File

@ -9,6 +9,7 @@ import { CreatePeterLustigSeed } from './seeds/users/peter-lustig.admin.seed'
import { CreateBibiBloxbergSeed } from './seeds/users/bibi-bloxberg.seed'
import { CreateRaeuberHotzenplotzSeed } from './seeds/users/raeuber-hotzenplotz.seed'
import { CreateBobBaumeisterSeed } from './seeds/users/bob-baumeister.seed'
import { DecayStartBlockSeed } from './seeds/decay-start-block.seed'
const run = async (command: string) => {
// Database actions not supported by our migration library
@ -63,6 +64,7 @@ const run = async (command: string) => {
await runSeeder(CreateBibiBloxbergSeed)
await runSeeder(CreateRaeuberHotzenplotzSeed)
await runSeeder(CreateBobBaumeisterSeed)
await runSeeder(DecayStartBlockSeed)
break
default:
throw new Error(`Unsupported command ${command}`)

View File

@ -0,0 +1,17 @@
import { Factory, Seeder } from 'typeorm-seeding'
import { Transaction } from '../../entity/Transaction'
export class DecayStartBlockSeed implements Seeder {
public async run(factory: Factory): Promise<void> {
await factory(Transaction)({
transactionTypeId: 9,
txHash: Buffer.from(
'9c9c4152b8a4cfbac287eee18d2d262e9de756fae726fc0ca36b788564973fff00000000000000000000000000000000',
'hex',
),
memo: '',
received: new Date('2021-11-30T09:13:26'),
blockchainTypeId: 1,
}).create()
}
}