@@ -37,7 +37,8 @@ export class ChatService {
3737 chat . date = chatPayload . date ;
3838 chat . ownerId = chatPayload . ownerId ;
3939
40- return await this . chatRepository . save ( chat ) ;
40+ const returnValue = await this . chatRepository . save ( chat ) ;
41+ return returnValue ;
4142 }
4243
4344 async findAll ( filters : any ) : Promise < ChatModel [ ] > {
@@ -53,25 +54,25 @@ export class ChatService {
5354
5455 if ( filters . not ) {
5556 _ . map ( filters . not , ( val , key ) => {
56- params [ ' where' ] [ key ] = Not ( val )
57+ params . where [ key ] = Not ( val )
5758 } )
5859 }
5960
6061 if ( filters . like ) {
6162 _ . map ( filters . like , ( val , key ) => {
62- params [ ' where' ] [ key ] = Like ( val )
63+ params . where [ key ] = Like ( val )
6364 } )
6465 }
6566
6667 if ( filters . in ) {
6768 _ . map ( filters . in , ( val , key ) => {
68- params [ ' where' ] [ key ] = In ( val )
69+ params . where [ key ] = In ( val )
6970 } )
7071 }
7172
7273 if ( filters . any ) {
7374 _ . map ( filters . any , ( val , key ) => {
74- params [ ' where' ] [ key ] = Any ( val )
75+ params . where [ key ] = Any ( val )
7576 } )
7677 }
7778
@@ -86,24 +87,28 @@ export class ChatService {
8687 if ( filters . take ) {
8788 params . take = filters . take ;
8889 }
89- return await this . chatRepository . find ( params ) ;
90+ const returnValue = await this . chatRepository . find ( params ) ;
91+ return returnValue ;
9092 }
9193
9294 async findOneById ( id : number ) : Promise < ChatModel > {
93- return await this . chatRepository . findOne ( id , { cache : true } ) ;
95+ const returnValue = await this . chatRepository . findOne ( id , { cache : true } ) ;
96+ return returnValue ;
9497 }
9598
9699 async update ( paramId : any , entity : IChat ) : Promise < ChatModel > {
97100 await this . chatRepository . update ( paramId , entity ) ;
98- return await this . findOneById ( paramId ) ;
101+ const returnValue = await this . findOneById ( paramId ) ;
102+ return returnValue ;
99103 }
100104
101105 async delete ( paramId : any ) : Promise < void > {
102106 const id = this . getId ( paramId ) ;
103107
104108 try {
105109 await this . chatRepository . delete ( id ) ;
106- } catch ( err ) {
110+ }
111+ catch ( err ) {
107112 throw new NotFoundException ( ) ;
108113 }
109114 }
0 commit comments