added explicitSinceSource as model option and only set source to query if option set to true
This commit is contained in:
parent
01f41614dd
commit
4ea8c29bd2
|
@ -893,18 +893,24 @@ module.exports = function(registry) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.trackChanges || options.enableRemoteReplication) {
|
if (options.trackChanges || options.enableRemoteReplication) {
|
||||||
setRemoting(PersistedModel, 'diff', {
|
var diffOptions = {
|
||||||
description: 'Get a set of deltas and conflicts since the given checkpoint.',
|
description: 'Get a set of deltas and conflicts since the given checkpoint.',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
accepts: [
|
accepts: [
|
||||||
{ arg: 'since', type: 'number', description: 'Find deltas since this checkpoint',
|
{arg: 'since', type: 'number', description: 'Find deltas since this checkpoint'},
|
||||||
http: { source: 'form' }},
|
{arg: 'remoteChanges', type: 'array', description: 'an array of change objects',
|
||||||
{ arg: 'remoteChanges', type: 'array', description: 'an array of change objects',
|
http: {source: 'body'}},
|
||||||
http: { source: 'form' }}
|
|
||||||
],
|
],
|
||||||
returns: {arg: 'result', type: 'object', root: true},
|
returns: {arg: 'result', type: 'object', root: true},
|
||||||
http: {verb: 'post', path: '/diff'},
|
http: {verb: 'post', path: '/diff'},
|
||||||
});
|
};
|
||||||
|
// The since argument is not passed in remote requests
|
||||||
|
// set options.explicitSinceSource to true in model config
|
||||||
|
// to explicitly set argument source and ensure its passed
|
||||||
|
if (options.explicitSinceSource) {
|
||||||
|
diffOptions[0].accepts.http = {source: 'query'};
|
||||||
|
}
|
||||||
|
setRemoting(PersistedModel, 'diff', diffOptions);
|
||||||
|
|
||||||
setRemoting(PersistedModel, 'changes', {
|
setRemoting(PersistedModel, 'changes', {
|
||||||
description: 'Get the changes to a model since a given checkpoint.' +
|
description: 'Get the changes to a model since a given checkpoint.' +
|
||||||
|
|
Loading…
Reference in New Issue