@@ -177,6 +177,8 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
177
177
public async updateOne ( req : CrudRequest , dto : DeepPartial < T > ) : Promise < T > {
178
178
const { allowParamsOverride, returnShallow } = req . options . routes . updateOneBase ;
179
179
const paramsFilters = this . getParamFilters ( req . parsed ) ;
180
+ // disable cache while updating
181
+ req . options . query . cache = false ;
180
182
const found = await this . getOneOrFail ( req , returnShallow ) ;
181
183
const toSave = ! allowParamsOverride
182
184
? { ...found , ...dto , ...paramsFilters , ...req . parsed . authPersist }
@@ -200,6 +202,8 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
200
202
* @param dto
201
203
*/
202
204
public async recoverOne ( req : CrudRequest ) : Promise < T > {
205
+ // disable cache while recovering
206
+ req . options . query . cache = false ;
203
207
const found = await this . getOneOrFail ( req , false , true ) ;
204
208
return this . repo . recover ( found ) ;
205
209
}
@@ -212,6 +216,8 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
212
216
public async replaceOne ( req : CrudRequest , dto : DeepPartial < T > ) : Promise < T > {
213
217
const { allowParamsOverride, returnShallow } = req . options . routes . replaceOneBase ;
214
218
const paramsFilters = this . getParamFilters ( req . parsed ) ;
219
+ // disable cache while replacing
220
+ req . options . query . cache = false ;
215
221
const [ _ , found ] = await oO ( this . getOneOrFail ( req , returnShallow ) ) ;
216
222
const toSave = ! allowParamsOverride
217
223
? { ...( found || { } ) , ...dto , ...paramsFilters , ...req . parsed . authPersist }
@@ -247,6 +253,8 @@ export class TypeOrmCrudService<T> extends CrudService<T> {
247
253
*/
248
254
public async deleteOne ( req : CrudRequest ) : Promise < void | T > {
249
255
const { returnDeleted } = req . options . routes . deleteOneBase ;
256
+ // disable cache while deleting
257
+ req . options . query . cache = false ;
250
258
const found = await this . getOneOrFail ( req , returnDeleted ) ;
251
259
const toReturn = returnDeleted
252
260
? plainToClass ( this . entityType , { ...found } )
0 commit comments