我使用$ sailsSocket来发出我的GET和POST请求。我的POST请求看起来像这样;
$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);
});
这是它保存的表格......
一切都保存得很好我甚至在ScheduleController中抛出了一个console.log,用我的POST请求检查数据库中插入了什么。这是输出;
问题是,当我向Schedule
表发出GET请求时,它会返回除repair_shop_equipment_id
之外的所有内容。这是获取请求;
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){
这就是回应......
以下是我的关联Sails模型和计划控制器的link到Gist;
我的某个型号配置有问题吗?感谢。