import { Block } from 'shared/model/block' ; import { ResponseEntity } from 'shared/model/response' ; export type RawBlock = { [ key ] : any ; } ; export type BlockId = string ; export interface IBlockRepository { add ( block ) : Block ; getGenesisBlock ( ) : Block ; getLastBlock ( ) : Block ; getMany ( required , offset ) : Array < Block > ; has ( blockId ) : boolean ; } export interface IBlockPGRepository { deleteById ( blockId ) : Promise < ResponseEntity < Array < string > > > ; getById ( blockId ) : Promise < Block > ; getGenesisBlock ( ) : Promise < Block > ; getLastBlock ( ) : Promise < Block > ; getLastNBlockIds ( ) : Promise < Array < BlockId > > ; getMany ( limit , offset ) : Promise < ResponseEntity < Array < Block > > > ; isExist ( blockId ) : Promise < boolean > ; save ( block ) : Promise < ResponseEntity < void > > ; }