@platform-modules/foreign-ministry 1.0.106 → 1.0.107
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/data-source.js +1 -1
- package/dist/models/HolidaysModel.d.ts +4 -2
- package/dist/models/HolidaysModel.js +16 -8
- package/dist/models/LeaveApprovalDetailsModel.d.ts +13 -0
- package/dist/models/LeaveApprovalDetailsModel.js +51 -0
- package/dist/models/LeaveApprovalMatrixModel.d.ts +7 -0
- package/dist/models/LeaveApprovalMatrixModel.js +40 -0
- package/package.json +1 -1
- package/src/data-source.ts +1 -1
- package/src/models/HolidaysModel.ts +15 -11
package/dist/data-source.js
CHANGED
|
@@ -80,7 +80,7 @@ exports.AppDataSource = new typeorm_1.DataSource({
|
|
|
80
80
|
username: process.env.DB_USER || 'postgres',
|
|
81
81
|
password: process.env.DB_PASS || 'postgres',
|
|
82
82
|
database: process.env.DB_NAME || 'common_models',
|
|
83
|
-
synchronize:
|
|
83
|
+
synchronize: false, // auto-create tables (disable in prod)
|
|
84
84
|
logging: false,
|
|
85
85
|
entities: [
|
|
86
86
|
user_1.User,
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { BaseModel } from './BaseModel';
|
|
2
2
|
export declare class Holidays extends BaseModel {
|
|
3
3
|
title: string;
|
|
4
|
-
|
|
4
|
+
holiday_from_date: Date;
|
|
5
|
+
holiday_to_date: Date;
|
|
5
6
|
description?: string;
|
|
6
7
|
region?: string;
|
|
7
8
|
is_optional: boolean;
|
|
8
9
|
holiday_type: string;
|
|
9
10
|
year?: number;
|
|
10
|
-
|
|
11
|
+
notification_days?: number;
|
|
12
|
+
constructor(title: string, holiday_from_date: Date, holiday_to_date: Date, holiday_type?: string, year?: number, notification_days?: number);
|
|
11
13
|
}
|
|
@@ -13,15 +13,14 @@ exports.Holidays = void 0;
|
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const BaseModel_1 = require("./BaseModel");
|
|
15
15
|
let Holidays = class Holidays extends BaseModel_1.BaseModel {
|
|
16
|
-
constructor(title,
|
|
16
|
+
constructor(title, holiday_from_date, holiday_to_date, holiday_type = 'Public', year, notification_days) {
|
|
17
17
|
super();
|
|
18
18
|
this.title = title;
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.region = region;
|
|
22
|
-
this.is_optional = is_optional;
|
|
19
|
+
this.holiday_from_date = holiday_from_date;
|
|
20
|
+
this.holiday_to_date = holiday_to_date;
|
|
23
21
|
this.holiday_type = holiday_type;
|
|
24
22
|
this.year = year;
|
|
23
|
+
this.notification_days = notification_days;
|
|
25
24
|
}
|
|
26
25
|
};
|
|
27
26
|
exports.Holidays = Holidays;
|
|
@@ -30,9 +29,13 @@ __decorate([
|
|
|
30
29
|
__metadata("design:type", String)
|
|
31
30
|
], Holidays.prototype, "title", void 0);
|
|
32
31
|
__decorate([
|
|
33
|
-
(0, typeorm_1.Column)({ type: 'date', name: '
|
|
32
|
+
(0, typeorm_1.Column)({ type: 'date', name: 'holiday_from_date' }),
|
|
34
33
|
__metadata("design:type", Date)
|
|
35
|
-
], Holidays.prototype, "
|
|
34
|
+
], Holidays.prototype, "holiday_from_date", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ type: 'date', name: 'holiday_to_date' }),
|
|
37
|
+
__metadata("design:type", Date)
|
|
38
|
+
], Holidays.prototype, "holiday_to_date", void 0);
|
|
36
39
|
__decorate([
|
|
37
40
|
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
38
41
|
__metadata("design:type", String)
|
|
@@ -53,7 +56,12 @@ __decorate([
|
|
|
53
56
|
(0, typeorm_1.Column)({ type: 'int', nullable: true }),
|
|
54
57
|
__metadata("design:type", Number)
|
|
55
58
|
], Holidays.prototype, "year", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: true }),
|
|
61
|
+
__metadata("design:type", Number)
|
|
62
|
+
], Holidays.prototype, "notification_days", void 0);
|
|
56
63
|
exports.Holidays = Holidays = __decorate([
|
|
57
64
|
(0, typeorm_1.Entity)({ name: 'holidays' }),
|
|
58
|
-
__metadata("design:paramtypes", [String, Date,
|
|
65
|
+
__metadata("design:paramtypes", [String, Date,
|
|
66
|
+
Date, String, Number, Number])
|
|
59
67
|
], Holidays);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseModel } from './BaseModel';
|
|
2
|
+
export declare enum ApprovalStatus {
|
|
3
|
+
PENDING = "Pending",
|
|
4
|
+
APPROVED = "Approved",
|
|
5
|
+
REJECTED = "Rejected"
|
|
6
|
+
}
|
|
7
|
+
export declare class LeaveApprovalDetails extends BaseModel {
|
|
8
|
+
leave_request_id: number;
|
|
9
|
+
level: number;
|
|
10
|
+
approver_id: number;
|
|
11
|
+
approval_status: ApprovalStatus;
|
|
12
|
+
constructor(leave_request_id: number, approver_id: number, approval_status: ApprovalStatus, level: number);
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.LeaveApprovalDetails = exports.ApprovalStatus = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const BaseModel_1 = require("./BaseModel");
|
|
15
|
+
var ApprovalStatus;
|
|
16
|
+
(function (ApprovalStatus) {
|
|
17
|
+
ApprovalStatus["PENDING"] = "Pending";
|
|
18
|
+
ApprovalStatus["APPROVED"] = "Approved";
|
|
19
|
+
ApprovalStatus["REJECTED"] = "Rejected";
|
|
20
|
+
})(ApprovalStatus || (exports.ApprovalStatus = ApprovalStatus = {}));
|
|
21
|
+
//This model is used to store the store the leave apporval details of the user for the leave request
|
|
22
|
+
let LeaveApprovalDetails = class LeaveApprovalDetails extends BaseModel_1.BaseModel {
|
|
23
|
+
constructor(leave_request_id, approver_id, approval_status, level) {
|
|
24
|
+
super();
|
|
25
|
+
this.leave_request_id = leave_request_id;
|
|
26
|
+
this.approver_id = approver_id;
|
|
27
|
+
this.approval_status = approval_status;
|
|
28
|
+
this.level = level;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.LeaveApprovalDetails = LeaveApprovalDetails;
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
34
|
+
__metadata("design:type", Number)
|
|
35
|
+
], LeaveApprovalDetails.prototype, "leave_request_id", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
38
|
+
__metadata("design:type", Number)
|
|
39
|
+
], LeaveApprovalDetails.prototype, "level", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], LeaveApprovalDetails.prototype, "approver_id", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)({ type: 'enum', enum: ApprovalStatus, default: ApprovalStatus.PENDING, nullable: false }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], LeaveApprovalDetails.prototype, "approval_status", void 0);
|
|
48
|
+
exports.LeaveApprovalDetails = LeaveApprovalDetails = __decorate([
|
|
49
|
+
(0, typeorm_1.Entity)({ name: 'leave_approval_details' }),
|
|
50
|
+
__metadata("design:paramtypes", [Number, Number, String, Number])
|
|
51
|
+
], LeaveApprovalDetails);
|
|
@@ -0,0 +1,40 @@
|
|
|
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.LeaveApprovalMatrix = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const BaseModel_1 = require("./BaseModel");
|
|
15
|
+
//This model is used to store the store the leave apporval matrix(HOD, Manager, HR, Director) based on leave type along with the levels
|
|
16
|
+
let LeaveApprovalMatrix = class LeaveApprovalMatrix extends BaseModel_1.BaseModel {
|
|
17
|
+
constructor(leave_type, level, approval_matrix) {
|
|
18
|
+
super();
|
|
19
|
+
this.leave_type = leave_type;
|
|
20
|
+
this.level = level;
|
|
21
|
+
this.approval_matrix = approval_matrix;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.LeaveApprovalMatrix = LeaveApprovalMatrix;
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
27
|
+
__metadata("design:type", Number)
|
|
28
|
+
], LeaveApprovalMatrix.prototype, "leave_type", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, typeorm_1.Column)({ type: 'int', nullable: false }),
|
|
31
|
+
__metadata("design:type", Number)
|
|
32
|
+
], LeaveApprovalMatrix.prototype, "level", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], LeaveApprovalMatrix.prototype, "approval_matrix", void 0);
|
|
37
|
+
exports.LeaveApprovalMatrix = LeaveApprovalMatrix = __decorate([
|
|
38
|
+
(0, typeorm_1.Entity)({ name: 'leave_approval_matrix' }),
|
|
39
|
+
__metadata("design:paramtypes", [Number, Number, String])
|
|
40
|
+
], LeaveApprovalMatrix);
|
package/package.json
CHANGED
package/src/data-source.ts
CHANGED
|
@@ -86,7 +86,7 @@ export const AppDataSource = new DataSource({
|
|
|
86
86
|
username: process.env.DB_USER || 'postgres',
|
|
87
87
|
password: process.env.DB_PASS || 'postgres',
|
|
88
88
|
database: process.env.DB_NAME || 'common_models',
|
|
89
|
-
synchronize:
|
|
89
|
+
synchronize: false, // auto-create tables (disable in prod)
|
|
90
90
|
logging: false,
|
|
91
91
|
entities: [
|
|
92
92
|
User,
|
|
@@ -7,8 +7,11 @@ export class Holidays extends BaseModel {
|
|
|
7
7
|
@Column({ type: 'varchar', length: 200 })
|
|
8
8
|
title: string;
|
|
9
9
|
|
|
10
|
-
@Column({ type: 'date', name: '
|
|
11
|
-
|
|
10
|
+
@Column({ type: 'date', name: 'holiday_from_date' })
|
|
11
|
+
holiday_from_date: Date;
|
|
12
|
+
|
|
13
|
+
@Column({ type: 'date', name: 'holiday_to_date' })
|
|
14
|
+
holiday_to_date: Date;
|
|
12
15
|
|
|
13
16
|
@Column({ type: 'text', nullable: true })
|
|
14
17
|
description?: string;
|
|
@@ -25,22 +28,23 @@ export class Holidays extends BaseModel {
|
|
|
25
28
|
@Column({ type: 'int', nullable: true })
|
|
26
29
|
year?: number;
|
|
27
30
|
|
|
31
|
+
@Column({ type: 'int', nullable: true })
|
|
32
|
+
notification_days?: number;
|
|
33
|
+
|
|
28
34
|
constructor(
|
|
29
35
|
title: string,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
region?: string,
|
|
33
|
-
is_optional: boolean = false,
|
|
36
|
+
holiday_from_date: Date,
|
|
37
|
+
holiday_to_date: Date,
|
|
34
38
|
holiday_type: string = 'Public',
|
|
35
|
-
year?: number
|
|
39
|
+
year?: number,
|
|
40
|
+
notification_days?: number
|
|
36
41
|
) {
|
|
37
42
|
super();
|
|
38
43
|
this.title = title;
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.region = region;
|
|
42
|
-
this.is_optional = is_optional;
|
|
44
|
+
this.holiday_from_date = holiday_from_date;
|
|
45
|
+
this.holiday_to_date = holiday_to_date;
|
|
43
46
|
this.holiday_type = holiday_type;
|
|
44
47
|
this.year = year;
|
|
48
|
+
this.notification_days = notification_days;
|
|
45
49
|
}
|
|
46
50
|
}
|