import { getConnection } from 'typeorm' ; import { User } from '../entities/User' ; import { Snake } from '../entities/Snake' ; function setTimestamp ( i ) { const now = new Date ( ) ; now . setMinutes ( now . getMinutes ( ) + i ) ; return now ; } export async function prepareData ( ) { const data = [ ... Array ( 10 ) . keys ( ) ] . map ( ( i ) => ( { name : `user${ i }` , camelCaseColumn : setTimestamp ( i ) , photos : [ { link : `http://photo.com/${ i }` , } , ] , } ) ) ; await getConnection ( ) . getRepository ( User ) . save ( data ) ; } export async function prepareSnakeData ( ) { const data = [ ... Array ( 10 ) . keys ( ) ] . map ( ( i ) => ( { snakeCaseColumn : setTimestamp ( i ) , } ) ) ; await getConnection ( ) . getRepository ( Snake ) . save ( data ) ; }