@platform-modules/foreign-ministry 1.3.209 → 1.3.211

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 (45) hide show
  1. package/.env +3 -17
  2. package/dist/data-source.js +10 -0
  3. package/dist/index.d.ts +5 -0
  4. package/dist/index.js +5 -0
  5. package/dist/models/EmbassyMasterModel.d.ts +16 -0
  6. package/dist/models/EmbassyMasterModel.js +75 -0
  7. package/dist/models/HallMasterModel.d.ts +3 -1
  8. package/dist/models/HallMasterModel.js +12 -2
  9. package/dist/models/ResignationTerminationApprovalModel.d.ts +22 -0
  10. package/dist/models/ResignationTerminationApprovalModel.js +79 -0
  11. package/dist/models/ResignationTerminationAttachmentModel.d.ts +11 -0
  12. package/dist/models/ResignationTerminationAttachmentModel.js +52 -0
  13. package/dist/models/ResignationTerminationChatModel.d.ts +17 -0
  14. package/dist/models/ResignationTerminationChatModel.js +76 -0
  15. package/dist/models/ResignationTerminationRequestModel.d.ts +30 -0
  16. package/dist/models/ResignationTerminationRequestModel.js +108 -0
  17. package/dist/models/ResignationTerminationWorkflowModel.d.ts +17 -0
  18. package/dist/models/ResignationTerminationWorkflowModel.js +62 -0
  19. package/dist/models/UserDependentsModel.d.ts +18 -0
  20. package/dist/models/UserDependentsModel.js +94 -0
  21. package/package.json +1 -1
  22. package/src/data-source.ts +10 -0
  23. package/src/index.ts +5 -0
  24. package/src/models/FinancialWorkFlowModel.ts +15 -15
  25. package/src/models/GatePassVisitorsModel.ts +7 -7
  26. package/src/models/HallMasterModel.ts +9 -1
  27. package/src/models/PollOptionsModel.ts +26 -26
  28. package/src/models/PollVotesModel.ts +37 -37
  29. package/src/models/PollsModel.ts +49 -49
  30. package/src/models/RegisterCandidateRequestModel.ts +183 -183
  31. package/src/models/ResignationTerminationApprovalModel.ts +51 -0
  32. package/src/models/ResignationTerminationAttachmentModel.ts +30 -0
  33. package/src/models/ResignationTerminationChatModel.ts +63 -0
  34. package/src/models/ResignationTerminationRequestModel.ts +76 -0
  35. package/src/models/ResignationTerminationWorkflowModel.ts +38 -0
  36. package/src/models/TelephoneDirectoryModel.ts +20 -20
  37. package/dist/models/HelpContentMappedCategoriesModel.d.ts +0 -6
  38. package/dist/models/HelpContentMappedCategoriesModel.js +0 -34
  39. package/dist/models/HelpContentMappedTagsModel.d.ts +0 -6
  40. package/dist/models/HelpContentMappedTagsModel.js +0 -34
  41. package/dist/models/HelpContentTagsModel.d.ts +0 -5
  42. package/dist/models/HelpContentTagsModel.js +0 -29
  43. package/dist/models/questionTagsModel.d.ts +0 -6
  44. package/dist/models/questionTagsModel.js +0 -34
  45. /package/src/models/{LeaveConfigGradesModel.ts → LeaveConfigGradesModel.Ts} +0 -0
@@ -0,0 +1,62 @@
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.ResignationTerminationWorkFlow = exports.ResignationTerminationWorkFlowStatus = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ var ResignationTerminationWorkFlowStatus;
16
+ (function (ResignationTerminationWorkFlowStatus) {
17
+ ResignationTerminationWorkFlowStatus["NOT_YET_STARTED"] = "Not Yet Started";
18
+ ResignationTerminationWorkFlowStatus["COMPLETED"] = "Completed";
19
+ ResignationTerminationWorkFlowStatus["PENDING"] = "Pending";
20
+ })(ResignationTerminationWorkFlowStatus || (exports.ResignationTerminationWorkFlowStatus = ResignationTerminationWorkFlowStatus = {}));
21
+ let ResignationTerminationWorkFlow = class ResignationTerminationWorkFlow extends BaseModel_1.BaseModel {
22
+ };
23
+ exports.ResignationTerminationWorkFlow = ResignationTerminationWorkFlow;
24
+ __decorate([
25
+ (0, typeorm_1.Column)({ type: 'integer', nullable: false }),
26
+ __metadata("design:type", Number)
27
+ ], ResignationTerminationWorkFlow.prototype, "request_id", void 0);
28
+ __decorate([
29
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
30
+ __metadata("design:type", Object)
31
+ ], ResignationTerminationWorkFlow.prototype, "service_id", void 0);
32
+ __decorate([
33
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
34
+ __metadata("design:type", Object)
35
+ ], ResignationTerminationWorkFlow.prototype, "sub_service_id", void 0);
36
+ __decorate([
37
+ (0, typeorm_1.Column)({ type: 'varchar', length: 500, nullable: false }),
38
+ __metadata("design:type", String)
39
+ ], ResignationTerminationWorkFlow.prototype, "content", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({ type: 'enum', enum: ResignationTerminationWorkFlowStatus, default: ResignationTerminationWorkFlowStatus.NOT_YET_STARTED, nullable: false }),
42
+ __metadata("design:type", String)
43
+ ], ResignationTerminationWorkFlow.prototype, "status", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
46
+ __metadata("design:type", Object)
47
+ ], ResignationTerminationWorkFlow.prototype, "user_id", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
50
+ __metadata("design:type", Object)
51
+ ], ResignationTerminationWorkFlow.prototype, "role_id", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
54
+ __metadata("design:type", Object)
55
+ ], ResignationTerminationWorkFlow.prototype, "department_id", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.Column)({ type: 'integer', nullable: true }),
58
+ __metadata("design:type", Object)
59
+ ], ResignationTerminationWorkFlow.prototype, "section_id", void 0);
60
+ exports.ResignationTerminationWorkFlow = ResignationTerminationWorkFlow = __decorate([
61
+ (0, typeorm_1.Entity)({ name: 'resignation_termination_workflows' })
62
+ ], ResignationTerminationWorkFlow);
@@ -0,0 +1,18 @@
1
+ import { BaseModel } from './BaseModel';
2
+ export declare class UserDependents extends BaseModel {
3
+ user_id: number;
4
+ first_name: string | null;
5
+ last_name: string | null;
6
+ family_name: string | null;
7
+ dob: Date | null;
8
+ age: number | null;
9
+ relation_type: string | null;
10
+ passport_available: boolean;
11
+ passport_number: string | null;
12
+ passport_type: string | null;
13
+ passport_issue_date: Date | null;
14
+ passport_place_of_issue: string | null;
15
+ passport_expiry_date: Date | null;
16
+ is_active: boolean;
17
+ constructor(user_id?: number, first_name?: string, last_name?: string, family_name?: string, dob?: Date, age?: number, relation_type?: string, passport_available?: boolean, passport_number?: string, passport_type?: string, passport_issue_date?: Date, passport_place_of_issue?: string, passport_expiry_date?: Date);
18
+ }
@@ -0,0 +1,94 @@
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.UserDependents = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ let UserDependents = class UserDependents extends BaseModel_1.BaseModel {
16
+ constructor(user_id, first_name, last_name, family_name, dob, age, relation_type, passport_available, passport_number, passport_type, passport_issue_date, passport_place_of_issue, passport_expiry_date) {
17
+ super();
18
+ this.user_id = user_id || 0;
19
+ this.first_name = first_name || null;
20
+ this.last_name = last_name || null;
21
+ this.family_name = family_name || null;
22
+ this.dob = dob || null;
23
+ this.age = age || null;
24
+ this.relation_type = relation_type || null;
25
+ this.passport_available = passport_available || false;
26
+ this.passport_number = passport_number || null;
27
+ this.passport_type = passport_type || null;
28
+ this.passport_issue_date = passport_issue_date || null;
29
+ this.passport_place_of_issue = passport_place_of_issue || null;
30
+ this.passport_expiry_date = passport_expiry_date || null;
31
+ this.is_active = true;
32
+ }
33
+ };
34
+ exports.UserDependents = UserDependents;
35
+ __decorate([
36
+ (0, typeorm_1.Column)({ type: 'int', nullable: false }),
37
+ __metadata("design:type", Number)
38
+ ], UserDependents.prototype, "user_id", void 0);
39
+ __decorate([
40
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
41
+ __metadata("design:type", Object)
42
+ ], UserDependents.prototype, "first_name", void 0);
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
45
+ __metadata("design:type", Object)
46
+ ], UserDependents.prototype, "last_name", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
49
+ __metadata("design:type", Object)
50
+ ], UserDependents.prototype, "family_name", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'date', nullable: true }),
53
+ __metadata("design:type", Object)
54
+ ], UserDependents.prototype, "dob", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
57
+ __metadata("design:type", Object)
58
+ ], UserDependents.prototype, "age", void 0);
59
+ __decorate([
60
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
61
+ __metadata("design:type", Object)
62
+ ], UserDependents.prototype, "relation_type", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: 'boolean', default: false }),
65
+ __metadata("design:type", Boolean)
66
+ ], UserDependents.prototype, "passport_available", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
69
+ __metadata("design:type", Object)
70
+ ], UserDependents.prototype, "passport_number", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
73
+ __metadata("design:type", Object)
74
+ ], UserDependents.prototype, "passport_type", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'date', nullable: true }),
77
+ __metadata("design:type", Object)
78
+ ], UserDependents.prototype, "passport_issue_date", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
81
+ __metadata("design:type", Object)
82
+ ], UserDependents.prototype, "passport_place_of_issue", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ type: 'date', nullable: true }),
85
+ __metadata("design:type", Object)
86
+ ], UserDependents.prototype, "passport_expiry_date", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({ type: 'boolean', default: true }),
89
+ __metadata("design:type", Boolean)
90
+ ], UserDependents.prototype, "is_active", void 0);
91
+ exports.UserDependents = UserDependents = __decorate([
92
+ (0, typeorm_1.Entity)({ name: 'user_dependents' }),
93
+ __metadata("design:paramtypes", [Number, String, String, String, Date, Number, String, Boolean, String, String, Date, String, Date])
94
+ ], UserDependents);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-modules/foreign-ministry",
3
- "version": "1.3.209",
3
+ "version": "1.3.211",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -116,6 +116,11 @@ import { RegisterCandidateRequestAttachment } from './models/RegisterCandidateAt
116
116
  import { RegisterCandidateRequestChat } from './models/RegisterCandidateChatModel';
117
117
  import { RegisterCandidateWorkFlow } from './models/RegisterCandidateWorkflowModel';
118
118
  import { RegisterCandidateExperienceActivity } from './models/RegisterCandidateExperienceActivityModel';
119
+ import { ResignationTerminationRequests } from './models/ResignationTerminationRequestModel';
120
+ import { ResignationTerminationApprovalDetails } from './models/ResignationTerminationApprovalModel';
121
+ import { ResignationTerminationRequestAttachment } from './models/ResignationTerminationAttachmentModel';
122
+ import { ResignationTerminationRequestChat } from './models/ResignationTerminationChatModel';
123
+ import { ResignationTerminationWorkFlow } from './models/ResignationTerminationWorkflowModel';
119
124
  import { LMSCourseExternalLecturerRequests } from './models/LMSCourseExternalLecturerRequestModel';
120
125
  import { LMSCourseExternalLecturerApprovalDetails } from './models/LMSCourseExternalLecturerApprovalModel';
121
126
  import { LMSCourseExternalLecturerRequestAttachment } from './models/LMSCourseExternalLecturerAttachmentModel';
@@ -335,6 +340,11 @@ export const AppDataSource = new DataSource({
335
340
  RegisterCandidateRequestChat,
336
341
  RegisterCandidateWorkFlow,
337
342
  RegisterCandidateExperienceActivity,
343
+ ResignationTerminationRequests,
344
+ ResignationTerminationApprovalDetails,
345
+ ResignationTerminationRequestAttachment,
346
+ ResignationTerminationRequestChat,
347
+ ResignationTerminationWorkFlow,
338
348
  LMSCourseExternalLecturerRequests,
339
349
  LMSCourseExternalLecturerApprovalDetails,
340
350
  LMSCourseExternalLecturerRequestAttachment,
package/src/index.ts CHANGED
@@ -113,6 +113,11 @@ export * from './models/RegisterCandidateChatModel';
113
113
  export * from './models/RegisterCandidateWorkflowModel';
114
114
  export * from './models/RegisterCandidateExperienceActivityModel';
115
115
  export {RegisterCandidateExperienceActivity} from './models/RegisterCandidateExperienceActivityModel';
116
+ export * from './models/ResignationTerminationRequestModel';
117
+ export * from './models/ResignationTerminationApprovalModel';
118
+ export * from './models/ResignationTerminationAttachmentModel';
119
+ export * from './models/ResignationTerminationChatModel';
120
+ export * from './models/ResignationTerminationWorkflowModel';
116
121
  export * from './models/LMSCourseExternalLecturerRequestModel';
117
122
  export * from './models/LMSCourseExternalLecturerApprovalModel';
118
123
  export * from './models/LMSCourseExternalLecturerAttachmentModel';
@@ -33,15 +33,15 @@ export class FinancialWorkFlow extends BaseModel {
33
33
  @Column({ type: 'int', nullable: true })
34
34
  approved_by_role_id: number;
35
35
 
36
- @Column({ type: 'int', nullable: true })
37
- step_order: number;
38
-
39
- @Column({ type: 'varchar', length: 50, nullable: true })
40
- action: string | null;
41
-
42
- @ManyToOne(() => FinancialRequests, fr => fr.workflows)
43
- @JoinColumn({ name: 'financial_request_id' })
44
- financialRequest?: FinancialRequests;
36
+ @Column({ type: 'int', nullable: true })
37
+ step_order: number;
38
+
39
+ @Column({ type: 'varchar', length: 50, nullable: true })
40
+ action: string | null;
41
+
42
+ @ManyToOne(() => FinancialRequests, fr => fr.workflows)
43
+ @JoinColumn({ name: 'financial_request_id' })
44
+ financialRequest?: FinancialRequests;
45
45
 
46
46
  constructor(
47
47
  financial_request_id: number,
@@ -55,10 +55,10 @@ export class FinancialWorkFlow extends BaseModel {
55
55
  this.status = status;
56
56
  this.approved_by_user_id = approved_by_user_id;
57
57
  this.content = content;
58
- this.financial_approval_id = 0;
59
- this.activity_date = new Date();
60
- this.step_order = step_order;
61
- this.action = null;
62
- }
63
- }
58
+ this.financial_approval_id = 0;
59
+ this.activity_date = new Date();
60
+ this.step_order = step_order;
61
+ this.action = null;
62
+ }
63
+ }
64
64
 
@@ -85,10 +85,10 @@ export class GatePassVisitors extends BaseModel {
85
85
  @Column({ type: 'varchar', length: 255, nullable: true })
86
86
  visiting_person_in_department: string | null; // زائر في القسم (Visiting Person in Department)
87
87
 
88
- @Column({ type: 'int', nullable: true, unique: true })
89
- serial_number: number | null;
90
-
91
- // QR Code for Gate Pass
88
+ @Column({ type: 'int', nullable: true, unique: true })
89
+ serial_number: number | null;
90
+
91
+ // QR Code for Gate Pass
92
92
  @Column({ type: 'text', nullable: true })
93
93
  qr_code_url: string | null; // QR code URL for this visitor (data URL can be 6000+ characters)
94
94
 
@@ -134,9 +134,9 @@ export class GatePassVisitors extends BaseModel {
134
134
  this.visitor_email_address = visitor_email_address;
135
135
  this.visitor_mobile_number = visitor_mobile_number;
136
136
  this.visitor_photo_url = visitor_photo_url;
137
- this.visitor_photo_file_name = visitor_photo_file_name;
138
- this.serial_number = null;
139
- this.gate_pass_generated = false;
137
+ this.visitor_photo_file_name = visitor_photo_file_name;
138
+ this.serial_number = null;
139
+ this.gate_pass_generated = false;
140
140
  this.email_sent = false;
141
141
  }
142
142
  }
@@ -12,12 +12,20 @@ export class HallMaster extends BaseModel {
12
12
  @Column({ type: 'varchar', length: 255, nullable: true })
13
13
  meeting_location: string | null;
14
14
 
15
+ @Column({ type: 'varchar', length: 255, nullable: true })
16
+ location_name_in_arabic: string | null;
17
+
18
+ @Column({ type: 'varchar', length: 255, nullable: true })
19
+ hall_name_in_arabic: string | null;
20
+
15
21
 
16
- constructor(name: string, location?: string | null, meeting_location?: string | null) {
22
+ constructor(name: string, location?: string | null, meeting_location?: string | null, location_name_in_arabic?: string | null, hall_name_in_arabic?: string | null) {
17
23
  super();
18
24
  this.name = name;
19
25
  this.location = location ?? null;
20
26
  this.meeting_location = meeting_location ?? null;
27
+ this.location_name_in_arabic = location_name_in_arabic ?? null;
28
+ this.hall_name_in_arabic = hall_name_in_arabic ?? null;
21
29
  }
22
30
  }
23
31
 
@@ -1,26 +1,26 @@
1
- import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from "typeorm";
2
- import { BaseModel } from "./BaseModel";
3
- import { Poll } from "./PollsModel";
4
- import { PollVote } from "./PollVotesModel";
5
-
6
- @Entity({ name: "poll_options" })
7
- export class PollOption extends BaseModel {
8
- @Column({ type: "int", nullable: false })
9
- poll_id: number;
10
-
11
- @Column({ type: "varchar", length: 500, nullable: false })
12
- option_text: string;
13
-
14
- @ManyToOne(() => Poll, (poll) => poll.options, { nullable: false })
15
- @JoinColumn({ name: "poll_id" })
16
- poll?: Poll;
17
-
18
- @OneToMany(() => PollVote, (vote) => vote.option)
19
- votes?: PollVote[];
20
-
21
- constructor() {
22
- super();
23
- this.poll_id = 0;
24
- this.option_text = "";
25
- }
26
- }
1
+ import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from "typeorm";
2
+ import { BaseModel } from "./BaseModel";
3
+ import { Poll } from "./PollsModel";
4
+ import { PollVote } from "./PollVotesModel";
5
+
6
+ @Entity({ name: "poll_options" })
7
+ export class PollOption extends BaseModel {
8
+ @Column({ type: "int", nullable: false })
9
+ poll_id: number;
10
+
11
+ @Column({ type: "varchar", length: 500, nullable: false })
12
+ option_text: string;
13
+
14
+ @ManyToOne(() => Poll, (poll) => poll.options, { nullable: false })
15
+ @JoinColumn({ name: "poll_id" })
16
+ poll?: Poll;
17
+
18
+ @OneToMany(() => PollVote, (vote) => vote.option)
19
+ votes?: PollVote[];
20
+
21
+ constructor() {
22
+ super();
23
+ this.poll_id = 0;
24
+ this.option_text = "";
25
+ }
26
+ }
@@ -1,37 +1,37 @@
1
- import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
2
- import { BaseModel } from "./BaseModel";
3
- import { Poll } from "./PollsModel";
4
- import { PollOption } from "./PollOptionsModel";
5
- import { User } from "./user";
6
-
7
- @Entity({ name: "poll_votes" })
8
- @Index("uq_poll_option_user", ["poll_id", "option_id", "user_id"], { unique: true })
9
- export class PollVote extends BaseModel {
10
- @Column({ type: "int", nullable: false })
11
- poll_id: number;
12
-
13
- @Column({ type: "int", nullable: false })
14
- option_id: number;
15
-
16
- @Column({ type: "int", nullable: false })
17
- user_id: number;
18
-
19
- @ManyToOne(() => Poll, (poll) => poll.votes, { nullable: false })
20
- @JoinColumn({ name: "poll_id" })
21
- poll?: Poll;
22
-
23
- @ManyToOne(() => PollOption, (option) => option.votes, { nullable: false })
24
- @JoinColumn({ name: "option_id" })
25
- option?: PollOption;
26
-
27
- @ManyToOne(() => User, { nullable: false })
28
- @JoinColumn({ name: "user_id" })
29
- user?: User;
30
-
31
- constructor() {
32
- super();
33
- this.poll_id = 0;
34
- this.option_id = 0;
35
- this.user_id = 0;
36
- }
37
- }
1
+ import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
2
+ import { BaseModel } from "./BaseModel";
3
+ import { Poll } from "./PollsModel";
4
+ import { PollOption } from "./PollOptionsModel";
5
+ import { User } from "./user";
6
+
7
+ @Entity({ name: "poll_votes" })
8
+ @Index("uq_poll_option_user", ["poll_id", "option_id", "user_id"], { unique: true })
9
+ export class PollVote extends BaseModel {
10
+ @Column({ type: "int", nullable: false })
11
+ poll_id: number;
12
+
13
+ @Column({ type: "int", nullable: false })
14
+ option_id: number;
15
+
16
+ @Column({ type: "int", nullable: false })
17
+ user_id: number;
18
+
19
+ @ManyToOne(() => Poll, (poll) => poll.votes, { nullable: false })
20
+ @JoinColumn({ name: "poll_id" })
21
+ poll?: Poll;
22
+
23
+ @ManyToOne(() => PollOption, (option) => option.votes, { nullable: false })
24
+ @JoinColumn({ name: "option_id" })
25
+ option?: PollOption;
26
+
27
+ @ManyToOne(() => User, { nullable: false })
28
+ @JoinColumn({ name: "user_id" })
29
+ user?: User;
30
+
31
+ constructor() {
32
+ super();
33
+ this.poll_id = 0;
34
+ this.option_id = 0;
35
+ this.user_id = 0;
36
+ }
37
+ }
@@ -1,49 +1,49 @@
1
- import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from "typeorm";
2
- import { BaseModel } from "./BaseModel";
3
- import { ConversationsV2 } from "./ConversationsV2Model";
4
- import { PollOption } from "./PollOptionsModel";
5
- import { PollVote } from "./PollVotesModel";
6
-
7
- @Entity({ name: "poll" })
8
- export class Poll extends BaseModel {
9
- @Column({ type: "int", nullable: false })
10
- group_id: number;
11
-
12
- @Column({ type: "int", nullable: true })
13
- meeting_id?: number | null;
14
-
15
- @Column({ type: "int", nullable: false })
16
- conversation_id: number;
17
-
18
- @Column({ type: "varchar", length: 255, nullable: false })
19
- title: string;
20
-
21
- @Column({ type: "text", nullable: false })
22
- question: string;
23
-
24
- @Column({ type: "timestamptz", nullable: true })
25
- expires_at?: Date | null;
26
-
27
- @Column({ type: "boolean", default: false })
28
- allow_multiple: boolean;
29
-
30
- @ManyToOne(() => ConversationsV2, { nullable: false })
31
- @JoinColumn({ name: "conversation_id" })
32
- conversation?: ConversationsV2;
33
-
34
- @OneToMany(() => PollOption, (option) => option.poll)
35
- options?: PollOption[];
36
-
37
- @OneToMany(() => PollVote, (vote) => vote.poll)
38
- votes?: PollVote[];
39
-
40
- constructor() {
41
- super();
42
- this.group_id = 0;
43
- this.meeting_id = null;
44
- this.conversation_id = 0;
45
- this.title = "";
46
- this.question = "";
47
- this.allow_multiple = false;
48
- }
49
- }
1
+ import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from "typeorm";
2
+ import { BaseModel } from "./BaseModel";
3
+ import { ConversationsV2 } from "./ConversationsV2Model";
4
+ import { PollOption } from "./PollOptionsModel";
5
+ import { PollVote } from "./PollVotesModel";
6
+
7
+ @Entity({ name: "poll" })
8
+ export class Poll extends BaseModel {
9
+ @Column({ type: "int", nullable: false })
10
+ group_id: number;
11
+
12
+ @Column({ type: "int", nullable: true })
13
+ meeting_id?: number | null;
14
+
15
+ @Column({ type: "int", nullable: false })
16
+ conversation_id: number;
17
+
18
+ @Column({ type: "varchar", length: 255, nullable: false })
19
+ title: string;
20
+
21
+ @Column({ type: "text", nullable: false })
22
+ question: string;
23
+
24
+ @Column({ type: "timestamptz", nullable: true })
25
+ expires_at?: Date | null;
26
+
27
+ @Column({ type: "boolean", default: false })
28
+ allow_multiple: boolean;
29
+
30
+ @ManyToOne(() => ConversationsV2, { nullable: false })
31
+ @JoinColumn({ name: "conversation_id" })
32
+ conversation?: ConversationsV2;
33
+
34
+ @OneToMany(() => PollOption, (option) => option.poll)
35
+ options?: PollOption[];
36
+
37
+ @OneToMany(() => PollVote, (vote) => vote.poll)
38
+ votes?: PollVote[];
39
+
40
+ constructor() {
41
+ super();
42
+ this.group_id = 0;
43
+ this.meeting_id = null;
44
+ this.conversation_id = 0;
45
+ this.title = "";
46
+ this.question = "";
47
+ this.allow_multiple = false;
48
+ }
49
+ }