@platform-modules/civil-aviation-authority 2.3.67 → 2.3.70

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 (39) hide show
  1. package/dist/data-source.js +11 -15
  2. package/dist/index.d.ts +0 -211
  3. package/dist/index.js +0 -319
  4. package/dist/models/DepartmentDocumentOwnerModel.d.ts +10 -0
  5. package/dist/models/DepartmentDocumentOwnerModel.js +44 -0
  6. package/dist/models/DocumentAuditLogModel.d.ts +12 -18
  7. package/dist/models/DocumentAuditLogModel.js +26 -34
  8. package/dist/models/DocumentFolderModel.d.ts +14 -0
  9. package/dist/models/DocumentFolderModel.js +60 -0
  10. package/dist/models/DocumentMetadataModel.d.ts +9 -12
  11. package/dist/models/DocumentMetadataModel.js +33 -22
  12. package/dist/models/DocumentModel.d.ts +25 -0
  13. package/dist/models/DocumentModel.js +96 -0
  14. package/dist/models/DocumentPermissionModel.d.ts +11 -0
  15. package/dist/models/DocumentPermissionModel.js +52 -0
  16. package/dist/models/DocumentTypeModel.d.ts +8 -0
  17. package/dist/models/DocumentTypeModel.js +37 -0
  18. package/dist/models/DocumentationDepartmentsModel.d.ts +5 -10
  19. package/dist/models/DocumentationDepartmentsModel.js +12 -31
  20. package/dist/models/FolderModel.d.ts +6 -9
  21. package/dist/models/FolderModel.js +18 -22
  22. package/dist/models/PermissionModel.d.ts +4 -7
  23. package/dist/models/PermissionModel.js +13 -22
  24. package/dist/models/UUIDBaseModel.d.ts +14 -0
  25. package/dist/models/UUIDBaseModel.js +66 -0
  26. package/package.json +1 -1
  27. package/src/data-source.ts +267 -271
  28. package/src/index.ts +0 -238
  29. package/src/models/DepartmentDocumentOwnerModel.ts +25 -0
  30. package/src/models/DepartmentsModel.ts +25 -25
  31. package/src/models/DocumentAuditLogModel.ts +38 -52
  32. package/src/models/DocumentFolderModel.ts +37 -0
  33. package/src/models/DocumentModel.ts +65 -0
  34. package/src/models/DocumentPermissionModel.ts +32 -0
  35. package/src/models/DocumentTypeModel.ts +19 -0
  36. package/src/models/DocumentMetadataModel.ts +0 -125
  37. package/src/models/DocumentationDepartmentsModel.ts +0 -55
  38. package/src/models/FolderModel.ts +0 -71
  39. package/src/models/PermissionModel.ts +0 -60
@@ -0,0 +1,44 @@
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.DepartmentDocumentOwner = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const DepartmentsModel_1 = require("./DepartmentsModel");
16
+ const user_1 = require("./user");
17
+ let DepartmentDocumentOwner = class DepartmentDocumentOwner extends BaseModel_1.BaseModel {
18
+ };
19
+ exports.DepartmentDocumentOwner = DepartmentDocumentOwner;
20
+ __decorate([
21
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false, unique: true }),
22
+ __metadata("design:type", Number)
23
+ ], DepartmentDocumentOwner.prototype, "department_id", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
26
+ __metadata("design:type", Number)
27
+ ], DepartmentDocumentOwner.prototype, "user_id", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: false, default: true }),
30
+ __metadata("design:type", Boolean)
31
+ ], DepartmentDocumentOwner.prototype, "is_active", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.ManyToOne)(() => DepartmentsModel_1.Departments),
34
+ (0, typeorm_1.JoinColumn)({ name: 'department_id' }),
35
+ __metadata("design:type", DepartmentsModel_1.Departments)
36
+ ], DepartmentDocumentOwner.prototype, "department", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.ManyToOne)(() => user_1.User),
39
+ (0, typeorm_1.JoinColumn)({ name: 'user_id' }),
40
+ __metadata("design:type", user_1.User)
41
+ ], DepartmentDocumentOwner.prototype, "user", void 0);
42
+ exports.DepartmentDocumentOwner = DepartmentDocumentOwner = __decorate([
43
+ (0, typeorm_1.Entity)({ name: 'department_document_owners' })
44
+ ], DepartmentDocumentOwner);
@@ -1,19 +1,13 @@
1
- export declare enum AuditAction {
2
- UPLOAD = "upload",
3
- VIEW = "view",
4
- DOWNLOAD = "download",
5
- UPDATE = "update",
6
- DELETE = "delete",
7
- PUBLISH = "publish"
8
- }
9
- export declare class DocumentAuditLog {
10
- id: string;
11
- document_id: string;
12
- user_id: string;
13
- user_name: string;
14
- action: AuditAction;
15
- ip_address: string;
16
- user_agent: string;
17
- metadata: Record<string, any>;
18
- timestamp: Date;
1
+ import { BaseModel } from './BaseModel';
2
+ import { User } from './user';
3
+ import { Document } from './DocumentModel';
4
+ export declare class DocumentAuditLog extends BaseModel {
5
+ document_id: number;
6
+ user_id: number;
7
+ action_type: string;
8
+ action_details?: any;
9
+ ip_address?: string;
10
+ user_agent?: string;
11
+ document?: Document;
12
+ user?: User;
19
13
  }
@@ -9,43 +9,34 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DocumentAuditLog = exports.AuditAction = void 0;
12
+ exports.DocumentAuditLog = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
- // Note: DocumentMetadata import removed to avoid circular dependency
15
- var AuditAction;
16
- (function (AuditAction) {
17
- AuditAction["UPLOAD"] = "upload";
18
- AuditAction["VIEW"] = "view";
19
- AuditAction["DOWNLOAD"] = "download";
20
- AuditAction["UPDATE"] = "update";
21
- AuditAction["DELETE"] = "delete";
22
- AuditAction["PUBLISH"] = "publish";
23
- })(AuditAction || (exports.AuditAction = AuditAction = {}));
24
- let DocumentAuditLog = class DocumentAuditLog {
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const user_1 = require("./user");
16
+ const DocumentModel_1 = require("./DocumentModel");
17
+ let DocumentAuditLog = class DocumentAuditLog extends BaseModel_1.BaseModel {
25
18
  };
26
19
  exports.DocumentAuditLog = DocumentAuditLog;
27
20
  __decorate([
28
- (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
29
- __metadata("design:type", String)
30
- ], DocumentAuditLog.prototype, "id", void 0);
31
- __decorate([
32
- (0, typeorm_1.Column)({ type: 'uuid' }),
33
- __metadata("design:type", String)
21
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
22
+ __metadata("design:type", Number)
34
23
  ], DocumentAuditLog.prototype, "document_id", void 0);
35
24
  __decorate([
36
- (0, typeorm_1.Column)({ type: 'uuid' }),
37
- (0, typeorm_1.Index)(),
38
- __metadata("design:type", String)
25
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
26
+ __metadata("design:type", Number)
39
27
  ], DocumentAuditLog.prototype, "user_id", void 0);
40
28
  __decorate([
41
- (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
29
+ (0, typeorm_1.Column)({
30
+ type: 'varchar',
31
+ length: 50,
32
+ nullable: false
33
+ }),
42
34
  __metadata("design:type", String)
43
- ], DocumentAuditLog.prototype, "user_name", void 0);
35
+ ], DocumentAuditLog.prototype, "action_type", void 0);
44
36
  __decorate([
45
- (0, typeorm_1.Column)({ type: 'enum', enum: AuditAction }),
46
- (0, typeorm_1.Index)(),
47
- __metadata("design:type", String)
48
- ], DocumentAuditLog.prototype, "action", void 0);
37
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
38
+ __metadata("design:type", Object)
39
+ ], DocumentAuditLog.prototype, "action_details", void 0);
49
40
  __decorate([
50
41
  (0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
51
42
  __metadata("design:type", String)
@@ -55,14 +46,15 @@ __decorate([
55
46
  __metadata("design:type", String)
56
47
  ], DocumentAuditLog.prototype, "user_agent", void 0);
57
48
  __decorate([
58
- (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
59
- __metadata("design:type", Object)
60
- ], DocumentAuditLog.prototype, "metadata", void 0);
49
+ (0, typeorm_1.ManyToOne)(() => DocumentModel_1.Document),
50
+ (0, typeorm_1.JoinColumn)({ name: 'document_id' }),
51
+ __metadata("design:type", DocumentModel_1.Document)
52
+ ], DocumentAuditLog.prototype, "document", void 0);
61
53
  __decorate([
62
- (0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
63
- (0, typeorm_1.Index)(),
64
- __metadata("design:type", Date)
65
- ], DocumentAuditLog.prototype, "timestamp", void 0);
54
+ (0, typeorm_1.ManyToOne)(() => user_1.User),
55
+ (0, typeorm_1.JoinColumn)({ name: 'user_id' }),
56
+ __metadata("design:type", user_1.User)
57
+ ], DocumentAuditLog.prototype, "user", void 0);
66
58
  exports.DocumentAuditLog = DocumentAuditLog = __decorate([
67
59
  (0, typeorm_1.Entity)({ name: 'document_audit_logs' })
68
60
  ], DocumentAuditLog);
@@ -0,0 +1,14 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { Departments } from './DepartmentsModel';
3
+ import { Document } from './DocumentModel';
4
+ export declare class DocumentFolder extends BaseModel {
5
+ name: string;
6
+ department_id: number;
7
+ parent_folder_id?: number;
8
+ description?: string;
9
+ is_active: boolean;
10
+ department?: Departments;
11
+ parentFolder?: DocumentFolder;
12
+ subFolders?: DocumentFolder[];
13
+ documents?: Document[];
14
+ }
@@ -0,0 +1,60 @@
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.DocumentFolder = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const DepartmentsModel_1 = require("./DepartmentsModel");
16
+ const DocumentModel_1 = require("./DocumentModel");
17
+ let DocumentFolder = class DocumentFolder extends BaseModel_1.BaseModel {
18
+ };
19
+ exports.DocumentFolder = DocumentFolder;
20
+ __decorate([
21
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: false }),
22
+ __metadata("design:type", String)
23
+ ], DocumentFolder.prototype, "name", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
26
+ __metadata("design:type", Number)
27
+ ], DocumentFolder.prototype, "department_id", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
30
+ __metadata("design:type", Number)
31
+ ], DocumentFolder.prototype, "parent_folder_id", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
34
+ __metadata("design:type", String)
35
+ ], DocumentFolder.prototype, "description", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: false, default: true }),
38
+ __metadata("design:type", Boolean)
39
+ ], DocumentFolder.prototype, "is_active", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.ManyToOne)(() => DepartmentsModel_1.Departments),
42
+ (0, typeorm_1.JoinColumn)({ name: 'department_id' }),
43
+ __metadata("design:type", DepartmentsModel_1.Departments)
44
+ ], DocumentFolder.prototype, "department", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.ManyToOne)(() => DocumentFolder, { nullable: true }),
47
+ (0, typeorm_1.JoinColumn)({ name: 'parent_folder_id' }),
48
+ __metadata("design:type", DocumentFolder)
49
+ ], DocumentFolder.prototype, "parentFolder", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.OneToMany)(() => DocumentFolder, folder => folder.parentFolder),
52
+ __metadata("design:type", Array)
53
+ ], DocumentFolder.prototype, "subFolders", void 0);
54
+ __decorate([
55
+ (0, typeorm_1.OneToMany)(() => DocumentModel_1.Document, document => document.folder),
56
+ __metadata("design:type", Array)
57
+ ], DocumentFolder.prototype, "documents", void 0);
58
+ exports.DocumentFolder = DocumentFolder = __decorate([
59
+ (0, typeorm_1.Entity)({ name: 'document_folders' })
60
+ ], DocumentFolder);
@@ -1,4 +1,5 @@
1
1
  import { Departments } from './DepartmentsModel';
2
+ import { UUIDBaseModel } from './UUIDBaseModel';
2
3
  export declare enum DocumentType {
3
4
  POLICY = "policy",
4
5
  PROCEDURE = "procedure",
@@ -15,10 +16,9 @@ export declare enum AccessLevel {
15
16
  GENERAL = "general",
16
17
  RESTRICTED = "restricted"
17
18
  }
18
- export declare class DocumentMetadata {
19
- id: string;
19
+ export declare class DocumentMetadata extends UUIDBaseModel {
20
20
  title: string;
21
- description: string;
21
+ description?: string;
22
22
  original_name: string;
23
23
  mime_type: string;
24
24
  size: number;
@@ -31,18 +31,15 @@ export declare class DocumentMetadata {
31
31
  is_sensitive: boolean;
32
32
  department: Departments;
33
33
  department_id: number;
34
- folder_id: string | null;
34
+ folder_id?: string | null;
35
35
  folder_path: string;
36
36
  uploaded_by: string;
37
- uploaded_by_name: string;
38
- authorized_person: string;
37
+ uploaded_by_name?: string;
38
+ authorized_person?: string;
39
39
  allowed_roles: string[];
40
40
  allowed_users: string[];
41
41
  download_count: number;
42
- last_accessed_at: Date;
43
- metadata: Record<string, any>;
44
- created_by: string;
45
- updated_by: string;
46
- created_at: Date;
47
- updated_at: Date;
42
+ last_accessed_at?: Date;
43
+ metadata?: Record<string, any>;
44
+ constructor(title: string, original_name: string, mime_type: string, size: number, mongodb_file_id: string, document_type: DocumentType, department_id: number, uploaded_by: string, access_level?: AccessLevel, status?: DocumentStatus, version?: string, folder_path?: string, created_by?: string, description?: string, folder_id?: string | null, uploaded_by_name?: string, authorized_person?: string, tags?: string[], allowed_roles?: string[], allowed_users?: string[], is_sensitive?: boolean, download_count?: number, last_accessed_at?: Date, metadata?: Record<string, any>);
48
45
  }
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DocumentMetadata = exports.AccessLevel = exports.DocumentStatus = exports.DocumentType = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const DepartmentsModel_1 = require("./DepartmentsModel");
15
+ const UUIDBaseModel_1 = require("./UUIDBaseModel");
15
16
  var DocumentType;
16
17
  (function (DocumentType) {
17
18
  DocumentType["POLICY"] = "policy";
@@ -31,13 +32,38 @@ var AccessLevel;
31
32
  AccessLevel["GENERAL"] = "general";
32
33
  AccessLevel["RESTRICTED"] = "restricted";
33
34
  })(AccessLevel || (exports.AccessLevel = AccessLevel = {}));
34
- let DocumentMetadata = class DocumentMetadata {
35
+ let DocumentMetadata = class DocumentMetadata extends UUIDBaseModel_1.UUIDBaseModel {
36
+ constructor(title, original_name, mime_type, size, mongodb_file_id, document_type, department_id, uploaded_by, access_level = AccessLevel.GENERAL, status = DocumentStatus.ACTIVE, version = '1.0.0', folder_path = '/', created_by, description, folder_id, uploaded_by_name, authorized_person, tags, allowed_roles, allowed_users, is_sensitive = false, download_count = 0, last_accessed_at, metadata) {
37
+ super();
38
+ this.title = title;
39
+ this.original_name = original_name;
40
+ this.mime_type = mime_type;
41
+ this.size = size;
42
+ this.mongodb_file_id = mongodb_file_id;
43
+ this.document_type = document_type;
44
+ this.department_id = department_id;
45
+ this.uploaded_by = uploaded_by;
46
+ this.access_level = access_level;
47
+ this.status = status;
48
+ this.version = version;
49
+ this.folder_path = folder_path;
50
+ this.description = description;
51
+ this.folder_id = folder_id;
52
+ this.uploaded_by_name = uploaded_by_name;
53
+ this.authorized_person = authorized_person;
54
+ this.tags = tags || [];
55
+ this.allowed_roles = allowed_roles || [];
56
+ this.allowed_users = allowed_users || [];
57
+ this.is_sensitive = is_sensitive;
58
+ this.download_count = download_count;
59
+ this.last_accessed_at = last_accessed_at;
60
+ this.metadata = metadata;
61
+ if (created_by) {
62
+ this.created_by = created_by;
63
+ }
64
+ }
35
65
  };
36
66
  exports.DocumentMetadata = DocumentMetadata;
37
- __decorate([
38
- (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
39
- __metadata("design:type", String)
40
- ], DocumentMetadata.prototype, "id", void 0);
41
67
  __decorate([
42
68
  (0, typeorm_1.Column)({ type: 'varchar', length: 500 }),
43
69
  (0, typeorm_1.Index)(),
@@ -139,22 +165,7 @@ __decorate([
139
165
  (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
140
166
  __metadata("design:type", Object)
141
167
  ], DocumentMetadata.prototype, "metadata", void 0);
142
- __decorate([
143
- (0, typeorm_1.Column)({ type: 'uuid' }),
144
- __metadata("design:type", String)
145
- ], DocumentMetadata.prototype, "created_by", void 0);
146
- __decorate([
147
- (0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
148
- __metadata("design:type", String)
149
- ], DocumentMetadata.prototype, "updated_by", void 0);
150
- __decorate([
151
- (0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
152
- __metadata("design:type", Date)
153
- ], DocumentMetadata.prototype, "created_at", void 0);
154
- __decorate([
155
- (0, typeorm_1.UpdateDateColumn)({ type: 'timestamp' }),
156
- __metadata("design:type", Date)
157
- ], DocumentMetadata.prototype, "updated_at", void 0);
158
168
  exports.DocumentMetadata = DocumentMetadata = __decorate([
159
- (0, typeorm_1.Entity)({ name: 'document_metadata' })
169
+ (0, typeorm_1.Entity)({ name: 'document_metadata' }),
170
+ __metadata("design:paramtypes", [String, String, String, Number, String, String, Number, String, String, String, String, String, String, String, Object, String, String, Array, Array, Array, Boolean, Number, Date, Object])
160
171
  ], DocumentMetadata);
@@ -0,0 +1,25 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { Departments } from './DepartmentsModel';
3
+ import { DocumentFolder } from './DocumentFolderModel';
4
+ import { DocumentType } from './DocumentTypeModel';
5
+ import { DocumentPermission } from './DocumentPermissionModel';
6
+ import { DocumentAuditLog } from './DocumentAuditLogModel';
7
+ export declare class Document extends BaseModel {
8
+ title: string;
9
+ department_id: number;
10
+ document_type_id: number;
11
+ folder_id?: number;
12
+ mongodb_file_id: string;
13
+ file_name: string;
14
+ file_size: number;
15
+ file_type?: string;
16
+ version: number;
17
+ description?: string;
18
+ is_sensitive: boolean;
19
+ is_active: boolean;
20
+ department?: Departments;
21
+ documentType?: DocumentType;
22
+ folder?: DocumentFolder;
23
+ permissions?: DocumentPermission[];
24
+ auditLogs?: DocumentAuditLog[];
25
+ }
@@ -0,0 +1,96 @@
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.Document = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const DepartmentsModel_1 = require("./DepartmentsModel");
16
+ const DocumentFolderModel_1 = require("./DocumentFolderModel");
17
+ const DocumentTypeModel_1 = require("./DocumentTypeModel");
18
+ const DocumentPermissionModel_1 = require("./DocumentPermissionModel");
19
+ const DocumentAuditLogModel_1 = require("./DocumentAuditLogModel");
20
+ let Document = class Document extends BaseModel_1.BaseModel {
21
+ };
22
+ exports.Document = Document;
23
+ __decorate([
24
+ (0, typeorm_1.Column)({ type: 'varchar', length: 200, nullable: false }),
25
+ __metadata("design:type", String)
26
+ ], Document.prototype, "title", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
29
+ __metadata("design:type", Number)
30
+ ], Document.prototype, "department_id", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
33
+ __metadata("design:type", Number)
34
+ ], Document.prototype, "document_type_id", void 0);
35
+ __decorate([
36
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
37
+ __metadata("design:type", Number)
38
+ ], Document.prototype, "folder_id", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
41
+ __metadata("design:type", String)
42
+ ], Document.prototype, "mongodb_file_id", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
45
+ __metadata("design:type", String)
46
+ ], Document.prototype, "file_name", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ type: 'bigint', nullable: false }),
49
+ __metadata("design:type", Number)
50
+ ], Document.prototype, "file_size", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
53
+ __metadata("design:type", String)
54
+ ], Document.prototype, "file_type", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false, default: 1 }),
57
+ __metadata("design:type", Number)
58
+ ], Document.prototype, "version", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
61
+ __metadata("design:type", String)
62
+ ], Document.prototype, "description", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: false, default: false }),
65
+ __metadata("design:type", Boolean)
66
+ ], Document.prototype, "is_sensitive", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: false, default: true }),
69
+ __metadata("design:type", Boolean)
70
+ ], Document.prototype, "is_active", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.ManyToOne)(() => DepartmentsModel_1.Departments),
73
+ (0, typeorm_1.JoinColumn)({ name: 'department_id' }),
74
+ __metadata("design:type", DepartmentsModel_1.Departments)
75
+ ], Document.prototype, "department", void 0);
76
+ __decorate([
77
+ (0, typeorm_1.ManyToOne)(() => DocumentTypeModel_1.DocumentType),
78
+ (0, typeorm_1.JoinColumn)({ name: 'document_type_id' }),
79
+ __metadata("design:type", DocumentTypeModel_1.DocumentType)
80
+ ], Document.prototype, "documentType", void 0);
81
+ __decorate([
82
+ (0, typeorm_1.ManyToOne)(() => DocumentFolderModel_1.DocumentFolder, { nullable: true }),
83
+ (0, typeorm_1.JoinColumn)({ name: 'folder_id' }),
84
+ __metadata("design:type", DocumentFolderModel_1.DocumentFolder)
85
+ ], Document.prototype, "folder", void 0);
86
+ __decorate([
87
+ (0, typeorm_1.OneToMany)(() => DocumentPermissionModel_1.DocumentPermission, permission => permission.document),
88
+ __metadata("design:type", Array)
89
+ ], Document.prototype, "permissions", void 0);
90
+ __decorate([
91
+ (0, typeorm_1.OneToMany)(() => DocumentAuditLogModel_1.DocumentAuditLog, log => log.document),
92
+ __metadata("design:type", Array)
93
+ ], Document.prototype, "auditLogs", void 0);
94
+ exports.Document = Document = __decorate([
95
+ (0, typeorm_1.Entity)({ name: 'documents' })
96
+ ], Document);
@@ -0,0 +1,11 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { Role } from './role';
3
+ import { Document } from './DocumentModel';
4
+ export declare class DocumentPermission extends BaseModel {
5
+ document_id: number;
6
+ role_id: number;
7
+ permission_type: string;
8
+ is_active: boolean;
9
+ document?: Document;
10
+ role?: Role;
11
+ }
@@ -0,0 +1,52 @@
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.DocumentPermission = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const role_1 = require("./role");
16
+ const DocumentModel_1 = require("./DocumentModel");
17
+ let DocumentPermission = class DocumentPermission extends BaseModel_1.BaseModel {
18
+ };
19
+ exports.DocumentPermission = DocumentPermission;
20
+ __decorate([
21
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
22
+ __metadata("design:type", Number)
23
+ ], DocumentPermission.prototype, "document_id", void 0);
24
+ __decorate([
25
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
26
+ __metadata("design:type", Number)
27
+ ], DocumentPermission.prototype, "role_id", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)({
30
+ type: 'varchar',
31
+ length: 50,
32
+ nullable: false
33
+ }),
34
+ __metadata("design:type", String)
35
+ ], DocumentPermission.prototype, "permission_type", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: false, default: true }),
38
+ __metadata("design:type", Boolean)
39
+ ], DocumentPermission.prototype, "is_active", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.ManyToOne)(() => DocumentModel_1.Document),
42
+ (0, typeorm_1.JoinColumn)({ name: 'document_id' }),
43
+ __metadata("design:type", DocumentModel_1.Document)
44
+ ], DocumentPermission.prototype, "document", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.ManyToOne)(() => role_1.Role),
47
+ (0, typeorm_1.JoinColumn)({ name: 'role_id' }),
48
+ __metadata("design:type", role_1.Role)
49
+ ], DocumentPermission.prototype, "role", void 0);
50
+ exports.DocumentPermission = DocumentPermission = __decorate([
51
+ (0, typeorm_1.Entity)({ name: 'document_permissions' })
52
+ ], DocumentPermission);
@@ -0,0 +1,8 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { Document } from './DocumentModel';
3
+ export declare class DocumentType extends BaseModel {
4
+ name: string;
5
+ description?: string;
6
+ is_active: boolean;
7
+ documents?: Document[];
8
+ }
@@ -0,0 +1,37 @@
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.DocumentType = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const DocumentModel_1 = require("./DocumentModel");
16
+ let DocumentType = class DocumentType extends BaseModel_1.BaseModel {
17
+ };
18
+ exports.DocumentType = DocumentType;
19
+ __decorate([
20
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: false, unique: true }),
21
+ __metadata("design:type", String)
22
+ ], DocumentType.prototype, "name", void 0);
23
+ __decorate([
24
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
25
+ __metadata("design:type", String)
26
+ ], DocumentType.prototype, "description", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)({ type: 'boolean', nullable: false, default: true }),
29
+ __metadata("design:type", Boolean)
30
+ ], DocumentType.prototype, "is_active", void 0);
31
+ __decorate([
32
+ (0, typeorm_1.OneToMany)(() => DocumentModel_1.Document, document => document.documentType),
33
+ __metadata("design:type", Array)
34
+ ], DocumentType.prototype, "documents", void 0);
35
+ exports.DocumentType = DocumentType = __decorate([
36
+ (0, typeorm_1.Entity)({ name: 'document_types' })
37
+ ], DocumentType);
@@ -1,18 +1,13 @@
1
- import { Departments } from './DepartmentsModel';
1
+ import { BaseModel } from './BaseModel';
2
2
  /**
3
3
  * Documentation Service specific department configuration
4
4
  * Links departments with authorized persons for document management
5
5
  */
6
- export declare class DocumentationDepartments {
7
- id: string;
8
- department: Departments;
6
+ export declare class DocumentationDepartments extends BaseModel {
9
7
  department_id: number;
10
8
  authorized_person_id: string;
11
- authorized_person_name: string;
12
- authorized_person_email: string;
9
+ authorized_person_name?: string;
10
+ authorized_person_email?: string;
13
11
  is_active: boolean;
14
- created_by: string;
15
- updated_by: string;
16
- created_at: Date;
17
- updated_at: Date;
12
+ constructor(department_id: number, authorized_person_id: string, authorized_person_name: string, authorized_person_email: string, is_active?: boolean);
18
13
  }