@@ -11,7 +11,7 @@ import { Converter } from './services/resource-converter';
1111import { LocalFilter } from './services/localfilter' ;
1212import { MemoryCache } from './services/memorycache' ;
1313
14- import { IService , ISchema , IResource , ICollection , ICache , IParamsCollection , IParamsResource } from './interfaces' ;
14+ import { IService , ISchema , IResource , ICollection , IExecParams , ICache , IParamsCollection , IParamsResource } from './interfaces' ;
1515// import { IRelationships, IRelationship } from './interfaces';
1616
1717export class Service extends ServiceWithRequests implements IService {
@@ -54,32 +54,34 @@ export class Service extends ServiceWithRequests implements IService {
5454 }
5555
5656 public get < T extends IResource > ( id , params ?: IParamsResource | Function , fc_success ?: Function , fc_error ?: Function ) : T {
57- return this . __exec ( id , params , fc_success , fc_error , 'get' ) ;
57+ // return this.__exec({ id, params, fc_success, fc_error, 'get' });
58+ return this . __exec ( { id : id , params : params , fc_success : fc_success , fc_error : fc_error , exec_type : 'get' } ) ;
5859 }
5960
6061 public delete ( id : string , params ?: Object | Function , fc_success ?: Function , fc_error ?: Function ) : void {
61- this . __exec ( id , params , fc_success , fc_error , 'delete' ) ;
62+ // this.__exec(id, params, fc_success, fc_error, 'delete');
63+ return this . __exec ( { id : id , params : params , fc_success : fc_success , fc_error : fc_error , exec_type : 'delete' } ) ;
6264 }
6365
6466 public all ( params ?: IParamsCollection | Function , fc_success ?: Function , fc_error ?: Function ) : ICollection {
65- return this . __exec ( null , params , fc_success , fc_error , 'all' ) ;
67+ return this . __exec ( { id : null , params : params , fc_success : fc_success , fc_error : fc_error , exec_type : 'all' } ) ;
6668 }
6769
6870 /**
6971 This method sort params for all(), get(), delete() and save()
7072 */
71- protected __exec ( id : string , params : IParamsResource , fc_success , fc_error , exec_type : string ) : any {
72- super . __exec ( id , params , fc_success , fc_error , exec_type ) ;
73+ protected __exec ( exec_params : IExecParams ) : any {
74+ super . __exec ( exec_params ) ;
7375
7476 this . schema = angular . extend ( { } , Base . Schema , this . schema ) ;
7577
76- switch ( exec_type ) {
78+ switch ( exec_params . exec_type ) {
7779 case 'get' :
78- return this . _get ( id , params , fc_success , fc_error ) ;
80+ return this . _get ( exec_params . id , exec_params . params , exec_params . fc_success , exec_params . fc_error ) ;
7981 case 'delete' :
80- return this . _delete ( id , params , fc_success , fc_error ) ;
82+ return this . _delete ( exec_params . id , exec_params . params , exec_params . fc_success , exec_params . fc_error ) ;
8183 case 'all' :
82- return this . _all ( params , fc_success , fc_error ) ;
84+ return this . _all ( exec_params . params , exec_params . fc_success , exec_params . fc_error ) ;
8385 }
8486 }
8587
0 commit comments