import { Prisma } from '@prisma/client' ; import { company , lorem , address , image } from 'faker' ; import { prisma } from 'src/prisma' ; const createChapters = async ( userId ) : Promise < number [ ] > => { const chapterIds = [ ] ; for ( let i = 0 ; i < 4 ; i ++ ) { const name = company . companyName ( ) ; const description = lorem . words ( ) ; const category = lorem . word ( ) ; const chapterData = { name , description , category , creator_id : userId , country : address . country ( ) , city : address . city ( ) , region : address . state ( ) , imageUrl : image . imageUrl ( 640 , 480 , 'tech' , true ) , } ; const chapter = await prisma . chapters . create ( { data : chapterData } ) ; chapterIds . push ( chapter . id ) ; } return chapterIds ; } ; export default createChapters ;