See Jee
09/22/2021, 5:35 AMawait this.prismaService.post.findFirst({
where: {
postUid,
}
});
I want to duplicate na data result, is there a function out there I can use?Ryan
09/22/2021, 6:04 AMSee Jee
09/22/2021, 12:20 PMconst post = await this.prismaService.post.findFirst({
where: {
postUid,
}
});
// post <--- I want to create new record of this except with postUid
// something like this
const newPost = post->duplicate()
newPost->create()
Ryan
09/22/2021, 12:39 PMconst post = await this.prismaService.post.findFirst({
where: {
postUid,
}
});
const { id, ...newPost } = post;
await this.prismaService.post.create({ data: newPost });
See Jee
09/23/2021, 3:14 AM