@vasrefil/api-toolkit 1.0.41 → 1.0.42

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.
@@ -14,7 +14,7 @@ export declare class RootController {
14
14
  fetchAll(condition?: object, query?: FetchAllQuery, select?: string | object, populate?: any): import("mongoose").Query<Omit<any, never>[], any, {}, any>;
15
15
  fetchAllWithPagination: (conditon: object, query?: FetchAllQuery, select?: string | object, populate?: ModelPopulateI[]) => Promise<FetchWithPaginationDataI>;
16
16
  getOneP: (condition: object, select?: any) => Promise<any>;
17
- getOne(condition: any, select?: any): import("mongoose").Query<any, any, {}, any>;
17
+ getOne(condition: any, select?: any, populate?: any): import("mongoose").Query<any, any, {}, any>;
18
18
  getOnePSes: (condition: object, session: ClientSession, select?: string) => Promise<any>;
19
19
  getById: (id: string, select?: string | object) => Promise<any>;
20
20
  getByIdSes: (id: string, session: ClientSession, select?: object | string) => Promise<any>;
@@ -144,13 +144,13 @@ class RootController {
144
144
  const { filter, skip, limit, sort } = query_helper_1.QueryHelper.build_query(query);
145
145
  return this.model.find({ ...filter, ...condition }).select(select).skip(skip).limit(limit).sort(sort).populate(populate);
146
146
  }
147
- getOne(condition, select) {
147
+ getOne(condition, select, populate) {
148
148
  select = select ? select : '';
149
149
  let cond = condition;
150
150
  if (this.modelName === 'User') {
151
151
  cond = { is_deleted: false, ...condition };
152
152
  }
153
- return (this.model.findOne(cond).select(select).lean());
153
+ return (this.model.findOne(cond).select(select).populate(populate).lean());
154
154
  }
155
155
  updateOne(condition, updateValues) {
156
156
  return this.model.updateOne({ ...condition }, { ...updateValues }, { new: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vasrefil/api-toolkit",
3
3
  "description": "This is Vasrefil API toolkit",
4
- "version": "1.0.41",
4
+ "version": "1.0.42",
5
5
  "author": "Sodiq Alabi",
6
6
  "main": "dist/public-api.js",
7
7
  "types": "dist/public-api.d.ts",