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