@mondart/nestjs-common-module 1.1.33 → 1.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,6 +22,8 @@ export declare abstract class CoreCrudService<T extends BaseModelEntity, CreateD
22
22
  update(id: number, updateDto: Partial<UpdateDto> | DeepPartial<T> | QueryDeepPartialEntity<T>, options?: CrudServiceOption<T>): Promise<UpdateResult>;
23
23
  softDelete(query: FindOptionsWhere<T>, options?: CrudServiceOption<T>): Promise<UpdateResult>;
24
24
  softDeleteById(id: string | string[] | number | number[], options?: CrudServiceOption<T>): Promise<UpdateResult>;
25
+ restore(query: FindOptionsWhere<T>, options?: CrudServiceOption<T>): Promise<UpdateResult>;
26
+ restoreById(id: string | string[] | number | number[], options?: CrudServiceOption<T>): Promise<UpdateResult>;
25
27
  delete(query: FindOptionsWhere<T>, options?: CrudServiceOption<T>): Promise<DeleteResult>;
26
28
  deleteById(id: string | string[] | number | number[], options?: CrudServiceOption<T>): Promise<DeleteResult>;
27
29
  private relatedPropertyTransformer;
@@ -210,6 +210,23 @@ class CoreCrudService {
210
210
  return await this.repository.softDelete(id);
211
211
  }
212
212
  }
213
+ async restore(query, options) {
214
+ const formatedQuery = this.whereQueryTransformer(query) ?? undefined;
215
+ if (options?.entityManager) {
216
+ return await options?.entityManager.restore(this.repository.target, formatedQuery);
217
+ }
218
+ else {
219
+ return await this.repository.restore(formatedQuery);
220
+ }
221
+ }
222
+ async restoreById(id, options) {
223
+ if (options?.entityManager) {
224
+ return await options?.entityManager.restore(this.repository.target, id);
225
+ }
226
+ else {
227
+ return await this.repository.restore(id);
228
+ }
229
+ }
213
230
  async delete(query, options) {
214
231
  const formatedQuery = this.whereQueryTransformer(query) ?? undefined;
215
232
  if (options?.entityManager) {