@platform-modules/foreign-ministry 1.0.28 → 1.0.29
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.
- package/.env +2 -2
- package/dist/data-source.js +42 -3
- package/dist/index.d.ts +14 -2
- package/dist/index.js +14 -2
- package/dist/models/ConversationModel.d.ts +16 -0
- package/dist/models/ConversationModel.js +64 -0
- package/dist/models/ConversationParticipantModel.d.ts +14 -0
- package/dist/models/ConversationParticipantModel.js +68 -0
- package/dist/models/DepartmentsModel.d.ts +7 -0
- package/dist/models/DepartmentsModel.js +39 -0
- package/dist/models/DesignationModel.d.ts +6 -0
- package/dist/models/DesignationModel.js +34 -0
- package/dist/models/DivisionModel.d.ts +6 -0
- package/dist/models/DivisionModel.js +34 -0
- package/dist/models/LeaveApprovalsModel.d.ts +15 -0
- package/dist/models/{LeaveApprovalDetailsModel.js → LeaveApprovalsModel.js} +23 -7
- package/dist/models/LeaveAttachmentsModel.d.ts +7 -0
- package/dist/models/LeaveAttachmentsModel.js +40 -0
- package/dist/models/LeaveChatModel.d.ts +7 -0
- package/dist/models/LeaveChatModel.js +40 -0
- package/dist/models/LeaveSettingsModel.d.ts +7 -0
- package/dist/models/{LeaveApprovalMatrixModel.js → LeaveSettingsModel.js} +14 -14
- package/dist/models/LeaveWorkFlowModel.d.ts +13 -0
- package/dist/models/LeaveWorkFlowModel.js +51 -0
- package/dist/models/MessageModel.d.ts +27 -0
- package/dist/models/MessageModel.js +108 -0
- package/dist/models/SectionModel.d.ts +8 -0
- package/dist/models/SectionModel.js +44 -0
- package/dist/models/faqsModel.d.ts +11 -0
- package/dist/models/faqsModel.js +57 -0
- package/dist/models/questionTagsModel.d.ts +6 -0
- package/dist/models/questionTagsModel.js +34 -0
- package/dist/models/user.d.ts +29 -16
- package/dist/models/user.js +99 -39
- package/package.json +1 -1
- package/src/data-source.ts +44 -3
- package/src/index.ts +15 -3
- package/src/models/ConversationModel.ts +48 -0
- package/src/models/ConversationParticipantModel.ts +51 -0
- package/src/models/DepartmentsModel.ts +26 -0
- package/src/models/DesignationModel.ts +19 -0
- package/src/models/DivisionModel.ts +19 -0
- package/src/models/LeaveApprovalsModel.ts +41 -0
- package/src/models/LeaveAttachmentsModel.ts +21 -0
- package/src/models/LeaveChatModel.ts +21 -0
- package/src/models/{LeaveApprovalMatrixModel.ts → LeaveSettingsModel.ts} +6 -6
- package/src/models/LeaveWorkFlowModel.ts +32 -0
- package/src/models/MessageModel.ts +93 -0
- package/src/models/SectionModel.ts +31 -0
- package/src/models/faqsModel.ts +43 -0
- package/src/models/questionTagsModel.ts +22 -0
- package/src/models/user.ts +111 -60
- package/dist/models/LeaveApprovalDetailsModel.d.ts +0 -8
- package/dist/models/LeaveApprovalMatrixModel.d.ts +0 -7
- package/src/models/LeaveApprovalDetailsModel.ts +0 -25
package/src/data-source.ts
CHANGED
|
@@ -12,8 +12,22 @@ import { HajjLeaveDates } from './models/HajjLeaveDatesModel';
|
|
|
12
12
|
import { StudyLeaveDegrees } from './models/StudyLeaveDegreesModel';
|
|
13
13
|
import { UnpaidLeaveCategories } from './models/UnpaidLeaveCatgoriesModel';
|
|
14
14
|
import { MounringLeaveRelations } from './models/MounringLeaveRelationModel';
|
|
15
|
-
import {
|
|
16
|
-
import { LeaveApprovalDetails } from './models/
|
|
15
|
+
import { LeaveSettings } from './models/LeaveSettingsModel';
|
|
16
|
+
import { LeaveApprovalDetails } from './models/LeaveApprovalsModel';
|
|
17
|
+
import { LeaveAttachments } from './models/LeaveAttachmentsModel';
|
|
18
|
+
import { LeaveChat } from './models/LeaveChatModel';
|
|
19
|
+
import { LeaveWorkFlow } from './models/LeaveWorkFlowModel';
|
|
20
|
+
import { Sections } from './models/SectionModel';
|
|
21
|
+
import { Designation } from './models/DesignationModel';
|
|
22
|
+
import { Departments } from './models/DepartmentsModel';
|
|
23
|
+
import { Division } from './models/DivisionModel';
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
import { Faqs } from './models/faqsModel';
|
|
27
|
+
import { QuestionTags } from './models/questionTagsModel';
|
|
28
|
+
import { Conversation } from './models/ConversationModel';
|
|
29
|
+
import { ConversationParticipant } from './models/ConversationParticipantModel';
|
|
30
|
+
import { Message } from './models/MessageModel';
|
|
17
31
|
import { FMServices } from './models/FMServices';
|
|
18
32
|
import { FMSubServices } from './models/FMSubservices';
|
|
19
33
|
|
|
@@ -27,5 +41,32 @@ export const AppDataSource = new DataSource({
|
|
|
27
41
|
database: process.env.DB_NAME || 'common_models',
|
|
28
42
|
synchronize: true, // auto-create tables (disable in prod)
|
|
29
43
|
logging: false,
|
|
30
|
-
entities: [
|
|
44
|
+
entities: [
|
|
45
|
+
User,
|
|
46
|
+
userSessions,
|
|
47
|
+
Role,
|
|
48
|
+
LeaveRequests,
|
|
49
|
+
LeaveTypes,
|
|
50
|
+
FinancialGrade,
|
|
51
|
+
HajjLeaveDates,
|
|
52
|
+
StudyLeaveDegrees,
|
|
53
|
+
UnpaidLeaveCategories,
|
|
54
|
+
MounringLeaveRelations,
|
|
55
|
+
LeaveSettings,
|
|
56
|
+
LeaveApprovalDetails,
|
|
57
|
+
LeaveAttachments,
|
|
58
|
+
LeaveChat,
|
|
59
|
+
LeaveWorkFlow,
|
|
60
|
+
Sections,
|
|
61
|
+
Designation,
|
|
62
|
+
Departments,
|
|
63
|
+
Division,
|
|
64
|
+
Faqs,
|
|
65
|
+
QuestionTags,
|
|
66
|
+
Conversation,
|
|
67
|
+
ConversationParticipant,
|
|
68
|
+
Message,
|
|
69
|
+
FMServices,
|
|
70
|
+
FMSubServices
|
|
71
|
+
],
|
|
31
72
|
});
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,19 @@ export * from './models/HajjLeaveDatesModel';
|
|
|
8
8
|
export * from './models/StudyLeaveDegreesModel';
|
|
9
9
|
export * from './models/UnpaidLeaveCatgoriesModel';
|
|
10
10
|
export * from './models/MounringLeaveRelationModel';
|
|
11
|
-
export * from './models/
|
|
12
|
-
export * from './models/
|
|
11
|
+
export * from './models/LeaveSettingsModel';
|
|
12
|
+
export * from './models/LeaveApprovalsModel';
|
|
13
|
+
export * from './models/LeaveAttachmentsModel';
|
|
14
|
+
export * from './models/LeaveChatModel';
|
|
15
|
+
export * from './models/LeaveWorkFlowModel';
|
|
16
|
+
export * from './models/SectionModel';
|
|
17
|
+
export * from './models/DesignationModel';
|
|
18
|
+
export * from './models/DepartmentsModel';
|
|
19
|
+
export * from './models/DivisionModel';
|
|
20
|
+
export * from './models/faqsModel';
|
|
21
|
+
export * from './models/questionTagsModel';
|
|
22
|
+
export * from './models/ConversationModel';
|
|
23
|
+
export * from './models/ConversationParticipantModel';
|
|
24
|
+
export * from './models/MessageModel';
|
|
13
25
|
export * from './models/FMServices';
|
|
14
|
-
export * from './models/FMSubservices';
|
|
26
|
+
export * from './models/FMSubservices';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Column, Entity, OneToMany } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
import { ConversationParticipant } from './ConversationParticipantModel';
|
|
4
|
+
import { Message } from './MessageModel';
|
|
5
|
+
|
|
6
|
+
export enum ConversationType {
|
|
7
|
+
DIRECT = "Direct",
|
|
8
|
+
GROUP = "Group"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@Entity({ name: 'conversations' })
|
|
12
|
+
export class Conversation extends BaseModel {
|
|
13
|
+
|
|
14
|
+
@Column({
|
|
15
|
+
type: 'enum',
|
|
16
|
+
enum: ConversationType,
|
|
17
|
+
default: ConversationType.DIRECT
|
|
18
|
+
})
|
|
19
|
+
conversationType: ConversationType;
|
|
20
|
+
|
|
21
|
+
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
22
|
+
conversationName?: string;
|
|
23
|
+
|
|
24
|
+
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
|
|
27
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
28
|
+
updatedAt?: Date;
|
|
29
|
+
|
|
30
|
+
@OneToMany(() => ConversationParticipant, participant => participant.conversation)
|
|
31
|
+
participants?: ConversationParticipant[];
|
|
32
|
+
|
|
33
|
+
@OneToMany(() => Message, message => message.conversation)
|
|
34
|
+
messages?: Message[];
|
|
35
|
+
|
|
36
|
+
constructor(
|
|
37
|
+
conversationType?: ConversationType,
|
|
38
|
+
conversationName?: string,
|
|
39
|
+
createdAt?: Date,
|
|
40
|
+
updatedAt?: Date
|
|
41
|
+
) {
|
|
42
|
+
super();
|
|
43
|
+
this.conversationType = conversationType || ConversationType.DIRECT;
|
|
44
|
+
this.conversationName = conversationName;
|
|
45
|
+
this.createdAt = createdAt || new Date();
|
|
46
|
+
this.updatedAt = updatedAt;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
import { Conversation } from './ConversationModel';
|
|
4
|
+
import { User } from './user';
|
|
5
|
+
|
|
6
|
+
@Entity({ name: 'conversation_participants' })
|
|
7
|
+
export class ConversationParticipant extends BaseModel {
|
|
8
|
+
|
|
9
|
+
@Column({ type: 'bigint' })
|
|
10
|
+
conversationId: number;
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int' })
|
|
13
|
+
userId: number;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'int' })
|
|
16
|
+
roleId: number;
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
|
|
19
|
+
joinedAt: Date;
|
|
20
|
+
|
|
21
|
+
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
|
|
22
|
+
createdAt: Date;
|
|
23
|
+
|
|
24
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
25
|
+
updatedAt?: Date;
|
|
26
|
+
|
|
27
|
+
@ManyToOne(() => Conversation, conversation => conversation.participants)
|
|
28
|
+
@JoinColumn({ name: 'conversationId' })
|
|
29
|
+
conversation?: Conversation;
|
|
30
|
+
|
|
31
|
+
@ManyToOne(() => User)
|
|
32
|
+
@JoinColumn({ name: 'userId' })
|
|
33
|
+
user?: User;
|
|
34
|
+
|
|
35
|
+
constructor(
|
|
36
|
+
conversationId?: number,
|
|
37
|
+
userId?: number,
|
|
38
|
+
roleId?: number,
|
|
39
|
+
joinedAt?: Date,
|
|
40
|
+
createdAt?: Date,
|
|
41
|
+
updatedAt?: Date
|
|
42
|
+
) {
|
|
43
|
+
super();
|
|
44
|
+
this.conversationId = conversationId || 0;
|
|
45
|
+
this.userId = userId || 0;
|
|
46
|
+
this.roleId = roleId || 0;
|
|
47
|
+
this.joinedAt = joinedAt || new Date();
|
|
48
|
+
this.createdAt = createdAt || new Date();
|
|
49
|
+
this.updatedAt = updatedAt;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'departments' })
|
|
5
|
+
export class Departments extends BaseModel {
|
|
6
|
+
|
|
7
|
+
@Column({ type: 'varchar', length: 64, nullable: false, unique: true })
|
|
8
|
+
department_name: string;
|
|
9
|
+
|
|
10
|
+
@Column({ type: 'varchar', length: 64, nullable: false, unique: true })
|
|
11
|
+
department_code: string;
|
|
12
|
+
|
|
13
|
+
@Column({ nullable: false })
|
|
14
|
+
department_description: string;
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
department_name: string,
|
|
18
|
+
department_code: string,
|
|
19
|
+
department_description: string,
|
|
20
|
+
) {
|
|
21
|
+
super();
|
|
22
|
+
this.department_name = department_name
|
|
23
|
+
this.department_code = department_code
|
|
24
|
+
this.department_description = department_description
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'designation' })
|
|
5
|
+
export class Designation extends BaseModel {
|
|
6
|
+
|
|
7
|
+
@Column({ nullable: true })
|
|
8
|
+
name: string;
|
|
9
|
+
|
|
10
|
+
@Column({ nullable: true })
|
|
11
|
+
is_deleted?: boolean;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
constructor(name: string,is_deleted:boolean) {
|
|
15
|
+
super();
|
|
16
|
+
this.name = name
|
|
17
|
+
this.is_deleted = is_deleted
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'division' })
|
|
5
|
+
export class Division extends BaseModel {
|
|
6
|
+
|
|
7
|
+
@Column({ nullable: true })
|
|
8
|
+
name: string;
|
|
9
|
+
|
|
10
|
+
@Column({ nullable: true })
|
|
11
|
+
is_deleted?: boolean;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
constructor(name: string,is_deleted:boolean) {
|
|
15
|
+
super();
|
|
16
|
+
this.name = name
|
|
17
|
+
this.is_deleted = is_deleted
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export enum ApprovalStatus {
|
|
6
|
+
PENDING = "Pending",
|
|
7
|
+
APPROVED = "Approved",
|
|
8
|
+
REJECTED = "Rejected"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
//This model is used to store the store the leave apporval details of the user for the leave request
|
|
12
|
+
@Entity({ name: 'leave_approvals' })
|
|
13
|
+
export class LeaveApprovalDetails extends BaseModel {
|
|
14
|
+
@Column({ type: 'int', nullable: false })
|
|
15
|
+
leave_request_id: number;
|
|
16
|
+
|
|
17
|
+
@Column({ type: 'int', nullable: false })
|
|
18
|
+
level: number;
|
|
19
|
+
|
|
20
|
+
@Column({ type: 'int', nullable: true })
|
|
21
|
+
approver_user_id: number;
|
|
22
|
+
|
|
23
|
+
@Column({ type: 'int', nullable: false })
|
|
24
|
+
approver_role_id: number;
|
|
25
|
+
|
|
26
|
+
@Column({ type: 'varchar', length: 255, nullable: false })
|
|
27
|
+
comment: string;
|
|
28
|
+
|
|
29
|
+
@Column({ type: 'enum', enum: ApprovalStatus,default: ApprovalStatus.PENDING, nullable: false })
|
|
30
|
+
approval_status: ApprovalStatus;
|
|
31
|
+
|
|
32
|
+
constructor(leave_request_id: number, approver_user_id: number, approver_role_id: number, comment: string, approval_status: ApprovalStatus, level: number) {
|
|
33
|
+
super();
|
|
34
|
+
this.leave_request_id = leave_request_id;
|
|
35
|
+
this.approver_user_id = approver_user_id;
|
|
36
|
+
this.approver_role_id = approver_role_id;
|
|
37
|
+
this.comment = comment;
|
|
38
|
+
this.approval_status = approval_status;
|
|
39
|
+
this.level = level;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
//This model is used to store the store the leave apporval matrix(HOD, Manager, HR, Director) based on leave type along with the levels
|
|
4
|
+
@Entity({ name: 'leave_attachments' })
|
|
5
|
+
export class LeaveAttachments extends BaseModel {
|
|
6
|
+
@Column({ type: 'int', nullable: false })
|
|
7
|
+
leave_request_id: number;
|
|
8
|
+
|
|
9
|
+
@Column({ type: 'varchar', length: 255, nullable: false })
|
|
10
|
+
files: string;
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: false })
|
|
13
|
+
attached_by_user_id: number;
|
|
14
|
+
|
|
15
|
+
constructor(leave_request_id: number, files: string, attached_by_user_id: number) {
|
|
16
|
+
super();
|
|
17
|
+
this.leave_request_id = leave_request_id;
|
|
18
|
+
this.files = files;
|
|
19
|
+
this.attached_by_user_id = attached_by_user_id;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
//This model is used to store the store the leave apporval matrix(HOD, Manager, HR, Director) based on leave type along with the levels
|
|
4
|
+
@Entity({ name: 'leave_chats' })
|
|
5
|
+
export class LeaveChat extends BaseModel {
|
|
6
|
+
@Column({ type: 'int', nullable: false })
|
|
7
|
+
leave_request_id: number;
|
|
8
|
+
|
|
9
|
+
@Column({ type: 'varchar', length: 255, nullable: false })
|
|
10
|
+
content: string;
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'int', nullable: false })
|
|
13
|
+
sender_user_id: number;
|
|
14
|
+
|
|
15
|
+
constructor(leave_request_id: number, content: string, sender_user_id: number) {
|
|
16
|
+
super();
|
|
17
|
+
this.leave_request_id = leave_request_id;
|
|
18
|
+
this.content = content;
|
|
19
|
+
this.sender_user_id = sender_user_id;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Column, Entity } from "typeorm";
|
|
2
2
|
import { BaseModel } from './BaseModel';
|
|
3
3
|
//This model is used to store the store the leave apporval matrix(HOD, Manager, HR, Director) based on leave type along with the levels
|
|
4
|
-
@Entity({ name: '
|
|
5
|
-
export class
|
|
4
|
+
@Entity({ name: 'leave_settings' })
|
|
5
|
+
export class LeaveSettings extends BaseModel {
|
|
6
6
|
@Column({ type: 'int', nullable: false })
|
|
7
7
|
leave_type: number;
|
|
8
8
|
|
|
9
9
|
@Column({ type: 'int', nullable: false })
|
|
10
10
|
level: number;
|
|
11
11
|
|
|
12
|
-
@Column({ type: '
|
|
13
|
-
|
|
12
|
+
@Column({ type: 'varchar', length: 255, nullable: false })
|
|
13
|
+
leave_approval_authority: string;
|
|
14
14
|
|
|
15
|
-
constructor(leave_type: number, level: number,
|
|
15
|
+
constructor(leave_type: number, level: number, leave_approval_authority: string) {
|
|
16
16
|
super();
|
|
17
17
|
this.leave_type = leave_type;
|
|
18
18
|
this.level = level;
|
|
19
|
-
this.
|
|
19
|
+
this.leave_approval_authority = leave_approval_authority;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
|
|
4
|
+
export enum workFlowStatus {
|
|
5
|
+
COMPLETED = "Completed",
|
|
6
|
+
NOT_YET_STARTED = "Not Yet Started",
|
|
7
|
+
PENDING = "Pending"
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
//This model is used to store the store the leave apporval matrix(HOD, Manager, HR, Director) based on leave type along with the levels
|
|
11
|
+
@Entity({ name: 'leave_work_flows' })
|
|
12
|
+
export class LeaveWorkFlow extends BaseModel {
|
|
13
|
+
@Column({ type: 'int', nullable: false })
|
|
14
|
+
leave_request_id: number;
|
|
15
|
+
|
|
16
|
+
@Column({ type: 'int', nullable: false, default: 0 })
|
|
17
|
+
leave_approval_details_id: number;
|
|
18
|
+
|
|
19
|
+
@Column({ type: 'varchar', length: 255, nullable: false })
|
|
20
|
+
content: string;
|
|
21
|
+
|
|
22
|
+
@Column({ type: 'enum', enum: workFlowStatus, default: workFlowStatus.NOT_YET_STARTED, nullable: false })
|
|
23
|
+
status: workFlowStatus;
|
|
24
|
+
|
|
25
|
+
constructor(leave_request_id: number, leave_approval_details_id: number, content: string, status: workFlowStatus) {
|
|
26
|
+
super();
|
|
27
|
+
this.leave_request_id = leave_request_id;
|
|
28
|
+
this.leave_approval_details_id = leave_approval_details_id;
|
|
29
|
+
this.content = content;
|
|
30
|
+
this.status = status;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Column, Entity, ManyToOne, JoinColumn } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
import { Conversation } from './ConversationModel';
|
|
4
|
+
import { User } from './user';
|
|
5
|
+
|
|
6
|
+
export enum MessageType {
|
|
7
|
+
TEXT = "text",
|
|
8
|
+
IMAGE = "image",
|
|
9
|
+
VIDEO = "video",
|
|
10
|
+
FILE = "file",
|
|
11
|
+
LINK = "link"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@Entity({ name: 'messages' })
|
|
15
|
+
export class Message extends BaseModel {
|
|
16
|
+
|
|
17
|
+
@Column({ type: 'bigint' })
|
|
18
|
+
conversationId: number;
|
|
19
|
+
|
|
20
|
+
@Column({ type: 'int' })
|
|
21
|
+
senderId: number;
|
|
22
|
+
|
|
23
|
+
@Column({ type: 'text', nullable: true, default: '' })
|
|
24
|
+
content?: string;
|
|
25
|
+
|
|
26
|
+
@Column({
|
|
27
|
+
type: 'enum',
|
|
28
|
+
enum: MessageType,
|
|
29
|
+
default: MessageType.TEXT
|
|
30
|
+
})
|
|
31
|
+
messageType: MessageType;
|
|
32
|
+
|
|
33
|
+
@Column({ type: 'bigint', nullable: true })
|
|
34
|
+
replyToMessageId?: number;
|
|
35
|
+
|
|
36
|
+
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
|
|
39
|
+
@Column({ type: 'boolean', default: false })
|
|
40
|
+
isDeleted: boolean;
|
|
41
|
+
|
|
42
|
+
@Column({ type: 'text', nullable: true })
|
|
43
|
+
attachmentUrl?: string;
|
|
44
|
+
|
|
45
|
+
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
46
|
+
attachmentFileType?: string;
|
|
47
|
+
|
|
48
|
+
@Column({ type: 'varchar', length: 255, nullable: true })
|
|
49
|
+
attachmentFileName?: string;
|
|
50
|
+
|
|
51
|
+
@Column({ type: 'int', nullable: true })
|
|
52
|
+
attachmentFileSize?: number;
|
|
53
|
+
|
|
54
|
+
@Column({ type: 'timestamp', nullable: true })
|
|
55
|
+
deletedAt?: Date;
|
|
56
|
+
|
|
57
|
+
@ManyToOne(() => Conversation, conversation => conversation.messages)
|
|
58
|
+
@JoinColumn({ name: 'conversationId' })
|
|
59
|
+
conversation?: Conversation;
|
|
60
|
+
|
|
61
|
+
@ManyToOne(() => User)
|
|
62
|
+
@JoinColumn({ name: 'senderId' })
|
|
63
|
+
sender?: User;
|
|
64
|
+
|
|
65
|
+
constructor(
|
|
66
|
+
conversationId?: number,
|
|
67
|
+
senderId?: number,
|
|
68
|
+
content?: string,
|
|
69
|
+
messageType?: MessageType,
|
|
70
|
+
replyToMessageId?: number,
|
|
71
|
+
createdAt?: Date,
|
|
72
|
+
isDeleted?: boolean,
|
|
73
|
+
attachmentUrl?: string,
|
|
74
|
+
attachmentFileType?: string,
|
|
75
|
+
attachmentFileName?: string,
|
|
76
|
+
attachmentFileSize?: number,
|
|
77
|
+
deletedAt?: Date
|
|
78
|
+
) {
|
|
79
|
+
super();
|
|
80
|
+
this.conversationId = conversationId || 0;
|
|
81
|
+
this.senderId = senderId || 0;
|
|
82
|
+
this.content = content || '';
|
|
83
|
+
this.messageType = messageType || MessageType.TEXT;
|
|
84
|
+
this.replyToMessageId = replyToMessageId;
|
|
85
|
+
this.createdAt = createdAt || new Date();
|
|
86
|
+
this.isDeleted = isDeleted || false;
|
|
87
|
+
this.attachmentUrl = attachmentUrl;
|
|
88
|
+
this.attachmentFileType = attachmentFileType;
|
|
89
|
+
this.attachmentFileName = attachmentFileName;
|
|
90
|
+
this.attachmentFileSize = attachmentFileSize;
|
|
91
|
+
this.deletedAt = deletedAt;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Column, Entity } from "typeorm";
|
|
2
|
+
import { BaseModel } from './BaseModel';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'sections' })
|
|
5
|
+
export class Sections extends BaseModel {
|
|
6
|
+
|
|
7
|
+
@Column({ type: 'varchar', length: 64, nullable: false, unique: true })
|
|
8
|
+
section_name: string;
|
|
9
|
+
|
|
10
|
+
@Column({ type: 'varchar', length: 64, nullable: false, unique: true })
|
|
11
|
+
section_code: string;
|
|
12
|
+
|
|
13
|
+
@Column({ nullable: false })
|
|
14
|
+
section_description: string;
|
|
15
|
+
|
|
16
|
+
@Column({ type: 'bigint', nullable: true })
|
|
17
|
+
department_id: number;
|
|
18
|
+
|
|
19
|
+
constructor(
|
|
20
|
+
section_name: string,
|
|
21
|
+
section_code: string,
|
|
22
|
+
section_description: string,
|
|
23
|
+
department_id: number
|
|
24
|
+
) {
|
|
25
|
+
super();
|
|
26
|
+
this.section_name = section_name
|
|
27
|
+
this.section_code = section_code
|
|
28
|
+
this.section_description = section_description
|
|
29
|
+
this.department_id = department_id
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
import { Column, Entity ,BeforeInsert,BeforeUpdate } from "typeorm";
|
|
3
|
+
import { BaseModel } from './BaseModel';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'faqs' })
|
|
6
|
+
export class Faqs extends BaseModel {
|
|
7
|
+
|
|
8
|
+
@Column({ nullable: true })
|
|
9
|
+
question: string;
|
|
10
|
+
|
|
11
|
+
@Column({ nullable: true })
|
|
12
|
+
answer: string;
|
|
13
|
+
|
|
14
|
+
@Column({ nullable: true })
|
|
15
|
+
category_Id: number;
|
|
16
|
+
|
|
17
|
+
@Column({ nullable: true })
|
|
18
|
+
sub_category_Id: number;
|
|
19
|
+
|
|
20
|
+
@Column({ nullable: true })
|
|
21
|
+
department_Id: number;
|
|
22
|
+
|
|
23
|
+
@Column({ nullable: true, default: 0 })
|
|
24
|
+
like_count: number;
|
|
25
|
+
|
|
26
|
+
@Column({ nullable: true, default: 0 })
|
|
27
|
+
dislike_count: number;
|
|
28
|
+
|
|
29
|
+
constructor(
|
|
30
|
+
question: string,
|
|
31
|
+
answer: string,
|
|
32
|
+
category_Id: number,
|
|
33
|
+
sub_category_Id: number,
|
|
34
|
+
department_Id: number,
|
|
35
|
+
) {
|
|
36
|
+
super();
|
|
37
|
+
this.question = question,
|
|
38
|
+
this.answer = answer,
|
|
39
|
+
this.category_Id = category_Id ,
|
|
40
|
+
this.sub_category_Id = sub_category_Id,
|
|
41
|
+
this.department_Id = department_Id
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { Column, Entity ,BeforeInsert,BeforeUpdate } from "typeorm";
|
|
3
|
+
import { BaseModel } from './BaseModel';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'question_tags' })
|
|
6
|
+
export class QuestionTags extends BaseModel {
|
|
7
|
+
|
|
8
|
+
@Column({ nullable: true })
|
|
9
|
+
name: string;
|
|
10
|
+
|
|
11
|
+
@Column({ nullable: true })
|
|
12
|
+
question_Id: number;
|
|
13
|
+
|
|
14
|
+
constructor(
|
|
15
|
+
name: string,
|
|
16
|
+
question_Id: number
|
|
17
|
+
) {
|
|
18
|
+
super();
|
|
19
|
+
this.name = name,
|
|
20
|
+
this.question_Id = question_Id
|
|
21
|
+
}
|
|
22
|
+
}
|