@@ -13,6 +13,7 @@ var assert = require('assert');
13
13
var RemoteObjects = require ( 'strong-remoting' ) ;
14
14
var SharedClass = require ( 'strong-remoting' ) . SharedClass ;
15
15
var extend = require ( 'util' ) . _extend ;
16
+ var format = require ( 'util' ) . format ;
16
17
17
18
module . exports = function ( registry ) {
18
19
@@ -452,7 +453,7 @@ module.exports = function(registry) {
452
453
http : { verb : 'get' , path : '/' + pathName } ,
453
454
accepts : { arg : 'refresh' , type : 'boolean' , http : { source : 'query' } } ,
454
455
accessType : 'READ' ,
455
- description : g . f ( 'Fetches belongsTo relation %s.' , relationName ) ,
456
+ description : format ( 'Fetches belongsTo relation %s.' , relationName ) ,
456
457
returns : { arg : relationName , type : modelName , root : true } ,
457
458
} , fn ) ;
458
459
} ;
@@ -476,7 +477,7 @@ module.exports = function(registry) {
476
477
isStatic : false ,
477
478
http : { verb : 'get' , path : '/' + pathName } ,
478
479
accepts : { arg : 'refresh' , type : 'boolean' , http : { source : 'query' } } ,
479
- description : g . f ( 'Fetches hasOne relation %s.' , relationName ) ,
480
+ description : format ( 'Fetches hasOne relation %s.' , relationName ) ,
480
481
accessType : 'READ' ,
481
482
returns : { arg : relationName , type : relation . modelTo . modelName , root : true } ,
482
483
rest : { after : convertNullToNotFoundError . bind ( null , toModelName ) }
@@ -486,7 +487,7 @@ module.exports = function(registry) {
486
487
isStatic : false ,
487
488
http : { verb : 'post' , path : '/' + pathName } ,
488
489
accepts : { arg : 'data' , type : toModelName , http : { source : 'body' } } ,
489
- description : g . f ( 'Creates a new instance in %s of this model.' , relationName ) ,
490
+ description : format ( 'Creates a new instance in %s of this model.' , relationName ) ,
490
491
accessType : 'WRITE' ,
491
492
returns : { arg : 'data' , type : toModelName , root : true }
492
493
} ) ;
@@ -495,15 +496,15 @@ module.exports = function(registry) {
495
496
isStatic : false ,
496
497
http : { verb : 'put' , path : '/' + pathName } ,
497
498
accepts : { arg : 'data' , type : toModelName , http : { source : 'body' } } ,
498
- description : g . f ( 'Update %s of this model.' , relationName ) ,
499
+ description : format ( 'Update %s of this model.' , relationName ) ,
499
500
accessType : 'WRITE' ,
500
501
returns : { arg : 'data' , type : toModelName , root : true }
501
502
} ) ;
502
503
503
504
define ( '__destroy__' + relationName , {
504
505
isStatic : false ,
505
506
http : { verb : 'delete' , path : '/' + pathName } ,
506
- description : g . f ( 'Deletes %s of this model.' , relationName ) ,
507
+ description : format ( 'Deletes %s of this model.' , relationName ) ,
507
508
accessType : 'WRITE' ,
508
509
} ) ;
509
510
} ;
@@ -517,10 +518,10 @@ module.exports = function(registry) {
517
518
isStatic : false ,
518
519
http : { verb : 'get' , path : '/' + pathName + '/:fk' } ,
519
520
accepts : { arg : 'fk' , type : 'any' ,
520
- description : g . f ( 'Foreign key for %s' , relationName ) ,
521
+ description : format ( 'Foreign key for %s' , relationName ) ,
521
522
required : true ,
522
523
http : { source : 'path' } } ,
523
- description : g . f ( 'Find a related item by id for %s.' , relationName ) ,
524
+ description : format ( 'Find a related item by id for %s.' , relationName ) ,
524
525
accessType : 'READ' ,
525
526
returns : { arg : 'result' , type : toModelName , root : true } ,
526
527
rest : { after : convertNullToNotFoundError . bind ( null , toModelName ) }
@@ -531,10 +532,10 @@ module.exports = function(registry) {
531
532
isStatic : false ,
532
533
http : { verb : 'delete' , path : '/' + pathName + '/:fk' } ,
533
534
accepts : { arg : 'fk' , type : 'any' ,
534
- description : g . f ( 'Foreign key for %s' , relationName ) ,
535
+ description : format ( 'Foreign key for %s' , relationName ) ,
535
536
required : true ,
536
537
http : { source : 'path' } } ,
537
- description : g . f ( 'Delete a related item by id for %s.' , relationName ) ,
538
+ description : format ( 'Delete a related item by id for %s.' , relationName ) ,
538
539
accessType : 'WRITE' ,
539
540
returns : [ ]
540
541
} , destroyByIdFunc ) ;
@@ -545,12 +546,12 @@ module.exports = function(registry) {
545
546
http : { verb : 'put' , path : '/' + pathName + '/:fk' } ,
546
547
accepts : [
547
548
{ arg : 'fk' , type : 'any' ,
548
- description : g . f ( 'Foreign key for %s' , relationName ) ,
549
+ description : format ( 'Foreign key for %s' , relationName ) ,
549
550
required : true ,
550
551
http : { source : 'path' } } ,
551
552
{ arg : 'data' , type : toModelName , http : { source : 'body' } } ,
552
553
] ,
553
- description : g . f ( 'Update a related item by id for %s.' , relationName ) ,
554
+ description : format ( 'Update a related item by id for %s.' , relationName ) ,
554
555
accessType : 'WRITE' ,
555
556
returns : { arg : 'result' , type : toModelName , root : true }
556
557
} , updateByIdFunc ) ;
@@ -569,10 +570,10 @@ module.exports = function(registry) {
569
570
isStatic : false ,
570
571
http : { verb : 'put' , path : '/' + pathName + '/rel/:fk' } ,
571
572
accepts : [ { arg : 'fk' , type : 'any' ,
572
- description : g . f ( 'Foreign key for %s' , relationName ) ,
573
+ description : format ( 'Foreign key for %s' , relationName ) ,
573
574
required : true ,
574
575
http : { source : 'path' } } ] . concat ( accepts ) ,
575
- description : g . f ( 'Add a related item by id for %s.' , relationName ) ,
576
+ description : format ( 'Add a related item by id for %s.' , relationName ) ,
576
577
accessType : 'WRITE' ,
577
578
returns : { arg : relationName , type : modelThrough . modelName , root : true }
578
579
} , addFunc ) ;
@@ -582,10 +583,10 @@ module.exports = function(registry) {
582
583
isStatic : false ,
583
584
http : { verb : 'delete' , path : '/' + pathName + '/rel/:fk' } ,
584
585
accepts : { arg : 'fk' , type : 'any' ,
585
- description : g . f ( 'Foreign key for %s' , relationName ) ,
586
+ description : format ( 'Foreign key for %s' , relationName ) ,
586
587
required : true ,
587
588
http : { source : 'path' } } ,
588
- description : g . f ( 'Remove the %s relation to an item by id.' , relationName ) ,
589
+ description : format ( 'Remove the %s relation to an item by id.' , relationName ) ,
589
590
accessType : 'WRITE' ,
590
591
returns : [ ]
591
592
} , removeFunc ) ;
@@ -597,10 +598,10 @@ module.exports = function(registry) {
597
598
isStatic : false ,
598
599
http : { verb : 'head' , path : '/' + pathName + '/rel/:fk' } ,
599
600
accepts : { arg : 'fk' , type : 'any' ,
600
- description : g . f ( 'Foreign key for %s' , relationName ) ,
601
+ description : format ( 'Foreign key for %s' , relationName ) ,
601
602
required : true ,
602
603
http : { source : 'path' } } ,
603
- description : g . f ( 'Check the existence of %s relation to an item by id.' , relationName ) ,
604
+ description : format ( 'Check the existence of %s relation to an item by id.' , relationName ) ,
604
605
accessType : 'READ' ,
605
606
returns : { arg : 'exists' , type : 'boolean' , root : true } ,
606
607
rest : {
@@ -643,7 +644,7 @@ module.exports = function(registry) {
643
644
isStatic : isStatic ,
644
645
http : { verb : 'get' , path : '/' + pathName } ,
645
646
accepts : { arg : 'filter' , type : 'object' } ,
646
- description : g . f ( 'Queries %s of %s.' , scopeName , this . modelName ) ,
647
+ description : format ( 'Queries %s of %s.' , scopeName , this . modelName ) ,
647
648
accessType : 'READ' ,
648
649
returns : { arg : scopeName , type : [ toModelName ] , root : true }
649
650
} ) ;
@@ -652,24 +653,24 @@ module.exports = function(registry) {
652
653
isStatic : isStatic ,
653
654
http : { verb : 'post' , path : '/' + pathName } ,
654
655
accepts : { arg : 'data' , type : toModelName , http : { source : 'body' } } ,
655
- description : g . f ( 'Creates a new instance in %s of this model.' , scopeName ) ,
656
+ description : format ( 'Creates a new instance in %s of this model.' , scopeName ) ,
656
657
accessType : 'WRITE' ,
657
658
returns : { arg : 'data' , type : toModelName , root : true }
658
659
} ) ;
659
660
660
661
define ( '__delete__' + scopeName , {
661
662
isStatic : isStatic ,
662
663
http : { verb : 'delete' , path : '/' + pathName } ,
663
- description : g . f ( 'Deletes all %s of this model.' , scopeName ) ,
664
+ description : format ( 'Deletes all %s of this model.' , scopeName ) ,
664
665
accessType : 'WRITE' ,
665
666
} ) ;
666
667
667
668
define ( '__count__' + scopeName , {
668
669
isStatic : isStatic ,
669
670
http : { verb : 'get' , path : '/' + pathName + '/count' } ,
670
671
accepts : { arg : 'where' , type : 'object' ,
671
- description : g . f ( 'Criteria to match model instances' ) } ,
672
- description : g . f ( 'Counts %s of %s.' , scopeName , this . modelName ) ,
672
+ description : 'Criteria to match model instances' } ,
673
+ description : format ( 'Counts %s of %s.' , scopeName , this . modelName ) ,
673
674
accessType : 'READ' ,
674
675
returns : { arg : 'count' , type : 'number' }
675
676
} ) ;
@@ -718,7 +719,7 @@ module.exports = function(registry) {
718
719
acceptArgs = [
719
720
{
720
721
arg : paramName , type : 'any' , http : { source : 'path' } ,
721
- description : g . f ( 'Foreign key for %s.' , relation . name ) ,
722
+ description : format ( 'Foreign key for %s.' , relation . name ) ,
722
723
required : true ,
723
724
} ,
724
725
] ;
0 commit comments