@kipicore/dbcore 1.1.159 → 1.1.161

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.
@@ -30,6 +30,11 @@ export declare class MongooseCommonService<T extends Document> implements IMongo
30
30
  userId?: string;
31
31
  session?: ClientSession;
32
32
  }): Promise<UpdateWriteOpResult | null>;
33
+ hardDelete(filter: FilterQuery<T>, options?: MongooseUpdateQueryOptions<T> & {
34
+ session?: ClientSession;
35
+ }): Promise<{
36
+ deletedCount?: number;
37
+ }>;
33
38
  aggregate(pipeline: PipelineStage[]): Promise<{
34
39
  [key: string]: string | number | object;
35
40
  }[]>;
@@ -99,6 +99,13 @@ class MongooseCommonService {
99
99
  async delete(filter, options = {}) {
100
100
  return this.model.updateMany(filter, { deletedBy: options.userId, deletedAt: new Date() }, options).exec();
101
101
  }
102
+ async hardDelete(filter, options) {
103
+ return this.model
104
+ .deleteMany(filter, {
105
+ session: options?.session,
106
+ })
107
+ .exec();
108
+ }
102
109
  async aggregate(pipeline) {
103
110
  return this.model.aggregate(pipeline).exec();
104
111
  }
@@ -30,6 +30,11 @@ interface IDeleteService<T extends Document> {
30
30
  userId?: string;
31
31
  session?: ClientSession;
32
32
  }): Promise<UpdateWriteOpResult | null>;
33
+ hardDelete(filter: FilterQuery<T>, options?: MongooseUpdateQueryOptions<T> & {
34
+ session?: ClientSession;
35
+ }): Promise<{
36
+ deletedCount?: number;
37
+ }>;
33
38
  }
34
39
  export interface IMongooseCommonService<T extends Document> extends IReadService<T>, IWriteService<T>, IDeleteService<T> {
35
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kipicore/dbcore",
3
- "version": "1.1.159",
3
+ "version": "1.1.161",
4
4
  "description": "Reusable DB core package with Postgres, MongoDB, models, services, interfaces, and types",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",