import { Prisma } from '@prisma/client' ; import { name , internet } from 'faker' ; import { prisma } from 'src/prisma' ; const createUsers = async ( ) : Promise < [ number , number [ ] ] > => { const userData = { email : 'foo@bar.com' , first_name : name . firstName ( ) , last_name : name . lastName ( ) , } ; const user = await prisma . users . create ( { data : userData } ) ; const othersData = Array . from ( new Array ( 10 ) , ( ) => ( { email : internet . email ( ) , first_name : name . firstName ( ) , last_name : name . lastName ( ) , } ) ) ; const otherIds = ( await Promise . all ( othersData . map ( ( other ) => prisma . users . create ( { data : other } ) ) ) ) . map ( ( other ) => other . id ) ; return [ user . id , otherIds ] ; } ; export default createUsers ;