@tomei/sso 0.13.0 → 0.14.0

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 (164) hide show
  1. package/dist/__tests__/unit/components/login-user/login-user.spec.d.ts +1 -1
  2. package/dist/__tests__/unit/components/login-user/login-user.spec.js +662 -662
  3. package/dist/__tests__/unit/components/password-hash/password-hash.service.spec.d.ts +1 -1
  4. package/dist/__tests__/unit/components/password-hash/password-hash.service.spec.js +37 -37
  5. package/dist/__tests__/unit/redis-client/redis.service.spec.d.ts +1 -1
  6. package/dist/__tests__/unit/redis-client/redis.service.spec.js +31 -31
  7. package/dist/__tests__/unit/session/session.service.spec.d.ts +1 -1
  8. package/dist/__tests__/unit/session/session.service.spec.js +54 -54
  9. package/dist/__tests__/unit/system-privilege/system-privilage.spec.js +5 -5
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.js +17 -17
  12. package/dist/src/components/building/building.d.ts +38 -0
  13. package/dist/src/components/building/building.js +92 -0
  14. package/dist/src/components/building/building.js.map +1 -0
  15. package/dist/src/components/building/building.repository.d.ts +5 -0
  16. package/dist/src/components/building/building.repository.js +12 -0
  17. package/dist/src/components/building/building.repository.js.map +1 -0
  18. package/dist/src/components/building/index.d.ts +2 -0
  19. package/dist/src/components/building/index.js +19 -0
  20. package/dist/src/components/building/index.js.map +1 -0
  21. package/dist/src/components/building-type/building-type.repository.d.ts +5 -0
  22. package/dist/src/components/building-type/building-type.repository.js +12 -0
  23. package/dist/src/components/building-type/building-type.repository.js.map +1 -0
  24. package/dist/src/components/building-type/index.d.ts +1 -0
  25. package/dist/src/components/building-type/index.js +18 -0
  26. package/dist/src/components/building-type/index.js.map +1 -0
  27. package/dist/src/components/index.d.ts +9 -7
  28. package/dist/src/components/index.js +25 -23
  29. package/dist/src/components/index.js.map +1 -1
  30. package/dist/src/components/login-history/index.d.ts +1 -1
  31. package/dist/src/components/login-history/index.js +17 -17
  32. package/dist/src/components/login-history/login-history.repository.d.ts +5 -5
  33. package/dist/src/components/login-history/login-history.repository.js +11 -11
  34. package/dist/src/components/login-user/index.d.ts +3 -3
  35. package/dist/src/components/login-user/index.js +19 -19
  36. package/dist/src/components/login-user/interfaces/index.d.ts +1 -1
  37. package/dist/src/components/login-user/interfaces/index.js +17 -17
  38. package/dist/src/components/login-user/interfaces/user-info.interface.d.ts +9 -9
  39. package/dist/src/components/login-user/interfaces/user-info.interface.js +2 -2
  40. package/dist/src/components/login-user/login-user.d.ts +46 -46
  41. package/dist/src/components/login-user/login-user.js +430 -430
  42. package/dist/src/components/login-user/user.repository.d.ts +5 -5
  43. package/dist/src/components/login-user/user.repository.js +11 -11
  44. package/dist/src/components/password-hash/index.d.ts +2 -2
  45. package/dist/src/components/password-hash/index.js +18 -18
  46. package/dist/src/components/password-hash/interfaces/index.d.ts +1 -1
  47. package/dist/src/components/password-hash/interfaces/index.js +17 -17
  48. package/dist/src/components/password-hash/interfaces/password-hash-service.interface.d.ts +4 -4
  49. package/dist/src/components/password-hash/interfaces/password-hash-service.interface.js +2 -2
  50. package/dist/src/components/password-hash/password-hash.service.d.ts +6 -6
  51. package/dist/src/components/password-hash/password-hash.service.js +27 -27
  52. package/dist/src/components/system/index.d.ts +1 -1
  53. package/dist/src/components/system/index.js +17 -17
  54. package/dist/src/components/system/system.repository.d.ts +5 -5
  55. package/dist/src/components/system/system.repository.js +11 -11
  56. package/dist/src/components/system-access/index.d.ts +1 -1
  57. package/dist/src/components/system-access/index.js +17 -17
  58. package/dist/src/components/system-access/system-access.repository.d.ts +5 -5
  59. package/dist/src/components/system-access/system-access.repository.js +11 -11
  60. package/dist/src/components/system-privilege/privilege.d.ts +6 -6
  61. package/dist/src/components/system-privilege/privilege.js +76 -76
  62. package/dist/src/components/system-privilege/system-privilege.repository.d.ts +6 -6
  63. package/dist/src/components/system-privilege/system-privilege.repository.js +34 -34
  64. package/dist/src/components/user-group/index.d.ts +1 -1
  65. package/dist/src/components/user-group/index.js +17 -17
  66. package/dist/src/components/user-group/user-group.repository.d.ts +5 -5
  67. package/dist/src/components/user-group/user-group.repository.js +11 -11
  68. package/dist/src/components/user-user-group/index.d.ts +1 -1
  69. package/dist/src/components/user-user-group/index.js +17 -17
  70. package/dist/src/components/user-user-group/user-user-group.repository.d.ts +5 -5
  71. package/dist/src/components/user-user-group/user-user-group.repository.js +11 -11
  72. package/dist/src/database.d.ts +4 -4
  73. package/dist/src/database.js +14 -14
  74. package/dist/src/index.d.ts +5 -5
  75. package/dist/src/index.js +23 -23
  76. package/dist/src/interfaces/index.d.ts +2 -2
  77. package/dist/src/interfaces/index.js +18 -18
  78. package/dist/src/interfaces/system-login.interface.d.ts +6 -6
  79. package/dist/src/interfaces/system-login.interface.js +2 -2
  80. package/dist/src/interfaces/user-session.interface.d.ts +4 -4
  81. package/dist/src/interfaces/user-session.interface.js +2 -2
  82. package/dist/src/models/authorization-code.entity.d.ts +14 -14
  83. package/dist/src/models/authorization-code.entity.js +85 -85
  84. package/dist/src/models/bearer-token.entity.d.ts +11 -11
  85. package/dist/src/models/bearer-token.entity.js +71 -71
  86. package/dist/src/models/building-type.entity.d.ts +7 -7
  87. package/dist/src/models/building-type.entity.js +49 -49
  88. package/dist/src/models/building.entity.d.ts +39 -39
  89. package/dist/src/models/building.entity.js +250 -250
  90. package/dist/src/models/city.entity.d.ts +11 -11
  91. package/dist/src/models/city.entity.js +71 -71
  92. package/dist/src/models/company.entity.d.ts +18 -18
  93. package/dist/src/models/company.entity.js +113 -113
  94. package/dist/src/models/country.entity.d.ts +15 -15
  95. package/dist/src/models/country.entity.js +91 -91
  96. package/dist/src/models/department.entity.d.ts +19 -19
  97. package/dist/src/models/department.entity.js +111 -111
  98. package/dist/src/models/group-role-privilege.entity.d.ts +17 -17
  99. package/dist/src/models/group-role-privilege.entity.js +89 -89
  100. package/dist/src/models/group-system-access.entity.d.ts +11 -11
  101. package/dist/src/models/group-system-access.entity.js +61 -61
  102. package/dist/src/models/group-system-privilege.entity.d.ts +11 -11
  103. package/dist/src/models/group-system-privilege.entity.js +61 -61
  104. package/dist/src/models/group-system-role.entity.d.ts +11 -11
  105. package/dist/src/models/group-system-role.entity.js +61 -61
  106. package/dist/src/models/login-history.entity.d.ts +12 -12
  107. package/dist/src/models/login-history.entity.js +69 -69
  108. package/dist/src/models/oauth-token.entity.d.ts +14 -14
  109. package/dist/src/models/oauth-token.entity.js +85 -85
  110. package/dist/src/models/role.entity.d.ts +17 -17
  111. package/dist/src/models/role.entity.js +101 -101
  112. package/dist/src/models/staff-type.entity.d.ts +7 -7
  113. package/dist/src/models/staff-type.entity.js +49 -49
  114. package/dist/src/models/staff.entity.d.ts +39 -39
  115. package/dist/src/models/staff.entity.js +249 -249
  116. package/dist/src/models/state.entity.d.ts +10 -10
  117. package/dist/src/models/state.entity.js +63 -63
  118. package/dist/src/models/system-accesss.entity.d.ts +6 -6
  119. package/dist/src/models/system-accesss.entity.js +50 -50
  120. package/dist/src/models/system-privilege.entity.d.ts +16 -16
  121. package/dist/src/models/system-privilege.entity.js +89 -89
  122. package/dist/src/models/system-role-privilege.entity.d.ts +11 -11
  123. package/dist/src/models/system-role-privilege.entity.js +59 -59
  124. package/dist/src/models/system-role.entity.d.ts +11 -11
  125. package/dist/src/models/system-role.entity.js +82 -82
  126. package/dist/src/models/system.entity.d.ts +19 -19
  127. package/dist/src/models/system.entity.js +145 -145
  128. package/dist/src/models/user-group.entity.d.ts +23 -23
  129. package/dist/src/models/user-group.entity.js +139 -139
  130. package/dist/src/models/user-role.entity.d.ts +12 -12
  131. package/dist/src/models/user-role.entity.js +72 -72
  132. package/dist/src/models/user-system-privileges.entity.d.ts +13 -13
  133. package/dist/src/models/user-system-privileges.entity.js +88 -88
  134. package/dist/src/models/user-system-role.entity.d.ts +11 -11
  135. package/dist/src/models/user-system-role.entity.js +59 -59
  136. package/dist/src/models/user-user-group.entity.d.ts +14 -14
  137. package/dist/src/models/user-user-group.entity.js +72 -72
  138. package/dist/src/models/user.entity.d.ts +30 -30
  139. package/dist/src/models/user.entity.js +130 -130
  140. package/dist/src/redis-client/__mocks__/jest-initial-setup.d.ts +1 -1
  141. package/dist/src/redis-client/__mocks__/jest-initial-setup.js +4 -4
  142. package/dist/src/redis-client/__mocks__/redis-mock.d.ts +2 -2
  143. package/dist/src/redis-client/__mocks__/redis-mock.js +22 -22
  144. package/dist/src/redis-client/index.d.ts +1 -1
  145. package/dist/src/redis-client/index.js +17 -17
  146. package/dist/src/redis-client/redis.service.d.ts +7 -7
  147. package/dist/src/redis-client/redis.service.js +60 -60
  148. package/dist/src/session/index.d.ts +2 -2
  149. package/dist/src/session/index.js +18 -18
  150. package/dist/src/session/interfaces/index.d.ts +1 -1
  151. package/dist/src/session/interfaces/index.js +17 -17
  152. package/dist/src/session/interfaces/session-service.interface.d.ts +6 -6
  153. package/dist/src/session/interfaces/session-service.interface.js +2 -2
  154. package/dist/src/session/session.service.d.ts +10 -10
  155. package/dist/src/session/session.service.js +62 -62
  156. package/dist/tsconfig.tsbuildinfo +1 -1
  157. package/package.json +2 -2
  158. package/src/components/building/building.repository.ts +11 -0
  159. package/src/components/building/building.ts +119 -0
  160. package/src/components/building/index.ts +3 -0
  161. package/src/components/building-type/building-type.repository.ts +11 -0
  162. package/src/components/building-type/index.ts +2 -0
  163. package/src/components/index.ts +2 -0
  164. package/src/models/building-type.entity.ts +1 -1
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,38 +1,38 @@
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
- const password_hash_service_1 = require("../../../../src/components/password-hash/password-hash.service");
13
- jest.mock('argon2', () => {
14
- return {
15
- hash: jest.fn((passowrd) => {
16
- return `hash${passowrd}`;
17
- }),
18
- verify: jest.fn().mockResolvedValue(true)
19
- };
20
- });
21
- describe('password-hash.service', () => {
22
- const passwordHashService = new password_hash_service_1.PasswordHashService();
23
- afterEach(() => {
24
- jest.clearAllMocks();
25
- });
26
- it('should return hash password', () => __awaiter(void 0, void 0, void 0, function* () {
27
- const password = 'password';
28
- const hash = yield passwordHashService.hashPassword(password);
29
- expect(hash).toEqual('hashpassword');
30
- }));
31
- it('should return true when verify password', () => __awaiter(void 0, void 0, void 0, function* () {
32
- const password = 'password';
33
- const hash = 'hashpassword10';
34
- const result = yield passwordHashService.verify(password, hash);
35
- expect(result).toEqual(true);
36
- }));
37
- });
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
+ const password_hash_service_1 = require("../../../../src/components/password-hash/password-hash.service");
13
+ jest.mock('argon2', () => {
14
+ return {
15
+ hash: jest.fn((passowrd) => {
16
+ return `hash${passowrd}`;
17
+ }),
18
+ verify: jest.fn().mockResolvedValue(true)
19
+ };
20
+ });
21
+ describe('password-hash.service', () => {
22
+ const passwordHashService = new password_hash_service_1.PasswordHashService();
23
+ afterEach(() => {
24
+ jest.clearAllMocks();
25
+ });
26
+ it('should return hash password', () => __awaiter(void 0, void 0, void 0, function* () {
27
+ const password = 'password';
28
+ const hash = yield passwordHashService.hashPassword(password);
29
+ expect(hash).toEqual('hashpassword');
30
+ }));
31
+ it('should return true when verify password', () => __awaiter(void 0, void 0, void 0, function* () {
32
+ const password = 'password';
33
+ const hash = 'hashpassword10';
34
+ const result = yield passwordHashService.verify(password, hash);
35
+ expect(result).toEqual(true);
36
+ }));
37
+ });
38
38
  //# sourceMappingURL=password-hash.service.spec.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,32 +1,32 @@
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
- const redis_service_1 = require("../../../src/redis-client/redis.service");
13
- require('dotenv').config();
14
- describe('redis.service', () => {
15
- afterEach(() => {
16
- jest.restoreAllMocks();
17
- });
18
- it('should return redis service when instansiated', () => __awaiter(void 0, void 0, void 0, function* () {
19
- const redisService = yield redis_service_1.RedisService.init();
20
- expect(redisService).toBeDefined();
21
- }));
22
- it('should able to write and read redis', () => __awaiter(void 0, void 0, void 0, function* () {
23
- const data = {
24
- test: 'test'
25
- };
26
- const redisService = yield redis_service_1.RedisService.init();
27
- yield redisService.set("test", data, 60 * 60 * 24 * 1);
28
- const result = yield redisService.get("test");
29
- expect(result).toEqual(JSON.stringify(data));
30
- }));
31
- });
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
+ const redis_service_1 = require("../../../src/redis-client/redis.service");
13
+ require('dotenv').config();
14
+ describe('redis.service', () => {
15
+ afterEach(() => {
16
+ jest.restoreAllMocks();
17
+ });
18
+ it('should return redis service when instansiated', () => __awaiter(void 0, void 0, void 0, function* () {
19
+ const redisService = yield redis_service_1.RedisService.init();
20
+ expect(redisService).toBeDefined();
21
+ }));
22
+ it('should able to write and read redis', () => __awaiter(void 0, void 0, void 0, function* () {
23
+ const data = {
24
+ test: 'test'
25
+ };
26
+ const redisService = yield redis_service_1.RedisService.init();
27
+ yield redisService.set("test", data, 60 * 60 * 24 * 1);
28
+ const result = yield redisService.get("test");
29
+ expect(result).toEqual(JSON.stringify(data));
30
+ }));
31
+ });
32
32
  //# sourceMappingURL=redis.service.spec.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,55 +1,55 @@
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
- const session_service_1 = require("../../../src/session/session.service");
13
- require('dotenv').config();
14
- describe('session.service', () => {
15
- it('should return session service when instansiated', () => __awaiter(void 0, void 0, void 0, function* () {
16
- const sessionService = yield session_service_1.SessionService.init();
17
- expect(sessionService).toBeDefined();
18
- }));
19
- it('should able to write session data', () => __awaiter(void 0, void 0, void 0, function* () {
20
- const data = {
21
- systemLogins: [
22
- {
23
- id: '1',
24
- code: 'EZC',
25
- sessionId: 'test1',
26
- privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
27
- },
28
- ],
29
- };
30
- const sessionService = yield session_service_1.SessionService.init();
31
- yield sessionService.setUserSession("1", data);
32
- const result = yield sessionService.retrieveUserSession("1");
33
- expect(result).toEqual(data);
34
- }));
35
- it('should able to refresh session data', () => __awaiter(void 0, void 0, void 0, function* () {
36
- const setUserSession = jest.spyOn(session_service_1.SessionService.prototype, 'setUserSession');
37
- const retrieveUserSession = jest.spyOn(session_service_1.SessionService.prototype, 'retrieveUserSession');
38
- const data = {
39
- systemLogins: [
40
- {
41
- id: '1',
42
- code: 'EZC',
43
- sessionId: 'test1',
44
- privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
45
- },
46
- ],
47
- };
48
- const sessionService = yield session_service_1.SessionService.init();
49
- yield sessionService.setUserSession("1", data);
50
- yield sessionService.refreshDuration("1");
51
- expect(setUserSession).toBeCalledTimes(2);
52
- expect(retrieveUserSession).toBeCalledTimes(1);
53
- }));
54
- });
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
+ const session_service_1 = require("../../../src/session/session.service");
13
+ require('dotenv').config();
14
+ describe('session.service', () => {
15
+ it('should return session service when instansiated', () => __awaiter(void 0, void 0, void 0, function* () {
16
+ const sessionService = yield session_service_1.SessionService.init();
17
+ expect(sessionService).toBeDefined();
18
+ }));
19
+ it('should able to write session data', () => __awaiter(void 0, void 0, void 0, function* () {
20
+ const data = {
21
+ systemLogins: [
22
+ {
23
+ id: '1',
24
+ code: 'EZC',
25
+ sessionId: 'test1',
26
+ privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
27
+ },
28
+ ],
29
+ };
30
+ const sessionService = yield session_service_1.SessionService.init();
31
+ yield sessionService.setUserSession("1", data);
32
+ const result = yield sessionService.retrieveUserSession("1");
33
+ expect(result).toEqual(data);
34
+ }));
35
+ it('should able to refresh session data', () => __awaiter(void 0, void 0, void 0, function* () {
36
+ const setUserSession = jest.spyOn(session_service_1.SessionService.prototype, 'setUserSession');
37
+ const retrieveUserSession = jest.spyOn(session_service_1.SessionService.prototype, 'retrieveUserSession');
38
+ const data = {
39
+ systemLogins: [
40
+ {
41
+ id: '1',
42
+ code: 'EZC',
43
+ sessionId: 'test1',
44
+ privileges: ['PRIVILEGE1', 'PRIVILEGE2'],
45
+ },
46
+ ],
47
+ };
48
+ const sessionService = yield session_service_1.SessionService.init();
49
+ yield sessionService.setUserSession("1", data);
50
+ yield sessionService.refreshDuration("1");
51
+ expect(setUserSession).toBeCalledTimes(2);
52
+ expect(retrieveUserSession).toBeCalledTimes(1);
53
+ }));
54
+ });
55
55
  //# sourceMappingURL=session.service.spec.js.map
@@ -1,6 +1,6 @@
1
- describe('SystemPrivilege', () => {
2
- it('should be true', () => {
3
- expect(true).toBe(true);
4
- });
5
- });
1
+ describe('SystemPrivilege', () => {
2
+ it('should be true', () => {
3
+ expect(true).toBe(true);
4
+ });
5
+ });
6
6
  //# sourceMappingURL=system-privilage.spec.js.map
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './src';
1
+ export * from './src';
package/dist/index.js CHANGED
@@ -1,18 +1,18 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src"), exports);
18
18
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,38 @@
1
+ import { LoginUser } from '../../..';
2
+ export declare class Building {
3
+ id: number;
4
+ name: string;
5
+ code: string;
6
+ building_type_id: number;
7
+ status: string;
8
+ email: string;
9
+ mobile: string;
10
+ phone: string;
11
+ address: string;
12
+ postcode: string;
13
+ longitude: number;
14
+ latitude: number;
15
+ country_id: number;
16
+ state: string;
17
+ city: string;
18
+ brand: string;
19
+ area_staff_id: string;
20
+ opening_date: any;
21
+ ceased_date: any;
22
+ opening_hours: any;
23
+ image: string;
24
+ private _created_by_id;
25
+ private _updated_by_id;
26
+ private _created_at;
27
+ private _updated_at;
28
+ private _BuildingTypeId;
29
+ private _BuildingType;
30
+ private static _Repo;
31
+ private _RepoBuildingType;
32
+ private constructor();
33
+ static init(dbTransaction: any, code?: string): Promise<Building | undefined>;
34
+ getBuildingType(loginUser: LoginUser, dbTransaction?: any): Promise<{
35
+ BuildingTypeId: number;
36
+ BuildingType: string;
37
+ }>;
38
+ }
@@ -0,0 +1,92 @@
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.Building = void 0;
13
+ const building_type_repository_1 = require("../building-type/building-type.repository");
14
+ const building_repository_1 = require("./building.repository");
15
+ const config_1 = require("@tomei/config");
16
+ class Building {
17
+ constructor(buildingInfo) {
18
+ this._RepoBuildingType = new building_type_repository_1.BuildingTypeRepository();
19
+ if (buildingInfo) {
20
+ this.id = buildingInfo.id;
21
+ this.name = buildingInfo.Name;
22
+ this.code = buildingInfo.Code;
23
+ this.building_type_id = buildingInfo.BuildingTypeId;
24
+ this.status = buildingInfo.Status;
25
+ this.email = buildingInfo.Email;
26
+ this.mobile = buildingInfo.Mobile;
27
+ this.phone = buildingInfo.Phone;
28
+ this.address = buildingInfo.Address;
29
+ this.postcode = buildingInfo.PostCode;
30
+ this.longitude = buildingInfo.Longitude;
31
+ this.latitude = buildingInfo.Latitude;
32
+ this.country_id = buildingInfo.CountryId;
33
+ this.state = buildingInfo.State;
34
+ this.city = buildingInfo.City;
35
+ this._created_by_id = buildingInfo.created_by_id;
36
+ this._updated_by_id = buildingInfo.updated_by_id;
37
+ this._created_at = buildingInfo.created_at;
38
+ this._updated_at = buildingInfo.updated_at;
39
+ this.brand = buildingInfo.Brand;
40
+ this.area_staff_id = buildingInfo.AreaStaffId;
41
+ this.opening_date = buildingInfo.OpeningDate;
42
+ this.ceased_date = buildingInfo.CeasedDate;
43
+ this.opening_hours = buildingInfo.OpeningHours;
44
+ this.image = buildingInfo.Image;
45
+ }
46
+ }
47
+ static init(dbTransaction, code) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ if (code) {
50
+ const building = yield Building._Repo.findOne({
51
+ where: {
52
+ code: code,
53
+ },
54
+ });
55
+ if (!building) {
56
+ throw Error('Building not found.');
57
+ }
58
+ return new Building(building);
59
+ }
60
+ });
61
+ }
62
+ getBuildingType(loginUser, dbTransaction) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const systemCode = config_1.ApplicationConfig.getComponentConfigValue('system-code');
65
+ const isPrivileged = yield loginUser.checkPrivileges(systemCode, 'Store - View');
66
+ if (!isPrivileged) {
67
+ throw new Error('You do not have permission to view store.');
68
+ }
69
+ if (!this.building_type_id) {
70
+ throw new Error('building type is null.');
71
+ }
72
+ const buildingType = yield this._RepoBuildingType.findOne({
73
+ where: {
74
+ id: this.building_type_id,
75
+ },
76
+ });
77
+ if (!buildingType) {
78
+ throw new Error('building is not found.');
79
+ }
80
+ const { id, name } = buildingType;
81
+ this._BuildingType = name;
82
+ this._BuildingTypeId = id;
83
+ return {
84
+ BuildingTypeId: this._BuildingTypeId,
85
+ BuildingType: this._BuildingType,
86
+ };
87
+ });
88
+ }
89
+ }
90
+ exports.Building = Building;
91
+ Building._Repo = new building_repository_1.BuildingRepository();
92
+ //# sourceMappingURL=building.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"building.js","sourceRoot":"","sources":["../../../../src/components/building/building.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wFAAmF;AACnF,+DAA2D;AAE3D,0CAAkD;AAElD,MAAa,QAAQ;IAiCnB,YAAoB,YAAY;QAFxB,sBAAiB,GAAG,IAAI,iDAAsB,EAAE,CAAC;QAGvD,IAAI,YAAY,EAAE;YAChB,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;YAC9B,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;YAC9B,IAAI,CAAC,gBAAgB,GAAG,YAAY,CAAC,cAAc,CAAC;YACpD,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;YAClC,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;YAChC,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;YAClC,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;YAChC,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;YACpC,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;YACtC,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;YACxC,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;YACtC,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC,SAAS,CAAC;YACzC,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;YAChC,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;YAC9B,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC,aAAa,CAAC;YACjD,IAAI,CAAC,cAAc,GAAG,YAAY,CAAC,aAAa,CAAC;YACjD,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC;YAC3C,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC;YAC3C,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;YAChC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,WAAW,CAAC;YAC9C,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC,WAAW,CAAC;YAC7C,IAAI,CAAC,WAAW,GAAG,YAAY,CAAC,UAAU,CAAC;YAC3C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,YAAY,CAAC;YAC/C,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;SACjC;IACH,CAAC;IAED,MAAM,CAAO,IAAI,CAAC,aAAkB,EAAE,IAAa;;YACjD,IAAI,IAAI,EAAE;gBACR,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC;oBAC5C,KAAK,EAAE;wBACL,IAAI,EAAE,IAAI;qBACX;iBACF,CAAC,CAAC;gBACH,IAAI,CAAC,QAAQ,EAAE;oBACb,MAAM,KAAK,CAAC,qBAAqB,CAAC,CAAC;iBACpC;gBACD,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;aAC/B;QACH,CAAC;KAAA;IAEY,eAAe,CAAC,SAAoB,EAAE,aAAmB;;YAEpE,MAAM,UAAU,GAAG,0BAAiB,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC;YAE5E,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,eAAe,CAClD,UAAU,EACV,cAAc,CACf,CAAC;YACF,IAAI,CAAC,YAAY,EAAE;gBACjB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;aAC9D;YAED,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;gBAC1B,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;aAC3C;YAED,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;gBACxD,KAAK,EAAE;oBACL,EAAE,EAAE,IAAI,CAAC,gBAAgB;iBAC1B;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,YAAY,EAAE;gBACjB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;aAC3C;YAED,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC;YAElC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAC1B,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;YAE1B,OAAO;gBACL,cAAc,EAAE,IAAI,CAAC,eAAe;gBACpC,YAAY,EAAE,IAAI,CAAC,aAAa;aACjC,CAAC;QACJ,CAAC;KAAA;;AAhHH,4BAiHC;AAnFgB,cAAK,GAAG,IAAI,wCAAkB,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import Building from '../../models/building.entity';
2
+ import { RepositoryBase, IRepositoryBase } from '@tomei/general';
3
+ export declare class BuildingRepository extends RepositoryBase<Building> implements IRepositoryBase<Building> {
4
+ constructor();
5
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildingRepository = void 0;
4
+ const building_entity_1 = require("../../models/building.entity");
5
+ const general_1 = require("@tomei/general");
6
+ class BuildingRepository extends general_1.RepositoryBase {
7
+ constructor() {
8
+ super(building_entity_1.default);
9
+ }
10
+ }
11
+ exports.BuildingRepository = BuildingRepository;
12
+ //# sourceMappingURL=building.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"building.repository.js","sourceRoot":"","sources":["../../../../src/components/building/building.repository.ts"],"names":[],"mappings":";;;AAAA,kEAAoD;AACpD,4CAAiE;AAEjE,MAAa,kBACX,SAAQ,wBAAwB;IAGhC;QACE,KAAK,CAAC,yBAAQ,CAAC,CAAC;IAClB,CAAC;CACF;AAPD,gDAOC"}
@@ -0,0 +1,2 @@
1
+ export * from './building';
2
+ export * from './building.repository';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./building"), exports);
18
+ __exportStar(require("./building.repository"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/building/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6CAA2B;AAC3B,wDAAsC"}
@@ -0,0 +1,5 @@
1
+ import BuildingType from '../../models/building-type.entity';
2
+ import { RepositoryBase, IRepositoryBase } from '@tomei/general';
3
+ export declare class BuildingTypeRepository extends RepositoryBase<BuildingType> implements IRepositoryBase<BuildingType> {
4
+ constructor();
5
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildingTypeRepository = void 0;
4
+ const building_type_entity_1 = require("../../models/building-type.entity");
5
+ const general_1 = require("@tomei/general");
6
+ class BuildingTypeRepository extends general_1.RepositoryBase {
7
+ constructor() {
8
+ super(building_type_entity_1.default);
9
+ }
10
+ }
11
+ exports.BuildingTypeRepository = BuildingTypeRepository;
12
+ //# sourceMappingURL=building-type.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"building-type.repository.js","sourceRoot":"","sources":["../../../../src/components/building-type/building-type.repository.ts"],"names":[],"mappings":";;;AAAA,4EAA6D;AAC7D,4CAAiE;AAEjE,MAAa,sBACX,SAAQ,wBAA4B;IAGpC;QACE,KAAK,CAAC,8BAAY,CAAC,CAAC;IACtB,CAAC;CACF;AAPD,wDAOC"}
@@ -0,0 +1 @@
1
+ export * from './building-type.repository';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./building-type.repository"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/building-type/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AACA,6DAA2C"}
@@ -1,7 +1,9 @@
1
- export * from './login-history';
2
- export * from './login-user';
3
- export * from './password-hash';
4
- export * from './system';
5
- export * from './system-access';
6
- export * from './user-group';
7
- export * from './user-user-group';
1
+ export * from './login-history';
2
+ export * from './login-user';
3
+ export * from './password-hash';
4
+ export * from './system';
5
+ export * from './system-access';
6
+ export * from './user-group';
7
+ export * from './user-user-group';
8
+ export * from './building';
9
+ export * from './building-type';
@@ -1,24 +1,26 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./login-history"), exports);
18
- __exportStar(require("./login-user"), exports);
19
- __exportStar(require("./password-hash"), exports);
20
- __exportStar(require("./system"), exports);
21
- __exportStar(require("./system-access"), exports);
22
- __exportStar(require("./user-group"), exports);
23
- __exportStar(require("./user-user-group"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./login-history"), exports);
18
+ __exportStar(require("./login-user"), exports);
19
+ __exportStar(require("./password-hash"), exports);
20
+ __exportStar(require("./system"), exports);
21
+ __exportStar(require("./system-access"), exports);
22
+ __exportStar(require("./user-group"), exports);
23
+ __exportStar(require("./user-user-group"), exports);
24
+ __exportStar(require("./building"), exports);
25
+ __exportStar(require("./building-type"), exports);
24
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,+CAA6B;AAC7B,kDAAgC;AAChC,2CAAyB;AACzB,kDAAgC;AAChC,+CAA6B;AAC7B,oDAAkC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,+CAA6B;AAC7B,kDAAgC;AAChC,2CAAyB;AACzB,kDAAgC;AAChC,+CAA6B;AAC7B,oDAAkC;AAClC,6CAA2B;AAC3B,kDAAgC"}