import { BigNumber } from '@0x/asset-swapper' ; import { Column , Entity , PrimaryColumn } from 'typeorm' ; import { BigNumberTransformer } from './transformers' ; export type RfqmWorkerHeartbeatOptions = Pick < RfqmWorkerHeartbeatEntity , 'address' | 'balance' | 'index' > & Partial < RfqmWorkerHeartbeatEntity > ; @ Entity ( { name : 'rfqm_worker_heartbeats' } ) export class RfqmWorkerHeartbeatEntity { @ PrimaryColumn ( { name : 'address' , type : 'varchar' } ) public address : string ; @ Column ( { name : 'timestamp' , type : 'timestamptz' , default : ( ) => 'now()' } ) public timestamp ! : Date ; @ Column ( { name : 'balance' , type : 'bigint' , transformer : BigNumberTransformer } ) public balance : BigNumber ; @ Column ( { name : 'index' , type : 'int' } ) public index : number ; constructor ( opts = { } as RfqmWorkerHeartbeatOptions ) { if ( opts . timestamp ) { this . timestamp = opts . timestamp ; } this . address = opts . address ; this . balance = opts . balance ; this . index = opts . index ; } }