@platform-modules/foreign-ministry 1.0.0 → 1.0.2
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/.env +5 -0
- package/.gitkeep +0 -0
- package/dist/data-source.js +3 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -9
- package/dist/models/LeaveRequestModel.d.ts +23 -0
- package/dist/models/LeaveRequestModel.js +95 -0
- package/dist/models/LeaveTypesModel.d.ts +7 -0
- package/dist/models/LeaveTypesModel.js +39 -0
- package/package.json +24 -24
- package/src/data-source.ts +21 -19
- package/src/helpers/utils/enum.ts +94 -94
- package/src/index.ts +5 -13
- package/src/models/BaseModel.ts +61 -61
- package/src/models/LeaveRequestModel.ts +77 -0
- package/src/models/LeaveTypesModel.ts +26 -0
- package/src/models/role.ts +36 -36
- package/src/models/user-sessions.ts +37 -37
- package/src/models/user.ts +100 -100
- package/src/scripts.ts +10 -10
- package/tsconfig.json +16 -16
- package/dist/models/db.d.ts +0 -2
- package/dist/models/db.js +0 -40
- package/src/models/db.ts +0 -37
package/.env
ADDED
package/.gitkeep
ADDED
|
File without changes
|
package/dist/data-source.js
CHANGED
|
@@ -8,6 +8,8 @@ require("dotenv/config");
|
|
|
8
8
|
const user_1 = require("./models/user"); // import all entities here
|
|
9
9
|
const user_sessions_1 = require("./models/user-sessions");
|
|
10
10
|
const role_1 = require("./models/role");
|
|
11
|
+
const LeaveRequestModel_1 = require("./models/LeaveRequestModel");
|
|
12
|
+
const LeaveTypesModel_1 = require("./models/LeaveTypesModel");
|
|
11
13
|
exports.AppDataSource = new typeorm_1.DataSource({
|
|
12
14
|
type: 'postgres',
|
|
13
15
|
host: process.env.DB_HOST || 'localhost',
|
|
@@ -17,5 +19,5 @@ exports.AppDataSource = new typeorm_1.DataSource({
|
|
|
17
19
|
database: process.env.DB_NAME || 'common_models',
|
|
18
20
|
synchronize: true, // auto-create tables (disable in prod)
|
|
19
21
|
logging: false,
|
|
20
|
-
entities: [user_1.User, user_sessions_1.userSessions, role_1.Role],
|
|
22
|
+
entities: [user_1.User, user_sessions_1.userSessions, role_1.Role, LeaveRequestModel_1.LeaveRequests, LeaveTypesModel_1.LeaveTypes],
|
|
21
23
|
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,15 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
// src/index.ts
|
|
18
17
|
__exportStar(require("./models/user"), exports);
|
|
19
|
-
//export * from './models/AMC';
|
|
20
|
-
//export * from './models/categories';
|
|
21
|
-
//export * from './models/import';
|
|
22
|
-
//export * from './models/notifications';
|
|
23
|
-
//export * from './models/otps';
|
|
24
18
|
__exportStar(require("./models/role"), exports);
|
|
25
|
-
//export * from './models/subcategories';
|
|
26
19
|
__exportStar(require("./models/user-sessions"), exports);
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
__exportStar(require("./models/LeaveRequestModel"), exports);
|
|
21
|
+
__exportStar(require("./models/LeaveTypesModel"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseModel } from './BaseModel';
|
|
2
|
+
export declare enum ContactFor {
|
|
3
|
+
SELF = "Self",
|
|
4
|
+
BEHALFOF = "Behalf of"
|
|
5
|
+
}
|
|
6
|
+
export declare enum status {
|
|
7
|
+
PENDING = "Pending",
|
|
8
|
+
APPROVED = "Approved",
|
|
9
|
+
REJECTED = "Rejected"
|
|
10
|
+
}
|
|
11
|
+
export declare class LeaveRequests extends BaseModel {
|
|
12
|
+
department: string;
|
|
13
|
+
leave_type: string;
|
|
14
|
+
reason: string;
|
|
15
|
+
request_for: ContactFor;
|
|
16
|
+
description: string;
|
|
17
|
+
from_date: Date;
|
|
18
|
+
to_date: Date;
|
|
19
|
+
user_id: number;
|
|
20
|
+
reporting_manager: number;
|
|
21
|
+
status: status;
|
|
22
|
+
constructor(department: string, leave_type: string, reason: string, request_for: ContactFor, description: string, from_date: Date, to_date: Date, reporting_manager: number, status: status);
|
|
23
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.LeaveRequests = exports.status = exports.ContactFor = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const BaseModel_1 = require("./BaseModel");
|
|
15
|
+
var ContactFor;
|
|
16
|
+
(function (ContactFor) {
|
|
17
|
+
ContactFor["SELF"] = "Self";
|
|
18
|
+
ContactFor["BEHALFOF"] = "Behalf of";
|
|
19
|
+
})(ContactFor || (exports.ContactFor = ContactFor = {}));
|
|
20
|
+
var status;
|
|
21
|
+
(function (status) {
|
|
22
|
+
status["PENDING"] = "Pending";
|
|
23
|
+
status["APPROVED"] = "Approved";
|
|
24
|
+
status["REJECTED"] = "Rejected";
|
|
25
|
+
})(status || (exports.status = status = {}));
|
|
26
|
+
let LeaveRequests = class LeaveRequests extends BaseModel_1.BaseModel {
|
|
27
|
+
constructor(department, leave_type, reason, request_for, description, from_date, to_date, reporting_manager, status) {
|
|
28
|
+
super();
|
|
29
|
+
this.department = department,
|
|
30
|
+
this.leave_type = leave_type,
|
|
31
|
+
this.reason = reason,
|
|
32
|
+
this.request_for = request_for,
|
|
33
|
+
this.description = description,
|
|
34
|
+
this.from_date = from_date,
|
|
35
|
+
this.to_date = to_date,
|
|
36
|
+
this.reporting_manager = reporting_manager,
|
|
37
|
+
this.status = status;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
exports.LeaveRequests = LeaveRequests;
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], LeaveRequests.prototype, "department", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], LeaveRequests.prototype, "leave_type", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], LeaveRequests.prototype, "reason", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)({
|
|
55
|
+
type: "enum",
|
|
56
|
+
enum: ContactFor,
|
|
57
|
+
default: ContactFor.SELF,
|
|
58
|
+
nullable: false,
|
|
59
|
+
}),
|
|
60
|
+
__metadata("design:type", String)
|
|
61
|
+
], LeaveRequests.prototype, "request_for", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], LeaveRequests.prototype, "description", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.Column)({ type: "date", nullable: false }),
|
|
68
|
+
__metadata("design:type", Date)
|
|
69
|
+
], LeaveRequests.prototype, "from_date", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({ type: "date", nullable: false }),
|
|
72
|
+
__metadata("design:type", Date)
|
|
73
|
+
], LeaveRequests.prototype, "to_date", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
76
|
+
__metadata("design:type", Number)
|
|
77
|
+
], LeaveRequests.prototype, "user_id", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
80
|
+
__metadata("design:type", Number)
|
|
81
|
+
], LeaveRequests.prototype, "reporting_manager", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.Column)({
|
|
84
|
+
type: "enum",
|
|
85
|
+
enum: status,
|
|
86
|
+
default: status.PENDING,
|
|
87
|
+
nullable: false,
|
|
88
|
+
}),
|
|
89
|
+
__metadata("design:type", String)
|
|
90
|
+
], LeaveRequests.prototype, "status", void 0);
|
|
91
|
+
exports.LeaveRequests = LeaveRequests = __decorate([
|
|
92
|
+
(0, typeorm_1.Entity)({ name: 'LeaveRequests' }),
|
|
93
|
+
__metadata("design:paramtypes", [String, String, String, String, String, Date,
|
|
94
|
+
Date, Number, String])
|
|
95
|
+
], LeaveRequests);
|
|
@@ -0,0 +1,39 @@
|
|
|
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.LeaveTypes = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const BaseModel_1 = require("./BaseModel");
|
|
15
|
+
let LeaveTypes = class LeaveTypes extends BaseModel_1.BaseModel {
|
|
16
|
+
constructor(name, nameinEnglish, nameinArabic) {
|
|
17
|
+
super();
|
|
18
|
+
this.name = name;
|
|
19
|
+
this.nameinEnglish = nameinEnglish,
|
|
20
|
+
this.nameinArabic = nameinArabic;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.LeaveTypes = LeaveTypes;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
26
|
+
__metadata("design:type", String)
|
|
27
|
+
], LeaveTypes.prototype, "name", void 0);
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], LeaveTypes.prototype, "nameinEnglish", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, typeorm_1.Column)({ nullable: false }),
|
|
34
|
+
__metadata("design:type", String)
|
|
35
|
+
], LeaveTypes.prototype, "nameinArabic", void 0);
|
|
36
|
+
exports.LeaveTypes = LeaveTypes = __decorate([
|
|
37
|
+
(0, typeorm_1.Entity)({ name: 'Leave_Types' }),
|
|
38
|
+
__metadata("design:paramtypes", [String, String, String])
|
|
39
|
+
], LeaveTypes);
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@platform-modules/foreign-ministry",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"main": "dist/index.js",
|
|
5
|
-
"types": "dist/index.d.ts",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "tsc",
|
|
8
|
-
"
|
|
9
|
-
},
|
|
10
|
-
"publishConfig": {
|
|
11
|
-
"access": "public"
|
|
12
|
-
},
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"moment-timezone": "^0.6.0",
|
|
15
|
-
"pg": "^8.16.0",
|
|
16
|
-
"typeorm": "^0.3.17"
|
|
17
|
-
},
|
|
18
|
-
"devDependencies": {
|
|
19
|
-
"@types/moment-timezone": "^0.5.30",
|
|
20
|
-
"dotenv": "^16.5.0",
|
|
21
|
-
"ts-node": "^10.9.2",
|
|
22
|
-
"typescript": "^5.2.0"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@platform-modules/foreign-ministry",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"dev": "ts-node src/scripts.ts"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"moment-timezone": "^0.6.0",
|
|
15
|
+
"pg": "^8.16.0",
|
|
16
|
+
"typeorm": "^0.3.17"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/moment-timezone": "^0.5.30",
|
|
20
|
+
"dotenv": "^16.5.0",
|
|
21
|
+
"ts-node": "^10.9.2",
|
|
22
|
+
"typescript": "^5.2.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/src/data-source.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
// src/data-source.ts
|
|
2
|
-
import 'reflect-metadata';
|
|
3
|
-
import { DataSource } from 'typeorm';
|
|
4
|
-
import 'dotenv/config';
|
|
5
|
-
import { User } from './models/user'; // import all entities here
|
|
6
|
-
import { userSessions } from './models/user-sessions';
|
|
7
|
-
import { Role } from './models/role';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
// src/data-source.ts
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
import { DataSource } from 'typeorm';
|
|
4
|
+
import 'dotenv/config';
|
|
5
|
+
import { User } from './models/user'; // import all entities here
|
|
6
|
+
import { userSessions } from './models/user-sessions';
|
|
7
|
+
import { Role } from './models/role';
|
|
8
|
+
import { LeaveRequests } from './models/LeaveRequestModel';
|
|
9
|
+
import { LeaveTypes } from './models/LeaveTypesModel';
|
|
10
|
+
|
|
11
|
+
export const AppDataSource = new DataSource({
|
|
12
|
+
type: 'postgres',
|
|
13
|
+
host: process.env.DB_HOST || 'localhost',
|
|
14
|
+
port: +(process.env.DB_PORT || 5432),
|
|
15
|
+
username: process.env.DB_USER || 'postgres',
|
|
16
|
+
password: process.env.DB_PASS || 'postgres',
|
|
17
|
+
database: process.env.DB_NAME || 'common_models',
|
|
18
|
+
synchronize: true, // auto-create tables (disable in prod)
|
|
19
|
+
logging: false,
|
|
20
|
+
entities: [User,userSessions,Role,LeaveRequests,LeaveTypes],
|
|
21
|
+
});
|
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
//import enums
|
|
2
|
-
|
|
3
|
-
export enum ImportStatusType {
|
|
4
|
-
NotStarted = 1,
|
|
5
|
-
InProgress = 2,
|
|
6
|
-
Completed = 3,
|
|
7
|
-
Error = 4,
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const enum EmployeeType {
|
|
11
|
-
Permanent = 'Permanent',
|
|
12
|
-
Contract = 'Contract',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const enum MaritalType {
|
|
16
|
-
Single = 'Single',
|
|
17
|
-
Married = 'Married',
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const enum genderType {
|
|
21
|
-
Male = 'Male',
|
|
22
|
-
Female = 'Female',
|
|
23
|
-
Others = 'Others',
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const enum ActionItemStatusType {
|
|
28
|
-
Not_Yet_Started = 'Not Yet Started',
|
|
29
|
-
InProgress = 'InProgress',
|
|
30
|
-
Completed = 'Completed',
|
|
31
|
-
Cancelled = 'Cancelled',
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const enum CampaignStatusType {
|
|
35
|
-
Not_Yet_Started = 'Not Yet Started',
|
|
36
|
-
InProgress = 'InProgress',
|
|
37
|
-
Completed = 'Completed',
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const enum platformType {
|
|
41
|
-
web = 'Web',
|
|
42
|
-
mobile = 'Mobile'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const enum contextType {
|
|
46
|
-
ADMIN = 'Admin',
|
|
47
|
-
BUSINESS_PARTNER = 'Business Partner',
|
|
48
|
-
CLIENT = 'Client'
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export enum ImportType {
|
|
52
|
-
admin = 1,
|
|
53
|
-
business_partner = 2,
|
|
54
|
-
client = 3
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export enum userType {
|
|
58
|
-
admin = 1,
|
|
59
|
-
business_partner = 2,
|
|
60
|
-
client = 3
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export enum ReportColumnDataType {
|
|
64
|
-
Int = 1,
|
|
65
|
-
String = 2,
|
|
66
|
-
Date = 3,
|
|
67
|
-
Time = 4,
|
|
68
|
-
DateTime = 5,
|
|
69
|
-
Money = 6,
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export enum CONSTANTS {
|
|
73
|
-
READ = 'READ',
|
|
74
|
-
DELETE = 'DELETE',
|
|
75
|
-
SEND = 'SEND',
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export enum NotificationRequestType {
|
|
79
|
-
request_raised = 'request raised',
|
|
80
|
-
request_approve = 'request approve',
|
|
81
|
-
request_reject = 'request reject',
|
|
82
|
-
request_withdraw = 'request withdraw',
|
|
83
|
-
reminder = 'reminder',
|
|
84
|
-
import = 'import',
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export enum RequestGroup {
|
|
88
|
-
ADMIN = 'Admin',
|
|
89
|
-
BUSINESS_PARTNER = 'Business Partner',
|
|
90
|
-
CLIENT = 'Client'
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
1
|
+
//import enums
|
|
2
|
+
|
|
3
|
+
export enum ImportStatusType {
|
|
4
|
+
NotStarted = 1,
|
|
5
|
+
InProgress = 2,
|
|
6
|
+
Completed = 3,
|
|
7
|
+
Error = 4,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const enum EmployeeType {
|
|
11
|
+
Permanent = 'Permanent',
|
|
12
|
+
Contract = 'Contract',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const enum MaritalType {
|
|
16
|
+
Single = 'Single',
|
|
17
|
+
Married = 'Married',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const enum genderType {
|
|
21
|
+
Male = 'Male',
|
|
22
|
+
Female = 'Female',
|
|
23
|
+
Others = 'Others',
|
|
24
|
+
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const enum ActionItemStatusType {
|
|
28
|
+
Not_Yet_Started = 'Not Yet Started',
|
|
29
|
+
InProgress = 'InProgress',
|
|
30
|
+
Completed = 'Completed',
|
|
31
|
+
Cancelled = 'Cancelled',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const enum CampaignStatusType {
|
|
35
|
+
Not_Yet_Started = 'Not Yet Started',
|
|
36
|
+
InProgress = 'InProgress',
|
|
37
|
+
Completed = 'Completed',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const enum platformType {
|
|
41
|
+
web = 'Web',
|
|
42
|
+
mobile = 'Mobile'
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const enum contextType {
|
|
46
|
+
ADMIN = 'Admin',
|
|
47
|
+
BUSINESS_PARTNER = 'Business Partner',
|
|
48
|
+
CLIENT = 'Client'
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export enum ImportType {
|
|
52
|
+
admin = 1,
|
|
53
|
+
business_partner = 2,
|
|
54
|
+
client = 3
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export enum userType {
|
|
58
|
+
admin = 1,
|
|
59
|
+
business_partner = 2,
|
|
60
|
+
client = 3
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export enum ReportColumnDataType {
|
|
64
|
+
Int = 1,
|
|
65
|
+
String = 2,
|
|
66
|
+
Date = 3,
|
|
67
|
+
Time = 4,
|
|
68
|
+
DateTime = 5,
|
|
69
|
+
Money = 6,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export enum CONSTANTS {
|
|
73
|
+
READ = 'READ',
|
|
74
|
+
DELETE = 'DELETE',
|
|
75
|
+
SEND = 'SEND',
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export enum NotificationRequestType {
|
|
79
|
+
request_raised = 'request raised',
|
|
80
|
+
request_approve = 'request approve',
|
|
81
|
+
request_reject = 'request reject',
|
|
82
|
+
request_withdraw = 'request withdraw',
|
|
83
|
+
reminder = 'reminder',
|
|
84
|
+
import = 'import',
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export enum RequestGroup {
|
|
88
|
+
ADMIN = 'Admin',
|
|
89
|
+
BUSINESS_PARTNER = 'Business Partner',
|
|
90
|
+
CLIENT = 'Client'
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './models/
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
//export * from './models/notifications';
|
|
7
|
-
//export * from './models/otps';
|
|
8
|
-
export * from './models/role';
|
|
9
|
-
//export * from './models/subcategories';
|
|
10
|
-
export * from './models/user-sessions';
|
|
11
|
-
//export * from './models/workflow';
|
|
12
|
-
// export * from './models/request';
|
|
13
|
-
|
|
1
|
+
export * from './models/user';
|
|
2
|
+
export * from './models/role';
|
|
3
|
+
export * from './models/user-sessions';
|
|
4
|
+
export * from './models/LeaveRequestModel';
|
|
5
|
+
export * from './models/LeaveTypesModel';
|
package/src/models/BaseModel.ts
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import moment from "moment-timezone";
|
|
2
|
-
import {
|
|
3
|
-
Column,
|
|
4
|
-
CreateDateColumn,
|
|
5
|
-
UpdateDateColumn,
|
|
6
|
-
BeforeInsert,
|
|
7
|
-
PrimaryGeneratedColumn
|
|
8
|
-
} from 'typeorm';
|
|
9
|
-
|
|
10
|
-
export abstract class Model0 {
|
|
11
|
-
jsonIgnore: string[] = ['logicalDelete', 'is_deleted', 'jsonIgnore'];
|
|
12
|
-
|
|
13
|
-
@Column({ nullable: false })
|
|
14
|
-
created_by?: string = '';
|
|
15
|
-
|
|
16
|
-
@CreateDateColumn({ type: "timestamptz", default: () => "CURRENT_TIMESTAMP" })
|
|
17
|
-
created_at?: Date;
|
|
18
|
-
|
|
19
|
-
@Column({ nullable: true })
|
|
20
|
-
updated_by?: string = '';
|
|
21
|
-
|
|
22
|
-
@UpdateDateColumn({ type: "timestamptz", default: () => "CURRENT_TIMESTAMP" })
|
|
23
|
-
updated_at?: Date;
|
|
24
|
-
|
|
25
|
-
@BeforeInsert()
|
|
26
|
-
insertCreated() {
|
|
27
|
-
const currentTime = moment().utc().tz('Asia/Kolkata').toDate();
|
|
28
|
-
this.created_at = currentTime;
|
|
29
|
-
this.updated_at = currentTime;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
@Column({ nullable: true, default: false })
|
|
33
|
-
is_deleted?: boolean = false;
|
|
34
|
-
|
|
35
|
-
logicalDelete: boolean;
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
this.logicalDelete = true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Don't serialize some fields
|
|
42
|
-
toJSON() {
|
|
43
|
-
const result: Record<string, any> = {};
|
|
44
|
-
for (const x in this) {
|
|
45
|
-
if (!this.jsonIgnore.includes(x)) {
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
result[x] = this[x];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return result;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export abstract class BaseModel extends Model0 {
|
|
55
|
-
@PrimaryGeneratedColumn()
|
|
56
|
-
id: number;
|
|
57
|
-
|
|
58
|
-
constructor() {
|
|
59
|
-
super();
|
|
60
|
-
this.id = 0; // This will be set by the database when the entity is saved
|
|
61
|
-
}
|
|
1
|
+
import moment from "moment-timezone";
|
|
2
|
+
import {
|
|
3
|
+
Column,
|
|
4
|
+
CreateDateColumn,
|
|
5
|
+
UpdateDateColumn,
|
|
6
|
+
BeforeInsert,
|
|
7
|
+
PrimaryGeneratedColumn
|
|
8
|
+
} from 'typeorm';
|
|
9
|
+
|
|
10
|
+
export abstract class Model0 {
|
|
11
|
+
jsonIgnore: string[] = ['logicalDelete', 'is_deleted', 'jsonIgnore'];
|
|
12
|
+
|
|
13
|
+
@Column({ nullable: false })
|
|
14
|
+
created_by?: string = '';
|
|
15
|
+
|
|
16
|
+
@CreateDateColumn({ type: "timestamptz", default: () => "CURRENT_TIMESTAMP" })
|
|
17
|
+
created_at?: Date;
|
|
18
|
+
|
|
19
|
+
@Column({ nullable: true })
|
|
20
|
+
updated_by?: string = '';
|
|
21
|
+
|
|
22
|
+
@UpdateDateColumn({ type: "timestamptz", default: () => "CURRENT_TIMESTAMP" })
|
|
23
|
+
updated_at?: Date;
|
|
24
|
+
|
|
25
|
+
@BeforeInsert()
|
|
26
|
+
insertCreated() {
|
|
27
|
+
const currentTime = moment().utc().tz('Asia/Kolkata').toDate();
|
|
28
|
+
this.created_at = currentTime;
|
|
29
|
+
this.updated_at = currentTime;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@Column({ nullable: true, default: false })
|
|
33
|
+
is_deleted?: boolean = false;
|
|
34
|
+
|
|
35
|
+
logicalDelete: boolean;
|
|
36
|
+
|
|
37
|
+
constructor() {
|
|
38
|
+
this.logicalDelete = true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Don't serialize some fields
|
|
42
|
+
toJSON() {
|
|
43
|
+
const result: Record<string, any> = {};
|
|
44
|
+
for (const x in this) {
|
|
45
|
+
if (!this.jsonIgnore.includes(x)) {
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
result[x] = this[x];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export abstract class BaseModel extends Model0 {
|
|
55
|
+
@PrimaryGeneratedColumn()
|
|
56
|
+
id: number;
|
|
57
|
+
|
|
58
|
+
constructor() {
|
|
59
|
+
super();
|
|
60
|
+
this.id = 0; // This will be set by the database when the entity is saved
|
|
61
|
+
}
|
|
62
62
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
export enum ContactFor {
|
|
4
|
+
SELF = "Self",
|
|
5
|
+
BEHALFOF = "Behalf of"
|
|
6
|
+
}
|
|
7
|
+
export enum status {
|
|
8
|
+
PENDING = "Pending",
|
|
9
|
+
APPROVED = "Approved",
|
|
10
|
+
REJECTED = "Rejected"
|
|
11
|
+
}
|
|
12
|
+
@Entity({ name: 'LeaveRequests' })
|
|
13
|
+
export class LeaveRequests extends BaseModel {
|
|
14
|
+
|
|
15
|
+
@Column({ nullable: false })
|
|
16
|
+
department: string;
|
|
17
|
+
|
|
18
|
+
@Column({ nullable: false })
|
|
19
|
+
leave_type: string;
|
|
20
|
+
|
|
21
|
+
@Column({ nullable: false })
|
|
22
|
+
reason: string;
|
|
23
|
+
|
|
24
|
+
@Column({
|
|
25
|
+
type: "enum",
|
|
26
|
+
enum: ContactFor,
|
|
27
|
+
default: ContactFor.SELF,
|
|
28
|
+
nullable: false,
|
|
29
|
+
})
|
|
30
|
+
request_for: ContactFor;
|
|
31
|
+
|
|
32
|
+
@Column({ nullable: false })
|
|
33
|
+
description: string;
|
|
34
|
+
|
|
35
|
+
@Column({ type: "date", nullable: false })
|
|
36
|
+
from_date: Date;
|
|
37
|
+
|
|
38
|
+
@Column({ type: "date", nullable: false })
|
|
39
|
+
to_date: Date;
|
|
40
|
+
|
|
41
|
+
@Column({ nullable: false })
|
|
42
|
+
user_id: number;
|
|
43
|
+
|
|
44
|
+
@Column({ nullable: true })
|
|
45
|
+
reporting_manager: number;
|
|
46
|
+
|
|
47
|
+
@Column({
|
|
48
|
+
type: "enum",
|
|
49
|
+
enum: status,
|
|
50
|
+
default: status.PENDING,
|
|
51
|
+
nullable: false,
|
|
52
|
+
})
|
|
53
|
+
status: status;
|
|
54
|
+
|
|
55
|
+
constructor(
|
|
56
|
+
department: string,
|
|
57
|
+
leave_type: string,
|
|
58
|
+
reason: string,
|
|
59
|
+
request_for: ContactFor,
|
|
60
|
+
description: string,
|
|
61
|
+
from_date: Date,
|
|
62
|
+
to_date: Date,
|
|
63
|
+
reporting_manager: number,
|
|
64
|
+
status: status,
|
|
65
|
+
) {
|
|
66
|
+
super();
|
|
67
|
+
this.department = department,
|
|
68
|
+
this.leave_type = leave_type,
|
|
69
|
+
this.reason = reason,
|
|
70
|
+
this.request_for = request_for,
|
|
71
|
+
this.description = description,
|
|
72
|
+
this.from_date = from_date,
|
|
73
|
+
this.to_date = to_date,
|
|
74
|
+
this.reporting_manager = reporting_manager,
|
|
75
|
+
this.status = status
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'Leave_Types' })
|
|
5
|
+
export class LeaveTypes extends BaseModel {
|
|
6
|
+
|
|
7
|
+
@Column({ nullable: false })
|
|
8
|
+
name: string;
|
|
9
|
+
|
|
10
|
+
@Column({ nullable: false })
|
|
11
|
+
nameinEnglish: string;
|
|
12
|
+
|
|
13
|
+
@Column({ nullable: false })
|
|
14
|
+
nameinArabic: string;
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
name: string,
|
|
18
|
+
nameinEnglish: string,
|
|
19
|
+
nameinArabic: string,
|
|
20
|
+
) {
|
|
21
|
+
super();
|
|
22
|
+
this.name = name
|
|
23
|
+
this.nameinEnglish = nameinEnglish,
|
|
24
|
+
this.nameinArabic = nameinArabic
|
|
25
|
+
}
|
|
26
|
+
}
|
package/src/models/role.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/** *
|
|
2
|
-
@author
|
|
3
|
-
Amnet Digital
|
|
4
|
-
@date
|
|
5
|
-
2024-05-20
|
|
6
|
-
@Model
|
|
7
|
-
Role
|
|
8
|
-
@usage
|
|
9
|
-
Userrole Information will store
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Column, Entity } from "typeorm";
|
|
13
|
-
import { BaseModel } from './BaseModel';
|
|
14
|
-
|
|
15
|
-
export interface Irole {
|
|
16
|
-
name: string;
|
|
17
|
-
id?: number;
|
|
18
|
-
is_deleted?: boolean;
|
|
19
|
-
created_by?: number;
|
|
20
|
-
}
|
|
21
|
-
@Entity({ name: 'role' })
|
|
22
|
-
export class Role extends BaseModel {
|
|
23
|
-
|
|
24
|
-
@Column({ nullable: true })
|
|
25
|
-
name: string;
|
|
26
|
-
|
|
27
|
-
@Column({ nullable: true })
|
|
28
|
-
is_deleted?: boolean;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
constructor(name: string,is_deleted:boolean,userId: number) {
|
|
32
|
-
super();
|
|
33
|
-
this.name = name
|
|
34
|
-
this.is_deleted = is_deleted
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
/** *
|
|
2
|
+
@author
|
|
3
|
+
Amnet Digital
|
|
4
|
+
@date
|
|
5
|
+
2024-05-20
|
|
6
|
+
@Model
|
|
7
|
+
Role
|
|
8
|
+
@usage
|
|
9
|
+
Userrole Information will store
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { Column, Entity } from "typeorm";
|
|
13
|
+
import { BaseModel } from './BaseModel';
|
|
14
|
+
|
|
15
|
+
export interface Irole {
|
|
16
|
+
name: string;
|
|
17
|
+
id?: number;
|
|
18
|
+
is_deleted?: boolean;
|
|
19
|
+
created_by?: number;
|
|
20
|
+
}
|
|
21
|
+
@Entity({ name: 'role' })
|
|
22
|
+
export class Role extends BaseModel {
|
|
23
|
+
|
|
24
|
+
@Column({ nullable: true })
|
|
25
|
+
name: string;
|
|
26
|
+
|
|
27
|
+
@Column({ nullable: true })
|
|
28
|
+
is_deleted?: boolean;
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
constructor(name: string,is_deleted:boolean,userId: number) {
|
|
32
|
+
super();
|
|
33
|
+
this.name = name
|
|
34
|
+
this.is_deleted = is_deleted
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
/** *
|
|
3
|
-
@author
|
|
4
|
-
Amnet Digital
|
|
5
|
-
@date
|
|
6
|
-
2024-05-20
|
|
7
|
-
@Model
|
|
8
|
-
Role
|
|
9
|
-
@usage
|
|
10
|
-
Roles Information will store
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
|
14
|
-
import { BaseModel} from './BaseModel';
|
|
15
|
-
|
|
16
|
-
@Entity({ name: 'user_sessions' })
|
|
17
|
-
export class userSessions extends BaseModel {
|
|
18
|
-
@Column({ nullable: true })
|
|
19
|
-
last_active_at: Date;
|
|
20
|
-
|
|
21
|
-
@Column({ nullable: true, default: true })
|
|
22
|
-
is_active: boolean;
|
|
23
|
-
|
|
24
|
-
@Column({ nullable: true })
|
|
25
|
-
expires_at: Date;
|
|
26
|
-
|
|
27
|
-
@Column({ nullable: true })
|
|
28
|
-
user_id: number;
|
|
29
|
-
|
|
30
|
-
constructor(last_active_at: Date, expires_at: Date, user_id: number, is_active: boolean) {
|
|
31
|
-
super();
|
|
32
|
-
this.last_active_at = last_active_at,
|
|
33
|
-
this.expires_at = expires_at,
|
|
34
|
-
this.user_id = user_id,
|
|
35
|
-
this.is_active = is_active
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
|
|
2
|
+
/** *
|
|
3
|
+
@author
|
|
4
|
+
Amnet Digital
|
|
5
|
+
@date
|
|
6
|
+
2024-05-20
|
|
7
|
+
@Model
|
|
8
|
+
Role
|
|
9
|
+
@usage
|
|
10
|
+
Roles Information will store
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
|
|
14
|
+
import { BaseModel} from './BaseModel';
|
|
15
|
+
|
|
16
|
+
@Entity({ name: 'user_sessions' })
|
|
17
|
+
export class userSessions extends BaseModel {
|
|
18
|
+
@Column({ nullable: true })
|
|
19
|
+
last_active_at: Date;
|
|
20
|
+
|
|
21
|
+
@Column({ nullable: true, default: true })
|
|
22
|
+
is_active: boolean;
|
|
23
|
+
|
|
24
|
+
@Column({ nullable: true })
|
|
25
|
+
expires_at: Date;
|
|
26
|
+
|
|
27
|
+
@Column({ nullable: true })
|
|
28
|
+
user_id: number;
|
|
29
|
+
|
|
30
|
+
constructor(last_active_at: Date, expires_at: Date, user_id: number, is_active: boolean) {
|
|
31
|
+
super();
|
|
32
|
+
this.last_active_at = last_active_at,
|
|
33
|
+
this.expires_at = expires_at,
|
|
34
|
+
this.user_id = user_id,
|
|
35
|
+
this.is_active = is_active
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
38
|
|
package/src/models/user.ts
CHANGED
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
import { Column, Entity ,BeforeInsert,BeforeUpdate } from "typeorm";
|
|
3
|
-
import { BaseModel } from './BaseModel';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'users' })
|
|
6
|
-
export class User extends BaseModel {
|
|
7
|
-
|
|
8
|
-
@Column({ nullable: true })
|
|
9
|
-
first_name: string;
|
|
10
|
-
|
|
11
|
-
@Column({ nullable: true })
|
|
12
|
-
last_name: string;
|
|
13
|
-
|
|
14
|
-
@Column({ nullable: true })
|
|
15
|
-
full_name: string;
|
|
16
|
-
|
|
17
|
-
@Column({ nullable: true })
|
|
18
|
-
password: string;
|
|
19
|
-
|
|
20
|
-
@Column({ nullable: true })
|
|
21
|
-
mobile: string;
|
|
22
|
-
|
|
23
|
-
@Column({ nullable: true })
|
|
24
|
-
email: string;
|
|
25
|
-
|
|
26
|
-
@Column({ nullable: true })
|
|
27
|
-
address: string;
|
|
28
|
-
|
|
29
|
-
@Column({ nullable: true })
|
|
30
|
-
city: string;
|
|
31
|
-
|
|
32
|
-
@Column({ nullable: true })
|
|
33
|
-
state: string;
|
|
34
|
-
|
|
35
|
-
@Column({ nullable: true })
|
|
36
|
-
country: string;
|
|
37
|
-
|
|
38
|
-
@Column({ nullable: true })
|
|
39
|
-
pincode: string;
|
|
40
|
-
|
|
41
|
-
@Column({ nullable: true, default: true })
|
|
42
|
-
is_active: boolean;
|
|
43
|
-
|
|
44
|
-
@Column({ nullable: true })
|
|
45
|
-
EncryptPassword: string;
|
|
46
|
-
|
|
47
|
-
@Column({ nullable: true })
|
|
48
|
-
roleId: number;
|
|
49
|
-
|
|
50
|
-
// @Column({ nullable: true })
|
|
51
|
-
// contract_start_date: string;
|
|
52
|
-
|
|
53
|
-
// @Column({ nullable: true })
|
|
54
|
-
// contract_end_date: string;
|
|
55
|
-
|
|
56
|
-
@Column({ nullable: true })
|
|
57
|
-
company: string;
|
|
58
|
-
|
|
59
|
-
constructor(
|
|
60
|
-
first_name: string,
|
|
61
|
-
last_name: string,
|
|
62
|
-
full_name: string,
|
|
63
|
-
password: string,
|
|
64
|
-
mobile: string,
|
|
65
|
-
email: string,
|
|
66
|
-
address: string,
|
|
67
|
-
city: string,
|
|
68
|
-
state: string,
|
|
69
|
-
country: string,
|
|
70
|
-
pincode: string,
|
|
71
|
-
is_active: boolean,
|
|
72
|
-
EncryptPassword: string,
|
|
73
|
-
roleId: number,
|
|
74
|
-
// contract_start_date: string,
|
|
75
|
-
// contract_end_date: string,
|
|
76
|
-
company: string
|
|
77
|
-
|
|
78
|
-
) {
|
|
79
|
-
super();
|
|
80
|
-
this.first_name = first_name,
|
|
81
|
-
this.last_name = last_name,
|
|
82
|
-
this.full_name = full_name ,
|
|
83
|
-
this.password = password,
|
|
84
|
-
this.EncryptPassword = EncryptPassword,
|
|
85
|
-
this.mobile = mobile,
|
|
86
|
-
this.email = email,
|
|
87
|
-
this.is_active = is_active,
|
|
88
|
-
this.address = address,
|
|
89
|
-
this.city = city,
|
|
90
|
-
this.state = state,
|
|
91
|
-
this.country = country,
|
|
92
|
-
this.pincode = pincode,
|
|
93
|
-
this.roleId = roleId,
|
|
94
|
-
// this.contract_start_date = contract_start_date,
|
|
95
|
-
// this.contract_end_date = contract_end_date,
|
|
96
|
-
this.company = company
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
1
|
+
|
|
2
|
+
import { Column, Entity ,BeforeInsert,BeforeUpdate } from "typeorm";
|
|
3
|
+
import { BaseModel } from './BaseModel';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'users' })
|
|
6
|
+
export class User extends BaseModel {
|
|
7
|
+
|
|
8
|
+
@Column({ nullable: true })
|
|
9
|
+
first_name: string;
|
|
10
|
+
|
|
11
|
+
@Column({ nullable: true })
|
|
12
|
+
last_name: string;
|
|
13
|
+
|
|
14
|
+
@Column({ nullable: true })
|
|
15
|
+
full_name: string;
|
|
16
|
+
|
|
17
|
+
@Column({ nullable: true })
|
|
18
|
+
password: string;
|
|
19
|
+
|
|
20
|
+
@Column({ nullable: true })
|
|
21
|
+
mobile: string;
|
|
22
|
+
|
|
23
|
+
@Column({ nullable: true })
|
|
24
|
+
email: string;
|
|
25
|
+
|
|
26
|
+
@Column({ nullable: true })
|
|
27
|
+
address: string;
|
|
28
|
+
|
|
29
|
+
@Column({ nullable: true })
|
|
30
|
+
city: string;
|
|
31
|
+
|
|
32
|
+
@Column({ nullable: true })
|
|
33
|
+
state: string;
|
|
34
|
+
|
|
35
|
+
@Column({ nullable: true })
|
|
36
|
+
country: string;
|
|
37
|
+
|
|
38
|
+
@Column({ nullable: true })
|
|
39
|
+
pincode: string;
|
|
40
|
+
|
|
41
|
+
@Column({ nullable: true, default: true })
|
|
42
|
+
is_active: boolean;
|
|
43
|
+
|
|
44
|
+
@Column({ nullable: true })
|
|
45
|
+
EncryptPassword: string;
|
|
46
|
+
|
|
47
|
+
@Column({ nullable: true })
|
|
48
|
+
roleId: number;
|
|
49
|
+
|
|
50
|
+
// @Column({ nullable: true })
|
|
51
|
+
// contract_start_date: string;
|
|
52
|
+
|
|
53
|
+
// @Column({ nullable: true })
|
|
54
|
+
// contract_end_date: string;
|
|
55
|
+
|
|
56
|
+
@Column({ nullable: true })
|
|
57
|
+
company: string;
|
|
58
|
+
|
|
59
|
+
constructor(
|
|
60
|
+
first_name: string,
|
|
61
|
+
last_name: string,
|
|
62
|
+
full_name: string,
|
|
63
|
+
password: string,
|
|
64
|
+
mobile: string,
|
|
65
|
+
email: string,
|
|
66
|
+
address: string,
|
|
67
|
+
city: string,
|
|
68
|
+
state: string,
|
|
69
|
+
country: string,
|
|
70
|
+
pincode: string,
|
|
71
|
+
is_active: boolean,
|
|
72
|
+
EncryptPassword: string,
|
|
73
|
+
roleId: number,
|
|
74
|
+
// contract_start_date: string,
|
|
75
|
+
// contract_end_date: string,
|
|
76
|
+
company: string
|
|
77
|
+
|
|
78
|
+
) {
|
|
79
|
+
super();
|
|
80
|
+
this.first_name = first_name,
|
|
81
|
+
this.last_name = last_name,
|
|
82
|
+
this.full_name = full_name ,
|
|
83
|
+
this.password = password,
|
|
84
|
+
this.EncryptPassword = EncryptPassword,
|
|
85
|
+
this.mobile = mobile,
|
|
86
|
+
this.email = email,
|
|
87
|
+
this.is_active = is_active,
|
|
88
|
+
this.address = address,
|
|
89
|
+
this.city = city,
|
|
90
|
+
this.state = state,
|
|
91
|
+
this.country = country,
|
|
92
|
+
this.pincode = pincode,
|
|
93
|
+
this.roleId = roleId,
|
|
94
|
+
// this.contract_start_date = contract_start_date,
|
|
95
|
+
// this.contract_end_date = contract_end_date,
|
|
96
|
+
this.company = company
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
package/src/scripts.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AppDataSource } from './data-source';
|
|
2
|
-
|
|
3
|
-
AppDataSource.initialize()
|
|
4
|
-
.then(() => {
|
|
5
|
-
console.log('✅ Database schema synchronized successfully.');
|
|
6
|
-
})
|
|
7
|
-
.catch((error: any) => {
|
|
8
|
-
console.error('❌ Error during schema synchronization:', error);
|
|
9
|
-
process.exit(1);
|
|
10
|
-
});
|
|
1
|
+
import { AppDataSource } from './data-source';
|
|
2
|
+
|
|
3
|
+
AppDataSource.initialize()
|
|
4
|
+
.then(() => {
|
|
5
|
+
console.log('✅ Database schema synchronized successfully.');
|
|
6
|
+
})
|
|
7
|
+
.catch((error: any) => {
|
|
8
|
+
console.error('❌ Error during schema synchronization:', error);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"declaration": true,
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"strictPropertyInitialization": false,
|
|
11
|
-
"experimentalDecorators": true,
|
|
12
|
-
"emitDecoratorMetadata": true
|
|
13
|
-
},
|
|
14
|
-
"include": ["src"],
|
|
15
|
-
"exclude": ["node_modules", "dist"]
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"strictPropertyInitialization": false,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"emitDecoratorMetadata": true
|
|
13
|
+
},
|
|
14
|
+
"include": ["src"],
|
|
15
|
+
"exclude": ["node_modules", "dist"]
|
|
16
|
+
}
|
package/dist/models/db.d.ts
DELETED
package/dist/models/db.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const typeorm_1 = require("typeorm");
|
|
7
|
-
const dotenv_1 = __importDefault(require("dotenv"));
|
|
8
|
-
const user_1 = require("../models/user");
|
|
9
|
-
const user_sessions_1 = require("../models/user-sessions");
|
|
10
|
-
dotenv_1.default.config();
|
|
11
|
-
let AppDataSource;
|
|
12
|
-
let retries = 5;
|
|
13
|
-
while (retries) {
|
|
14
|
-
try {
|
|
15
|
-
AppDataSource = new typeorm_1.DataSource({
|
|
16
|
-
type: "postgres",
|
|
17
|
-
host: process.env.TYPEORM_HOST,
|
|
18
|
-
port: parseInt(process.env.TYPEORM_PORT),
|
|
19
|
-
username: process.env.TYPEORM_USERNAME,
|
|
20
|
-
password: process.env.TYPEORM_PASSWORD,
|
|
21
|
-
database: process.env.TYPEORM_DATABASE,
|
|
22
|
-
synchronize: true,
|
|
23
|
-
logging: false,
|
|
24
|
-
entities: [user_1.User, user_sessions_1.userSessions]
|
|
25
|
-
});
|
|
26
|
-
AppDataSource.initialize()
|
|
27
|
-
.then(() => {
|
|
28
|
-
console.log("Database Connection Established");
|
|
29
|
-
})
|
|
30
|
-
.catch((error) => console.log(error));
|
|
31
|
-
retries = 0;
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
console.log('Postgres trying to reconnect : ', retries, 'Error :', error);
|
|
35
|
-
retries -= 1;
|
|
36
|
-
AppDataSource = undefined;
|
|
37
|
-
new Promise(res => setTimeout(res, 500));
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.default = AppDataSource;
|
package/src/models/db.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { DataSource } from "typeorm";
|
|
2
|
-
import dotenv from 'dotenv';
|
|
3
|
-
import { User } from "../models/user";
|
|
4
|
-
import { userSessions } from '../models/user-sessions';
|
|
5
|
-
|
|
6
|
-
dotenv.config();
|
|
7
|
-
let AppDataSource: any;
|
|
8
|
-
let retries: number = 5;
|
|
9
|
-
while (retries) {
|
|
10
|
-
try {
|
|
11
|
-
AppDataSource = new DataSource({
|
|
12
|
-
type: "postgres",
|
|
13
|
-
host: process.env.TYPEORM_HOST,
|
|
14
|
-
port: parseInt(process.env.TYPEORM_PORT!),
|
|
15
|
-
username: process.env.TYPEORM_USERNAME,
|
|
16
|
-
password: process.env.TYPEORM_PASSWORD,
|
|
17
|
-
database: process.env.TYPEORM_DATABASE,
|
|
18
|
-
synchronize: true,
|
|
19
|
-
logging: false,
|
|
20
|
-
entities: [ User,userSessions]
|
|
21
|
-
});
|
|
22
|
-
AppDataSource.initialize()
|
|
23
|
-
.then(() => {
|
|
24
|
-
console.log("Database Connection Established");
|
|
25
|
-
})
|
|
26
|
-
.catch((error: any) => console.log(error));
|
|
27
|
-
retries = 0;
|
|
28
|
-
} catch (error) {
|
|
29
|
-
console.log('Postgres trying to reconnect : ', retries, 'Error :', error);
|
|
30
|
-
retries -= 1;
|
|
31
|
-
AppDataSource = undefined;
|
|
32
|
-
new Promise(res => setTimeout(res, 500));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export default AppDataSource;
|