const apiRouter = require('express').Router();
const getMatches = require('../db/controllers/getMatchesGivenSelfAndOffset.js');
const addToRequests = require('../db/controllers/moveMatchIntoRequests.js');
const addToRejects = require('../db/controllers/moveMatchIntoRejects.js');
const changeToConnectionFromRequest = require('../db/controllers/moveRequestIntoConnectionsGivenSelfIdAndRequestId.js');
const changeToRejectFromRequest = require('../db/controllers/moveRequestIntoRejectsGivenSelfIdAndRequestId.js');
const changeToRejectFromConnection = require('../db/controllers/moveConnectionIntoRejectsGivenSelfIdAndConnectionId.js');

apiRouter.route('/matches')
  .get((req, res) => { // get matches
    getMatches(req.body.id, req.body.offset)
    .then(matches => {
      res.json = matches;
    });
  });

apiRouter.route('/relationships')
  .post((req, res) => {

  }) // post to rejects and requests
  .put((req, res) => {

  });  // change relationship type

apiRouter.route('/profile/:id')
  .put((req, res) => {

  }); // update profile

module.exports = apiRouter;

@@ -782,18 +782,17 @@
 json
- = 
+(
 matches
+)
 ;%0A  
@@ -858,24 +858,391 @@
 , res) =%3E %7B%0A
+    if (req.body.newType === 'request') %7B%0A      return addToRequests(req.body.selfId, req.body.matchId)%0A      .then(() =%3E %7B%0A        res.sendStatus(201);%0A      %7D);%0A    %7D%0A    if (req.body.newType === 'reject') %7B%0A      return addToRejects(req.body.selfId, req.body.matchId)%0A      .then(() =%3E %7B%0A        res.sendStatus(201);%0A      %7D);%0A    %7D%0A    return res.sendStatus(404);
 %0A  %7D) // pos

Handle post to /api/relationships