delete verification user #83
@ -27,10 +27,12 @@ router.post('/:user_id/:action/:id', (req, res) => {
 | 
			
		||||
  const user_id = parseInt(req.params.user_id);
 | 
			
		||||
  const id = parseInt(req.params.id);
 | 
			
		||||
  const action = req.params.action;
 | 
			
		||||
  /*
 | 
			
		||||
  if (users_data.findIndex((item) => item.id === user_id) === -1 || data.findIndex((item) => item.id === id) === -1) {
 | 
			
		||||
    res.status(404).send();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
    */
 | 
			
		||||
  if (action !== 'participate' && action !== 'refuse') {
 | 
			
		||||
    res.status(400).send({ error: 'Invalid action' });
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,17 @@
 | 
			
		||||
      "Музыка"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "id": 1252744945,
 | 
			
		||||
    "username": "Моряков Сергей",
 | 
			
		||||
    "photo": "",
 | 
			
		||||
    "about": "Люблю путешествия и фотографию, обожаю изучать новые культуры.",
 | 
			
		||||
    "email": "sergey.moryakov@example.com",
 | 
			
		||||
    "interests": [
 | 
			
		||||
      "Путешествия и туризм",
 | 
			
		||||
      "Искусство, фотография и дизайн"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "id": 2,
 | 
			
		||||
    "username": "Мария Смирнова",
 | 
			
		||||
@ -218,16 +229,5 @@
 | 
			
		||||
      "Медицина и здоровье",
 | 
			
		||||
      "Спорт, фитнес и ЗОЖ"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
    "id": 1252744945,
 | 
			
		||||
    "username": "Моряков Сергей",
 | 
			
		||||
    "photo": "https://i.pravatar.cc/150?img=50",
 | 
			
		||||
    "about": "Люблю путешествия и фотографию, обожаю изучать новые культуры.",
 | 
			
		||||
    "email": "maria.smirnova@example.com",
 | 
			
		||||
    "interests": [
 | 
			
		||||
      "Путешествия и туризм",
 | 
			
		||||
      "Искусство, фотография и дизайн"
 | 
			
		||||
    ]
 | 
			
		||||
  }
 | 
			
		||||
]
 | 
			
		||||
@ -27,10 +27,12 @@ router.post('/:to_id/:action/:from_id', (req, res) => {
 | 
			
		||||
  const to_id = parseInt(req.params.to_id);
 | 
			
		||||
  const from_id = parseInt(req.params.from_id);
 | 
			
		||||
  const action = req.params.action;
 | 
			
		||||
  /*
 | 
			
		||||
  if (data.findIndex((item) => item.id === to_id) === -1 || data.findIndex((item) => item.id === from_id) === -1) {
 | 
			
		||||
    res.status(404).send();
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
    */
 | 
			
		||||
  if (action !== 'like' && action !== 'dislike') {
 | 
			
		||||
    res.status(400).send({ error: 'Invalid action' });
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user