fix: numerical IDs

This commit is contained in:
Adam Hong 2021-02-09 16:44:39 -08:00
parent ec8250cf58
commit c2b233015a
2 changed files with 8 additions and 8 deletions

View File

@ -185,7 +185,7 @@ module.exports = function(registry) {
var idDesc = ModelCtor.modelName + ' id';
ModelCtor.sharedCtor.accepts = [
{arg: 'id', type: 'any', required: true, http: {source: 'path'},
{arg: 'id', type: 'string', required: true, http: {source: 'path'},
description: idDesc}
// {arg: 'instance', type: 'object', http: {source: 'body'}}
];

View File

@ -692,7 +692,7 @@ module.exports = function(registry) {
setRemoting(PersistedModel, 'exists', {
description: 'Check whether a model instance exists in the data source.',
accessType: 'READ',
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true},
accepts: {arg: 'id', type: 'string', description: 'Model id', required: true},
returns: {arg: 'exists', type: 'boolean'},
http: [
{verb: 'get', path: '/:id/exists'},
@ -724,7 +724,7 @@ module.exports = function(registry) {
description: 'Find a model instance by {{id}} from the data source.',
accessType: 'READ',
accepts: [
{ arg: 'id', type: 'any', description: 'Model id', required: true,
{ arg: 'id', type: 'string', description: 'Model id', required: true,
http: {source: 'path'}},
{ arg: 'filter', type: 'object',
description: 'Filter defining fields and include' },
@ -738,7 +738,7 @@ module.exports = function(registry) {
description: 'Replace attributes for a model instance and persist it into the data source.',
accessType: 'WRITE',
accepts: [
{ arg: 'id', type: 'any', description: 'Model id', required: true,
{ arg: 'id', type: 'string', description: 'Model id', required: true,
http: { source: 'path' }},
{ arg: 'data', type: 'object', model: typeName, http: { source: 'body' }, description:
'Model instance data' },
@ -807,7 +807,7 @@ module.exports = function(registry) {
aliases: ['destroyById', 'removeById'],
description: 'Delete a model instance by {{id}} from the data source.',
accessType: 'WRITE',
accepts: {arg: 'id', type: 'any', description: 'Model id', required: true,
accepts: {arg: 'id', type: 'string', description: 'Model id', required: true,
http: {source: 'path'}},
http: {verb: 'del', path: '/:id'},
returns: {arg: 'count', type: 'object', root: true}
@ -906,7 +906,7 @@ module.exports = function(registry) {
description: 'Get the most recent change record for this instance.',
accessType: 'READ',
accepts: {
arg: 'id', type: 'any', required: true, http: { source: 'path' },
arg: 'id', type: 'string', required: true, http: { source: 'path' },
description: 'Model id'
},
returns: { arg: 'result', type: this.Change.modelName, root: true },
@ -920,7 +920,7 @@ module.exports = function(registry) {
accessType: 'WRITE',
accepts: [
{
arg: 'id', type: 'any', required: true, http: { source: 'path' },
arg: 'id', type: 'string', required: true, http: { source: 'path' },
description: 'Model id'
},
{
@ -945,7 +945,7 @@ module.exports = function(registry) {
setRemoting(PersistedModel, 'rectifyChange', {
description: 'Tell loopback that a change to the model with the given id has occurred.',
accessType: 'WRITE',
accepts: {arg: 'id', type: 'any', http: {source: 'path'}},
accepts: {arg: 'id', type: 'string', http: {source: 'path'}},
http: {verb: 'post', path: '/:id/rectify-change'}
});
}