Guest User

Untitled

a guest
May 3rd, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. main.belongsToMany(left,{through: m_l});
  2. left.belongsToMany(main,{through: m_l});
  3.  
  4. data.belongsToMany(left,{through: l_d});
  5. left.belongsToMany(data,{through: l_d});
  6.  
  7. l_d.belongsToMany(main,{through: ld_m});
  8. main.belongsToMany(l_d,{through: ld_m});
  9. -------------------------------
  10. router.post('/create-link-ldm',(request,response)=>{
  11.     models.db.main.findOne({
  12.         where:{id: request.body.main}
  13.     })
  14.         .then(main=>{
  15.             models.db.l_d.findOne({
  16.                 where: {id: request.body.ld}
  17.             })
  18.                 .then(ld=>{
  19.                     main.addLd(ld);
  20.                     response.json({
  21.                         add: true
  22.                     });
  23.                 })
  24.                 .catch(err=>console.log(err));
  25.         })
  26.         .catch(err=>console.log(err));
  27. });
Advertisement
Add Comment
Please, Sign In to add comment