Now populating many-to-many ids in GET

Fixed a SQL error in foreign key creation

Added endpoint test (failing for now) to check that many-to-many ids in PUT are being used