1

I'm using $sailsSocket to make my GET and POST requests. My POST request looks like this;

$sailsSocket.post('/schedules/toDateObj', 
    { jobSchedObj: 
        { repair_shop_equipment_id: response.config.data.schedEquip.rsrcId, 
          repair_history_id: response.data.id, 
          technician_id: response.data.technician_id, 
          allotted_time: response.data.allotted_time,
          times: timeObj,
          repair_shop_id: $localstorage.get('shopId')
          }
      })
      .success(function(){
          $location.path('/app/checkin');
      })
      .error(function (response){
          console.log(response);
      });

And here is the table it saves to... screen shot 2015-08-01 at 2 17 15 pm

Everything saves fine I even threw a console.log in my ScheduleController to check what was being inserted in the database with my POST request. Here is the output; screen shot 2015-08-03 at 4 41 09 pm

The problem is when I make a GET request to the Schedule table it comes back with everything except repair_shop_equipment_id. Here is the get request;

 var firstDay = scope.getJobsFor[0];
 var lowerBound = firstDay.open_time;
 var lastDay = scope.getJobsFor[scope.getJobsFor.length - 1];
 var upperBound = lastDay.close_time;
 $sailsSocket.get("/schedules", {params:
     {where: {
         repair_shop_id: scope.shopId,
         technician_id: scope.schedTech.id,  
         repair_shop_equipment_id: scope.schedEquip.rsrcId,
         scheduled_start_time:{ date: {'>':lowerBound, '<':upperBound}}
         }
     }
 })
 .success(function (response){

And this is the response...

screen shot 2015-08-04 at 1 24 25 pm

Here is a link to a Gist with my associated Sails models and the schedule controller;

Is there something wrong with one of my model configurations? Thanks.

Brad W
  • 2,540
  • 2
  • 18
  • 28
  • It could be that you have to populate that association. Try tacking on `?populate=repair_shop_equipment_id` to that get request – Ryan Quinn Aug 06 '15 at 17:35

0 Answers0