boolean-uk / team-dev-server-ex-2410-team3

0 stars 0 forks source link

Update seed to create dummy data for Comment #17

Closed sebgro98 closed 8 hours ago

sebgro98 commented 1 day ago

Update the seed.js file to include a function to create dummy data. Connected to: https://github.com/boolean-uk/team-dev-server-ex-2410-team3/issues/3

async function createComment(postId, userId, content) {
  const comment = await prisma.comment.create({
    data: {
      postId,
      userId,
      content
    },
    include: {
      user: true
    }
  })

  console.info('Comment created', comment)

  return comment
}

Also call this function to create a comment as dummy data.

await createComment(post.id, student.id, 'Great post!')
sebgro98 commented 1 day ago

approved

amos1969 commented 1 day ago

Approved