identity-admin 1.25.15 → 1.25.17

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.
@@ -186,23 +186,30 @@ let DashboardController = DashboardController_1 = class DashboardController {
186
186
  const populatedString = modifiedResource.properties.populatedString;
187
187
  const populationHelper = new PopulationHelper_1.PopulationHelper(resource, PopulationHelper_1.PopulationType.LIST, populatedString);
188
188
  const modifiedPopulatedObject = yield populationHelper.get();
189
- if (!req.query.page && !req.query.perPage) {
190
- records = yield repository.findMany({
191
- sort: sortQuery,
192
- filter,
193
- populate: modifiedPopulatedObject,
194
- });
195
- }
196
- else {
197
- const page = yield repository.paginate({
198
- sort: sortQuery,
199
- filter,
200
- paginateParams: paginateParams,
201
- populate: modifiedPopulatedObject,
202
- });
189
+ if (crudOperations && crudOperations.index && crudOperations.index.index) {
190
+ const page = yield crudOperations.index.index(req, filter, sortQuery, paginateParams, modifiedPopulatedObject, currentUser);
203
191
  records = page.records;
204
192
  pageInfo = page.pageInfo;
205
193
  }
194
+ else {
195
+ if (!req.query.page && !req.query.perPage) {
196
+ records = yield repository.findMany({
197
+ sort: sortQuery,
198
+ filter,
199
+ populate: modifiedPopulatedObject,
200
+ });
201
+ }
202
+ else {
203
+ const page = yield repository.paginate({
204
+ sort: sortQuery,
205
+ filter,
206
+ paginateParams: paginateParams,
207
+ populate: modifiedPopulatedObject,
208
+ });
209
+ records = page.records;
210
+ pageInfo = page.pageInfo;
211
+ }
212
+ }
206
213
  var documents = [];
207
214
  for (var i = 0; i < records.length; i++) {
208
215
  const record = records[i];
@@ -13,14 +13,14 @@ interface IQueryOptions {
13
13
  paginateParams?: PaginateParams;
14
14
  populate?: any;
15
15
  }
16
- interface PageInfo {
16
+ export interface PageInfo {
17
17
  currentPage: number;
18
18
  pagesCount: number;
19
19
  nextPage: number;
20
20
  recordsCount: number;
21
21
  perPage: number;
22
22
  }
23
- interface Page<T> {
23
+ export interface Page<T> {
24
24
  records: T[];
25
25
  pageInfo: PageInfo;
26
26
  }
@@ -1,6 +1,6 @@
1
1
  import { Document, Model } from "mongoose";
2
2
  import { IRequest } from "../middlewares/isAuth";
3
- import { IRepository } from "../repositories/Repository";
3
+ import { IRepository, PageInfo, PaginateParams } from "../repositories/Repository";
4
4
  import SaveResult from "../repositories/SaveResult";
5
5
  import { ActionNames, ActionTypes, FieldTypes, FileTypes, HandlerStrategy, Virtuals } from "./helpers";
6
6
  declare type orderTypes = "asc" | "desc";
@@ -73,6 +73,18 @@ interface ICrudOperations {
73
73
  * @returns the array of documents
74
74
  */
75
75
  after?: (req: IRequest, documents: Document[], currentUser: Document) => Promise<Document[]>;
76
+ /**
77
+ * index handler that gives you the access to the run custom index method with custom query.
78
+ * @returns result list of records
79
+ */
80
+ index?: (req: IRequest, filter: {
81
+ [key: string]: any;
82
+ }, sortQuery: {
83
+ [key: string]: any;
84
+ }, paginateParams: PaginateParams | undefined, populate: any, currentUser: Document) => Promise<{
85
+ records: Document[];
86
+ pageInfo?: PageInfo;
87
+ }>;
76
88
  };
77
89
  create?: {
78
90
  /**
@@ -34,7 +34,8 @@ export declare enum FieldTypes {
34
34
  LOCATION = "LOCATION",
35
35
  HTML = "HTML",
36
36
  RICH_TEXT_I = "RICH_TEXT_I",
37
- RICH_TEXT_II = "RICH_TEXT_II"
37
+ RICH_TEXT_II = "RICH_TEXT_II",
38
+ EXTERNAL_LINK = "EXTERNAL_LINK"
38
39
  }
39
40
  export declare enum FileTypes {
40
41
  ALL = "ALL",
@@ -42,6 +42,7 @@ var FieldTypes;
42
42
  FieldTypes["HTML"] = "HTML";
43
43
  FieldTypes["RICH_TEXT_I"] = "RICH_TEXT_I";
44
44
  FieldTypes["RICH_TEXT_II"] = "RICH_TEXT_II";
45
+ FieldTypes["EXTERNAL_LINK"] = "EXTERNAL_LINK";
45
46
  })(FieldTypes = exports.FieldTypes || (exports.FieldTypes = {}));
46
47
  var FileTypes;
47
48
  (function (FileTypes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "identity-admin",
3
- "version": "1.25.15",
3
+ "version": "1.25.17",
4
4
  "description": "",
5
5
  "main": "lib/Dashboard.js",
6
6
  "types": "lib/Dashbord.d.ts",