@platform-modules/foreign-ministry 1.0.80 → 1.0.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.env +2 -2
  2. package/dist/data-source.js +2 -12
  3. package/dist/index.d.ts +13 -5
  4. package/dist/index.js +13 -5
  5. package/dist/models/AllowanceRequestsModel.d.ts +9 -0
  6. package/dist/models/AllowanceRequestsModel.js +49 -0
  7. package/dist/models/AllowanceTypesModel.d.ts +8 -0
  8. package/dist/models/AllowanceTypesModel.js +43 -0
  9. package/dist/models/BankAccountChangeRequestsModel.d.ts +12 -0
  10. package/dist/models/BankAccountChangeRequestsModel.js +62 -0
  11. package/dist/models/FMServices.js +1 -1
  12. package/dist/models/FinancialApprovalsModel.d.ts +19 -0
  13. package/dist/models/FinancialApprovalsModel.js +69 -0
  14. package/dist/models/FinancialAttachmentsModel.d.ts +10 -0
  15. package/dist/models/FinancialAttachmentsModel.js +50 -0
  16. package/dist/models/FinancialChatsModel.d.ts +9 -0
  17. package/dist/models/FinancialChatsModel.js +45 -0
  18. package/dist/models/FinancialRequestsModel.d.ts +49 -0
  19. package/dist/models/FinancialRequestsModel.js +154 -0
  20. package/dist/models/FinancialSettingsModel.d.ts +8 -0
  21. package/dist/models/FinancialSettingsModel.js +44 -0
  22. package/dist/models/FinancialWorkFlowModel.d.ts +18 -0
  23. package/dist/models/FinancialWorkFlowModel.js +67 -0
  24. package/dist/models/PayslipRequestsModel.d.ts +10 -0
  25. package/dist/models/PayslipRequestsModel.js +50 -0
  26. package/dist/models/ReimbursementRequestsModel.d.ts +14 -0
  27. package/dist/models/ReimbursementRequestsModel.js +73 -0
  28. package/dist/models/RequestTypeMasterModel.d.ts +11 -0
  29. package/dist/models/RequestTypeMasterModel.js +55 -0
  30. package/dist/models/SalaryCertificateRequestsModel.d.ts +12 -0
  31. package/dist/models/SalaryCertificateRequestsModel.js +62 -0
  32. package/dist/models/role.d.ts +7 -1
  33. package/dist/models/role.js +2 -2
  34. package/dist/models/user.d.ts +1 -5
  35. package/dist/models/user.js +2 -22
  36. package/package.json +1 -1
  37. package/src/data-source.ts +2 -12
  38. package/src/index.ts +13 -5
  39. package/src/models/AllowanceRequestsModel.ts +38 -0
  40. package/src/models/AllowanceTypesModel.ts +26 -0
  41. package/src/models/BankAccountChangeRequestsModel.ts +50 -0
  42. package/src/models/FMServices.ts +1 -1
  43. package/src/models/FinancialApprovalsModel.ts +52 -0
  44. package/src/models/FinancialAttachmentsModel.ts +35 -0
  45. package/src/models/FinancialChatsModel.ts +27 -0
  46. package/src/models/FinancialRequestsModel.ts +122 -0
  47. package/src/models/FinancialSettingsModel.ts +30 -0
  48. package/src/models/FinancialWorkFlowModel.ts +51 -0
  49. package/src/models/PayslipRequestsModel.ts +31 -0
  50. package/src/models/ReimbursementRequestsModel.ts +58 -0
  51. package/src/models/RequestTypeMasterModel.ts +36 -0
  52. package/src/models/SalaryCertificateRequestsModel.ts +40 -0
  53. package/src/models/role.ts +7 -1
  54. package/src/models/user.ts +0 -21
  55. package/dist/models/HelpContentMappedCategoriesModel.d.ts +0 -6
  56. package/dist/models/HelpContentMappedCategoriesModel.js +0 -34
  57. package/dist/models/HelpContentMappedTagsModel.d.ts +0 -6
  58. package/dist/models/HelpContentMappedTagsModel.js +0 -34
  59. package/dist/models/HelpContentTagsModel.d.ts +0 -5
  60. package/dist/models/HelpContentTagsModel.js +0 -29
  61. package/dist/models/HolidaysModel.d.ts +0 -11
  62. package/dist/models/HolidaysModel.js +0 -59
  63. package/dist/models/NotificationModel.d.ts +0 -18
  64. package/dist/models/NotificationModel.js +0 -79
  65. package/dist/models/PortalFeedbackModel.d.ts +0 -8
  66. package/dist/models/PortalFeedbackModel.js +0 -44
  67. package/dist/models/roleRightsModel.d.ts +0 -16
  68. package/dist/models/roleRightsModel.js +0 -44
  69. package/dist/models/userRolesModel.d.ts +0 -19
  70. package/dist/models/userRolesModel.js +0 -59
  71. package/src/models/HolidaysModel.ts +0 -46
  72. package/src/models/NotificationModel.ts +0 -68
  73. package/src/models/PortalFeedbackModel.ts +0 -33
  74. package/src/models/roleRightsModel.ts +0 -31
  75. package/src/models/userRolesModel.ts +0 -42
@@ -13,7 +13,7 @@ exports.User = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const BaseModel_1 = require("./BaseModel");
15
15
  let User = class User extends BaseModel_1.BaseModel {
16
- constructor(employee_id, employee_name, employee_arabic_name, date_of_birth, region_of_birth, country_of_birth, date_of_joining, last_promotion_date, gender, marital_status, nationality, email, blood_group, national_id, mobile, department, section, grade, location, country, is_admin, division, reporting_to, address, residential_status, religion, designation, avatar, passport_number, personal_email, extension_number, diplomatic_name, civil_employee_id, qualification, father_name, spouse_name, children1_name, children2_name) {
16
+ constructor(employee_id, employee_name, employee_arabic_name, date_of_birth, region_of_birth, country_of_birth, date_of_joining, last_promotion_date, gender, marital_status, nationality, email, blood_group, national_id, mobile, department, section, grade, location, country, is_admin, division, reporting_to, address, residential_status, religion, designation, avatar, passport_number, personal_email, extension_number, diplomatic_name, civil_employee_id, qualification) {
17
17
  super();
18
18
  this.employee_id = employee_id;
19
19
  this.employee_name = employee_name;
@@ -49,10 +49,6 @@ let User = class User extends BaseModel_1.BaseModel {
49
49
  this.diplomatic_name = diplomatic_name;
50
50
  this.civil_employee_id = civil_employee_id;
51
51
  this.qualification = qualification;
52
- this.father_name = father_name;
53
- this.spouse_name = spouse_name;
54
- this.children1_name = children1_name;
55
- this.children2_name = children2_name;
56
52
  }
57
53
  };
58
54
  exports.User = User;
@@ -192,23 +188,7 @@ __decorate([
192
188
  (0, typeorm_1.Column)({ nullable: true }),
193
189
  __metadata("design:type", String)
194
190
  ], User.prototype, "qualification", void 0);
195
- __decorate([
196
- (0, typeorm_1.Column)({ nullable: true }),
197
- __metadata("design:type", String)
198
- ], User.prototype, "father_name", void 0);
199
- __decorate([
200
- (0, typeorm_1.Column)({ nullable: true }),
201
- __metadata("design:type", String)
202
- ], User.prototype, "spouse_name", void 0);
203
- __decorate([
204
- (0, typeorm_1.Column)({ nullable: true }),
205
- __metadata("design:type", String)
206
- ], User.prototype, "children1_name", void 0);
207
- __decorate([
208
- (0, typeorm_1.Column)({ nullable: true }),
209
- __metadata("design:type", String)
210
- ], User.prototype, "children2_name", void 0);
211
191
  exports.User = User = __decorate([
212
192
  (0, typeorm_1.Entity)({ name: 'users' }),
213
- __metadata("design:paramtypes", [Number, String, String, String, String, String, String, String, String, String, String, String, String, Number, String, Number, Number, Number, String, String, Boolean, Number, Number, String, String, String, Number, String, String, String, Number, String, Number, String, String, String, String, String])
193
+ __metadata("design:paramtypes", [Number, String, String, String, String, String, String, String, String, String, String, String, String, Number, String, Number, Number, Number, String, String, Boolean, Number, Number, String, String, String, Number, String, String, String, Number, String, Number, String])
214
194
  ], User);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-modules/foreign-ministry",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -50,11 +50,6 @@ import { MessageReadStatus } from './models/MessageReadStatusModel';
50
50
  import { ShiftDetails } from './models/ShifttimesModel';
51
51
  import { AttendanceDetails } from './models/AttendanceModel';
52
52
  import { UserShift } from './models/UserShiftModel';
53
- import { Holidays } from './models/HolidaysModel';
54
- import { UserRole } from './models/userRolesModel';
55
- import { RoleRights } from './models/roleRightsModel';
56
- import { PortalFeedback } from './models/PortalFeedbackModel';
57
- import { Notification } from './models/NotificationModel';
58
53
 
59
54
 
60
55
  export const AppDataSource = new DataSource({
@@ -64,7 +59,7 @@ export const AppDataSource = new DataSource({
64
59
  username: process.env.DB_USER || 'postgres',
65
60
  password: process.env.DB_PASS || 'postgres',
66
61
  database: process.env.DB_NAME || 'common_models',
67
- synchronize: true, // auto-create tables (disable in prod)
62
+ synchronize: false, // auto-create tables (disable in prod)
68
63
  logging: false,
69
64
  entities: [
70
65
  User,
@@ -110,11 +105,6 @@ export const AppDataSource = new DataSource({
110
105
  MessageReadStatus,
111
106
  ShiftDetails,
112
107
  AttendanceDetails,
113
- UserShift,
114
- Holidays,
115
- UserRole,
116
- RoleRights,
117
- PortalFeedback,
118
- Notification
108
+ UserShift
119
109
  ],
120
110
  });
package/src/index.ts CHANGED
@@ -42,8 +42,16 @@ export * from './models/ShifttimesModel';
42
42
  export * from './models/AttendanceModel';
43
43
  export * from './models/contactInfoModel';
44
44
  export * from './models/UserShiftModel';
45
- export * from './models/HolidaysModel';
46
- export * from './models/userRolesModel';
47
- export * from './models/roleRightsModel';
48
- export * from './models/PortalFeedbackModel';
49
- export * from './models/NotificationModel';
45
+ export * from './models/FinancialRequestsModel';
46
+ export * from './models/PayslipRequestsModel';
47
+ export * from './models/SalaryCertificateRequestsModel';
48
+ export * from './models/AllowanceRequestsModel';
49
+ export * from './models/ReimbursementRequestsModel';
50
+ export * from './models/BankAccountChangeRequestsModel';
51
+ export * from './models/FinancialChatsModel';
52
+ export * from './models/FinancialApprovalsModel';
53
+ export * from './models/FinancialWorkFlowModel';
54
+ export * from './models/FinancialAttachmentsModel';
55
+ export * from './models/RequestTypeMasterModel';
56
+ export * from './models/FinancialSettingsModel';
57
+ export * from './models/AllowanceTypesModel';
@@ -0,0 +1,38 @@
1
+ import { Column, Entity, OneToOne, JoinColumn, ManyToOne } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'allowance_requests' })
5
+ export class AllowanceRequests extends BaseModel {
6
+ @Column({ type: 'int', unique: true })
7
+ financial_request_id: number;
8
+
9
+ @Column({ type: 'int' })
10
+ allowance_type_id: number;
11
+
12
+ @Column({ type: 'decimal', precision: 10, scale: 2 })
13
+ allowance_amount: number;
14
+
15
+ @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true })
16
+ approved_allowance_amount: number;
17
+
18
+ @Column({ type: 'boolean', default: false })
19
+ currency : string;
20
+
21
+
22
+ constructor(
23
+ financial_request_id: number,
24
+ allowance_type_id: number,
25
+ allowance_amount: number,
26
+ approved_allowance_amount: number,
27
+ currency: string
28
+
29
+ ) {
30
+ super();
31
+ this.financial_request_id = financial_request_id;
32
+ this.allowance_type_id = allowance_type_id;
33
+ this.allowance_amount = allowance_amount;
34
+ this.approved_allowance_amount = approved_allowance_amount;
35
+ this.currency = currency;
36
+ }
37
+ }
38
+
@@ -0,0 +1,26 @@
1
+ import { Column, Entity } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'allowance_types' })
5
+ export class AllowanceTypes extends BaseModel {
6
+ @Column({ type: 'varchar', length: 100, unique: true })
7
+ allowance_code: string; // HOUSING, TRANSPORT, EDUCATION, etc.
8
+
9
+ @Column({ type: 'varchar', length: 255 })
10
+ allowance_name: string;
11
+
12
+ @Column({ type: 'text', nullable: true })
13
+ description: string;
14
+
15
+
16
+ @Column({ type: 'boolean', default: true })
17
+ is_active: boolean;
18
+
19
+ constructor(allowance_code: string, allowance_name: string) {
20
+ super();
21
+ this.allowance_code = allowance_code;
22
+ this.allowance_name = allowance_name;
23
+ this.is_active = true;
24
+ }
25
+ }
26
+
@@ -0,0 +1,50 @@
1
+ import { Column, Entity, OneToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'bank_account_change_requests' })
5
+ export class BankAccountChangeRequests extends BaseModel {
6
+ @Column({ type: 'int', unique: true })
7
+ financial_request_id: number;
8
+
9
+ // Old Bank Details
10
+ @Column({ type: 'varchar', length: 100, nullable: true })
11
+ old_bank_name: string;
12
+
13
+ @Column({ type: 'varchar', length: 50, nullable: true })
14
+ old_account_number: string;
15
+
16
+
17
+ // New Bank Details
18
+ @Column({ type: 'varchar', length: 100 })
19
+ new_bank_name: string;
20
+
21
+ @Column({ type: 'varchar', length: 50 })
22
+ new_account_number: string;
23
+
24
+ @Column({ type: 'varchar', length: 50, nullable: true })
25
+ new_account_name: string;
26
+
27
+ @Column({ type: 'varchar', length: 100, nullable: true })
28
+ new_branch_ifsc_code: string;
29
+
30
+ @Column({ type: 'text' })
31
+ reason_for_change: string;
32
+
33
+ constructor(
34
+ financial_request_id: number,
35
+ new_bank_name: string,
36
+ new_account_number: string,
37
+ new_account_name: string,
38
+ new_branch_ifsc_code: string,
39
+ reason_for_change: string,
40
+ ) {
41
+ super();
42
+ this.financial_request_id = financial_request_id;
43
+ this.new_bank_name = new_bank_name;
44
+ this.new_account_number = new_account_number;
45
+ this.new_account_name = new_account_name;
46
+ this.new_branch_ifsc_code = new_branch_ifsc_code;
47
+ this.reason_for_change = reason_for_change;
48
+ }
49
+ }
50
+
@@ -14,7 +14,7 @@ export class FMServices extends BaseModel {
14
14
  @Column({ nullable: false })
15
15
  description: string;
16
16
 
17
- @Column({ nullable: true })
17
+ @Column({ nullable: false })
18
18
  logo_url: string;
19
19
 
20
20
  constructor(
@@ -0,0 +1,52 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { FinancialRequests } from './FinancialRequestsModel';
4
+
5
+ export enum FinancialApprovalStatus {
6
+ PENDING = "Pending",
7
+ APPROVED = "Approved",
8
+ REJECTED = "Rejected",
9
+ SKIPPED = "Skipped"
10
+ }
11
+
12
+ @Entity({ name: 'financial_approvals' })
13
+ export class FinancialApprovals extends BaseModel {
14
+ @Column({ type: 'int' })
15
+ financial_request_id: number;
16
+
17
+ @Column({ type: 'int' })
18
+ level: number;
19
+
20
+ @Column({ type: 'int', nullable: true })
21
+ approver_user_id: number;
22
+
23
+ @Column({ type: 'int' })
24
+ approver_role_id: number;
25
+
26
+ @Column({ type: 'text', nullable: true })
27
+ comment: string;
28
+
29
+ @Column({ type: 'enum', enum: FinancialApprovalStatus, default: FinancialApprovalStatus.PENDING })
30
+ approval_status: FinancialApprovalStatus;
31
+
32
+ @Column({ type: 'timestamp', nullable: true })
33
+ action_date: Date;
34
+
35
+ @ManyToOne(() => FinancialRequests, fr => fr.approvals)
36
+ @JoinColumn({ name: 'financial_request_id' })
37
+ financialRequest?: FinancialRequests;
38
+
39
+ constructor(
40
+ financial_request_id: number,
41
+ level: number,
42
+ approver_role_id: number,
43
+ approval_status: FinancialApprovalStatus
44
+ ) {
45
+ super();
46
+ this.financial_request_id = financial_request_id;
47
+ this.level = level;
48
+ this.approver_role_id = approver_role_id;
49
+ this.approval_status = approval_status;
50
+ }
51
+ }
52
+
@@ -0,0 +1,35 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { FinancialRequests } from './FinancialRequestsModel';
4
+
5
+ @Entity({ name: 'financial_attachments' })
6
+ export class FinancialAttachments extends BaseModel {
7
+ @Column({ type: 'int' })
8
+ financial_request_id: number;
9
+
10
+ @Column({ type: 'varchar', length: 500 })
11
+ file_url: string;
12
+
13
+ @Column({ type: 'varchar', length: 255 })
14
+ file_name: string;
15
+
16
+ @Column({ type: 'varchar', length: 50, nullable: true })
17
+ file_type: string; // PDF, JPG, PNG, etc.
18
+
19
+ @ManyToOne(() => FinancialRequests, fr => fr.attachments)
20
+ @JoinColumn({ name: 'financial_request_id' })
21
+ financialRequest?: FinancialRequests;
22
+
23
+ constructor(
24
+ financial_request_id: number,
25
+ file_url: string,
26
+ file_name: string
27
+ ) {
28
+ super();
29
+ this.financial_request_id = financial_request_id;
30
+ this.file_url = file_url;
31
+ this.file_name = file_name;
32
+ this.file_type = 'PDF';
33
+ }
34
+ }
35
+
@@ -0,0 +1,27 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { FinancialRequests } from './FinancialRequestsModel';
4
+
5
+ @Entity({ name: 'financial_chats' })
6
+ export class FinancialChats extends BaseModel {
7
+ @Column({ type: 'int' })
8
+ financial_request_id: number;
9
+
10
+ @Column({ type: 'text' })
11
+ content: string;
12
+
13
+ @Column({ type: 'int' })
14
+ sender_user_id: number;
15
+
16
+ @ManyToOne(() => FinancialRequests, fr => fr.chats)
17
+ @JoinColumn({ name: 'financial_request_id' })
18
+ financialRequest?: FinancialRequests;
19
+
20
+ constructor(financial_request_id: number, content: string, sender_user_id: number) {
21
+ super();
22
+ this.financial_request_id = financial_request_id;
23
+ this.content = content;
24
+ this.sender_user_id = sender_user_id;
25
+ }
26
+ }
27
+
@@ -0,0 +1,122 @@
1
+ import { Column, Entity, OneToOne, OneToMany, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { PayslipRequests } from './PayslipRequestsModel';
4
+ import { SalaryCertificateRequests } from './SalaryCertificateRequestsModel';
5
+ import { AllowanceRequests } from './AllowanceRequestsModel';
6
+ import { ReimbursementRequests } from './ReimbursementRequestsModel';
7
+ import { BankAccountChangeRequests } from './BankAccountChangeRequestsModel';
8
+ import { FinancialChats } from './FinancialChatsModel';
9
+ import { FinancialApprovals } from './FinancialApprovalsModel';
10
+ import { FinancialWorkFlow } from './FinancialWorkFlowModel';
11
+ import { FinancialAttachments } from './FinancialAttachmentsModel';
12
+ import { RequestTypeMaster } from './RequestTypeMasterModel';
13
+
14
+ export enum FinancialRequestStatus {
15
+ DRAFT = "Draft",
16
+ SUBMITTED = "Submitted",
17
+ PENDING = "Pending",
18
+ IN_PROGRESS = "In Progress",
19
+ APPROVED = "Approved",
20
+ REJECTED = "Rejected",
21
+ COMPLETED = "Completed",
22
+ CANCELLED = "Cancelled"
23
+ }
24
+
25
+ @Entity({ name: 'financial_requests' })
26
+ export class FinancialRequests extends BaseModel {
27
+ @Column({ type: 'int' })
28
+ user_id: number;
29
+
30
+ @Column({ type: 'varchar', length: 100 })
31
+ employee_id: string;
32
+
33
+ @Column({ type: 'varchar', length: 255 })
34
+ employee_name: string;
35
+
36
+ @Column({ type: 'varchar', length: 100, nullable: true })
37
+ grade: string;
38
+
39
+ @Column({ type: 'int', nullable: true })
40
+ designation_id: number;
41
+
42
+ @Column({ type: 'int', nullable: true })
43
+ department_id: number;
44
+
45
+ @Column({ type: 'varchar', length: 255 })
46
+ email_address: string;
47
+
48
+ @Column({ type: 'varchar', length: 20 })
49
+ contact_number: string;
50
+
51
+ @Column({ type: 'int' })
52
+ request_type_id: number;
53
+
54
+ @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
55
+ request_date: Date;
56
+
57
+ @Column({ type: 'enum', enum: FinancialRequestStatus, default: FinancialRequestStatus.PENDING })
58
+ request_status: FinancialRequestStatus;
59
+
60
+ @Column({ type: 'timestamp', nullable: true })
61
+ request_close_date: Date;
62
+
63
+ @Column({ type: 'text', nullable: true })
64
+ remarks: string;
65
+
66
+ @Column({ type: 'int', nullable: true })
67
+ current_approval_level: number;
68
+
69
+ @Column({ type: 'int', nullable: true })
70
+ current_approver_id: number;
71
+
72
+ @OneToOne(() => PayslipRequests, payslip => payslip.financialRequest, { nullable: true })
73
+ payslipRequest?: PayslipRequests;
74
+
75
+ @OneToOne(() => SalaryCertificateRequests, cert => cert.financial_request_id, { nullable: true })
76
+ salaryCertificateRequest?: SalaryCertificateRequests;
77
+
78
+ @OneToOne(() => AllowanceRequests, allowance => allowance.financial_request_id, { nullable: true })
79
+ allowanceRequest?: AllowanceRequests;
80
+
81
+ @OneToOne(() => ReimbursementRequests, reimb => reimb.financial_request_id, { nullable: true })
82
+ reimbursementRequest?: ReimbursementRequests;
83
+
84
+ @OneToOne(() => BankAccountChangeRequests, bank => bank.financial_request_id, { nullable: true })
85
+ bankAccountChangeRequest?: BankAccountChangeRequests;
86
+
87
+ @OneToMany(() => FinancialChats, chat => chat.financialRequest)
88
+ chats?: FinancialChats[];
89
+
90
+ @OneToMany(() => FinancialApprovals, approval => approval.financialRequest)
91
+ approvals?: FinancialApprovals[];
92
+
93
+ @OneToMany(() => FinancialWorkFlow, workflow => workflow.financialRequest)
94
+ workflows?: FinancialWorkFlow[];
95
+
96
+ @OneToMany(() => FinancialAttachments, attachment => attachment.financialRequest)
97
+ attachments?: FinancialAttachments[];
98
+
99
+ @ManyToOne(() => RequestTypeMaster)
100
+ @JoinColumn({ name: 'request_type_id' })
101
+ requestType?: RequestTypeMaster;
102
+
103
+ constructor(
104
+ user_id: number,
105
+ employee_id: string,
106
+ employee_name: string,
107
+ email_address: string,
108
+ contact_number: string,
109
+ request_type_id: number
110
+ ) {
111
+ super();
112
+ this.user_id = user_id;
113
+ this.employee_id = employee_id;
114
+ this.employee_name = employee_name;
115
+ this.email_address = email_address;
116
+ this.contact_number = contact_number;
117
+ this.request_type_id = request_type_id;
118
+ this.request_date = new Date();
119
+ this.request_status = FinancialRequestStatus.PENDING;
120
+ }
121
+ }
122
+
@@ -0,0 +1,30 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'financial_settings' })
5
+ export class FinancialSettings extends BaseModel {
6
+ @Column({ type: 'int' })
7
+ service_id: number;
8
+
9
+ @Column({ type: 'int' })
10
+ approval_level: number;
11
+
12
+ @Column({ type: 'int' })
13
+ approver_role_id: number;
14
+
15
+ @Column({ type: 'boolean', default: true })
16
+ is_active: boolean;
17
+
18
+ constructor(
19
+ service_id: number,
20
+ approval_level: number,
21
+ approver_role_id: number,
22
+ ) {
23
+ super();
24
+ this.service_id = service_id;
25
+ this.approval_level = approval_level;
26
+ this.approver_role_id = approver_role_id;
27
+ this.is_active = true;
28
+ }
29
+ }
30
+
@@ -0,0 +1,51 @@
1
+ import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { FinancialRequests } from './FinancialRequestsModel';
4
+
5
+ export enum FinancialWorkFlowStatus {
6
+ COMPLETED = "Completed",
7
+ NOT_YET_STARTED = "Not Yet Started",
8
+ PENDING = "Pending",
9
+ IN_PROGRESS = "In Progress"
10
+ }
11
+
12
+ @Entity({ name: 'financial_work_flows' })
13
+ export class FinancialWorkFlow extends BaseModel {
14
+ @Column({ type: 'int' })
15
+ financial_request_id: number;
16
+
17
+ @Column({ type: 'int', nullable: true, default: 0 })
18
+ financial_approval_id: number;
19
+
20
+ @Column({ type: 'enum', enum: FinancialWorkFlowStatus, default: FinancialWorkFlowStatus.NOT_YET_STARTED })
21
+ status: FinancialWorkFlowStatus;
22
+
23
+ @Column({ type: 'int', nullable: true })
24
+ approved_by_user_id: number;
25
+
26
+ @Column({ type: 'varchar', length: 500 })
27
+ content: string;
28
+
29
+ @Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
30
+ activity_date: Date;
31
+
32
+ @ManyToOne(() => FinancialRequests, fr => fr.workflows)
33
+ @JoinColumn({ name: 'financial_request_id' })
34
+ financialRequest?: FinancialRequests;
35
+
36
+ constructor(
37
+ financial_request_id: number,
38
+ status: FinancialWorkFlowStatus,
39
+ approved_by_user_id: number,
40
+ content: string
41
+ ) {
42
+ super();
43
+ this.financial_request_id = financial_request_id;
44
+ this.status = status;
45
+ this.approved_by_user_id = approved_by_user_id;
46
+ this.content = content;
47
+ this.financial_approval_id = 0;
48
+ this.activity_date = new Date();
49
+ }
50
+ }
51
+
@@ -0,0 +1,31 @@
1
+ import { Column, Entity, OneToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+ import { FinancialRequests } from './FinancialRequestsModel';
4
+
5
+ @Entity({ name: 'payslip_requests' })
6
+ export class PayslipRequests extends BaseModel {
7
+ @Column({ type: 'int', unique: true })
8
+ financial_request_id: number;
9
+
10
+ @Column({ type: 'varchar', length: 7 })
11
+ payslip_month: string; // Format: 2025-01
12
+
13
+ @Column({ type: 'int', nullable: true })
14
+ payslip_year: number;
15
+
16
+ @Column({ type: 'varchar', length: 500, nullable: true })
17
+ payslip_url: string;
18
+
19
+ @OneToOne(() => FinancialRequests, fr => fr.payslipRequest)
20
+ @JoinColumn({ name: 'financial_request_id' })
21
+ financialRequest?: FinancialRequests;
22
+
23
+ constructor(financial_request_id: number, payslip_month: string, payslip_year: number, payslip_url: string) {
24
+ super();
25
+ this.financial_request_id = financial_request_id;
26
+ this.payslip_month = payslip_month;
27
+ this.payslip_year = payslip_year;
28
+ this.payslip_url = payslip_url;
29
+ }
30
+ }
31
+
@@ -0,0 +1,58 @@
1
+ import { Column, Entity, OneToOne, JoinColumn } from "typeorm";
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'reimbursement_requests' })
5
+ export class ReimbursementRequests extends BaseModel {
6
+ @Column({ type: 'int', unique: true })
7
+ financial_request_id: number;
8
+
9
+ @Column({ type: 'text' })
10
+ expense_description: string;
11
+
12
+ @Column({ type: 'decimal', precision: 10, scale: 2 })
13
+ price: number;
14
+
15
+ @Column({ type: 'decimal', precision: 10, scale: 2 })
16
+ quantity: number;
17
+
18
+ @Column({ type: 'decimal', precision: 10, scale: 2 })
19
+ amount: number;
20
+
21
+ @Column({ type: 'decimal', precision: 10, scale: 2 })
22
+ total_amount: number;
23
+
24
+ @Column({ type: 'decimal', precision: 10, scale: 2, nullable: true })
25
+ approved_amount: number;
26
+
27
+ @Column({ type: 'boolean', default: false })
28
+ payment_processed: boolean;
29
+
30
+ @Column({ type: 'varchar', length: 100, nullable: true })
31
+ payment_mode: string;
32
+
33
+ @Column({ type: 'date', nullable: true })
34
+ payment_date: Date;
35
+
36
+ constructor(
37
+ financial_request_id: number,
38
+ amount: number,
39
+ quantity: number,
40
+ total_amount: number,
41
+ approved_amount: number,
42
+ payment_mode: string,
43
+ payment_date: Date,
44
+ expense_description: string
45
+ ) {
46
+ super();
47
+ this.financial_request_id = financial_request_id;
48
+ this.amount = amount;
49
+ this.quantity = quantity;
50
+ this.total_amount = total_amount;
51
+ this.approved_amount = approved_amount;
52
+ this.payment_mode = payment_mode;
53
+ this.payment_date = payment_date;
54
+ this.expense_description = expense_description;
55
+ this.payment_processed = false;
56
+ }
57
+ }
58
+