identity-admin 1.28.2 → 1.28.5

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.
Files changed (179) hide show
  1. package/README.md +294 -294
  2. package/lib/Dashboard.d.ts +14 -14
  3. package/lib/Dashboard.js +95 -95
  4. package/lib/container/helpers/HelperInversify.d.ts +6 -6
  5. package/lib/container/helpers/HelperInversify.js +10 -10
  6. package/lib/container/helpers/HelperTypes.d.ts +5 -5
  7. package/lib/container/helpers/HelperTypes.js +7 -7
  8. package/lib/container/index.d.ts +1 -1
  9. package/lib/container/index.js +14 -14
  10. package/lib/container/repositories/RepositoryInversify.d.ts +4 -4
  11. package/lib/container/repositories/RepositoryInversify.js +13 -13
  12. package/lib/container/repositories/RepositoryTypes.d.ts +4 -4
  13. package/lib/container/repositories/RepositoryTypes.js +6 -6
  14. package/lib/container/types.d.ts +8 -8
  15. package/lib/container/types.js +9 -9
  16. package/lib/controllers/ActionController.d.ts +8 -8
  17. package/lib/controllers/ActionController.js +96 -96
  18. package/lib/controllers/AdminNotificationController.d.ts +8 -8
  19. package/lib/controllers/AdminNotificationController.js +69 -69
  20. package/lib/controllers/DashboardController.d.ts +44 -44
  21. package/lib/controllers/DashboardController.js +787 -787
  22. package/lib/controllers/ResourceController.d.ts +15 -15
  23. package/lib/controllers/ResourceController.js +135 -135
  24. package/lib/helpers/ActionsGenerator.d.ts +11 -11
  25. package/lib/helpers/ActionsGenerator.js +179 -179
  26. package/lib/helpers/AdminNotifications/AdminNotificationCreation.d.ts +49 -49
  27. package/lib/helpers/AdminNotifications/AdminNotificationCreation.js +66 -66
  28. package/lib/helpers/AdminNotifications/AdminNotificationFetcher.d.ts +51 -51
  29. package/lib/helpers/AdminNotifications/AdminNotificationFetcher.js +39 -39
  30. package/lib/helpers/FilterQueryHelper.d.ts +9 -9
  31. package/lib/helpers/FilterQueryHelper.js +83 -83
  32. package/lib/helpers/FiltersHelper.d.ts +9 -9
  33. package/lib/helpers/FiltersHelper.js +126 -126
  34. package/lib/helpers/LocalesHelper.d.ts +4 -4
  35. package/lib/helpers/LocalesHelper.js +73 -73
  36. package/lib/helpers/LocalizedStringHelper.d.ts +11 -11
  37. package/lib/helpers/LocalizedStringHelper.js +74 -74
  38. package/lib/helpers/Permissions/PermissionFetcher.d.ts +8 -8
  39. package/lib/helpers/Permissions/PermissionFetcher.js +95 -95
  40. package/lib/helpers/Permissions/PermissionLabel.d.ts +2 -2
  41. package/lib/helpers/Permissions/PermissionLabel.js +42 -42
  42. package/lib/helpers/Permissions/PermissionMapper.d.ts +13 -13
  43. package/lib/helpers/Permissions/PermissionMapper.js +35 -35
  44. package/lib/helpers/Permissions/PermissionResource.d.ts +6 -6
  45. package/lib/helpers/Permissions/PermissionResource.js +62 -62
  46. package/lib/helpers/Permissions/PermissionSavingService.d.ts +13 -13
  47. package/lib/helpers/Permissions/PermissionSavingService.js +32 -32
  48. package/lib/helpers/Permissions/SavePermissionGroup.d.ts +6 -6
  49. package/lib/helpers/Permissions/SavePermissionGroup.js +32 -32
  50. package/lib/helpers/Permissions/UpdatePermissionGroup.d.ts +6 -6
  51. package/lib/helpers/Permissions/UpdatePermissionGroup.js +50 -50
  52. package/lib/helpers/Permissions/types.d.ts +17 -17
  53. package/lib/helpers/Permissions/types.js +2 -2
  54. package/lib/helpers/PopulationHelper.d.ts +12 -12
  55. package/lib/helpers/PopulationHelper.js +50 -50
  56. package/lib/helpers/RecordsCounter.d.ts +10 -10
  57. package/lib/helpers/RecordsCounter.js +33 -33
  58. package/lib/helpers/ReportsGenerator.d.ts +26 -26
  59. package/lib/helpers/ReportsGenerator.js +162 -162
  60. package/lib/helpers/ResourceGenerator.d.ts +9 -9
  61. package/lib/helpers/ResourceGenerator.js +172 -172
  62. package/lib/helpers/ResourceHelper.d.ts +28 -28
  63. package/lib/helpers/ResourceHelper.js +395 -395
  64. package/lib/helpers/RportsGenerator.d.ts +10 -10
  65. package/lib/helpers/RportsGenerator.js +21 -21
  66. package/lib/helpers/SchemaGenerator.d.ts +7 -7
  67. package/lib/helpers/SchemaGenerator.js +130 -130
  68. package/lib/helpers/SchemaHelper.d.ts +5 -5
  69. package/lib/helpers/SchemaHelper.js +21 -21
  70. package/lib/helpers/UserActionsLog/UserActionsLogHelper.d.ts +2 -2
  71. package/lib/helpers/UserActionsLog/UserActionsLogHelper.js +49 -49
  72. package/lib/locales/en.json +53 -53
  73. package/lib/middlewares/cache/decorator.d.ts +3 -3
  74. package/lib/middlewares/cache/decorator.js +60 -60
  75. package/lib/middlewares/cache/deletionMethods.d.ts +3 -3
  76. package/lib/middlewares/cache/deletionMethods.js +23 -23
  77. package/lib/middlewares/isAuth.d.ts +13 -13
  78. package/lib/middlewares/isAuth.js +43 -43
  79. package/lib/models/ModelNames.d.ts +9 -9
  80. package/lib/models/ModelNames.js +12 -12
  81. package/lib/models/adminNotification/AdminNotification.d.ts +5 -5
  82. package/lib/models/adminNotification/AdminNotification.js +53 -53
  83. package/lib/models/adminNotification/IAdminNotification.d.ts +30 -30
  84. package/lib/models/adminNotification/IAdminNotification.js +15 -15
  85. package/lib/models/adminpermission/AdminPermission.d.ts +11 -11
  86. package/lib/models/adminpermission/AdminPermission.js +23 -23
  87. package/lib/models/adminpermission/IAdminPermission.d.ts +13 -13
  88. package/lib/models/adminpermission/IAdminPermission.js +2 -2
  89. package/lib/models/customPage/CustomPage.d.ts +2 -2
  90. package/lib/models/customPage/CustomPage.js +38 -38
  91. package/lib/models/customPage/ICustomPage.d.ts +17 -17
  92. package/lib/models/customPage/ICustomPage.js +2 -2
  93. package/lib/models/file/File.d.ts +2 -2
  94. package/lib/models/file/File.js +23 -23
  95. package/lib/models/file/IFile.d.ts +15 -15
  96. package/lib/models/file/IFile.js +2 -2
  97. package/lib/models/location/ILocation.d.ts +14 -14
  98. package/lib/models/location/ILocation.js +2 -2
  99. package/lib/models/location/Location.d.ts +2 -2
  100. package/lib/models/location/Location.js +21 -21
  101. package/lib/models/modelConfiguration/IModelConfigurations.d.ts +29 -29
  102. package/lib/models/modelConfiguration/IModelConfigurations.js +2 -2
  103. package/lib/models/modelConfiguration/ModelConfiguration.d.ts +13 -13
  104. package/lib/models/modelConfiguration/ModelConfiguration.js +95 -95
  105. package/lib/models/permission/IPermission.d.ts +14 -14
  106. package/lib/models/permission/IPermission.js +2 -2
  107. package/lib/models/permission/Permission.d.ts +2 -2
  108. package/lib/models/permission/Permission.js +21 -21
  109. package/lib/models/request-log/IRequestLog.d.ts +22 -22
  110. package/lib/models/request-log/IRequestLog.js +2 -2
  111. package/lib/models/request-log/RequestLog.d.ts +3 -3
  112. package/lib/models/request-log/RequestLog.js +51 -51
  113. package/lib/models/userActionsLog/IUserActionsLog.d.ts +26 -26
  114. package/lib/models/userActionsLog/IUserActionsLog.js +11 -11
  115. package/lib/models/userActionsLog/UserActionsLog.d.ts +3 -3
  116. package/lib/models/userActionsLog/UserActionsLog.js +41 -41
  117. package/lib/pdf/ReportTemplate.d.ts +71 -71
  118. package/lib/pdf/ReportTemplate.js +94 -94
  119. package/lib/repositories/AdminNotificationRepository.d.ts +7 -7
  120. package/lib/repositories/AdminNotificationRepository.js +23 -23
  121. package/lib/repositories/DashboardRepository.d.ts +5 -5
  122. package/lib/repositories/DashboardRepository.js +12 -12
  123. package/lib/repositories/Repository.d.ts +68 -68
  124. package/lib/repositories/Repository.js +215 -215
  125. package/lib/repositories/RequestLogRepository.d.ts +10 -10
  126. package/lib/repositories/RequestLogRepository.js +54 -54
  127. package/lib/repositories/SaveResult.d.ts +14 -14
  128. package/lib/repositories/SaveResult.js +18 -18
  129. package/lib/resources/AdminNotificationsResource.d.ts +3 -3
  130. package/lib/resources/AdminNotificationsResource.js +23 -23
  131. package/lib/resources/parents.d.ts +4 -4
  132. package/lib/resources/parents.js +7 -7
  133. package/lib/router/index.d.ts +8 -8
  134. package/lib/router/index.js +104 -104
  135. package/lib/types/DashbordConfig.d.ts +21 -21
  136. package/lib/types/DashbordConfig.js +2 -2
  137. package/lib/types/IConfigurationFile.d.ts +11 -11
  138. package/lib/types/IConfigurationFile.js +2 -2
  139. package/lib/types/IResourceFile.d.ts +710 -701
  140. package/lib/types/IResourceFile.js +2 -2
  141. package/lib/types/IResourceResponse.d.ts +95 -95
  142. package/lib/types/IResourceResponse.js +2 -2
  143. package/lib/types/helpers.d.ts +66 -66
  144. package/lib/types/helpers.js +77 -77
  145. package/lib/utils/DateUtils.d.ts +7 -7
  146. package/lib/utils/DateUtils.js +45 -45
  147. package/lib/utils/ResourceUtils.d.ts +2 -2
  148. package/lib/utils/ResourceUtils.js +7 -7
  149. package/lib/utils/ResponseUtils.d.ts +11 -11
  150. package/lib/utils/ResponseUtils.js +41 -41
  151. package/lib/utils/StringUtils.d.ts +9 -9
  152. package/lib/utils/StringUtils.js +46 -46
  153. package/lib/view/asset-manifest.json +18 -18
  154. package/lib/view/assets/icons/delete_icon.svg +3 -3
  155. package/lib/view/assets/icons/flags/ic_flag_cn.svg +9 -9
  156. package/lib/view/assets/icons/flags/ic_flag_sa.svg +9 -9
  157. package/lib/view/assets/icons/flags/ic_flag_vn.svg +9 -9
  158. package/lib/view/assets/icons/info_icon.svg +3 -3
  159. package/lib/view/assets/icons/navbar/ic_banking.svg +5 -5
  160. package/lib/view/assets/icons/navbar/ic_invoice.svg +4 -4
  161. package/lib/view/assets/icons/navbar/ic_kanban.svg +7 -7
  162. package/lib/view/assets/icons/navbar/ic_menu_item.svg +8 -8
  163. package/lib/view/assets/icons/small_info_icon.svg +3 -3
  164. package/lib/view/assets/illustrations/Group 16.svg +4 -4
  165. package/lib/view/assets/illustrations/logo.svg +5 -5
  166. package/lib/view/favicon/browserconfig.xml +9 -9
  167. package/lib/view/favicon/safari-pinned-tab.svg +182 -182
  168. package/lib/view/favicon/site.webmanifest +19 -19
  169. package/lib/view/fonts/index.css +18 -18
  170. package/lib/view/index.html +52 -52
  171. package/lib/view/manifest.json +20 -20
  172. package/lib/view/robots.txt +3 -3
  173. package/lib/view/static/css/main.54de06ef.css +1 -1
  174. package/lib/view/static/js/574.778b5963.chunk.js +1 -1
  175. package/lib/view/static/js/678.521704a3.chunk.js +1 -1
  176. package/lib/view/static/js/798.54856416.chunk.js +1 -1
  177. package/lib/view/static/js/main.4687f255.js +2 -2
  178. package/lib/view/static/js/main.4687f255.js.LICENSE.txt +214 -214
  179. package/package.json +63 -63
@@ -1,60 +1,60 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.cached = void 0;
13
- require("reflect-metadata");
14
- var cache = require('memory-cache');
15
- function cached(
16
- /*
17
- Duration in ms
18
- */
19
- duration,
20
- /*
21
- A handler in case you would like to change any information in the cached data
22
- */
23
- cachedResponseModifier) {
24
- return function (target, propertyKey, descriptor) {
25
- const originalMethod = descriptor.value;
26
- descriptor.value = function (req, res, ...args) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- const headers = req.headers;
29
- const requestLanguage = headers['language'] || 'en';
30
- const requestPath = req.path;
31
- const requestQuery = Object.keys(req.query).length > 0 ? JSON.stringify(sortObject(req.query)) : undefined;
32
- var cacheKey = `${requestPath}_${requestLanguage}`;
33
- if (requestQuery)
34
- cacheKey += `_${requestQuery}`;
35
- const cachedData = cache.get(cacheKey);
36
- if (cachedData) {
37
- const parsedData = JSON.parse(cachedData);
38
- return res.send(cachedResponseModifier ? yield cachedResponseModifier(parsedData, req) : parsedData);
39
- }
40
- const originalSend = res.send;
41
- res.send = function (body) {
42
- cache.put(cacheKey, body, duration);
43
- return originalSend.call(this, body);
44
- };
45
- const result = yield originalMethod.apply(this, [req, res, ...args]);
46
- return result;
47
- });
48
- };
49
- return descriptor;
50
- };
51
- }
52
- exports.cached = cached;
53
- function sortObject(obj) {
54
- return Object.keys(obj)
55
- .sort()
56
- .reduce((sorted, key) => {
57
- sorted[key] = obj[key];
58
- return sorted;
59
- }, {});
60
- }
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.cached = void 0;
13
+ require("reflect-metadata");
14
+ var cache = require('memory-cache');
15
+ function cached(
16
+ /*
17
+ Duration in ms
18
+ */
19
+ duration,
20
+ /*
21
+ A handler in case you would like to change any information in the cached data
22
+ */
23
+ cachedResponseModifier) {
24
+ return function (target, propertyKey, descriptor) {
25
+ const originalMethod = descriptor.value;
26
+ descriptor.value = function (req, res, ...args) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const headers = req.headers;
29
+ const requestLanguage = headers['language'] || 'en';
30
+ const requestPath = req.path;
31
+ const requestQuery = Object.keys(req.query).length > 0 ? JSON.stringify(sortObject(req.query)) : undefined;
32
+ var cacheKey = `${requestPath}_${requestLanguage}`;
33
+ if (requestQuery)
34
+ cacheKey += `_${requestQuery}`;
35
+ const cachedData = cache.get(cacheKey);
36
+ if (cachedData) {
37
+ const parsedData = JSON.parse(cachedData);
38
+ return res.send(cachedResponseModifier ? yield cachedResponseModifier(parsedData, req) : parsedData);
39
+ }
40
+ const originalSend = res.send;
41
+ res.send = function (body) {
42
+ cache.put(cacheKey, body, duration);
43
+ return originalSend.call(this, body);
44
+ };
45
+ const result = yield originalMethod.apply(this, [req, res, ...args]);
46
+ return result;
47
+ });
48
+ };
49
+ return descriptor;
50
+ };
51
+ }
52
+ exports.cached = cached;
53
+ function sortObject(obj) {
54
+ return Object.keys(obj)
55
+ .sort()
56
+ .reduce((sorted, key) => {
57
+ sorted[key] = obj[key];
58
+ return sorted;
59
+ }, {});
60
+ }
@@ -1,3 +1,3 @@
1
- export declare function deleteAllCacheEntries(): void;
2
- export declare function deleteCacheEntry(key: string): void;
3
- export declare function deleteAllCacheEntriesByPathName(pathName: string): void;
1
+ export declare function deleteAllCacheEntries(): void;
2
+ export declare function deleteCacheEntry(key: string): void;
3
+ export declare function deleteAllCacheEntriesByPathName(pathName: string): void;
@@ -1,23 +1,23 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteAllCacheEntriesByPathName = exports.deleteCacheEntry = exports.deleteAllCacheEntries = void 0;
4
- var cache = require('memory-cache');
5
- function deleteAllCacheEntries() {
6
- cache.clear();
7
- }
8
- exports.deleteAllCacheEntries = deleteAllCacheEntries;
9
- function deleteCacheEntry(key) {
10
- cache.del(key);
11
- }
12
- exports.deleteCacheEntry = deleteCacheEntry;
13
- function deleteAllCacheEntriesByPathName(pathName) {
14
- const cacheEntriesKeys = cache.keys();
15
- cacheEntriesKeys.forEach((cacheEntryKey) => {
16
- const parsedKey = cacheEntryKey.split('_');
17
- const cachedPathName = parsedKey[0];
18
- if (pathName === cachedPathName) {
19
- cache.del(cacheEntryKey);
20
- }
21
- });
22
- }
23
- exports.deleteAllCacheEntriesByPathName = deleteAllCacheEntriesByPathName;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteAllCacheEntriesByPathName = exports.deleteCacheEntry = exports.deleteAllCacheEntries = void 0;
4
+ var cache = require('memory-cache');
5
+ function deleteAllCacheEntries() {
6
+ cache.clear();
7
+ }
8
+ exports.deleteAllCacheEntries = deleteAllCacheEntries;
9
+ function deleteCacheEntry(key) {
10
+ cache.del(key);
11
+ }
12
+ exports.deleteCacheEntry = deleteCacheEntry;
13
+ function deleteAllCacheEntriesByPathName(pathName) {
14
+ const cacheEntriesKeys = cache.keys();
15
+ cacheEntriesKeys.forEach((cacheEntryKey) => {
16
+ const parsedKey = cacheEntryKey.split('_');
17
+ const cachedPathName = parsedKey[0];
18
+ if (pathName === cachedPathName) {
19
+ cache.del(cacheEntryKey);
20
+ }
21
+ });
22
+ }
23
+ exports.deleteAllCacheEntriesByPathName = deleteAllCacheEntriesByPathName;
@@ -1,13 +1,13 @@
1
- import { NextFunction, Request, Response } from "express";
2
- import { AuthenticateMiddleWare } from "../types/DashbordConfig";
3
- import { Document } from "mongoose";
4
- export interface IRequest extends Request {
5
- user: Document;
6
- language: string;
7
- timezone: string;
8
- startTime: Date;
9
- }
10
- export declare const defaultHeaders: (req: IRequest, res: Response, next: NextFunction) => void;
11
- export declare const authenticate: (req: IRequest, res: Response, next: NextFunction, authenticate: AuthenticateMiddleWare) => Promise<void>;
12
- declare const isAuth: (req: IRequest, res: Response, next: NextFunction) => void;
13
- export default isAuth;
1
+ import { NextFunction, Request, Response } from "express";
2
+ import { AuthenticateMiddleWare } from "../types/DashbordConfig";
3
+ import { Document } from "mongoose";
4
+ export interface IRequest extends Request {
5
+ user: Document;
6
+ language: string;
7
+ timezone: string;
8
+ startTime: Date;
9
+ }
10
+ export declare const defaultHeaders: (req: IRequest, res: Response, next: NextFunction) => void;
11
+ export declare const authenticate: (req: IRequest, res: Response, next: NextFunction, authenticate: AuthenticateMiddleWare) => Promise<void>;
12
+ declare const isAuth: (req: IRequest, res: Response, next: NextFunction) => void;
13
+ export default isAuth;
@@ -1,43 +1,43 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.authenticate = exports.defaultHeaders = void 0;
16
- const ResponseUtils_1 = __importDefault(require("../utils/ResponseUtils"));
17
- const defaultHeaders = function (req, res, next) {
18
- req.language = req.headers['accept-language'] ? req.headers['accept-language'] : 'en';
19
- req.timezone = req.headers.timezone ? req.headers.timezone : 'UTC';
20
- next();
21
- };
22
- exports.defaultHeaders = defaultHeaders;
23
- const authenticate = (req, res, next, authenticate) => __awaiter(void 0, void 0, void 0, function* () {
24
- const adminCredentials = {
25
- email: req.body.user.email,
26
- password: req.body.user.password
27
- };
28
- const user = yield authenticate(adminCredentials);
29
- if (!user) {
30
- return ResponseUtils_1.default.unauthorized(res);
31
- }
32
- req.user = user;
33
- next();
34
- });
35
- exports.authenticate = authenticate;
36
- const isAuth = function (req, res, next) {
37
- const session = req.session;
38
- if (!session.userName) {
39
- return ResponseUtils_1.default.unauthorized(res);
40
- }
41
- next();
42
- };
43
- exports.default = isAuth;
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.authenticate = exports.defaultHeaders = void 0;
16
+ const ResponseUtils_1 = __importDefault(require("../utils/ResponseUtils"));
17
+ const defaultHeaders = function (req, res, next) {
18
+ req.language = req.headers['accept-language'] ? req.headers['accept-language'] : 'en';
19
+ req.timezone = req.headers.timezone ? req.headers.timezone : 'UTC';
20
+ next();
21
+ };
22
+ exports.defaultHeaders = defaultHeaders;
23
+ const authenticate = (req, res, next, authenticate) => __awaiter(void 0, void 0, void 0, function* () {
24
+ const adminCredentials = {
25
+ email: req.body.user.email,
26
+ password: req.body.user.password
27
+ };
28
+ const user = yield authenticate(adminCredentials);
29
+ if (!user) {
30
+ return ResponseUtils_1.default.unauthorized(res);
31
+ }
32
+ req.user = user;
33
+ next();
34
+ });
35
+ exports.authenticate = authenticate;
36
+ const isAuth = function (req, res, next) {
37
+ const session = req.session;
38
+ if (!session.userName) {
39
+ return ResponseUtils_1.default.unauthorized(res);
40
+ }
41
+ next();
42
+ };
43
+ exports.default = isAuth;
@@ -1,9 +1,9 @@
1
- export default class ModelNames {
2
- static User: string;
3
- static RequestLog: string;
4
- static Permission: string;
5
- static PermissionGroup: string;
6
- static AdminPermission: string;
7
- static UserActionsLog: string;
8
- static AdminNotification: string;
9
- }
1
+ export default class ModelNames {
2
+ static User: string;
3
+ static RequestLog: string;
4
+ static Permission: string;
5
+ static PermissionGroup: string;
6
+ static AdminPermission: string;
7
+ static UserActionsLog: string;
8
+ static AdminNotification: string;
9
+ }
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- class ModelNames {
4
- }
5
- exports.default = ModelNames;
6
- ModelNames.User = 'User';
7
- ModelNames.RequestLog = 'RequestLog';
8
- ModelNames.Permission = 'Permission';
9
- ModelNames.PermissionGroup = 'PermissionGroup';
10
- ModelNames.AdminPermission = 'AdminPermission';
11
- ModelNames.UserActionsLog = 'UserActionsLog';
12
- ModelNames.AdminNotification = 'AdminNotification';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class ModelNames {
4
+ }
5
+ exports.default = ModelNames;
6
+ ModelNames.User = 'User';
7
+ ModelNames.RequestLog = 'RequestLog';
8
+ ModelNames.Permission = 'Permission';
9
+ ModelNames.PermissionGroup = 'PermissionGroup';
10
+ ModelNames.AdminPermission = 'AdminPermission';
11
+ ModelNames.UserActionsLog = 'UserActionsLog';
12
+ ModelNames.AdminNotification = 'AdminNotification';
@@ -1,5 +1,5 @@
1
- import { Schema } from 'mongoose';
2
- import IAdminNotificationModel from './IAdminNotification';
3
- export declare const AdminNotificationSchema: Schema;
4
- declare const AdminNotification: IAdminNotificationModel;
5
- export default AdminNotification;
1
+ import { Schema } from 'mongoose';
2
+ import IAdminNotificationModel from './IAdminNotification';
3
+ export declare const AdminNotificationSchema: Schema;
4
+ declare const AdminNotification: IAdminNotificationModel;
5
+ export default AdminNotification;
@@ -1,53 +1,53 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AdminNotificationSchema = void 0;
7
- const mongoose_1 = require("mongoose");
8
- const IAdminNotification_1 = require("./IAdminNotification");
9
- const ModelNames_1 = __importDefault(require("../ModelNames"));
10
- exports.AdminNotificationSchema = new mongoose_1.Schema({
11
- isRead: {
12
- type: Boolean,
13
- required: false,
14
- default: false,
15
- },
16
- title: {
17
- type: String,
18
- required: true,
19
- },
20
- message: {
21
- type: String,
22
- required: false,
23
- },
24
- redirectUrl: {
25
- type: String,
26
- required: false,
27
- },
28
- redirectUrlType: {
29
- type: String,
30
- required: false,
31
- enum: Object.values(IAdminNotification_1.AdminNotificationNavigationType),
32
- default: IAdminNotification_1.AdminNotificationNavigationType.NONE,
33
- },
34
- type: {
35
- type: String,
36
- required: false,
37
- },
38
- relatedId: {
39
- type: mongoose_1.Schema.Types.ObjectId,
40
- required: false,
41
- },
42
- priority: {
43
- type: String,
44
- required: false,
45
- enum: Object.values(IAdminNotification_1.AdminNotificationTypePriority),
46
- default: IAdminNotification_1.AdminNotificationTypePriority.MEDIUM,
47
- },
48
- data: {
49
- type: String
50
- }
51
- }, { timestamps: true });
52
- const AdminNotification = (0, mongoose_1.model)(ModelNames_1.default.AdminNotification, exports.AdminNotificationSchema);
53
- exports.default = AdminNotification;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AdminNotificationSchema = void 0;
7
+ const mongoose_1 = require("mongoose");
8
+ const IAdminNotification_1 = require("./IAdminNotification");
9
+ const ModelNames_1 = __importDefault(require("../ModelNames"));
10
+ exports.AdminNotificationSchema = new mongoose_1.Schema({
11
+ isRead: {
12
+ type: Boolean,
13
+ required: false,
14
+ default: false,
15
+ },
16
+ title: {
17
+ type: String,
18
+ required: true,
19
+ },
20
+ message: {
21
+ type: String,
22
+ required: false,
23
+ },
24
+ redirectUrl: {
25
+ type: String,
26
+ required: false,
27
+ },
28
+ redirectUrlType: {
29
+ type: String,
30
+ required: false,
31
+ enum: Object.values(IAdminNotification_1.AdminNotificationNavigationType),
32
+ default: IAdminNotification_1.AdminNotificationNavigationType.NONE,
33
+ },
34
+ type: {
35
+ type: String,
36
+ required: false,
37
+ },
38
+ relatedId: {
39
+ type: mongoose_1.Schema.Types.ObjectId,
40
+ required: false,
41
+ },
42
+ priority: {
43
+ type: String,
44
+ required: false,
45
+ enum: Object.values(IAdminNotification_1.AdminNotificationTypePriority),
46
+ default: IAdminNotification_1.AdminNotificationTypePriority.MEDIUM,
47
+ },
48
+ data: {
49
+ type: String
50
+ }
51
+ }, { timestamps: true });
52
+ const AdminNotification = (0, mongoose_1.model)(ModelNames_1.default.AdminNotification, exports.AdminNotificationSchema);
53
+ exports.default = AdminNotification;
@@ -1,30 +1,30 @@
1
- import { Document, Model, Types } from 'mongoose';
2
- export declare enum AdminNotificationTypePriority {
3
- LOW = "LOW",
4
- MEDIUM = "MEDIUM",
5
- HIGH = "HIGH"
6
- }
7
- export declare enum AdminNotificationNavigationType {
8
- NONE = "NONE",
9
- INTERNAL = "INTERNAL",
10
- EXTERNAL = "EXTERNAL"
11
- }
12
- export interface IAdminNotificationProps {
13
- _id?: Types.ObjectId;
14
- isRead?: boolean;
15
- title: string;
16
- message?: string;
17
- redirectUrl?: String;
18
- type?: string;
19
- relatedId?: string;
20
- priority?: AdminNotificationTypePriority;
21
- redirectUrlType?: AdminNotificationNavigationType;
22
- data?: string;
23
- }
24
- export interface IAdminNotificationDocument extends IAdminNotificationProps, Document {
25
- _id: Types.ObjectId;
26
- createdAt: Date;
27
- updatedAt: Date;
28
- }
29
- export default interface IAdminNotificationModel extends Model<IAdminNotificationDocument> {
30
- }
1
+ import { Document, Model, Types } from 'mongoose';
2
+ export declare enum AdminNotificationTypePriority {
3
+ LOW = "LOW",
4
+ MEDIUM = "MEDIUM",
5
+ HIGH = "HIGH"
6
+ }
7
+ export declare enum AdminNotificationNavigationType {
8
+ NONE = "NONE",
9
+ INTERNAL = "INTERNAL",
10
+ EXTERNAL = "EXTERNAL"
11
+ }
12
+ export interface IAdminNotificationProps {
13
+ _id?: Types.ObjectId;
14
+ isRead?: boolean;
15
+ title: string;
16
+ message?: string;
17
+ redirectUrl?: String;
18
+ type?: string;
19
+ relatedId?: string;
20
+ priority?: AdminNotificationTypePriority;
21
+ redirectUrlType?: AdminNotificationNavigationType;
22
+ data?: string;
23
+ }
24
+ export interface IAdminNotificationDocument extends IAdminNotificationProps, Document {
25
+ _id: Types.ObjectId;
26
+ createdAt: Date;
27
+ updatedAt: Date;
28
+ }
29
+ export default interface IAdminNotificationModel extends Model<IAdminNotificationDocument> {
30
+ }
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdminNotificationNavigationType = exports.AdminNotificationTypePriority = void 0;
4
- var AdminNotificationTypePriority;
5
- (function (AdminNotificationTypePriority) {
6
- AdminNotificationTypePriority["LOW"] = "LOW";
7
- AdminNotificationTypePriority["MEDIUM"] = "MEDIUM";
8
- AdminNotificationTypePriority["HIGH"] = "HIGH";
9
- })(AdminNotificationTypePriority = exports.AdminNotificationTypePriority || (exports.AdminNotificationTypePriority = {}));
10
- var AdminNotificationNavigationType;
11
- (function (AdminNotificationNavigationType) {
12
- AdminNotificationNavigationType["NONE"] = "NONE";
13
- AdminNotificationNavigationType["INTERNAL"] = "INTERNAL";
14
- AdminNotificationNavigationType["EXTERNAL"] = "EXTERNAL";
15
- })(AdminNotificationNavigationType = exports.AdminNotificationNavigationType || (exports.AdminNotificationNavigationType = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdminNotificationNavigationType = exports.AdminNotificationTypePriority = void 0;
4
+ var AdminNotificationTypePriority;
5
+ (function (AdminNotificationTypePriority) {
6
+ AdminNotificationTypePriority["LOW"] = "LOW";
7
+ AdminNotificationTypePriority["MEDIUM"] = "MEDIUM";
8
+ AdminNotificationTypePriority["HIGH"] = "HIGH";
9
+ })(AdminNotificationTypePriority = exports.AdminNotificationTypePriority || (exports.AdminNotificationTypePriority = {}));
10
+ var AdminNotificationNavigationType;
11
+ (function (AdminNotificationNavigationType) {
12
+ AdminNotificationNavigationType["NONE"] = "NONE";
13
+ AdminNotificationNavigationType["INTERNAL"] = "INTERNAL";
14
+ AdminNotificationNavigationType["EXTERNAL"] = "EXTERNAL";
15
+ })(AdminNotificationNavigationType = exports.AdminNotificationNavigationType || (exports.AdminNotificationNavigationType = {}));
@@ -1,11 +1,11 @@
1
- /// <reference types="passport-local-mongoose" />
2
- import { Schema } from "mongoose";
3
- export declare function getAdminPermissionSchema(): Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").ResolveSchemaOptions<{
4
- timestamps: true;
5
- }>, {
6
- createdAt: NativeDate;
7
- updatedAt: NativeDate;
8
- } & {
9
- permissionId: import("mongoose").Types.ObjectId;
10
- permissionGroupId: import("mongoose").Types.ObjectId;
11
- }>;
1
+ /// <reference types="passport-local-mongoose" />
2
+ import { Schema } from "mongoose";
3
+ export declare function getAdminPermissionSchema(): Schema<any, import("mongoose").Model<any, any, any, any, any>, {}, {}, {}, {}, import("mongoose").ResolveSchemaOptions<{
4
+ timestamps: true;
5
+ }>, {
6
+ createdAt: NativeDate;
7
+ updatedAt: NativeDate;
8
+ } & {
9
+ permissionId: import("mongoose").Types.ObjectId;
10
+ permissionGroupId: import("mongoose").Types.ObjectId;
11
+ }>;
@@ -1,23 +1,23 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getAdminPermissionSchema = void 0;
7
- const mongoose_1 = require("mongoose");
8
- const ModelNames_1 = __importDefault(require("../ModelNames"));
9
- function getAdminPermissionSchema() {
10
- return new mongoose_1.Schema({
11
- permissionGroupId: {
12
- type: mongoose_1.Schema.Types.ObjectId,
13
- ref: ModelNames_1.default.PermissionGroup,
14
- required: true,
15
- },
16
- permissionId: {
17
- type: mongoose_1.Schema.Types.ObjectId,
18
- ref: ModelNames_1.default.Permission,
19
- required: true,
20
- },
21
- }, { timestamps: true });
22
- }
23
- exports.getAdminPermissionSchema = getAdminPermissionSchema;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAdminPermissionSchema = void 0;
7
+ const mongoose_1 = require("mongoose");
8
+ const ModelNames_1 = __importDefault(require("../ModelNames"));
9
+ function getAdminPermissionSchema() {
10
+ return new mongoose_1.Schema({
11
+ permissionGroupId: {
12
+ type: mongoose_1.Schema.Types.ObjectId,
13
+ ref: ModelNames_1.default.PermissionGroup,
14
+ required: true,
15
+ },
16
+ permissionId: {
17
+ type: mongoose_1.Schema.Types.ObjectId,
18
+ ref: ModelNames_1.default.Permission,
19
+ required: true,
20
+ },
21
+ }, { timestamps: true });
22
+ }
23
+ exports.getAdminPermissionSchema = getAdminPermissionSchema;
@@ -1,13 +1,13 @@
1
- import { Document, Model, Types } from 'mongoose';
2
- export interface IAdminPermissionProps {
3
- _id?: Types.ObjectId;
4
- permissionGroupId: string;
5
- permissionId: string;
6
- }
7
- export interface IAdminPermissionDocument extends IAdminPermissionProps, Document {
8
- _id: Types.ObjectId;
9
- createdAt: Date;
10
- updatedAt: Date;
11
- }
12
- export default interface IAdminPermissionModel extends Model<IAdminPermissionDocument> {
13
- }
1
+ import { Document, Model, Types } from 'mongoose';
2
+ export interface IAdminPermissionProps {
3
+ _id?: Types.ObjectId;
4
+ permissionGroupId: string;
5
+ permissionId: string;
6
+ }
7
+ export interface IAdminPermissionDocument extends IAdminPermissionProps, Document {
8
+ _id: Types.ObjectId;
9
+ createdAt: Date;
10
+ updatedAt: Date;
11
+ }
12
+ export default interface IAdminPermissionModel extends Model<IAdminPermissionDocument> {
13
+ }