@platform-modules/foreign-ministry 1.3.286 → 1.3.290

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 (27) hide show
  1. package/dist/data-source.js +2 -0
  2. package/dist/helpers/employee-evaluation-request.utils.d.ts +30 -0
  3. package/dist/helpers/employee-evaluation-request.utils.js +139 -0
  4. package/dist/index.d.ts +3 -0
  5. package/dist/index.js +8 -1
  6. package/dist/models/EmployeeEvaluationAnswerModel.d.ts +5 -8
  7. package/dist/models/EmployeeEvaluationAnswerModel.js +18 -16
  8. package/dist/models/EmployeeEvaluationApprovalModel.d.ts +1 -1
  9. package/dist/models/EmployeeEvaluationApprovalModel.js +2 -2
  10. package/dist/models/EmployeeEvaluationPersonScoreModel.d.ts +9 -0
  11. package/dist/models/EmployeeEvaluationPersonScoreModel.js +45 -0
  12. package/dist/models/EmployeeEvaluationRequestModel.d.ts +6 -1
  13. package/dist/models/EmployeeEvaluationRequestModel.js +18 -2
  14. package/dist/models/EvaluationEligibilitySettingModel.d.ts +2 -0
  15. package/dist/models/EvaluationEligibilitySettingModel.js +4 -0
  16. package/package.json +24 -24
  17. package/scripts/migration-employee-evaluation-approval-role-null.sql +11 -0
  18. package/scripts/migration-employee-evaluation-request-v2.sql +63 -0
  19. package/scripts/migration-evaluation-max-employees-per-request.sql +2 -0
  20. package/src/data-source.ts +614 -612
  21. package/src/helpers/employee-evaluation-request.utils.ts +181 -0
  22. package/src/index.ts +479 -467
  23. package/src/models/EmployeeEvaluationAnswerModel.ts +26 -28
  24. package/src/models/EmployeeEvaluationApprovalModel.ts +2 -2
  25. package/src/models/EmployeeEvaluationPersonScoreModel.ts +25 -0
  26. package/src/models/EmployeeEvaluationRequestModel.ts +90 -77
  27. package/src/models/EvaluationEligibilitySettingModel.ts +51 -47
@@ -1,28 +1,26 @@
1
- import { Column, Entity, JoinColumn, ManyToOne } from 'typeorm';
2
- import { BaseModel } from './BaseModel';
3
- import { EvaluationFormSection } from './EvaluationFormSectionModel';
4
- import { EvaluationFormQuestion } from './EvaluationFormQuestionModel';
5
- import { EmployeeEvaluation } from './EmployeeEvaluationModel';
6
-
7
- @Entity({ name: 'employee_evaluation_answers' })
8
- export class EmployeeEvaluationAnswers extends BaseModel {
9
- @ManyToOne(() => EmployeeEvaluation, { onDelete: 'CASCADE' })
10
- @JoinColumn({ name: 'employee_evaluation_id' })
11
- employee_evaluation: EmployeeEvaluation;
12
-
13
- /** Form section (replaces legacy evaluation_section_master). */
14
- @ManyToOne(() => EvaluationFormSection, { onDelete: 'RESTRICT' })
15
- @JoinColumn({ name: 'evaluation_section_id' })
16
- evaluation_section: EvaluationFormSection;
17
-
18
- /** Form question (replaces legacy evaluation_question_master). */
19
- @ManyToOne(() => EvaluationFormQuestion, { onDelete: 'RESTRICT' })
20
- @JoinColumn({ name: 'evaluation_question_id' })
21
- evaluation_question: EvaluationFormQuestion;
22
-
23
- @Column({ type: 'int', nullable: false })
24
- score: number;
25
-
26
- @Column({ type: 'text', nullable: true })
27
- remarks: string | null;
28
- }
1
+ import { Column, Entity } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'employee_evaluation_answers' })
5
+ export class EmployeeEvaluationAnswers extends BaseModel {
6
+ @Column({ type: 'integer', nullable: false })
7
+ request_id: number;
8
+
9
+ @Column({ type: 'integer', nullable: false })
10
+ user_id: number;
11
+
12
+ @Column({ type: 'integer', nullable: false })
13
+ form_id: number;
14
+
15
+ @Column({ type: 'integer', nullable: false })
16
+ section_id: number;
17
+
18
+ @Column({ type: 'integer', nullable: false })
19
+ question_id: number;
20
+
21
+ @Column({ type: 'integer', nullable: false })
22
+ score: number;
23
+
24
+ @Column({ type: 'text', nullable: true })
25
+ remarks: string | null;
26
+ }
@@ -22,8 +22,8 @@ export class EmployeeEvaluationApprovalDetails extends BaseModel {
22
22
  @Column({ type: 'integer', nullable: false })
23
23
  level: number;
24
24
 
25
- @Column({ type: 'integer', nullable: false })
26
- approver_role_id: number;
25
+ @Column({ type: 'integer', nullable: true })
26
+ approver_role_id: number | null;
27
27
 
28
28
  @Column({ type: 'integer', nullable: true })
29
29
  department_id: number | null;
@@ -0,0 +1,25 @@
1
+ import { Column, Entity } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+ import { EmployeeEvaluationUsFeedback } from './EmployeeEvaluationModel';
4
+
5
+ @Entity({ name: 'employee_evaluation_person_scores' })
6
+ export class EmployeeEvaluationPersonScore extends BaseModel {
7
+ @Column({ type: 'integer', nullable: false })
8
+ request_id: number;
9
+
10
+ @Column({ type: 'integer', nullable: false })
11
+ user_id: number;
12
+
13
+ @Column({
14
+ type: 'enum',
15
+ enum: EmployeeEvaluationUsFeedback,
16
+ nullable: true,
17
+ })
18
+ us_feedback: EmployeeEvaluationUsFeedback | null;
19
+
20
+ @Column({ type: 'boolean', default: false, nullable: false })
21
+ is_rca: boolean;
22
+
23
+ @Column({ type: 'float', nullable: true })
24
+ total_score: number | null;
25
+ }
@@ -1,77 +1,90 @@
1
- import { Column, Entity } from 'typeorm';
2
- import { BaseModel } from './BaseModel';
3
-
4
- export enum EmployeeEvaluationRequestStatus {
5
- PENDING = 'Pending',
6
- IN_PROGRESS = 'In Progress',
7
- APPROVED = 'Approved',
8
- REJECTED = 'Rejected',
9
- }
10
-
11
- /** Routing bucket derived from undersecretary department (US Political / Administrative / Finance). */
12
- export enum EmployeeEvaluationRoutingBucket {
13
- US_POLITICAL = 'US_POLITICAL',
14
- US_ADMINISTRATIVE = 'US_ADMINISTRATIVE',
15
- FINANCE = 'FINANCE',
16
- OTHER = 'OTHER',
17
- }
18
-
19
- @Entity({ name: 'employee_evaluation_requests' })
20
- export class EmployeeEvaluationRequests extends BaseModel {
21
- @Column({ type: 'int', nullable: true })
22
- req_user_department_id: number | null;
23
-
24
- @Column({ type: 'int', nullable: true })
25
- req_user_section_id: number | null;
26
-
27
- @Column({ type: 'int', nullable: true })
28
- service_id: number | null;
29
-
30
- @Column({ type: 'int', nullable: true })
31
- sub_service_id: number | null;
32
-
33
- /** User who raised the request (e.g. HOD). */
34
- @Column({ type: 'int', nullable: false })
35
- user_id: number;
36
-
37
- @Column({ type: 'int', nullable: false })
38
- evaluation_year: number;
39
-
40
- @Column({ type: 'varchar', length: 120, nullable: false })
41
- evaluation_period: string;
42
-
43
- @Column({ type: 'int', nullable: false })
44
- evaluation_month: number;
45
-
46
- /** Scope: employees must belong to this department. */
47
- @Column({ type: 'int', nullable: false })
48
- department_id: number;
49
-
50
- /** Scope: employees must belong to this section. */
51
- @Column({ type: 'int', nullable: false })
52
- section_id: number;
53
-
54
- @Column({ type: 'bigint', nullable: true })
55
- undersecretary_department_id: number | null;
56
-
57
- @Column({
58
- type: 'enum',
59
- enum: EmployeeEvaluationRoutingBucket,
60
- nullable: true,
61
- })
62
- evaluation_routing_bucket: EmployeeEvaluationRoutingBucket | null;
63
-
64
- @Column({
65
- type: 'enum',
66
- enum: EmployeeEvaluationRequestStatus,
67
- default: EmployeeEvaluationRequestStatus.PENDING,
68
- nullable: false,
69
- })
70
- status: EmployeeEvaluationRequestStatus;
71
-
72
- @Column({ type: 'varchar', length: 255, nullable: true })
73
- workflow_execution_id: string | null;
74
-
75
- @Column({ type: 'text', nullable: true })
76
- comments: string | null;
77
- }
1
+ import { Column, Entity } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ export enum EmployeeEvaluationRequestStatus {
5
+ PENDING = 'Pending',
6
+ IN_PROGRESS = 'In Progress',
7
+ APPROVED = 'Approved',
8
+ REJECTED = 'Rejected',
9
+ }
10
+
11
+ /** Routing bucket derived from undersecretary department (US Political / Administrative / Finance). */
12
+ export enum EmployeeEvaluationRoutingBucket {
13
+ US_POLITICAL = 'US_POLITICAL',
14
+ US_ADMINISTRATIVE = 'US_ADMINISTRATIVE',
15
+ FINANCE = 'FINANCE',
16
+ OTHER = 'OTHER',
17
+ }
18
+
19
+ @Entity({ name: 'employee_evaluation_requests' })
20
+ export class EmployeeEvaluationRequests extends BaseModel {
21
+ @Column({ type: 'int', nullable: true })
22
+ req_user_department_id: number | null;
23
+
24
+ @Column({ type: 'int', nullable: true })
25
+ req_user_section_id: number | null;
26
+
27
+ @Column({ type: 'int', nullable: true })
28
+ service_id: number | null;
29
+
30
+ @Column({ type: 'int', nullable: true })
31
+ sub_service_id: number | null;
32
+
33
+ /** User who raised the request (e.g. HOD). */
34
+ @Column({ type: 'int', nullable: false })
35
+ user_id: number;
36
+
37
+ @Column({ type: 'varchar', length: 10, nullable: false })
38
+ evaluation_year: string;
39
+
40
+ @Column({ type: 'varchar', length: 120, nullable: false })
41
+ evaluation_period: string;
42
+
43
+ @Column({ type: 'int', nullable: false })
44
+ evaluation_month: number;
45
+
46
+ /** Scope: employees must belong to this department. */
47
+ @Column({ type: 'int', nullable: false })
48
+ department_id: number;
49
+
50
+ /** Scope: employees must belong to this section. */
51
+ @Column({ type: 'int', nullable: false })
52
+ section_id: number;
53
+
54
+ @Column({ type: 'bigint', nullable: true })
55
+ undersecretary_department_id: number | null;
56
+
57
+ @Column({
58
+ type: 'enum',
59
+ enum: EmployeeEvaluationRoutingBucket,
60
+ nullable: true,
61
+ })
62
+ evaluation_routing_bucket: EmployeeEvaluationRoutingBucket | null;
63
+
64
+ @Column({
65
+ type: 'enum',
66
+ enum: EmployeeEvaluationRequestStatus,
67
+ default: EmployeeEvaluationRequestStatus.PENDING,
68
+ nullable: false,
69
+ })
70
+ status: EmployeeEvaluationRequestStatus;
71
+
72
+ @Column({ type: 'varchar', length: 255, nullable: true })
73
+ workflow_execution_id: string | null;
74
+
75
+ @Column({ type: 'text', nullable: true })
76
+ comments: string | null;
77
+
78
+ @Column({ type: 'float', nullable: true })
79
+ total_score: number | null;
80
+
81
+ @Column({ type: 'float', nullable: true })
82
+ average_score: number | null;
83
+
84
+ @Column({ type: 'int', default: 0, nullable: false })
85
+ employee_count: number;
86
+
87
+ /** Form structure snapshot at request creation (sections/questions). */
88
+ @Column({ type: 'jsonb', nullable: true })
89
+ dynamic_evaluation_form: Record<string, unknown> | null;
90
+ }
@@ -1,47 +1,51 @@
1
- import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
2
- import { BaseModel } from './BaseModel';
3
-
4
- /**
5
- * Department/section/month evaluation window: which employees are excluded or re-included
6
- * for that cycle (e.g. excluded in January, eligible again in May via a different month row).
7
- */
8
- @Entity({ name: 'evaluation_eligibility_settings' })
9
- export class EvaluationEligibilitySetting extends BaseModel {
10
- @Column({ type: 'int' })
11
- department_id: number;
12
-
13
- @Column({ type: 'int' })
14
- section_id: number;
15
-
16
- /** Evaluation window start month (1–12). */
17
- @Column({ type: 'int' })
18
- from_month: number;
19
-
20
- /** Evaluation window end month (1–12), inclusive. */
21
- @Column({ type: 'int' })
22
- to_month: number;
23
-
24
- /** Last day of the evaluation month (1–31) when submissions close. */
25
- @Column({ type: 'int' })
26
- evaluation_end_date: number;
27
-
28
- @Column({ type: 'boolean', default: true })
29
- is_active: boolean;
30
-
31
- @OneToMany(() => EvaluationEligibilitySettingEmployee, (e) => e.evaluation_eligibility_setting)
32
- employees?: EvaluationEligibilitySettingEmployee[];
33
- }
34
-
35
- @Entity({ name: 'evaluation_eligibility_setting_employees' })
36
- export class EvaluationEligibilitySettingEmployee extends BaseModel {
37
- @ManyToOne(() => EvaluationEligibilitySetting, (s) => s.employees, { onDelete: 'CASCADE' })
38
- @JoinColumn({ name: 'setting_id' })
39
- evaluation_eligibility_setting: EvaluationEligibilitySetting;
40
-
41
- @Column({ type: 'int' })
42
- employee_id: number;
43
-
44
- /** When true, employee is excluded from evaluation for this setting’s month/department/section. */
45
- @Column({ type: 'boolean', default: true })
46
- is_excluded_from_evaluation: boolean;
47
- }
1
+ import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ /**
5
+ * Department/section/month evaluation window: which employees are excluded or re-included
6
+ * for that cycle (e.g. excluded in January, eligible again in May via a different month row).
7
+ */
8
+ @Entity({ name: 'evaluation_eligibility_settings' })
9
+ export class EvaluationEligibilitySetting extends BaseModel {
10
+ @Column({ type: 'int' })
11
+ department_id: number;
12
+
13
+ @Column({ type: 'int' })
14
+ section_id: number;
15
+
16
+ /** Evaluation window start month (1–12). */
17
+ @Column({ type: 'int' })
18
+ from_month: number;
19
+
20
+ /** Evaluation window end month (1–12), inclusive. */
21
+ @Column({ type: 'int' })
22
+ to_month: number;
23
+
24
+ /** Last day of the evaluation month (1–31) when submissions close. */
25
+ @Column({ type: 'int' })
26
+ evaluation_end_date: number;
27
+
28
+ @Column({ type: 'boolean', default: true })
29
+ is_active: boolean;
30
+
31
+ /** Maximum employees allowed in one evaluation request for this dept/section window. */
32
+ @Column({ type: 'int', default: 50 })
33
+ max_employees_per_request: number;
34
+
35
+ @OneToMany(() => EvaluationEligibilitySettingEmployee, (e) => e.evaluation_eligibility_setting)
36
+ employees?: EvaluationEligibilitySettingEmployee[];
37
+ }
38
+
39
+ @Entity({ name: 'evaluation_eligibility_setting_employees' })
40
+ export class EvaluationEligibilitySettingEmployee extends BaseModel {
41
+ @ManyToOne(() => EvaluationEligibilitySetting, (s) => s.employees, { onDelete: 'CASCADE' })
42
+ @JoinColumn({ name: 'setting_id' })
43
+ evaluation_eligibility_setting: EvaluationEligibilitySetting;
44
+
45
+ @Column({ type: 'int' })
46
+ employee_id: number;
47
+
48
+ /** When true, employee is excluded from evaluation for this setting’s month/department/section. */
49
+ @Column({ type: 'boolean', default: true })
50
+ is_excluded_from_evaluation: boolean;
51
+ }