@platform-modules/foreign-ministry 1.3.248 → 1.3.250

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.
@@ -261,7 +261,9 @@ const ProjectModel_1 = require("./models/ProjectModel");
261
261
  const TemplateModel_1 = require("./models/TemplateModel");
262
262
  const ProjectMilestoneDocumentsModel_1 = require("./models/ProjectMilestoneDocumentsModel");
263
263
  const ProjectTasksModel_1 = require("./models/ProjectTasksModel");
264
+ const ProjectTaskUsersModel_1 = require("./models/ProjectTaskUsersModel");
264
265
  const ProjectTaskActivityModel_1 = require("./models/ProjectTaskActivityModel");
266
+ const ProjectActivityModel_1 = require("./models/ProjectActivityModel");
265
267
  const ProjectTaskCommentsModel_1 = require("./models/ProjectTaskCommentsModel");
266
268
  const DocumentationFolderModel_1 = require("./models/DocumentationFolderModel");
267
269
  const DocumentationFileModel_1 = require("./models/DocumentationFileModel");
@@ -533,7 +535,9 @@ exports.AppDataSource = new typeorm_1.DataSource({
533
535
  TemplateModel_1.Templates,
534
536
  ProjectMilestoneDocumentsModel_1.ProjectMilestoneDocuments,
535
537
  ProjectTasksModel_1.ProjectTasks,
538
+ ProjectTaskUsersModel_1.ProjectTaskUsers,
536
539
  ProjectTaskActivityModel_1.ProjectTaskActivity,
540
+ ProjectActivityModel_1.ProjectActivity,
537
541
  ProjectTaskCommentsModel_1.ProjectTaskComments,
538
542
  DocumentationFolderModel_1.DocumentationFolder,
539
543
  DocumentationFileModel_1.DocumentationFile,
package/dist/index.d.ts CHANGED
@@ -369,7 +369,9 @@ export * from './models/ProjectMilestoneDocumentsModel';
369
369
  export * from './models/ProjectMilestonePhasesModel';
370
370
  export * from './models/ProjectTimelineModel';
371
371
  export * from './models/ProjectTasksModel';
372
+ export * from './models/ProjectTaskUsersModel';
372
373
  export * from './models/ProjectTaskActivityModel';
374
+ export * from './models/ProjectActivityModel';
373
375
  export * from './models/ProjectTaskCommentsModel';
374
376
  export * from './models/DocumentationFolderModel';
375
377
  export * from './models/DocumentationFileModel';
package/dist/index.js CHANGED
@@ -449,7 +449,9 @@ __exportStar(require("./models/ProjectMilestoneDocumentsModel"), exports);
449
449
  __exportStar(require("./models/ProjectMilestonePhasesModel"), exports);
450
450
  __exportStar(require("./models/ProjectTimelineModel"), exports);
451
451
  __exportStar(require("./models/ProjectTasksModel"), exports);
452
+ __exportStar(require("./models/ProjectTaskUsersModel"), exports);
452
453
  __exportStar(require("./models/ProjectTaskActivityModel"), exports);
454
+ __exportStar(require("./models/ProjectActivityModel"), exports);
453
455
  __exportStar(require("./models/ProjectTaskCommentsModel"), exports);
454
456
  __exportStar(require("./models/DocumentationFolderModel"), exports);
455
457
  __exportStar(require("./models/DocumentationFileModel"), exports);
@@ -0,0 +1,12 @@
1
+ import { BaseModel } from './BaseModel';
2
+ /** Audit log for project-level entities (project, scope, milestone, timeline). */
3
+ export declare class ProjectActivity extends BaseModel {
4
+ project_id: number;
5
+ /** e.g. project | scope | milestone | timeline */
6
+ entity_type: string;
7
+ entity_id: number | null;
8
+ activity_type: string;
9
+ description: string;
10
+ old_value: string | null;
11
+ new_value: string | null;
12
+ }
@@ -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.ProjectActivity = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ /** Audit log for project-level entities (project, scope, milestone, timeline). */
16
+ let ProjectActivity = class ProjectActivity extends BaseModel_1.BaseModel {
17
+ };
18
+ exports.ProjectActivity = ProjectActivity;
19
+ __decorate([
20
+ (0, typeorm_1.Column)({ type: 'int' }),
21
+ __metadata("design:type", Number)
22
+ ], ProjectActivity.prototype, "project_id", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50 }),
25
+ __metadata("design:type", String)
26
+ ], ProjectActivity.prototype, "entity_type", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
29
+ __metadata("design:type", Object)
30
+ ], ProjectActivity.prototype, "entity_id", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
33
+ __metadata("design:type", String)
34
+ ], ProjectActivity.prototype, "activity_type", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
37
+ __metadata("design:type", String)
38
+ ], ProjectActivity.prototype, "description", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
41
+ __metadata("design:type", Object)
42
+ ], ProjectActivity.prototype, "old_value", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
45
+ __metadata("design:type", Object)
46
+ ], ProjectActivity.prototype, "new_value", void 0);
47
+ exports.ProjectActivity = ProjectActivity = __decorate([
48
+ (0, typeorm_1.Entity)({ name: 'project_activity' }),
49
+ (0, typeorm_1.Index)(['project_id']),
50
+ (0, typeorm_1.Index)(['entity_type', 'entity_id'])
51
+ ], ProjectActivity);
@@ -0,0 +1,9 @@
1
+ import { BaseModel } from './BaseModel';
2
+ /**
3
+ * Many-to-many: one project task can be assigned to multiple users.
4
+ * Replaces the former `project_tasks.assign_to` single column.
5
+ */
6
+ export declare class ProjectTaskUsers extends BaseModel {
7
+ task_id: number;
8
+ user_id: number;
9
+ }
@@ -0,0 +1,32 @@
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.ProjectTaskUsers = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ /**
16
+ * Many-to-many: one project task can be assigned to multiple users.
17
+ * Replaces the former `project_tasks.assign_to` single column.
18
+ */
19
+ let ProjectTaskUsers = class ProjectTaskUsers extends BaseModel_1.BaseModel {
20
+ };
21
+ exports.ProjectTaskUsers = ProjectTaskUsers;
22
+ __decorate([
23
+ (0, typeorm_1.Column)({ type: 'int' }),
24
+ __metadata("design:type", Number)
25
+ ], ProjectTaskUsers.prototype, "task_id", void 0);
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ type: 'int' }),
28
+ __metadata("design:type", Number)
29
+ ], ProjectTaskUsers.prototype, "user_id", void 0);
30
+ exports.ProjectTaskUsers = ProjectTaskUsers = __decorate([
31
+ (0, typeorm_1.Entity)({ name: 'project_task_users' })
32
+ ], ProjectTaskUsers);
@@ -16,9 +16,8 @@ export declare class ProjectTasks extends BaseModel {
16
16
  status: string;
17
17
  milestone_id: number | null;
18
18
  phase: number;
19
- assign_to: number | null;
20
19
  manager_id: number | null;
21
20
  start_date: Date | null;
22
21
  end_date: Date | null;
23
- constructor(project_id?: number, task_title?: string, task_description?: string, attachments?: TaskAttachmentItem[] | null, priority?: string, status?: string, milestone_id?: number | null, phase?: number, assign_to?: number | null, manager_id?: number | null, start_date?: Date | null, end_date?: Date | null);
22
+ constructor(project_id?: number, task_title?: string, task_description?: string, attachments?: TaskAttachmentItem[] | null, priority?: string, status?: string, milestone_id?: number | null, phase?: number, manager_id?: number | null, start_date?: Date | null, end_date?: Date | null);
24
23
  }
@@ -15,7 +15,7 @@ const BaseModel_1 = require("./BaseModel");
15
15
  exports.TASK_PRIORITY = ['low', 'medium', 'high'];
16
16
  exports.TASK_STATUS = ['Not started', 'Pending', 'In Progress', 'Completed'];
17
17
  let ProjectTasks = class ProjectTasks extends BaseModel_1.BaseModel {
18
- constructor(project_id, task_title, task_description, attachments, priority, status, milestone_id, phase, assign_to, manager_id, start_date, end_date) {
18
+ constructor(project_id, task_title, task_description, attachments, priority, status, milestone_id, phase, manager_id, start_date, end_date) {
19
19
  super();
20
20
  this.project_id = project_id ?? 0;
21
21
  this.task_title = task_title ?? '';
@@ -25,7 +25,6 @@ let ProjectTasks = class ProjectTasks extends BaseModel_1.BaseModel {
25
25
  this.status = status ?? 'Not started';
26
26
  this.milestone_id = milestone_id ?? null;
27
27
  this.phase = phase ?? 1;
28
- this.assign_to = assign_to ?? null;
29
28
  this.manager_id = manager_id ?? null;
30
29
  this.start_date = start_date ?? null;
31
30
  this.end_date = end_date ?? null;
@@ -64,10 +63,6 @@ __decorate([
64
63
  (0, typeorm_1.Column)({ type: 'int', default: 1, nullable: true }),
65
64
  __metadata("design:type", Number)
66
65
  ], ProjectTasks.prototype, "phase", void 0);
67
- __decorate([
68
- (0, typeorm_1.Column)({ type: 'int', nullable: true }),
69
- __metadata("design:type", Object)
70
- ], ProjectTasks.prototype, "assign_to", void 0);
71
66
  __decorate([
72
67
  (0, typeorm_1.Column)({ type: 'int', nullable: true }),
73
68
  __metadata("design:type", Object)
@@ -82,5 +77,5 @@ __decorate([
82
77
  ], ProjectTasks.prototype, "end_date", void 0);
83
78
  exports.ProjectTasks = ProjectTasks = __decorate([
84
79
  (0, typeorm_1.Entity)({ name: 'project_tasks' }),
85
- __metadata("design:paramtypes", [Number, String, String, Object, String, String, Object, Number, Object, Object, Object, Object])
80
+ __metadata("design:paramtypes", [Number, String, String, Object, String, String, Object, Number, Object, Object, Object])
86
81
  ], ProjectTasks);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-modules/foreign-ministry",
3
- "version": "1.3.248",
3
+ "version": "1.3.250",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -267,7 +267,9 @@ import { Projects } from './models/ProjectModel';
267
267
  import { Templates } from './models/TemplateModel';
268
268
  import { ProjectMilestoneDocuments } from './models/ProjectMilestoneDocumentsModel';
269
269
  import { ProjectTasks } from './models/ProjectTasksModel';
270
+ import { ProjectTaskUsers } from './models/ProjectTaskUsersModel';
270
271
  import { ProjectTaskActivity } from './models/ProjectTaskActivityModel';
272
+ import { ProjectActivity } from './models/ProjectActivityModel';
271
273
  import { ProjectTaskComments } from './models/ProjectTaskCommentsModel';
272
274
  import { DocumentationFolder } from './models/DocumentationFolderModel';
273
275
  import { DocumentationFile } from './models/DocumentationFileModel';
@@ -540,7 +542,9 @@ export const AppDataSource = new DataSource({
540
542
  Templates,
541
543
  ProjectMilestoneDocuments,
542
544
  ProjectTasks,
545
+ ProjectTaskUsers,
543
546
  ProjectTaskActivity,
547
+ ProjectActivity,
544
548
  ProjectTaskComments,
545
549
  DocumentationFolder,
546
550
  DocumentationFile,
package/src/index.ts CHANGED
@@ -386,7 +386,9 @@ export * from './models/ProjectMilestoneDocumentsModel';
386
386
  export * from './models/ProjectMilestonePhasesModel';
387
387
  export * from './models/ProjectTimelineModel';
388
388
  export * from './models/ProjectTasksModel';
389
+ export * from './models/ProjectTaskUsersModel';
389
390
  export * from './models/ProjectTaskActivityModel';
391
+ export * from './models/ProjectActivityModel';
390
392
  export * from './models/ProjectTaskCommentsModel';
391
393
  export * from './models/DocumentationFolderModel';
392
394
  export * from './models/DocumentationFileModel';
@@ -1,40 +1,40 @@
1
- import { Column, Entity } from 'typeorm';
2
- import { BaseModel } from './BaseModel';
3
-
4
- @Entity({ name: 'documentation_files' })
5
- export class DocumentationFile extends BaseModel {
6
- @Column({ type: 'int', nullable: true })
7
- project_id: number | null;
8
-
9
- @Column({ type: 'int' })
10
- folder_id: number;
11
-
12
- @Column({ type: 'text', nullable: true })
13
- file_path: string;
14
-
15
- @Column({ type: 'varchar', length: 500, nullable: true })
16
- filename: string;
17
-
18
- @Column({ type: 'bigint', nullable: true })
19
- filesize: number;
20
-
21
- @Column({ type: 'varchar', length: 100, nullable: true })
22
- filetype: string;
23
-
24
- constructor(
25
- project_id?: number | null,
26
- folder_id?: number,
27
- file_path?: string,
28
- filename?: string,
29
- filesize?: number,
30
- filetype?: string
31
- ) {
32
- super();
33
- this.project_id = project_id ?? null;
34
- this.folder_id = folder_id ?? 0;
35
- this.file_path = file_path ?? '';
36
- this.filename = filename ?? '';
37
- this.filesize = filesize ?? 0;
38
- this.filetype = filetype ?? '';
39
- }
40
- }
1
+ import { Column, Entity } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'documentation_files' })
5
+ export class DocumentationFile extends BaseModel {
6
+ @Column({ type: 'int', nullable: true })
7
+ project_id: number | null;
8
+
9
+ @Column({ type: 'int' })
10
+ folder_id: number;
11
+
12
+ @Column({ type: 'text', nullable: true })
13
+ file_path: string;
14
+
15
+ @Column({ type: 'varchar', length: 500, nullable: true })
16
+ filename: string;
17
+
18
+ @Column({ type: 'bigint', nullable: true })
19
+ filesize: number;
20
+
21
+ @Column({ type: 'varchar', length: 100, nullable: true })
22
+ filetype: string;
23
+
24
+ constructor(
25
+ project_id?: number | null,
26
+ folder_id?: number,
27
+ file_path?: string,
28
+ filename?: string,
29
+ filesize?: number,
30
+ filetype?: string
31
+ ) {
32
+ super();
33
+ this.project_id = project_id ?? null;
34
+ this.folder_id = folder_id ?? 0;
35
+ this.file_path = file_path ?? '';
36
+ this.filename = filename ?? '';
37
+ this.filesize = filesize ?? 0;
38
+ this.filetype = filetype ?? '';
39
+ }
40
+ }
@@ -0,0 +1,30 @@
1
+ import { Column, Entity, Index } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ /** Audit log for project-level entities (project, scope, milestone, timeline). */
5
+ @Entity({ name: 'project_activity' })
6
+ @Index(['project_id'])
7
+ @Index(['entity_type', 'entity_id'])
8
+ export class ProjectActivity extends BaseModel {
9
+ @Column({ type: 'int' })
10
+ project_id: number;
11
+
12
+ /** e.g. project | scope | milestone | timeline */
13
+ @Column({ type: 'varchar', length: 50 })
14
+ entity_type: string;
15
+
16
+ @Column({ type: 'int', nullable: true })
17
+ entity_id: number | null;
18
+
19
+ @Column({ type: 'varchar', length: 100, nullable: true })
20
+ activity_type: string;
21
+
22
+ @Column({ type: 'text', nullable: true })
23
+ description: string;
24
+
25
+ @Column({ type: 'text', nullable: true })
26
+ old_value: string | null;
27
+
28
+ @Column({ type: 'text', nullable: true })
29
+ new_value: string | null;
30
+ }
@@ -1,46 +1,46 @@
1
- import { Column, Entity } from 'typeorm';
2
- import { BaseModel } from './BaseModel';
3
-
4
- @Entity({ name: 'project_contacts' })
5
- export class ProjectContacts extends BaseModel {
6
- @Column({ type: 'int' })
7
- project_id: number;
8
-
9
- @Column({ type: 'varchar', length: 50 })
10
- contact_type: string;
11
-
12
- @Column({ type: 'varchar', length: 50, nullable: true })
13
- phone_number: string;
14
-
15
- @Column({ type: 'varchar', length: 255, nullable: true })
16
- email_id: string;
17
-
18
- @Column({ type: 'varchar', length: 255, nullable: true })
19
- name: string;
20
-
21
- @Column({ type: 'varchar', length: 255, nullable: true })
22
- designation: string;
23
-
24
- /** Optional FK to departments.id */
25
- @Column({ type: 'int', nullable: true })
26
- department_id: number | null;
27
-
28
- constructor(
29
- project_id?: number,
30
- contact_type?: string,
31
- phone_number?: string,
32
- email_id?: string,
33
- name?: string,
34
- designation?: string,
35
- department_id?: number | null
36
- ) {
37
- super();
38
- this.project_id = project_id ?? 0;
39
- this.contact_type = contact_type ?? '';
40
- this.phone_number = phone_number ?? '';
41
- this.email_id = email_id ?? '';
42
- this.name = name ?? '';
43
- this.designation = designation ?? '';
44
- this.department_id = department_id ?? null;
45
- }
46
- }
1
+ import { Column, Entity } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ @Entity({ name: 'project_contacts' })
5
+ export class ProjectContacts extends BaseModel {
6
+ @Column({ type: 'int' })
7
+ project_id: number;
8
+
9
+ @Column({ type: 'varchar', length: 50 })
10
+ contact_type: string;
11
+
12
+ @Column({ type: 'varchar', length: 50, nullable: true })
13
+ phone_number: string;
14
+
15
+ @Column({ type: 'varchar', length: 255, nullable: true })
16
+ email_id: string;
17
+
18
+ @Column({ type: 'varchar', length: 255, nullable: true })
19
+ name: string;
20
+
21
+ @Column({ type: 'varchar', length: 255, nullable: true })
22
+ designation: string;
23
+
24
+ /** Optional FK to departments.id */
25
+ @Column({ type: 'int', nullable: true })
26
+ department_id: number | null;
27
+
28
+ constructor(
29
+ project_id?: number,
30
+ contact_type?: string,
31
+ phone_number?: string,
32
+ email_id?: string,
33
+ name?: string,
34
+ designation?: string,
35
+ department_id?: number | null
36
+ ) {
37
+ super();
38
+ this.project_id = project_id ?? 0;
39
+ this.contact_type = contact_type ?? '';
40
+ this.phone_number = phone_number ?? '';
41
+ this.email_id = email_id ?? '';
42
+ this.name = name ?? '';
43
+ this.designation = designation ?? '';
44
+ this.department_id = department_id ?? null;
45
+ }
46
+ }
@@ -0,0 +1,15 @@
1
+ import { Column, Entity } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ /**
5
+ * Many-to-many: one project task can be assigned to multiple users.
6
+ * Replaces the former `project_tasks.assign_to` single column.
7
+ */
8
+ @Entity({ name: 'project_task_users' })
9
+ export class ProjectTaskUsers extends BaseModel {
10
+ @Column({ type: 'int' })
11
+ task_id: number;
12
+
13
+ @Column({ type: 'int' })
14
+ user_id: number;
15
+ }
@@ -1,80 +1,75 @@
1
- import { Column, Entity } from 'typeorm';
2
- import { BaseModel } from './BaseModel';
3
-
4
- export interface TaskAttachmentItem {
5
- link?: string;
6
- filename?: string;
7
- filesize?: number;
8
- filetype?: string;
9
- }
10
-
11
- export const TASK_PRIORITY = ['low', 'medium', 'high'] as const;
12
- export const TASK_STATUS = ['Not started', 'Pending', 'In Progress', 'Completed'] as const;
13
-
14
- @Entity({ name: 'project_tasks' })
15
- export class ProjectTasks extends BaseModel {
16
- @Column({ type: 'int' })
17
- project_id: number;
18
-
19
- @Column({ type: 'varchar', length: 500 })
20
- task_title: string;
21
-
22
- @Column({ type: 'text', nullable: true })
23
- task_description: string;
24
-
25
- @Column({ type: 'jsonb', nullable: true })
26
- attachments: TaskAttachmentItem[] | null;
27
-
28
- @Column({ type: 'varchar', length: 20, default: 'medium' })
29
- priority: string;
30
-
31
- @Column({ type: 'varchar', length: 50, default: 'Not started' })
32
- status: string;
33
-
34
- @Column({ type: 'int', nullable: true })
35
- milestone_id: number | null;
36
-
37
- @Column({ type: 'int', default: 1, nullable: true })
38
- phase: number;
39
-
40
- @Column({ type: 'int', nullable: true })
41
- assign_to: number | null;
42
-
43
- @Column({ type: 'int', nullable: true })
44
- manager_id: number | null;
45
-
46
- @Column({ type: 'date', nullable: true })
47
- start_date: Date | null;
48
-
49
- @Column({ type: 'date', nullable: true })
50
- end_date: Date | null;
51
-
52
- constructor(
53
- project_id?: number,
54
- task_title?: string,
55
- task_description?: string,
56
- attachments?: TaskAttachmentItem[] | null,
57
- priority?: string,
58
- status?: string,
59
- milestone_id?: number | null,
60
- phase?: number,
61
- assign_to?: number | null,
62
- manager_id?: number | null,
63
- start_date?: Date | null,
64
- end_date?: Date | null
65
- ) {
66
- super();
67
- this.project_id = project_id ?? 0;
68
- this.task_title = task_title ?? '';
69
- this.task_description = task_description ?? '';
70
- this.attachments = attachments ?? null;
71
- this.priority = priority ?? 'medium';
72
- this.status = status ?? 'Not started';
73
- this.milestone_id = milestone_id ?? null;
74
- this.phase = phase ?? 1;
75
- this.assign_to = assign_to ?? null;
76
- this.manager_id = manager_id ?? null;
77
- this.start_date = start_date ?? null;
78
- this.end_date = end_date ?? null;
79
- }
80
- }
1
+ import { Column, Entity } from 'typeorm';
2
+ import { BaseModel } from './BaseModel';
3
+
4
+ export interface TaskAttachmentItem {
5
+ link?: string;
6
+ filename?: string;
7
+ filesize?: number;
8
+ filetype?: string;
9
+ }
10
+
11
+ export const TASK_PRIORITY = ['low', 'medium', 'high'] as const;
12
+ export const TASK_STATUS = ['Not started', 'Pending', 'In Progress', 'Completed'] as const;
13
+
14
+ @Entity({ name: 'project_tasks' })
15
+ export class ProjectTasks extends BaseModel {
16
+ @Column({ type: 'int' })
17
+ project_id: number;
18
+
19
+ @Column({ type: 'varchar', length: 500 })
20
+ task_title: string;
21
+
22
+ @Column({ type: 'text', nullable: true })
23
+ task_description: string;
24
+
25
+ @Column({ type: 'jsonb', nullable: true })
26
+ attachments: TaskAttachmentItem[] | null;
27
+
28
+ @Column({ type: 'varchar', length: 20, default: 'medium' })
29
+ priority: string;
30
+
31
+ @Column({ type: 'varchar', length: 50, default: 'Not started' })
32
+ status: string;
33
+
34
+ @Column({ type: 'int', nullable: true })
35
+ milestone_id: number | null;
36
+
37
+ @Column({ type: 'int', default: 1, nullable: true })
38
+ phase: number;
39
+
40
+ @Column({ type: 'int', nullable: true })
41
+ manager_id: number | null;
42
+
43
+ @Column({ type: 'date', nullable: true })
44
+ start_date: Date | null;
45
+
46
+ @Column({ type: 'date', nullable: true })
47
+ end_date: Date | null;
48
+
49
+ constructor(
50
+ project_id?: number,
51
+ task_title?: string,
52
+ task_description?: string,
53
+ attachments?: TaskAttachmentItem[] | null,
54
+ priority?: string,
55
+ status?: string,
56
+ milestone_id?: number | null,
57
+ phase?: number,
58
+ manager_id?: number | null,
59
+ start_date?: Date | null,
60
+ end_date?: Date | null
61
+ ) {
62
+ super();
63
+ this.project_id = project_id ?? 0;
64
+ this.task_title = task_title ?? '';
65
+ this.task_description = task_description ?? '';
66
+ this.attachments = attachments ?? null;
67
+ this.priority = priority ?? 'medium';
68
+ this.status = status ?? 'Not started';
69
+ this.milestone_id = milestone_id ?? null;
70
+ this.phase = phase ?? 1;
71
+ this.manager_id = manager_id ?? null;
72
+ this.start_date = start_date ?? null;
73
+ this.end_date = end_date ?? null;
74
+ }
75
+ }