@duvdu-v1/duvdu 1.1.290 → 1.1.293

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.
@@ -41,7 +41,7 @@ const getRedisConfig = () => {
41
41
  if (times > 3)
42
42
  return null;
43
43
  return Math.min(times * 100, 3000);
44
- }
44
+ },
45
45
  };
46
46
  };
47
47
  // Get Redis client info to monitor connections
@@ -25,8 +25,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Ticket = void 0;
27
27
  const mongoose_1 = __importStar(require("mongoose"));
28
+ const all_contracts_model_1 = require("./all-contracts.model");
28
29
  const model_names_1 = require("../types/model-names");
29
30
  const ticketSchema = new mongoose_1.default.Schema({
31
+ ticketNumber: { type: String, default: all_contracts_model_1.generateTicketNumber, unique: true, sparse: true },
30
32
  userId: {
31
33
  type: mongoose_1.default.Schema.Types.ObjectId,
32
34
  ref: model_names_1.MODELS.user,
@@ -24,6 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { Types } from 'mongoose';
26
26
  import { Iuser } from '../types/User';
27
+ export declare const generateTicketNumber: () => string;
27
28
  export interface Icontract {
28
29
  id: string;
29
30
  customer: Types.ObjectId | Iuser;
@@ -32,6 +33,7 @@ export interface Icontract {
32
33
  ref: string;
33
34
  cycle: string;
34
35
  coupons: Types.ObjectId[];
36
+ ticketNumber: string;
35
37
  }
36
38
  export declare const Contracts: import("mongoose").Model<Icontract, {}, {}, {}, import("mongoose").Document<unknown, {}, Icontract> & Icontract & {
37
39
  _id: Types.ObjectId;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContractReports = exports.Contracts = void 0;
3
+ exports.ContractReports = exports.Contracts = exports.generateTicketNumber = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const model_names_1 = require("../types/model-names");
6
6
  // Function to generate simple unique ticket number
@@ -8,6 +8,7 @@ const generateTicketNumber = () => {
8
8
  const random = Math.floor(100000 + Math.random() * 900000); // 6-digit random number
9
9
  return `TKT${random}`;
10
10
  };
11
+ exports.generateTicketNumber = generateTicketNumber;
11
12
  exports.Contracts = (0, mongoose_1.model)(model_names_1.MODELS.allContracts, new mongoose_1.Schema({
12
13
  customer: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
13
14
  sp: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
@@ -15,22 +16,25 @@ exports.Contracts = (0, mongoose_1.model)(model_names_1.MODELS.allContracts, new
15
16
  ref: String,
16
17
  cycle: { type: String, default: null },
17
18
  coupons: [{ type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.coupon }],
19
+ ticketNumber: { type: String, default: null },
18
20
  }, { timestamps: true, collection: model_names_1.MODELS.allContracts }));
19
21
  exports.ContractReports = (0, mongoose_1.model)(model_names_1.MODELS.contractReports, new mongoose_1.Schema({
20
- ticketNumber: { type: String, default: generateTicketNumber, unique: true },
22
+ ticketNumber: { type: String, default: exports.generateTicketNumber, unique: true },
21
23
  reporter: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
22
24
  contract: { type: mongoose_1.Schema.Types.ObjectId, refPath: 'ref' },
23
25
  ref: String,
24
26
  desc: { type: String, default: null },
25
27
  attachments: [String],
26
- state: [{
28
+ state: [
29
+ {
27
30
  addedBy: {
28
31
  type: mongoose_1.Schema.Types.ObjectId,
29
32
  ref: model_names_1.MODELS.user,
30
33
  default: null,
31
34
  },
32
35
  feedback: { type: String, default: null },
33
- }],
36
+ },
37
+ ],
34
38
  isClosed: {
35
39
  type: Boolean,
36
40
  default: false,
@@ -51,7 +51,7 @@ exports.Message = (0, mongoose_1.model)(model_names_1.MODELS.messages, new mongo
51
51
  transform(doc, ret) {
52
52
  // Handle media array - transform URLs for each media item
53
53
  if (ret.media && Array.isArray(ret.media)) {
54
- ret.media = ret.media.map(mediaItem => {
54
+ ret.media = ret.media.map((mediaItem) => {
55
55
  if (mediaItem === null || mediaItem === void 0 ? void 0 : mediaItem.url) {
56
56
  return Object.assign(Object.assign({}, mediaItem), { url: process.env.BUCKET_HOST + '/' + mediaItem.url });
57
57
  }
@@ -31,6 +31,7 @@ export declare enum InviteStatus {
31
31
  }
32
32
  export interface IprojectCycle {
33
33
  user: Types.ObjectId | Iuser;
34
+ ticketNumber: string;
34
35
  category: Types.ObjectId | Iuser;
35
36
  subCategory: {
36
37
  ar: string;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProjectCycle = exports.InviteStatus = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
+ const all_contracts_model_1 = require("./all-contracts.model");
5
6
  const model_names_1 = require("../types/model-names");
6
7
  var InviteStatus;
7
8
  (function (InviteStatus) {
@@ -11,6 +12,7 @@ var InviteStatus;
11
12
  })(InviteStatus || (exports.InviteStatus = InviteStatus = {}));
12
13
  exports.ProjectCycle = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPost, new mongoose_1.Schema({
13
14
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
15
+ ticketNumber: { type: String, default: all_contracts_model_1.generateTicketNumber, unique: true, sparse: true },
14
16
  category: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.category },
15
17
  subCategory: {
16
18
  ar: { type: String, default: null },
@@ -33,6 +33,7 @@ export declare enum ContractStatus {
33
33
  complaint = "complaint"
34
34
  }
35
35
  export interface IproducerContarct {
36
+ ticketNumber: string;
36
37
  producer: Types.ObjectId | Iuser;
37
38
  sp: Types.ObjectId | Iuser;
38
39
  user: Types.ObjectId | Iuser;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProducerContract = exports.ContractStatus = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
+ const all_contracts_model_1 = require("./all-contracts.model");
5
6
  const model_names_1 = require("../types/model-names");
6
7
  var ContractStatus;
7
8
  (function (ContractStatus) {
@@ -13,6 +14,7 @@ var ContractStatus;
13
14
  ContractStatus["complaint"] = "complaint";
14
15
  })(ContractStatus || (exports.ContractStatus = ContractStatus = {}));
15
16
  exports.ProducerContract = (0, mongoose_1.model)(model_names_1.MODELS.producerContract, new mongoose_1.Schema({
17
+ ticketNumber: { type: String, default: all_contracts_model_1.generateTicketNumber, unique: true, sparse: true },
16
18
  producer: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
17
19
  sp: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
18
20
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
@@ -39,6 +39,7 @@ export declare enum ProjectContractStatus {
39
39
  }
40
40
  export interface IprojectContract {
41
41
  sp: Types.ObjectId | Iuser;
42
+ ticketNumber: string;
42
43
  customer: Types.ObjectId | Iuser;
43
44
  project: Types.ObjectId | IprojectCycle;
44
45
  tools: {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProjectContract = exports.ProjectContractStatus = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
+ const all_contracts_model_1 = require("./all-contracts.model");
5
6
  const copyright_contract_model_1 = require("./copyright-contract.model");
6
7
  const model_names_1 = require("../types/model-names");
7
8
  var ProjectContractStatus;
@@ -18,6 +19,7 @@ var ProjectContractStatus;
18
19
  })(ProjectContractStatus || (exports.ProjectContractStatus = ProjectContractStatus = {}));
19
20
  exports.ProjectContract = (0, mongoose_1.model)(model_names_1.MODELS.projectContract, new mongoose_1.Schema({
20
21
  sp: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
22
+ ticketNumber: { type: String, default: all_contracts_model_1.generateTicketNumber, unique: true, sparse: true },
21
23
  customer: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
22
24
  project: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.portfolioPost },
23
25
  tools: [
@@ -77,3 +79,4 @@ exports.ProjectContract = (0, mongoose_1.model)(model_names_1.MODELS.projectCont
77
79
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user, default: null },
78
80
  },
79
81
  }, { timestamps: true, collection: model_names_1.MODELS.projectContract }));
82
+ // i need here add ticket number to the project contract by default
@@ -36,6 +36,7 @@ export declare enum RentalContractStatus {
36
36
  }
37
37
  export interface IrentalContract {
38
38
  id: string;
39
+ ticketNumber: string;
39
40
  customer: Types.ObjectId | Iuser;
40
41
  sp: Types.ObjectId | Iuser;
41
42
  project: Types.ObjectId | Irental;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RentalContracts = exports.RentalContractStatus = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
+ const all_contracts_model_1 = require("./all-contracts.model");
5
6
  const model_names_1 = require("../types/model-names");
6
7
  var RentalContractStatus;
7
8
  (function (RentalContractStatus) {
@@ -14,6 +15,7 @@ var RentalContractStatus;
14
15
  RentalContractStatus["complaint"] = "complaint";
15
16
  })(RentalContractStatus || (exports.RentalContractStatus = RentalContractStatus = {}));
16
17
  exports.RentalContracts = (0, mongoose_1.model)(model_names_1.MODELS.rentalContract, new mongoose_1.Schema({
18
+ ticketNumber: { type: String, default: all_contracts_model_1.generateTicketNumber, unique: true, sparse: true },
17
19
  customer: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
18
20
  sp: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
19
21
  project: { type: mongoose_1.Schema.Types.ObjectId, ref: 'rentals' },
@@ -34,6 +34,7 @@ export declare enum RentalUnits {
34
34
  }
35
35
  export interface Irental {
36
36
  id: string;
37
+ ticketNumber: string;
37
38
  user: Types.ObjectId | Iuser;
38
39
  category: Types.ObjectId | Icategory;
39
40
  subCategory: {
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Rentals = exports.RentalUnits = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
+ const all_contracts_model_1 = require("./all-contracts.model");
5
6
  const model_names_1 = require("../types/model-names");
6
7
  var RentalUnits;
7
8
  (function (RentalUnits) {
@@ -13,6 +14,7 @@ var RentalUnits;
13
14
  })(RentalUnits || (exports.RentalUnits = RentalUnits = {}));
14
15
  exports.Rentals = (0, mongoose_1.model)('rentals', new mongoose_1.Schema({
15
16
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
17
+ ticketNumber: { type: String, default: all_contracts_model_1.generateTicketNumber, unique: true, sparse: true },
16
18
  category: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.category },
17
19
  subCategory: { ar: String, en: String, _id: String },
18
20
  tags: [{ ar: String, en: String }],
@@ -25,6 +25,7 @@
25
25
  import { Types } from 'mongoose';
26
26
  import { Iuser } from '../types/User';
27
27
  export interface Ireport {
28
+ ticketNumber: string;
28
29
  sourceUser: Types.ObjectId | Iuser;
29
30
  project: Types.ObjectId;
30
31
  desc: string;
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Report = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
+ const all_contracts_model_1 = require("./all-contracts.model");
5
6
  const model_names_1 = require("../types/model-names");
6
7
  exports.Report = (0, mongoose_1.model)(model_names_1.MODELS.report, new mongoose_1.Schema({
8
+ ticketNumber: { type: String, default: all_contracts_model_1.generateTicketNumber, unique: true, sparse: true },
7
9
  sourceUser: {
8
10
  type: mongoose_1.Schema.Types.ObjectId,
9
11
  ref: model_names_1.MODELS.user,
@@ -28,6 +28,7 @@ import { Icategory } from '../types/Category';
28
28
  import { Iuser } from '../types/User';
29
29
  export interface ITeamProject {
30
30
  user: Types.ObjectId | Iuser;
31
+ ticketNumber: string;
31
32
  cover: string;
32
33
  title: string;
33
34
  desc: string;
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TeamProject = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
+ const all_contracts_model_1 = require("./all-contracts.model");
5
6
  const cycles_1 = require("../types/cycles");
6
7
  const model_names_1 = require("../types/model-names");
7
8
  exports.TeamProject = (0, mongoose_1.model)(model_names_1.MODELS.teamProject, new mongoose_1.Schema({
8
9
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
10
+ ticketNumber: { type: String, default: all_contracts_model_1.generateTicketNumber, unique: true, sparse: true },
9
11
  cover: { type: String, default: null },
10
12
  title: { type: String, default: null },
11
13
  desc: { type: String, default: null },
@@ -25,6 +25,11 @@ export declare enum PERMISSIONS {
25
25
  listComplaints = "list-complaints",
26
26
  updateComplaint = "update-complaint",
27
27
  closeComplaint = "close-complaint",
28
+ listContracts = "list-contracts",
29
+ listContractsAnalysis = "list-contracts-analysis",
30
+ listCancelContracts = "list-cancel-contracts",
31
+ acceptCancelContract = "accept-cancel-contract",
32
+ deleteCancelContract = "delete-cancel-contract",
28
33
  bookmarks = "bookmarks",
29
34
  createTicket = "create ticket",
30
35
  getAllTickets = "get-all-tickets",
@@ -70,10 +75,7 @@ export declare enum PERMISSIONS {
70
75
  accessDashboard = "access dashboard",
71
76
  createPlatform = "create producer platform",
72
77
  updatePlatform = "update producer platform",
73
- getPlatform = "get producer platform",
74
- getContractsCancel = "get contracts cancel",
75
- deleteContractCancel = "delete contract cancel",
76
- acceptContractCancel = "accept contract cancel"
78
+ getPlatform = "get producer platform"
77
79
  }
78
80
  export declare const permissions: {
79
81
  all: PERMISSIONS[];
@@ -84,6 +86,7 @@ export declare const permissions: {
84
86
  projects: PERMISSIONS[];
85
87
  withdrawMethods: PERMISSIONS[];
86
88
  complaint: PERMISSIONS[];
89
+ contract: PERMISSIONS[];
87
90
  bookmarks: PERMISSIONS[];
88
91
  ticket: PERMISSIONS[];
89
92
  terms: PERMISSIONS[];
@@ -97,5 +100,4 @@ export declare const permissions: {
97
100
  producer: PERMISSIONS[];
98
101
  dashboard: PERMISSIONS[];
99
102
  producerPlatform: PERMISSIONS[];
100
- contractCancel: PERMISSIONS[];
101
103
  };
@@ -36,6 +36,12 @@ var PERMISSIONS;
36
36
  PERMISSIONS["listComplaints"] = "list-complaints";
37
37
  PERMISSIONS["updateComplaint"] = "update-complaint";
38
38
  PERMISSIONS["closeComplaint"] = "close-complaint";
39
+ // contract
40
+ PERMISSIONS["listContracts"] = "list-contracts";
41
+ PERMISSIONS["listContractsAnalysis"] = "list-contracts-analysis";
42
+ PERMISSIONS["listCancelContracts"] = "list-cancel-contracts";
43
+ PERMISSIONS["acceptCancelContract"] = "accept-cancel-contract";
44
+ PERMISSIONS["deleteCancelContract"] = "delete-cancel-contract";
39
45
  PERMISSIONS["bookmarks"] = "bookmarks";
40
46
  PERMISSIONS["createTicket"] = "create ticket";
41
47
  PERMISSIONS["getAllTickets"] = "get-all-tickets";
@@ -93,10 +99,6 @@ var PERMISSIONS;
93
99
  PERMISSIONS["createPlatform"] = "create producer platform";
94
100
  PERMISSIONS["updatePlatform"] = "update producer platform";
95
101
  PERMISSIONS["getPlatform"] = "get producer platform";
96
- // contract cancel
97
- PERMISSIONS["getContractsCancel"] = "get contracts cancel";
98
- PERMISSIONS["deleteContractCancel"] = "delete contract cancel";
99
- PERMISSIONS["acceptContractCancel"] = "accept contract cancel";
100
102
  })(PERMISSIONS || (exports.PERMISSIONS = PERMISSIONS = {}));
101
103
  exports.permissions = {
102
104
  all: [
@@ -128,6 +130,11 @@ exports.permissions = {
128
130
  PERMISSIONS.listComplaints,
129
131
  PERMISSIONS.updateComplaint,
130
132
  PERMISSIONS.closeComplaint,
133
+ PERMISSIONS.listContracts,
134
+ PERMISSIONS.listContractsAnalysis,
135
+ PERMISSIONS.listCancelContracts,
136
+ PERMISSIONS.acceptCancelContract,
137
+ PERMISSIONS.deleteCancelContract,
131
138
  ],
132
139
  category: [
133
140
  PERMISSIONS.createCategory,
@@ -152,24 +159,21 @@ exports.permissions = {
152
159
  PERMISSIONS.unBlockUser,
153
160
  PERMISSIONS.removeUser,
154
161
  ],
155
- messages: [
156
- PERMISSIONS.listMessagesFromTo,
157
- PERMISSIONS.sendNotificationToUsers,
158
- ],
162
+ messages: [PERMISSIONS.listMessagesFromTo, PERMISSIONS.sendNotificationToUsers],
159
163
  projects: [
160
164
  PERMISSIONS.listProjects,
161
165
  PERMISSIONS.updateProject,
162
166
  PERMISSIONS.removeProject,
163
167
  PERMISSIONS.getProjectAnalysis,
164
168
  ],
165
- withdrawMethods: [
166
- PERMISSIONS.listWithdrawMethods,
167
- PERMISSIONS.updateWithdrawMethod,
168
- ],
169
- complaint: [
170
- PERMISSIONS.listComplaints,
171
- PERMISSIONS.updateComplaint,
172
- PERMISSIONS.closeComplaint,
169
+ withdrawMethods: [PERMISSIONS.listWithdrawMethods, PERMISSIONS.updateWithdrawMethod],
170
+ complaint: [PERMISSIONS.listComplaints, PERMISSIONS.updateComplaint, PERMISSIONS.closeComplaint],
171
+ contract: [
172
+ PERMISSIONS.listContracts,
173
+ PERMISSIONS.listContractsAnalysis,
174
+ PERMISSIONS.listCancelContracts,
175
+ PERMISSIONS.acceptCancelContract,
176
+ PERMISSIONS.deleteCancelContract,
173
177
  ],
174
178
  bookmarks: [PERMISSIONS.bookmarks],
175
179
  ticket: [
@@ -228,9 +232,4 @@ exports.permissions = {
228
232
  PERMISSIONS.createPlatform,
229
233
  PERMISSIONS.updatePlatform,
230
234
  ],
231
- contractCancel: [
232
- PERMISSIONS.getContractsCancel,
233
- PERMISSIONS.deleteContractCancel,
234
- PERMISSIONS.acceptContractCancel,
235
- ],
236
235
  };
@@ -26,6 +26,7 @@ import { Types } from 'mongoose';
26
26
  import { Iuser } from './User';
27
27
  export interface Iticket {
28
28
  id: string;
29
+ ticketNumber: string;
29
30
  userId: Types.ObjectId | Iuser;
30
31
  name: string;
31
32
  phoneNumber: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.290",
3
+ "version": "1.1.293",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [