@platform-modules/foreign-ministry 1.0.25 → 1.0.27

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  DB_HOST=localhost
2
- DB_PORT=5432
2
+ DB_PORT=5433
3
3
  DB_USER=postgres
4
- DB_PASS=Fa@123
4
+ DB_PASS=123
5
5
  DB_NAME=FM
@@ -24,6 +24,11 @@ const SectionModel_1 = require("./models/SectionModel");
24
24
  const DesignationModel_1 = require("./models/DesignationModel");
25
25
  const DepartmentsModel_1 = require("./models/DepartmentsModel");
26
26
  const DivisionModel_1 = require("./models/DivisionModel");
27
+ const faqsModel_1 = require("./models/faqsModel");
28
+ const questionTagsModel_1 = require("./models/questionTagsModel");
29
+ const ConversationModel_1 = require("./models/ConversationModel");
30
+ const ConversationParticipantModel_1 = require("./models/ConversationParticipantModel");
31
+ const MessageModel_1 = require("./models/MessageModel");
27
32
  exports.AppDataSource = new typeorm_1.DataSource({
28
33
  type: 'postgres',
29
34
  host: process.env.DB_HOST || 'localhost',
@@ -52,6 +57,11 @@ exports.AppDataSource = new typeorm_1.DataSource({
52
57
  SectionModel_1.Sections,
53
58
  DesignationModel_1.Designation,
54
59
  DepartmentsModel_1.Departments,
55
- DivisionModel_1.Division
60
+ DivisionModel_1.Division,
61
+ faqsModel_1.Faqs,
62
+ questionTagsModel_1.QuestionTags,
63
+ ConversationModel_1.Conversation,
64
+ ConversationParticipantModel_1.ConversationParticipant,
65
+ MessageModel_1.Message
56
66
  ],
57
67
  });
package/dist/index.d.ts CHANGED
@@ -17,3 +17,8 @@ export * from './models/SectionModel';
17
17
  export * from './models/DesignationModel';
18
18
  export * from './models/DepartmentsModel';
19
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';
package/dist/index.js CHANGED
@@ -33,3 +33,8 @@ __exportStar(require("./models/SectionModel"), exports);
33
33
  __exportStar(require("./models/DesignationModel"), exports);
34
34
  __exportStar(require("./models/DepartmentsModel"), exports);
35
35
  __exportStar(require("./models/DivisionModel"), exports);
36
+ __exportStar(require("./models/faqsModel"), exports);
37
+ __exportStar(require("./models/questionTagsModel"), exports);
38
+ __exportStar(require("./models/ConversationModel"), exports);
39
+ __exportStar(require("./models/ConversationParticipantModel"), exports);
40
+ __exportStar(require("./models/MessageModel"), exports);
@@ -0,0 +1,16 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { ConversationParticipant } from './ConversationParticipantModel';
3
+ import { Message } from './MessageModel';
4
+ export declare enum ConversationType {
5
+ DIRECT = "Direct",
6
+ GROUP = "Group"
7
+ }
8
+ export declare class Conversation extends BaseModel {
9
+ conversationType: ConversationType;
10
+ conversationName?: string;
11
+ createdAt: Date;
12
+ updatedAt?: Date;
13
+ participants?: ConversationParticipant[];
14
+ messages?: Message[];
15
+ constructor(conversationType?: ConversationType, conversationName?: string, createdAt?: Date, updatedAt?: Date);
16
+ }
@@ -0,0 +1,64 @@
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.Conversation = exports.ConversationType = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const ConversationParticipantModel_1 = require("./ConversationParticipantModel");
16
+ const MessageModel_1 = require("./MessageModel");
17
+ var ConversationType;
18
+ (function (ConversationType) {
19
+ ConversationType["DIRECT"] = "Direct";
20
+ ConversationType["GROUP"] = "Group";
21
+ })(ConversationType || (exports.ConversationType = ConversationType = {}));
22
+ let Conversation = class Conversation extends BaseModel_1.BaseModel {
23
+ constructor(conversationType, conversationName, createdAt, updatedAt) {
24
+ super();
25
+ this.conversationType = conversationType || ConversationType.DIRECT;
26
+ this.conversationName = conversationName;
27
+ this.createdAt = createdAt || new Date();
28
+ this.updatedAt = updatedAt;
29
+ }
30
+ };
31
+ exports.Conversation = Conversation;
32
+ __decorate([
33
+ (0, typeorm_1.Column)({
34
+ type: 'enum',
35
+ enum: ConversationType,
36
+ default: ConversationType.DIRECT
37
+ }),
38
+ __metadata("design:type", String)
39
+ ], Conversation.prototype, "conversationType", void 0);
40
+ __decorate([
41
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
42
+ __metadata("design:type", String)
43
+ ], Conversation.prototype, "conversationName", void 0);
44
+ __decorate([
45
+ (0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
46
+ __metadata("design:type", Date)
47
+ ], Conversation.prototype, "createdAt", void 0);
48
+ __decorate([
49
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
50
+ __metadata("design:type", Date)
51
+ ], Conversation.prototype, "updatedAt", void 0);
52
+ __decorate([
53
+ (0, typeorm_1.OneToMany)(() => ConversationParticipantModel_1.ConversationParticipant, participant => participant.conversation),
54
+ __metadata("design:type", Array)
55
+ ], Conversation.prototype, "participants", void 0);
56
+ __decorate([
57
+ (0, typeorm_1.OneToMany)(() => MessageModel_1.Message, message => message.conversation),
58
+ __metadata("design:type", Array)
59
+ ], Conversation.prototype, "messages", void 0);
60
+ exports.Conversation = Conversation = __decorate([
61
+ (0, typeorm_1.Entity)({ name: 'conversations' }),
62
+ __metadata("design:paramtypes", [String, String, Date,
63
+ Date])
64
+ ], Conversation);
@@ -0,0 +1,14 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { Conversation } from './ConversationModel';
3
+ import { User } from './user';
4
+ export declare class ConversationParticipant extends BaseModel {
5
+ conversationId: number;
6
+ userId: number;
7
+ roleId: number;
8
+ joinedAt: Date;
9
+ createdAt: Date;
10
+ updatedAt?: Date;
11
+ conversation?: Conversation;
12
+ user?: User;
13
+ constructor(conversationId?: number, userId?: number, roleId?: number, joinedAt?: Date, createdAt?: Date, updatedAt?: Date);
14
+ }
@@ -0,0 +1,68 @@
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.ConversationParticipant = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const ConversationModel_1 = require("./ConversationModel");
16
+ const user_1 = require("./user");
17
+ let ConversationParticipant = class ConversationParticipant extends BaseModel_1.BaseModel {
18
+ constructor(conversationId, userId, roleId, joinedAt, createdAt, updatedAt) {
19
+ super();
20
+ this.conversationId = conversationId || 0;
21
+ this.userId = userId || 0;
22
+ this.roleId = roleId || 0;
23
+ this.joinedAt = joinedAt || new Date();
24
+ this.createdAt = createdAt || new Date();
25
+ this.updatedAt = updatedAt;
26
+ }
27
+ };
28
+ exports.ConversationParticipant = ConversationParticipant;
29
+ __decorate([
30
+ (0, typeorm_1.Column)({ type: 'bigint' }),
31
+ __metadata("design:type", Number)
32
+ ], ConversationParticipant.prototype, "conversationId", void 0);
33
+ __decorate([
34
+ (0, typeorm_1.Column)({ type: 'int' }),
35
+ __metadata("design:type", Number)
36
+ ], ConversationParticipant.prototype, "userId", void 0);
37
+ __decorate([
38
+ (0, typeorm_1.Column)({ type: 'int' }),
39
+ __metadata("design:type", Number)
40
+ ], ConversationParticipant.prototype, "roleId", void 0);
41
+ __decorate([
42
+ (0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
43
+ __metadata("design:type", Date)
44
+ ], ConversationParticipant.prototype, "joinedAt", void 0);
45
+ __decorate([
46
+ (0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
47
+ __metadata("design:type", Date)
48
+ ], ConversationParticipant.prototype, "createdAt", void 0);
49
+ __decorate([
50
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
51
+ __metadata("design:type", Date)
52
+ ], ConversationParticipant.prototype, "updatedAt", void 0);
53
+ __decorate([
54
+ (0, typeorm_1.ManyToOne)(() => ConversationModel_1.Conversation, conversation => conversation.participants),
55
+ (0, typeorm_1.JoinColumn)({ name: 'conversationId' }),
56
+ __metadata("design:type", ConversationModel_1.Conversation)
57
+ ], ConversationParticipant.prototype, "conversation", void 0);
58
+ __decorate([
59
+ (0, typeorm_1.ManyToOne)(() => user_1.User),
60
+ (0, typeorm_1.JoinColumn)({ name: 'userId' }),
61
+ __metadata("design:type", user_1.User)
62
+ ], ConversationParticipant.prototype, "user", void 0);
63
+ exports.ConversationParticipant = ConversationParticipant = __decorate([
64
+ (0, typeorm_1.Entity)({ name: 'conversation_participants' }),
65
+ __metadata("design:paramtypes", [Number, Number, Number, Date,
66
+ Date,
67
+ Date])
68
+ ], ConversationParticipant);
@@ -0,0 +1,27 @@
1
+ import { BaseModel } from './BaseModel';
2
+ import { Conversation } from './ConversationModel';
3
+ import { User } from './user';
4
+ export declare enum MessageType {
5
+ TEXT = "text",
6
+ IMAGE = "image",
7
+ VIDEO = "video",
8
+ FILE = "file",
9
+ LINK = "link"
10
+ }
11
+ export declare class Message extends BaseModel {
12
+ conversationId: number;
13
+ senderId: number;
14
+ content?: string;
15
+ messageType: MessageType;
16
+ replyToMessageId?: number;
17
+ createdAt: Date;
18
+ isDeleted: boolean;
19
+ attachmentUrl?: string;
20
+ attachmentFileType?: string;
21
+ attachmentFileName?: string;
22
+ attachmentFileSize?: number;
23
+ deletedAt?: Date;
24
+ conversation?: Conversation;
25
+ sender?: User;
26
+ constructor(conversationId?: number, senderId?: number, content?: string, messageType?: MessageType, replyToMessageId?: number, createdAt?: Date, isDeleted?: boolean, attachmentUrl?: string, attachmentFileType?: string, attachmentFileName?: string, attachmentFileSize?: number, deletedAt?: Date);
27
+ }
@@ -0,0 +1,108 @@
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.Message = exports.MessageType = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ const ConversationModel_1 = require("./ConversationModel");
16
+ const user_1 = require("./user");
17
+ var MessageType;
18
+ (function (MessageType) {
19
+ MessageType["TEXT"] = "text";
20
+ MessageType["IMAGE"] = "image";
21
+ MessageType["VIDEO"] = "video";
22
+ MessageType["FILE"] = "file";
23
+ MessageType["LINK"] = "link";
24
+ })(MessageType || (exports.MessageType = MessageType = {}));
25
+ let Message = class Message extends BaseModel_1.BaseModel {
26
+ constructor(conversationId, senderId, content, messageType, replyToMessageId, createdAt, isDeleted, attachmentUrl, attachmentFileType, attachmentFileName, attachmentFileSize, deletedAt) {
27
+ super();
28
+ this.conversationId = conversationId || 0;
29
+ this.senderId = senderId || 0;
30
+ this.content = content || '';
31
+ this.messageType = messageType || MessageType.TEXT;
32
+ this.replyToMessageId = replyToMessageId;
33
+ this.createdAt = createdAt || new Date();
34
+ this.isDeleted = isDeleted || false;
35
+ this.attachmentUrl = attachmentUrl;
36
+ this.attachmentFileType = attachmentFileType;
37
+ this.attachmentFileName = attachmentFileName;
38
+ this.attachmentFileSize = attachmentFileSize;
39
+ this.deletedAt = deletedAt;
40
+ }
41
+ };
42
+ exports.Message = Message;
43
+ __decorate([
44
+ (0, typeorm_1.Column)({ type: 'bigint' }),
45
+ __metadata("design:type", Number)
46
+ ], Message.prototype, "conversationId", void 0);
47
+ __decorate([
48
+ (0, typeorm_1.Column)({ type: 'int' }),
49
+ __metadata("design:type", Number)
50
+ ], Message.prototype, "senderId", void 0);
51
+ __decorate([
52
+ (0, typeorm_1.Column)({ type: 'text', nullable: true, default: '' }),
53
+ __metadata("design:type", String)
54
+ ], Message.prototype, "content", void 0);
55
+ __decorate([
56
+ (0, typeorm_1.Column)({
57
+ type: 'enum',
58
+ enum: MessageType,
59
+ default: MessageType.TEXT
60
+ }),
61
+ __metadata("design:type", String)
62
+ ], Message.prototype, "messageType", void 0);
63
+ __decorate([
64
+ (0, typeorm_1.Column)({ type: 'bigint', nullable: true }),
65
+ __metadata("design:type", Number)
66
+ ], Message.prototype, "replyToMessageId", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
69
+ __metadata("design:type", Date)
70
+ ], Message.prototype, "createdAt", void 0);
71
+ __decorate([
72
+ (0, typeorm_1.Column)({ type: 'boolean', default: false }),
73
+ __metadata("design:type", Boolean)
74
+ ], Message.prototype, "isDeleted", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
77
+ __metadata("design:type", String)
78
+ ], Message.prototype, "attachmentUrl", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: true }),
81
+ __metadata("design:type", String)
82
+ ], Message.prototype, "attachmentFileType", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
85
+ __metadata("design:type", String)
86
+ ], Message.prototype, "attachmentFileName", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
89
+ __metadata("design:type", Number)
90
+ ], Message.prototype, "attachmentFileSize", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
93
+ __metadata("design:type", Date)
94
+ ], Message.prototype, "deletedAt", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.ManyToOne)(() => ConversationModel_1.Conversation, conversation => conversation.messages),
97
+ (0, typeorm_1.JoinColumn)({ name: 'conversationId' }),
98
+ __metadata("design:type", ConversationModel_1.Conversation)
99
+ ], Message.prototype, "conversation", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.ManyToOne)(() => user_1.User),
102
+ (0, typeorm_1.JoinColumn)({ name: 'senderId' }),
103
+ __metadata("design:type", user_1.User)
104
+ ], Message.prototype, "sender", void 0);
105
+ exports.Message = Message = __decorate([
106
+ (0, typeorm_1.Entity)({ name: 'messages' }),
107
+ __metadata("design:paramtypes", [Number, Number, String, String, Number, Date, Boolean, String, String, String, Number, Date])
108
+ ], Message);
@@ -0,0 +1,11 @@
1
+ import { BaseModel } from './BaseModel';
2
+ export declare class Faqs extends BaseModel {
3
+ question: string;
4
+ answer: string;
5
+ category_Id: number;
6
+ sub_category_Id: number;
7
+ department_Id: number;
8
+ like_count: number;
9
+ dislike_count: number;
10
+ constructor(question: string, answer: string, category_Id: number, sub_category_Id: number, department_Id: number);
11
+ }
@@ -0,0 +1,57 @@
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.Faqs = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ let Faqs = class Faqs extends BaseModel_1.BaseModel {
16
+ constructor(question, answer, category_Id, sub_category_Id, department_Id) {
17
+ super();
18
+ this.question = question,
19
+ this.answer = answer,
20
+ this.category_Id = category_Id,
21
+ this.sub_category_Id = sub_category_Id,
22
+ this.department_Id = department_Id;
23
+ }
24
+ };
25
+ exports.Faqs = Faqs;
26
+ __decorate([
27
+ (0, typeorm_1.Column)({ nullable: true }),
28
+ __metadata("design:type", String)
29
+ ], Faqs.prototype, "question", void 0);
30
+ __decorate([
31
+ (0, typeorm_1.Column)({ nullable: true }),
32
+ __metadata("design:type", String)
33
+ ], Faqs.prototype, "answer", void 0);
34
+ __decorate([
35
+ (0, typeorm_1.Column)({ nullable: true }),
36
+ __metadata("design:type", Number)
37
+ ], Faqs.prototype, "category_Id", void 0);
38
+ __decorate([
39
+ (0, typeorm_1.Column)({ nullable: true }),
40
+ __metadata("design:type", Number)
41
+ ], Faqs.prototype, "sub_category_Id", void 0);
42
+ __decorate([
43
+ (0, typeorm_1.Column)({ nullable: true }),
44
+ __metadata("design:type", Number)
45
+ ], Faqs.prototype, "department_Id", void 0);
46
+ __decorate([
47
+ (0, typeorm_1.Column)({ nullable: true, default: 0 }),
48
+ __metadata("design:type", Number)
49
+ ], Faqs.prototype, "like_count", void 0);
50
+ __decorate([
51
+ (0, typeorm_1.Column)({ nullable: true, default: 0 }),
52
+ __metadata("design:type", Number)
53
+ ], Faqs.prototype, "dislike_count", void 0);
54
+ exports.Faqs = Faqs = __decorate([
55
+ (0, typeorm_1.Entity)({ name: 'faqs' }),
56
+ __metadata("design:paramtypes", [String, String, Number, Number, Number])
57
+ ], Faqs);
@@ -0,0 +1,6 @@
1
+ import { BaseModel } from './BaseModel';
2
+ export declare class QuestionTags extends BaseModel {
3
+ name: string;
4
+ question_Id: number;
5
+ constructor(name: string, question_Id: number);
6
+ }
@@ -0,0 +1,34 @@
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.QuestionTags = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const BaseModel_1 = require("./BaseModel");
15
+ let QuestionTags = class QuestionTags extends BaseModel_1.BaseModel {
16
+ constructor(name, question_Id) {
17
+ super();
18
+ this.name = name,
19
+ this.question_Id = question_Id;
20
+ }
21
+ };
22
+ exports.QuestionTags = QuestionTags;
23
+ __decorate([
24
+ (0, typeorm_1.Column)({ nullable: true }),
25
+ __metadata("design:type", String)
26
+ ], QuestionTags.prototype, "name", void 0);
27
+ __decorate([
28
+ (0, typeorm_1.Column)({ nullable: true }),
29
+ __metadata("design:type", Number)
30
+ ], QuestionTags.prototype, "question_Id", void 0);
31
+ exports.QuestionTags = QuestionTags = __decorate([
32
+ (0, typeorm_1.Entity)({ name: 'question_tags' }),
33
+ __metadata("design:paramtypes", [String, Number])
34
+ ], QuestionTags);
@@ -27,5 +27,6 @@ export declare class User extends BaseModel {
27
27
  address?: string;
28
28
  residential_status?: string;
29
29
  religion?: string;
30
- constructor(employee_id?: number, employee_name?: string, employee_arabic_name?: string, date_of_birth?: string, region_of_birth?: string, country_of_birth?: string, date_of_joining?: string, last_promotion_date?: string, gender?: string, marital_status?: string, nationality?: string, email?: string, blood_group?: string, national_id?: number, mobile?: string, department?: number, section?: number, grade?: number, location?: string, country?: string, is_admin?: boolean, division?: number, reporting_to?: number, address?: string, residential_status?: string, religion?: string, designation?: number);
30
+ avatar?: string;
31
+ constructor(employee_id?: number, employee_name?: string, employee_arabic_name?: string, date_of_birth?: string, region_of_birth?: string, country_of_birth?: string, date_of_joining?: string, last_promotion_date?: string, gender?: string, marital_status?: string, nationality?: string, email?: string, blood_group?: string, national_id?: number, mobile?: string, department?: number, section?: number, grade?: number, location?: string, country?: string, is_admin?: boolean, division?: number, reporting_to?: number, address?: string, residential_status?: string, religion?: string, designation?: number, avatar?: string);
31
32
  }
@@ -13,7 +13,7 @@ exports.User = void 0;
13
13
  const typeorm_1 = require("typeorm");
14
14
  const BaseModel_1 = require("./BaseModel");
15
15
  let User = class User extends BaseModel_1.BaseModel {
16
- constructor(employee_id, employee_name, employee_arabic_name, date_of_birth, region_of_birth, country_of_birth, date_of_joining, last_promotion_date, gender, marital_status, nationality, email, blood_group, national_id, mobile, department, section, grade, location, country, is_admin, division, reporting_to, address, residential_status, religion, designation) {
16
+ constructor(employee_id, employee_name, employee_arabic_name, date_of_birth, region_of_birth, country_of_birth, date_of_joining, last_promotion_date, gender, marital_status, nationality, email, blood_group, national_id, mobile, department, section, grade, location, country, is_admin, division, reporting_to, address, residential_status, religion, designation, avatar) {
17
17
  super();
18
18
  this.employee_id = employee_id;
19
19
  this.employee_name = employee_name;
@@ -42,6 +42,7 @@ let User = class User extends BaseModel_1.BaseModel {
42
42
  this.residential_status = residential_status;
43
43
  this.religion = religion;
44
44
  this.designation = designation;
45
+ this.avatar = avatar;
45
46
  }
46
47
  };
47
48
  exports.User = User;
@@ -153,7 +154,11 @@ __decorate([
153
154
  (0, typeorm_1.Column)({ nullable: true }),
154
155
  __metadata("design:type", String)
155
156
  ], User.prototype, "religion", void 0);
157
+ __decorate([
158
+ (0, typeorm_1.Column)({ nullable: true }),
159
+ __metadata("design:type", String)
160
+ ], User.prototype, "avatar", void 0);
156
161
  exports.User = User = __decorate([
157
162
  (0, typeorm_1.Entity)({ name: 'users' }),
158
- __metadata("design:paramtypes", [Number, String, String, String, String, String, String, String, String, String, String, String, String, Number, String, Number, Number, Number, String, String, Boolean, Number, Number, String, String, String, Number])
163
+ __metadata("design:paramtypes", [Number, String, String, String, String, String, String, String, String, String, String, String, String, Number, String, Number, Number, Number, String, String, Boolean, Number, Number, String, String, String, Number, String])
159
164
  ], User);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-modules/foreign-ministry",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -23,6 +23,11 @@ import { Departments } from './models/DepartmentsModel';
23
23
  import { Division } from './models/DivisionModel';
24
24
 
25
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';
26
31
 
27
32
 
28
33
  export const AppDataSource = new DataSource({
@@ -53,6 +58,11 @@ export const AppDataSource = new DataSource({
53
58
  Sections,
54
59
  Designation,
55
60
  Departments,
56
- Division
61
+ Division,
62
+ Faqs,
63
+ QuestionTags,
64
+ Conversation,
65
+ ConversationParticipant,
66
+ Message
57
67
  ],
58
68
  });
package/src/index.ts CHANGED
@@ -16,4 +16,9 @@ export * from './models/LeaveWorkFlowModel';
16
16
  export * from './models/SectionModel';
17
17
  export * from './models/DesignationModel';
18
18
  export * from './models/DepartmentsModel';
19
- export * from './models/DivisionModel';
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';
@@ -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,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,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
+ }
@@ -85,6 +85,9 @@ export class User extends BaseModel {
85
85
  @Column({ nullable: true })
86
86
  religion?: string;
87
87
 
88
+ @Column({ nullable: true })
89
+ avatar?: string;
90
+
88
91
  constructor(
89
92
  employee_id?: number,
90
93
  employee_name?: string,
@@ -113,6 +116,7 @@ export class User extends BaseModel {
113
116
  residential_status?: string,
114
117
  religion?: string,
115
118
  designation?: number,
119
+ avatar?: string,
116
120
  ) {
117
121
  super();
118
122
  this.employee_id = employee_id;
@@ -142,5 +146,6 @@ export class User extends BaseModel {
142
146
  this.residential_status = residential_status;
143
147
  this.religion = religion;
144
148
  this.designation = designation;
149
+ this.avatar = avatar;
145
150
  }
146
151
  }
@@ -1,13 +0,0 @@
1
- import { BaseModel } from './BaseModel';
2
- export declare enum ApprovalStatus {
3
- PENDING = "Pending",
4
- APPROVED = "Approved",
5
- REJECTED = "Rejected"
6
- }
7
- export declare class LeaveApprovalDetails extends BaseModel {
8
- leave_request_id: number;
9
- level: number;
10
- approver_id: number;
11
- approval_status: ApprovalStatus;
12
- constructor(leave_request_id: number, approver_id: number, approval_status: ApprovalStatus, level: number);
13
- }
@@ -1,51 +0,0 @@
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.LeaveApprovalDetails = exports.ApprovalStatus = void 0;
13
- const typeorm_1 = require("typeorm");
14
- const BaseModel_1 = require("./BaseModel");
15
- var ApprovalStatus;
16
- (function (ApprovalStatus) {
17
- ApprovalStatus["PENDING"] = "Pending";
18
- ApprovalStatus["APPROVED"] = "Approved";
19
- ApprovalStatus["REJECTED"] = "Rejected";
20
- })(ApprovalStatus || (exports.ApprovalStatus = ApprovalStatus = {}));
21
- //This model is used to store the store the leave apporval details of the user for the leave request
22
- let LeaveApprovalDetails = class LeaveApprovalDetails extends BaseModel_1.BaseModel {
23
- constructor(leave_request_id, approver_id, approval_status, level) {
24
- super();
25
- this.leave_request_id = leave_request_id;
26
- this.approver_id = approver_id;
27
- this.approval_status = approval_status;
28
- this.level = level;
29
- }
30
- };
31
- exports.LeaveApprovalDetails = LeaveApprovalDetails;
32
- __decorate([
33
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
34
- __metadata("design:type", Number)
35
- ], LeaveApprovalDetails.prototype, "leave_request_id", void 0);
36
- __decorate([
37
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
38
- __metadata("design:type", Number)
39
- ], LeaveApprovalDetails.prototype, "level", void 0);
40
- __decorate([
41
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
42
- __metadata("design:type", Number)
43
- ], LeaveApprovalDetails.prototype, "approver_id", void 0);
44
- __decorate([
45
- (0, typeorm_1.Column)({ type: 'enum', enum: ApprovalStatus, default: ApprovalStatus.PENDING, nullable: false }),
46
- __metadata("design:type", String)
47
- ], LeaveApprovalDetails.prototype, "approval_status", void 0);
48
- exports.LeaveApprovalDetails = LeaveApprovalDetails = __decorate([
49
- (0, typeorm_1.Entity)({ name: 'leave_approval_details' }),
50
- __metadata("design:paramtypes", [Number, Number, String, Number])
51
- ], LeaveApprovalDetails);
@@ -1,7 +0,0 @@
1
- import { BaseModel } from './BaseModel';
2
- export declare class LeaveApprovalMatrix extends BaseModel {
3
- leave_type: number;
4
- level: number;
5
- approval_matrix: string;
6
- constructor(leave_type: number, level: number, approval_matrix: string);
7
- }
@@ -1,40 +0,0 @@
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.LeaveApprovalMatrix = void 0;
13
- const typeorm_1 = require("typeorm");
14
- const BaseModel_1 = require("./BaseModel");
15
- //This model is used to store the store the leave apporval matrix(HOD, Manager, HR, Director) based on leave type along with the levels
16
- let LeaveApprovalMatrix = class LeaveApprovalMatrix extends BaseModel_1.BaseModel {
17
- constructor(leave_type, level, approval_matrix) {
18
- super();
19
- this.leave_type = leave_type;
20
- this.level = level;
21
- this.approval_matrix = approval_matrix;
22
- }
23
- };
24
- exports.LeaveApprovalMatrix = LeaveApprovalMatrix;
25
- __decorate([
26
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
27
- __metadata("design:type", Number)
28
- ], LeaveApprovalMatrix.prototype, "leave_type", void 0);
29
- __decorate([
30
- (0, typeorm_1.Column)({ type: 'int', nullable: false }),
31
- __metadata("design:type", Number)
32
- ], LeaveApprovalMatrix.prototype, "level", void 0);
33
- __decorate([
34
- (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: false }),
35
- __metadata("design:type", String)
36
- ], LeaveApprovalMatrix.prototype, "approval_matrix", void 0);
37
- exports.LeaveApprovalMatrix = LeaveApprovalMatrix = __decorate([
38
- (0, typeorm_1.Entity)({ name: 'leave_approval_matrix' }),
39
- __metadata("design:paramtypes", [Number, Number, String])
40
- ], LeaveApprovalMatrix);