File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -175,14 +175,9 @@ export abstract class SoftCrudRepository<
175175 [ pk ] : id ,
176176 } as Condition < T > ;
177177 }
178-
179- //As parent method findById have filter: FilterExcludingWhere<T>
180- //so we need add check here.
181- const entityToRemove = await super . findOne ( filter , options ) ;
182-
183- if ( entityToRemove ) {
184- // Now call super
185- return super . findById ( id , filter , options ) ;
178+ const entity = await super . findById ( id , filter , options ) ;
179+ if ( entity && ! entity . deleted ) {
180+ return entity ;
186181 } else {
187182 throw new HttpErrors . NotFound ( ErrorKeys . EntityNotFound ) ;
188183 }
@@ -194,13 +189,9 @@ export abstract class SoftCrudRepository<
194189 filter ?: Filter < T > ,
195190 options ?: Options ,
196191 ) : Promise < T & Relations > {
197- //As parent method findById have filter: FilterExcludingWhere<T>
198- //so we need add check here.
199- const entityToRemove = await super . findOne ( filter , options ) ;
200-
201- if ( entityToRemove ) {
202- // Now call super
203- return super . findById ( id , filter , options ) ;
192+ const entity = await super . findById ( id , filter , options ) ;
193+ if ( entity ) {
194+ return entity ;
204195 } else {
205196 throw new HttpErrors . NotFound ( ErrorKeys . EntityNotFound ) ;
206197 }
You can’t perform that action at this time.
0 commit comments