@uniorganization/uni-lib 4.3.3 → 5.0.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.
- package/dist/entities/division-lob.types.d.ts +23 -0
- package/dist/entities/division-lob.types.js +14 -0
- package/dist/entities/index.d.ts +1 -0
- package/dist/entities/index.js +1 -0
- package/dist/entities/user-client-context.entity.d.ts +10 -0
- package/dist/entities/user-client-context.entity.js +59 -0
- package/dist/entities/users-lobs.entity.js +1 -4
- package/dist/entities/usr.entity.d.ts +1 -4
- package/dist/entities/usr.entity.js +2 -17
- package/dist/entities/vw-escalation-age.d.ts +0 -2
- package/dist/entities/vw-escalation-age.js +0 -8
- package/dist/modules/common/jwt.strategy.js +2 -3
- package/dist/modules/tenant/master-users.guard.d.ts +4 -0
- package/dist/modules/tenant/master-users.guard.js +35 -0
- package/dist/modules/tenant/tenant-authorization.keys.js +1 -1
- package/dist/modules/tenant/tenant-authorization.service.js +9 -5
- package/dist/modules/tenant/tenant-authorization.types.d.ts +1 -2
- package/dist/modules/tenant/tenant.types.d.ts +1 -2
- package/dist/utils/division-lob-catalog.d.ts +9 -0
- package/dist/utils/division-lob-catalog.js +60 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +12 -13
- package/dist/entities/daily-payment.entity.d.ts +0 -58
- package/dist/entities/daily-payment.entity.js +0 -248
- package/dist/middlewares/index.d.ts +0 -1
- package/dist/middlewares/index.js +0 -17
- package/dist/middlewares/version-checker.middleware.d.ts +0 -2
- package/dist/middlewares/version-checker.middleware.js +0 -27
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface DivisionReference {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export interface LobReference {
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
division: DivisionReference;
|
|
9
|
+
}
|
|
10
|
+
export interface DivisionLobScope {
|
|
11
|
+
division: DivisionReference | null;
|
|
12
|
+
lob: LobReference | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function toLobReference(assignment: {
|
|
15
|
+
lob?: {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
division?: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
} | null;
|
|
22
|
+
} | null;
|
|
23
|
+
}): LobReference | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toLobReference = toLobReference;
|
|
4
|
+
function toLobReference(assignment) {
|
|
5
|
+
const lob = assignment.lob;
|
|
6
|
+
const division = lob === null || lob === void 0 ? void 0 : lob.division;
|
|
7
|
+
if (!lob || !division)
|
|
8
|
+
return null;
|
|
9
|
+
return {
|
|
10
|
+
id: String(lob.id),
|
|
11
|
+
name: lob.name,
|
|
12
|
+
division: { id: String(division.id), name: division.name },
|
|
13
|
+
};
|
|
14
|
+
}
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './config.entity';
|
|
|
9
9
|
export * from './depreciation-categories.entity';
|
|
10
10
|
export * from './depreciation-details.entity';
|
|
11
11
|
export * from './division.entity';
|
|
12
|
+
export * from './division-lob.types';
|
|
12
13
|
export * from './detail-type.entity';
|
|
13
14
|
export * from './lob.entity';
|
|
14
15
|
export * from './users-lobs.entity';
|
package/dist/entities/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __exportStar(require("./config.entity"), exports);
|
|
|
25
25
|
__exportStar(require("./depreciation-categories.entity"), exports);
|
|
26
26
|
__exportStar(require("./depreciation-details.entity"), exports);
|
|
27
27
|
__exportStar(require("./division.entity"), exports);
|
|
28
|
+
__exportStar(require("./division-lob.types"), exports);
|
|
28
29
|
__exportStar(require("./detail-type.entity"), exports);
|
|
29
30
|
__exportStar(require("./lob.entity"), exports);
|
|
30
31
|
__exportStar(require("./users-lobs.entity"), exports);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UserClientContext = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
let UserClientContext = class UserClientContext {
|
|
15
|
+
};
|
|
16
|
+
exports.UserClientContext = UserClientContext;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, typeorm_1.PrimaryColumn)({ name: 'USER_ID', type: 'numeric' }),
|
|
19
|
+
__metadata("design:type", Number)
|
|
20
|
+
], UserClientContext.prototype, "userId", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryColumn)({ name: 'client_id', type: 'integer' }),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], UserClientContext.prototype, "clientId", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 250, default: '' }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], UserClientContext.prototype, "profile", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 250, default: '' }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], UserClientContext.prototype, "division", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 250, default: '' }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], UserClientContext.prototype, "lob", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)({ name: 'REPORTS_TO', type: 'numeric', nullable: true }),
|
|
39
|
+
__metadata("design:type", Number)
|
|
40
|
+
], UserClientContext.prototype, "reportsToId", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.CreateDateColumn)({
|
|
43
|
+
name: 'created_at',
|
|
44
|
+
type: 'timestamptz',
|
|
45
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", Date)
|
|
48
|
+
], UserClientContext.prototype, "createdAt", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.UpdateDateColumn)({
|
|
51
|
+
name: 'updated_at',
|
|
52
|
+
type: 'timestamptz',
|
|
53
|
+
default: () => 'CURRENT_TIMESTAMP',
|
|
54
|
+
}),
|
|
55
|
+
__metadata("design:type", Date)
|
|
56
|
+
], UserClientContext.prototype, "updatedAt", void 0);
|
|
57
|
+
exports.UserClientContext = UserClientContext = __decorate([
|
|
58
|
+
(0, typeorm_1.Entity)('USER_CLIENT_CONTEXT', { schema: 'stm' })
|
|
59
|
+
], UserClientContext);
|
|
@@ -38,10 +38,7 @@ __decorate([
|
|
|
38
38
|
], UsersLobs.prototype, "updatedAt", void 0);
|
|
39
39
|
__decorate([
|
|
40
40
|
(0, typeorm_1.ManyToOne)(() => usr_entity_1.Users, (user) => user.usersLobs, { onDelete: 'CASCADE' }),
|
|
41
|
-
(0, typeorm_1.JoinColumn)(
|
|
42
|
-
{ name: 'user_id', referencedColumnName: 'id' },
|
|
43
|
-
{ name: 'client_id', referencedColumnName: 'clientId' },
|
|
44
|
-
]),
|
|
41
|
+
(0, typeorm_1.JoinColumn)({ name: 'user_id', referencedColumnName: 'id' }),
|
|
45
42
|
__metadata("design:type", usr_entity_1.Users)
|
|
46
43
|
], UsersLobs.prototype, "user", void 0);
|
|
47
44
|
__decorate([
|
|
@@ -16,8 +16,6 @@ export declare class Users {
|
|
|
16
16
|
is_active: number;
|
|
17
17
|
password_expired: number;
|
|
18
18
|
ntgid: string;
|
|
19
|
-
lob: string;
|
|
20
|
-
division: string;
|
|
21
19
|
profile: string;
|
|
22
20
|
viewEvaluations: boolean;
|
|
23
21
|
ern: string;
|
|
@@ -27,6 +25,5 @@ export declare class Users {
|
|
|
27
25
|
rawRoster: RawRoster;
|
|
28
26
|
usersLobs: UsersLobs[];
|
|
29
27
|
fullName: string;
|
|
30
|
-
|
|
31
|
-
private firstLobDivision;
|
|
28
|
+
applyCalculatedProperties(): void;
|
|
32
29
|
}
|
|
@@ -16,23 +16,8 @@ const user_roles_entity_1 = require("./user-roles.entity");
|
|
|
16
16
|
const raw_roster_entity_1 = require("./raw_roster.entity");
|
|
17
17
|
const users_lobs_entity_1 = require("./users-lobs.entity");
|
|
18
18
|
let Users = class Users {
|
|
19
|
-
|
|
20
|
-
var _a;
|
|
19
|
+
applyCalculatedProperties() {
|
|
21
20
|
this.fullName = `${this.first_name} ${this.last_name}`;
|
|
22
|
-
const lobNames = ((_a = this.usersLobs) !== null && _a !== void 0 ? _a : [])
|
|
23
|
-
.map((assignment) => { var _a; return (_a = assignment.lob) === null || _a === void 0 ? void 0 : _a.name; })
|
|
24
|
-
.filter((name) => Boolean(name))
|
|
25
|
-
.sort((a, b) => a.localeCompare(b));
|
|
26
|
-
this.lob = lobNames.join(',');
|
|
27
|
-
this.division = lobNames.length > 0 ? this.firstLobDivision() : '';
|
|
28
|
-
}
|
|
29
|
-
firstLobDivision() {
|
|
30
|
-
var _a, _b;
|
|
31
|
-
const divisions = ((_a = this.usersLobs) !== null && _a !== void 0 ? _a : [])
|
|
32
|
-
.map((assignment) => { var _a, _b; return (_b = (_a = assignment.lob) === null || _a === void 0 ? void 0 : _a.division) === null || _b === void 0 ? void 0 : _b.name; })
|
|
33
|
-
.filter((name) => Boolean(name))
|
|
34
|
-
.sort((a, b) => a.localeCompare(b));
|
|
35
|
-
return (_b = divisions[0]) !== null && _b !== void 0 ? _b : '';
|
|
36
21
|
}
|
|
37
22
|
};
|
|
38
23
|
exports.Users = Users;
|
|
@@ -127,7 +112,7 @@ __decorate([
|
|
|
127
112
|
__metadata("design:type", Function),
|
|
128
113
|
__metadata("design:paramtypes", []),
|
|
129
114
|
__metadata("design:returntype", void 0)
|
|
130
|
-
], Users.prototype, "
|
|
115
|
+
], Users.prototype, "applyCalculatedProperties", null);
|
|
131
116
|
exports.Users = Users = __decorate([
|
|
132
117
|
(0, typeorm_1.Entity)('USERS')
|
|
133
118
|
], Users);
|
|
@@ -26,14 +26,6 @@ __decorate([
|
|
|
26
26
|
(0, typeorm_1.ViewColumn)(),
|
|
27
27
|
__metadata("design:type", String)
|
|
28
28
|
], VwEscalationAge.prototype, "category", void 0);
|
|
29
|
-
__decorate([
|
|
30
|
-
(0, typeorm_1.ViewColumn)(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], VwEscalationAge.prototype, "division", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, typeorm_1.ViewColumn)(),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], VwEscalationAge.prototype, "lob", void 0);
|
|
37
29
|
__decorate([
|
|
38
30
|
(0, typeorm_1.ViewColumn)({ name: 'division_id' }),
|
|
39
31
|
__metadata("design:type", String)
|
|
@@ -35,7 +35,7 @@ let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(pas
|
|
|
35
35
|
}
|
|
36
36
|
validate(payload) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
var _a, _b, _c;
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
39
|
const signedUser = payload === null || payload === void 0 ? void 0 : payload.user;
|
|
40
40
|
const effectiveClientId = Number(signedUser === null || signedUser === void 0 ? void 0 : signedUser.clientId);
|
|
41
41
|
const originalClientId = (_a = signedUser === null || signedUser === void 0 ? void 0 : signedUser.originalClientId) !== null && _a !== void 0 ? _a : null;
|
|
@@ -80,8 +80,7 @@ let JwtStrategy = class JwtStrategy extends (0, passport_1.PassportStrategy)(pas
|
|
|
80
80
|
first_name: identity.firstName,
|
|
81
81
|
username: identity.username,
|
|
82
82
|
last_name: identity.lastName,
|
|
83
|
-
|
|
84
|
-
lob: identity.lob,
|
|
83
|
+
lobIds: (_d = identity.lobIds) !== null && _d !== void 0 ? _d : [],
|
|
85
84
|
fullName: identity.fullName,
|
|
86
85
|
ntgid: identity.ntgid,
|
|
87
86
|
profile: identity.profile,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.MasterUsersGuard = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const tenant_constants_1 = require("./tenant.constants");
|
|
12
|
+
let MasterUsersGuard = class MasterUsersGuard {
|
|
13
|
+
canActivate(context) {
|
|
14
|
+
var _a, _b, _c, _d, _e;
|
|
15
|
+
const request = context.switchToHttp().getRequest();
|
|
16
|
+
const user = request.user;
|
|
17
|
+
if (!user || user === true) {
|
|
18
|
+
throw new common_1.UnauthorizedException();
|
|
19
|
+
}
|
|
20
|
+
const effectiveClientId = (_b = (_a = request.tenantContext) === null || _a === void 0 ? void 0 : _a.clientId) !== null && _b !== void 0 ? _b : user.clientId;
|
|
21
|
+
const originalClientId = (_e = (_d = (_c = request.tenantContext) === null || _c === void 0 ? void 0 : _c.originalClientId) !== null && _d !== void 0 ? _d : user.originalClientId) !== null && _e !== void 0 ? _e : null;
|
|
22
|
+
const hasCapability = (user.privileges || []).some((privilege) => privilege.trim().toUpperCase() === tenant_constants_1.MASTER_USERS_ADMIN_PRIVILEGE);
|
|
23
|
+
if (effectiveClientId !== tenant_constants_1.NEWTECH_CLIENT_ID ||
|
|
24
|
+
originalClientId !== null ||
|
|
25
|
+
!user.isMasterTenantAdmin ||
|
|
26
|
+
!hasCapability) {
|
|
27
|
+
throw new common_1.ForbiddenException();
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
exports.MasterUsersGuard = MasterUsersGuard;
|
|
33
|
+
exports.MasterUsersGuard = MasterUsersGuard = __decorate([
|
|
34
|
+
(0, common_1.Injectable)()
|
|
35
|
+
], MasterUsersGuard);
|
|
@@ -18,7 +18,7 @@ function tokenIdentifier(value) {
|
|
|
18
18
|
return value;
|
|
19
19
|
}
|
|
20
20
|
function tenantAuthorizationKey(clientId, userId) {
|
|
21
|
-
return `client:${positiveInteger(clientId, 'clientId')}:authz:user:${positiveInteger(userId, 'userId')}`;
|
|
21
|
+
return `client:${positiveInteger(clientId, 'clientId')}:authz:v2:user:${positiveInteger(userId, 'userId')}`;
|
|
22
22
|
}
|
|
23
23
|
function revokedAccessTokenKey(jti) {
|
|
24
24
|
return `security:access-token:revoked:${tokenIdentifier(jti)}`;
|
|
@@ -124,7 +124,7 @@ let TenantAuthorizationService = TenantAuthorizationService_1 = class TenantAuth
|
|
|
124
124
|
}
|
|
125
125
|
loadFromDatabase(userId, clientId) {
|
|
126
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
127
|
-
var _a, _b;
|
|
127
|
+
var _a, _b, _c, _d;
|
|
128
128
|
const [user, client, assignments, accessRows] = yield Promise.all([
|
|
129
129
|
this.userRepository.findOne({
|
|
130
130
|
where: { id: userId },
|
|
@@ -166,6 +166,9 @@ let TenantAuthorizationService = TenantAuthorizationService_1 = class TenantAuth
|
|
|
166
166
|
AND membership.client_id = $2
|
|
167
167
|
GROUP BY role.id`, [userId, clientId]),
|
|
168
168
|
]);
|
|
169
|
+
if (user) {
|
|
170
|
+
user.usersLobs = ((_a = user.usersLobs) !== null && _a !== void 0 ? _a : []).filter((assignment) => Number(assignment.clientId) === clientId);
|
|
171
|
+
}
|
|
169
172
|
if (!user ||
|
|
170
173
|
!Number(user.is_active) ||
|
|
171
174
|
!client ||
|
|
@@ -175,7 +178,7 @@ let TenantAuthorizationService = TenantAuthorizationService_1 = class TenantAuth
|
|
|
175
178
|
}
|
|
176
179
|
const accessRow = accessRows[0];
|
|
177
180
|
const usingLegacyCompatibility = accessRows.length === 0 || accessRow.code.startsWith('migrated-');
|
|
178
|
-
const legacyRole = (
|
|
181
|
+
const legacyRole = (_b = assignments[0]) === null || _b === void 0 ? void 0 : _b.role;
|
|
179
182
|
const accessRole = accessRow
|
|
180
183
|
? {
|
|
181
184
|
id: Number(accessRow.id),
|
|
@@ -189,7 +192,7 @@ let TenantAuthorizationService = TenantAuthorizationService_1 = class TenantAuth
|
|
|
189
192
|
: {
|
|
190
193
|
id: Number(legacyRole === null || legacyRole === void 0 ? void 0 : legacyRole.id),
|
|
191
194
|
code: `legacy-${Number(legacyRole === null || legacyRole === void 0 ? void 0 : legacyRole.id)}`,
|
|
192
|
-
name: (
|
|
195
|
+
name: (_c = legacyRole === null || legacyRole === void 0 ? void 0 : legacyRole.roleName) !== null && _c !== void 0 ? _c : 'Legacy access',
|
|
193
196
|
scope: 'CLIENT',
|
|
194
197
|
clientId,
|
|
195
198
|
};
|
|
@@ -232,8 +235,9 @@ let TenantAuthorizationService = TenantAuthorizationService_1 = class TenantAuth
|
|
|
232
235
|
firstName: user.first_name,
|
|
233
236
|
username: user.username,
|
|
234
237
|
lastName: user.last_name,
|
|
235
|
-
|
|
236
|
-
|
|
238
|
+
lobIds: ((_d = user.usersLobs) !== null && _d !== void 0 ? _d : [])
|
|
239
|
+
.map((assignment) => String(assignment.lobId))
|
|
240
|
+
.sort(),
|
|
237
241
|
fullName: user.fullName,
|
|
238
242
|
ntgid: user.ntgid,
|
|
239
243
|
profile: user.profile,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DataSource, EntityManager } from 'typeorm';
|
|
2
|
+
import { DivisionLobScope } from '../entities/division-lob.types';
|
|
3
|
+
type QueryExecutor = Pick<DataSource | EntityManager, 'query'>;
|
|
4
|
+
export declare function validateDivisionLobIds(executor: QueryExecutor, clientId: number, divisionIdValue: unknown, lobIdValue: unknown): Promise<{
|
|
5
|
+
divisionId: string;
|
|
6
|
+
lobId: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function loadDivisionLobScope(executor: QueryExecutor, clientId: number, divisionIdValue: unknown, lobIdValue: unknown): Promise<DivisionLobScope>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +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.validateDivisionLobIds = validateDivisionLobIds;
|
|
13
|
+
exports.loadDivisionLobScope = loadDivisionLobScope;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
function bigintId(value, field) {
|
|
16
|
+
const normalized = String(value !== null && value !== void 0 ? value : '');
|
|
17
|
+
if (!/^[1-9]\d*$/.test(normalized)) {
|
|
18
|
+
throw new common_1.BadRequestException(`${field} must be a positive bigint identifier`);
|
|
19
|
+
}
|
|
20
|
+
return normalized;
|
|
21
|
+
}
|
|
22
|
+
function validateDivisionLobIds(executor, clientId, divisionIdValue, lobIdValue) {
|
|
23
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
const divisionId = bigintId(divisionIdValue, 'divisionId');
|
|
25
|
+
const lobId = bigintId(lobIdValue, 'lobId');
|
|
26
|
+
const rows = yield executor.query(`SELECT lob.id
|
|
27
|
+
FROM stm.lob lob
|
|
28
|
+
JOIN stm.division division
|
|
29
|
+
ON division.id = lob.division_id
|
|
30
|
+
AND division.client_id = lob.client_id
|
|
31
|
+
WHERE lob.id = $1 AND division.id = $2 AND lob.client_id = $3
|
|
32
|
+
AND lob.deleted_at IS NULL AND division.deleted_at IS NULL`, [lobId, divisionId, clientId]);
|
|
33
|
+
if (!rows.length) {
|
|
34
|
+
throw new common_1.BadRequestException('Division and LOB are not active for this client');
|
|
35
|
+
}
|
|
36
|
+
return { divisionId, lobId };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function loadDivisionLobScope(executor, clientId, divisionIdValue, lobIdValue) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
if (divisionIdValue == null && lobIdValue == null) {
|
|
42
|
+
return { division: null, lob: null };
|
|
43
|
+
}
|
|
44
|
+
const divisionId = bigintId(divisionIdValue, 'divisionId');
|
|
45
|
+
const lobId = bigintId(lobIdValue, 'lobId');
|
|
46
|
+
const rows = yield executor.query(`SELECT division.id::text AS "divisionId", division.name AS "divisionName",
|
|
47
|
+
lob.id::text AS "lobId", lob.name AS "lobName"
|
|
48
|
+
FROM stm.division division
|
|
49
|
+
JOIN stm.lob lob ON lob.division_id = division.id AND lob.client_id = division.client_id
|
|
50
|
+
WHERE division.id = $1 AND lob.id = $2 AND division.client_id = $3`, [divisionId, lobId, clientId]);
|
|
51
|
+
if (!rows.length)
|
|
52
|
+
return { division: null, lob: null };
|
|
53
|
+
const row = rows[0];
|
|
54
|
+
const division = { id: String(row.divisionId), name: row.divisionName };
|
|
55
|
+
return {
|
|
56
|
+
division,
|
|
57
|
+
lob: { id: String(row.lobId), name: row.lobName, division },
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
}
|
package/dist/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
|
@@ -18,3 +18,4 @@ __exportStar(require("./object.utils"), exports);
|
|
|
18
18
|
__exportStar(require("./string.utils"), exports);
|
|
19
19
|
__exportStar(require("./parse.util"), exports);
|
|
20
20
|
__exportStar(require("./ticket-service-center-match-progress.util"), exports);
|
|
21
|
+
__exportStar(require("./division-lob-catalog"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniorganization/uni-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "UNI Library",
|
|
5
5
|
"author": "Jhomiguel",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,17 +9,6 @@
|
|
|
9
9
|
"dist/**/*",
|
|
10
10
|
"*.md"
|
|
11
11
|
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"start:dev": "tsc -w",
|
|
14
|
-
"build": "tsc",
|
|
15
|
-
"prepublishOnly": "pnpm run build",
|
|
16
|
-
"format": "prettier --write \"src/**/*.ts\"",
|
|
17
|
-
"lint": "tslint -p tsconfig.json -c tslint.json",
|
|
18
|
-
"test": "jest",
|
|
19
|
-
"test:watch": "jest --watch",
|
|
20
|
-
"test:cov": "jest --coverage",
|
|
21
|
-
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
22
|
-
},
|
|
23
12
|
"dependencies": {
|
|
24
13
|
"@googlemaps/google-maps-services-js": "^3.4.2",
|
|
25
14
|
"@aws-sdk/client-s3": "^3.833.0",
|
|
@@ -82,5 +71,15 @@
|
|
|
82
71
|
},
|
|
83
72
|
"coverageDirectory": "../coverage",
|
|
84
73
|
"testEnvironment": "node"
|
|
74
|
+
},
|
|
75
|
+
"scripts": {
|
|
76
|
+
"start:dev": "tsc -w",
|
|
77
|
+
"build": "tsc",
|
|
78
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
79
|
+
"lint": "tslint -p tsconfig.json -c tslint.json",
|
|
80
|
+
"test": "jest",
|
|
81
|
+
"test:watch": "jest --watch",
|
|
82
|
+
"test:cov": "jest --coverage",
|
|
83
|
+
"test:e2e": "jest --config ./test/jest-e2e.json"
|
|
85
84
|
}
|
|
86
|
-
}
|
|
85
|
+
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Transactions } from './transactions.entity';
|
|
2
|
-
export declare class DailyPayment {
|
|
3
|
-
transactionId: string;
|
|
4
|
-
rowDate: Date;
|
|
5
|
-
rowSource: string;
|
|
6
|
-
rnnNumber: string;
|
|
7
|
-
sourceType: string;
|
|
8
|
-
customerNo: string;
|
|
9
|
-
cnnNumber: string;
|
|
10
|
-
symptom: string;
|
|
11
|
-
subSymptom: string;
|
|
12
|
-
createdBy: string;
|
|
13
|
-
receiptUserName: string;
|
|
14
|
-
partsUseFlag: string;
|
|
15
|
-
svcCenterType: string;
|
|
16
|
-
repairReceiptTimestamp: Date;
|
|
17
|
-
model: string;
|
|
18
|
-
serialNo: string;
|
|
19
|
-
state: string;
|
|
20
|
-
zipCode: string;
|
|
21
|
-
callStatus: string;
|
|
22
|
-
product: string;
|
|
23
|
-
receiptRemark: string;
|
|
24
|
-
dateScheduled: Date;
|
|
25
|
-
ascCode: string;
|
|
26
|
-
svcEngineerName: string;
|
|
27
|
-
callSubstatus: string;
|
|
28
|
-
updatedOn: Date;
|
|
29
|
-
daysSinceLastStatusUpdate: string;
|
|
30
|
-
svcContKey: string;
|
|
31
|
-
callEndDate: Date;
|
|
32
|
-
tappTicketStatus: string;
|
|
33
|
-
tappSubStatus: string;
|
|
34
|
-
tappTrackingResult: string;
|
|
35
|
-
tappApptScheduleDateOrCompletionDate: Date;
|
|
36
|
-
tappStatusEndedDate: Date;
|
|
37
|
-
statusEndedDate: Date;
|
|
38
|
-
agreedPrice: string;
|
|
39
|
-
serviceCenter: string;
|
|
40
|
-
orderDate: Date;
|
|
41
|
-
orderStatusName: string;
|
|
42
|
-
actualShipmentDate: Date;
|
|
43
|
-
trackingNo: string;
|
|
44
|
-
eta: Date;
|
|
45
|
-
backOrderHold: string;
|
|
46
|
-
backOrderRelease: string;
|
|
47
|
-
postingDate: Date;
|
|
48
|
-
tat: string;
|
|
49
|
-
repairTat: string;
|
|
50
|
-
schWithin: string;
|
|
51
|
-
svcType: string;
|
|
52
|
-
partsAging: string;
|
|
53
|
-
primaryRepairCode: string;
|
|
54
|
-
vocNo: string;
|
|
55
|
-
workInfoSkill: string;
|
|
56
|
-
rmaNo: string;
|
|
57
|
-
transaction: Transactions;
|
|
58
|
-
}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.DailyPayment = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const transactions_entity_1 = require("./transactions.entity");
|
|
15
|
-
let DailyPayment = class DailyPayment {
|
|
16
|
-
};
|
|
17
|
-
exports.DailyPayment = DailyPayment;
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, typeorm_1.PrimaryColumn)({ name: 'transaction_id' }),
|
|
20
|
-
__metadata("design:type", String)
|
|
21
|
-
], DailyPayment.prototype, "transactionId", void 0);
|
|
22
|
-
__decorate([
|
|
23
|
-
(0, typeorm_1.PrimaryColumn)({ name: 'row_date', type: 'date' }),
|
|
24
|
-
__metadata("design:type", Date)
|
|
25
|
-
], DailyPayment.prototype, "rowDate", void 0);
|
|
26
|
-
__decorate([
|
|
27
|
-
(0, typeorm_1.PrimaryColumn)({ name: 'row_source' }),
|
|
28
|
-
__metadata("design:type", String)
|
|
29
|
-
], DailyPayment.prototype, "rowSource", void 0);
|
|
30
|
-
__decorate([
|
|
31
|
-
(0, typeorm_1.PrimaryColumn)({ name: 'rnn_number' }),
|
|
32
|
-
__metadata("design:type", String)
|
|
33
|
-
], DailyPayment.prototype, "rnnNumber", void 0);
|
|
34
|
-
__decorate([
|
|
35
|
-
(0, typeorm_1.Column)({ name: 'source_type', nullable: true }),
|
|
36
|
-
__metadata("design:type", String)
|
|
37
|
-
], DailyPayment.prototype, "sourceType", void 0);
|
|
38
|
-
__decorate([
|
|
39
|
-
(0, typeorm_1.Column)({ name: 'customer_no', nullable: true }),
|
|
40
|
-
__metadata("design:type", String)
|
|
41
|
-
], DailyPayment.prototype, "customerNo", void 0);
|
|
42
|
-
__decorate([
|
|
43
|
-
(0, typeorm_1.Column)({ name: 'cnn_number', nullable: true }),
|
|
44
|
-
__metadata("design:type", String)
|
|
45
|
-
], DailyPayment.prototype, "cnnNumber", void 0);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
48
|
-
__metadata("design:type", String)
|
|
49
|
-
], DailyPayment.prototype, "symptom", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
(0, typeorm_1.Column)({ name: 'sub_symptom', nullable: true }),
|
|
52
|
-
__metadata("design:type", String)
|
|
53
|
-
], DailyPayment.prototype, "subSymptom", void 0);
|
|
54
|
-
__decorate([
|
|
55
|
-
(0, typeorm_1.Column)({ name: 'created_by', nullable: true }),
|
|
56
|
-
__metadata("design:type", String)
|
|
57
|
-
], DailyPayment.prototype, "createdBy", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, typeorm_1.Column)({ name: 'receipt_user_name', nullable: true }),
|
|
60
|
-
__metadata("design:type", String)
|
|
61
|
-
], DailyPayment.prototype, "receiptUserName", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, typeorm_1.Column)({ name: 'parts_use_flag', nullable: true }),
|
|
64
|
-
__metadata("design:type", String)
|
|
65
|
-
], DailyPayment.prototype, "partsUseFlag", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
(0, typeorm_1.Column)({ name: 'svc_center_type', nullable: true }),
|
|
68
|
-
__metadata("design:type", String)
|
|
69
|
-
], DailyPayment.prototype, "svcCenterType", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
(0, typeorm_1.Column)('timestamp', { name: 'repair_receipt_timestamp', nullable: true }),
|
|
72
|
-
__metadata("design:type", Date)
|
|
73
|
-
], DailyPayment.prototype, "repairReceiptTimestamp", void 0);
|
|
74
|
-
__decorate([
|
|
75
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
76
|
-
__metadata("design:type", String)
|
|
77
|
-
], DailyPayment.prototype, "model", void 0);
|
|
78
|
-
__decorate([
|
|
79
|
-
(0, typeorm_1.Column)({ name: 'serial_no', nullable: true }),
|
|
80
|
-
__metadata("design:type", String)
|
|
81
|
-
], DailyPayment.prototype, "serialNo", void 0);
|
|
82
|
-
__decorate([
|
|
83
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
84
|
-
__metadata("design:type", String)
|
|
85
|
-
], DailyPayment.prototype, "state", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
(0, typeorm_1.Column)({ name: 'zip_code', nullable: true }),
|
|
88
|
-
__metadata("design:type", String)
|
|
89
|
-
], DailyPayment.prototype, "zipCode", void 0);
|
|
90
|
-
__decorate([
|
|
91
|
-
(0, typeorm_1.Column)({ name: 'call_status', nullable: true }),
|
|
92
|
-
__metadata("design:type", String)
|
|
93
|
-
], DailyPayment.prototype, "callStatus", void 0);
|
|
94
|
-
__decorate([
|
|
95
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
96
|
-
__metadata("design:type", String)
|
|
97
|
-
], DailyPayment.prototype, "product", void 0);
|
|
98
|
-
__decorate([
|
|
99
|
-
(0, typeorm_1.Column)({ name: 'receipt_remark', nullable: true }),
|
|
100
|
-
__metadata("design:type", String)
|
|
101
|
-
], DailyPayment.prototype, "receiptRemark", void 0);
|
|
102
|
-
__decorate([
|
|
103
|
-
(0, typeorm_1.Column)('date', { name: 'date_scheduled', nullable: true }),
|
|
104
|
-
__metadata("design:type", Date)
|
|
105
|
-
], DailyPayment.prototype, "dateScheduled", void 0);
|
|
106
|
-
__decorate([
|
|
107
|
-
(0, typeorm_1.Column)({ name: 'asc_code', nullable: true }),
|
|
108
|
-
__metadata("design:type", String)
|
|
109
|
-
], DailyPayment.prototype, "ascCode", void 0);
|
|
110
|
-
__decorate([
|
|
111
|
-
(0, typeorm_1.Column)({ name: 'svc_engineer_name', nullable: true }),
|
|
112
|
-
__metadata("design:type", String)
|
|
113
|
-
], DailyPayment.prototype, "svcEngineerName", void 0);
|
|
114
|
-
__decorate([
|
|
115
|
-
(0, typeorm_1.Column)({ name: 'call_substatus', nullable: true }),
|
|
116
|
-
__metadata("design:type", String)
|
|
117
|
-
], DailyPayment.prototype, "callSubstatus", void 0);
|
|
118
|
-
__decorate([
|
|
119
|
-
(0, typeorm_1.Column)('timestamp', { name: 'updated_on', nullable: true }),
|
|
120
|
-
__metadata("design:type", Date)
|
|
121
|
-
], DailyPayment.prototype, "updatedOn", void 0);
|
|
122
|
-
__decorate([
|
|
123
|
-
(0, typeorm_1.Column)({ name: 'days_since_last_status_update', nullable: true }),
|
|
124
|
-
__metadata("design:type", String)
|
|
125
|
-
], DailyPayment.prototype, "daysSinceLastStatusUpdate", void 0);
|
|
126
|
-
__decorate([
|
|
127
|
-
(0, typeorm_1.Column)({ name: 'svc_cont_key', nullable: true }),
|
|
128
|
-
__metadata("design:type", String)
|
|
129
|
-
], DailyPayment.prototype, "svcContKey", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
(0, typeorm_1.Column)('date', { name: 'call_end_date', nullable: true }),
|
|
132
|
-
__metadata("design:type", Date)
|
|
133
|
-
], DailyPayment.prototype, "callEndDate", void 0);
|
|
134
|
-
__decorate([
|
|
135
|
-
(0, typeorm_1.Column)({ name: 'tapp_ticket_status', nullable: true }),
|
|
136
|
-
__metadata("design:type", String)
|
|
137
|
-
], DailyPayment.prototype, "tappTicketStatus", void 0);
|
|
138
|
-
__decorate([
|
|
139
|
-
(0, typeorm_1.Column)({ name: 'tapp_sub_status', nullable: true }),
|
|
140
|
-
__metadata("design:type", String)
|
|
141
|
-
], DailyPayment.prototype, "tappSubStatus", void 0);
|
|
142
|
-
__decorate([
|
|
143
|
-
(0, typeorm_1.Column)({ name: 'tapp_tracking_result', nullable: true }),
|
|
144
|
-
__metadata("design:type", String)
|
|
145
|
-
], DailyPayment.prototype, "tappTrackingResult", void 0);
|
|
146
|
-
__decorate([
|
|
147
|
-
(0, typeorm_1.Column)('date', {
|
|
148
|
-
name: 'tapp_appt_schedule_date_or_completion_date',
|
|
149
|
-
nullable: true,
|
|
150
|
-
}),
|
|
151
|
-
__metadata("design:type", Date)
|
|
152
|
-
], DailyPayment.prototype, "tappApptScheduleDateOrCompletionDate", void 0);
|
|
153
|
-
__decorate([
|
|
154
|
-
(0, typeorm_1.Column)('timestamp', { name: 'tapp_status_ended_date', nullable: true }),
|
|
155
|
-
__metadata("design:type", Date)
|
|
156
|
-
], DailyPayment.prototype, "tappStatusEndedDate", void 0);
|
|
157
|
-
__decorate([
|
|
158
|
-
(0, typeorm_1.Column)('timestamp', { name: 'status_ended_date', nullable: true }),
|
|
159
|
-
__metadata("design:type", Date)
|
|
160
|
-
], DailyPayment.prototype, "statusEndedDate", void 0);
|
|
161
|
-
__decorate([
|
|
162
|
-
(0, typeorm_1.Column)({ name: 'agreed_price', nullable: true }),
|
|
163
|
-
__metadata("design:type", String)
|
|
164
|
-
], DailyPayment.prototype, "agreedPrice", void 0);
|
|
165
|
-
__decorate([
|
|
166
|
-
(0, typeorm_1.Column)({ name: 'service_center', nullable: true }),
|
|
167
|
-
__metadata("design:type", String)
|
|
168
|
-
], DailyPayment.prototype, "serviceCenter", void 0);
|
|
169
|
-
__decorate([
|
|
170
|
-
(0, typeorm_1.Column)('date', { name: 'order_date', nullable: true }),
|
|
171
|
-
__metadata("design:type", Date)
|
|
172
|
-
], DailyPayment.prototype, "orderDate", void 0);
|
|
173
|
-
__decorate([
|
|
174
|
-
(0, typeorm_1.Column)({ name: 'order_status_name', nullable: true }),
|
|
175
|
-
__metadata("design:type", String)
|
|
176
|
-
], DailyPayment.prototype, "orderStatusName", void 0);
|
|
177
|
-
__decorate([
|
|
178
|
-
(0, typeorm_1.Column)('date', { name: 'actual_shipment_date', nullable: true }),
|
|
179
|
-
__metadata("design:type", Date)
|
|
180
|
-
], DailyPayment.prototype, "actualShipmentDate", void 0);
|
|
181
|
-
__decorate([
|
|
182
|
-
(0, typeorm_1.Column)({ name: 'tracking_no', nullable: true }),
|
|
183
|
-
__metadata("design:type", String)
|
|
184
|
-
], DailyPayment.prototype, "trackingNo", void 0);
|
|
185
|
-
__decorate([
|
|
186
|
-
(0, typeorm_1.Column)('date', { name: 'eta', nullable: true }),
|
|
187
|
-
__metadata("design:type", Date)
|
|
188
|
-
], DailyPayment.prototype, "eta", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
(0, typeorm_1.Column)({ name: 'back_order_hold', nullable: true }),
|
|
191
|
-
__metadata("design:type", String)
|
|
192
|
-
], DailyPayment.prototype, "backOrderHold", void 0);
|
|
193
|
-
__decorate([
|
|
194
|
-
(0, typeorm_1.Column)({ name: 'back_order_release', nullable: true }),
|
|
195
|
-
__metadata("design:type", String)
|
|
196
|
-
], DailyPayment.prototype, "backOrderRelease", void 0);
|
|
197
|
-
__decorate([
|
|
198
|
-
(0, typeorm_1.Column)('date', { name: 'posting_date', nullable: true }),
|
|
199
|
-
__metadata("design:type", Date)
|
|
200
|
-
], DailyPayment.prototype, "postingDate", void 0);
|
|
201
|
-
__decorate([
|
|
202
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
203
|
-
__metadata("design:type", String)
|
|
204
|
-
], DailyPayment.prototype, "tat", void 0);
|
|
205
|
-
__decorate([
|
|
206
|
-
(0, typeorm_1.Column)({ name: 'repair_tat', nullable: true }),
|
|
207
|
-
__metadata("design:type", String)
|
|
208
|
-
], DailyPayment.prototype, "repairTat", void 0);
|
|
209
|
-
__decorate([
|
|
210
|
-
(0, typeorm_1.Column)({ name: 'sch_within', nullable: true }),
|
|
211
|
-
__metadata("design:type", String)
|
|
212
|
-
], DailyPayment.prototype, "schWithin", void 0);
|
|
213
|
-
__decorate([
|
|
214
|
-
(0, typeorm_1.Column)({ name: 'svc_type', nullable: true }),
|
|
215
|
-
__metadata("design:type", String)
|
|
216
|
-
], DailyPayment.prototype, "svcType", void 0);
|
|
217
|
-
__decorate([
|
|
218
|
-
(0, typeorm_1.Column)({ name: 'parts_aging', nullable: true }),
|
|
219
|
-
__metadata("design:type", String)
|
|
220
|
-
], DailyPayment.prototype, "partsAging", void 0);
|
|
221
|
-
__decorate([
|
|
222
|
-
(0, typeorm_1.Column)({ name: 'primary_repair_code', nullable: true }),
|
|
223
|
-
__metadata("design:type", String)
|
|
224
|
-
], DailyPayment.prototype, "primaryRepairCode", void 0);
|
|
225
|
-
__decorate([
|
|
226
|
-
(0, typeorm_1.Column)({ name: 'voc_no', nullable: true }),
|
|
227
|
-
__metadata("design:type", String)
|
|
228
|
-
], DailyPayment.prototype, "vocNo", void 0);
|
|
229
|
-
__decorate([
|
|
230
|
-
(0, typeorm_1.Column)({ name: 'work_info_skill', nullable: true }),
|
|
231
|
-
__metadata("design:type", String)
|
|
232
|
-
], DailyPayment.prototype, "workInfoSkill", void 0);
|
|
233
|
-
__decorate([
|
|
234
|
-
(0, typeorm_1.Column)({ name: 'rma_no', nullable: true }),
|
|
235
|
-
__metadata("design:type", String)
|
|
236
|
-
], DailyPayment.prototype, "rmaNo", void 0);
|
|
237
|
-
__decorate([
|
|
238
|
-
(0, typeorm_1.ManyToOne)(() => transactions_entity_1.Transactions, { nullable: true }),
|
|
239
|
-
(0, typeorm_1.JoinColumn)({
|
|
240
|
-
name: 'transaction_id',
|
|
241
|
-
referencedColumnName: 'transactionId',
|
|
242
|
-
}),
|
|
243
|
-
__metadata("design:type", transactions_entity_1.Transactions)
|
|
244
|
-
], DailyPayment.prototype, "transaction", void 0);
|
|
245
|
-
exports.DailyPayment = DailyPayment = __decorate([
|
|
246
|
-
(0, typeorm_1.Entity)('daily_payments', { schema: 'lgai' }),
|
|
247
|
-
(0, typeorm_1.Index)(['transactionId', 'rowDate'])
|
|
248
|
-
], DailyPayment);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './version-checker.middleware';
|
|
@@ -1,17 +0,0 @@
|
|
|
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("./version-checker.middleware"), exports);
|
|
@@ -1,27 +0,0 @@
|
|
|
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.versionChecker = versionChecker;
|
|
13
|
-
const fs = require("fs/promises");
|
|
14
|
-
const path = require("path");
|
|
15
|
-
function versionChecker(req, res, next) {
|
|
16
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
const version = (yield fs.readFile(path.join(process.cwd(), 'app-version.txt')))
|
|
18
|
-
.toString()
|
|
19
|
-
.trim();
|
|
20
|
-
if (req.headers['app-version'] !== version)
|
|
21
|
-
return res.status(409).json({
|
|
22
|
-
message: `You need to update the application version to ${version}`,
|
|
23
|
-
status: 409,
|
|
24
|
-
});
|
|
25
|
-
next();
|
|
26
|
-
});
|
|
27
|
-
}
|