Advertisement
elliottchong

copy workflowCards from one workflow to another

Feb 23rd, 2024 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. import { db } from "@cascading/db/prisma";
  2.  
  3. const workflowCards = await db.workflowCard.findMany({
  4. where: {
  5. // this is the ID of the workflow schema that you want to copy from
  6. workflowSchemaId: 'clr711oof0056tnh91cxxcevs'
  7. }
  8. })
  9. await Promise.all(workflowCards.map(async (workflowField) => {
  10. return await db.workflowCard.create({
  11. data: {
  12. name: workflowField.name,
  13. codeName: workflowField.codeName,
  14. order: workflowField.order,
  15. getNextCard: workflowField.getNextCard,
  16. isFirstCard: workflowField.isFirstCard,
  17.  
  18.  
  19. // this is the ID of the workflow schema that you want to copy to
  20. workflowSchemaId: 'clszn5h57001mn0xy36wbcxys'
  21. }
  22. })
  23. }))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement