@duvdu-v1/duvdu 1.1.291 → 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 },
@@ -159,25 +159,15 @@ exports.permissions = {
159
159
  PERMISSIONS.unBlockUser,
160
160
  PERMISSIONS.removeUser,
161
161
  ],
162
- messages: [
163
- PERMISSIONS.listMessagesFromTo,
164
- PERMISSIONS.sendNotificationToUsers,
165
- ],
162
+ messages: [PERMISSIONS.listMessagesFromTo, PERMISSIONS.sendNotificationToUsers],
166
163
  projects: [
167
164
  PERMISSIONS.listProjects,
168
165
  PERMISSIONS.updateProject,
169
166
  PERMISSIONS.removeProject,
170
167
  PERMISSIONS.getProjectAnalysis,
171
168
  ],
172
- withdrawMethods: [
173
- PERMISSIONS.listWithdrawMethods,
174
- PERMISSIONS.updateWithdrawMethod,
175
- ],
176
- complaint: [
177
- PERMISSIONS.listComplaints,
178
- PERMISSIONS.updateComplaint,
179
- PERMISSIONS.closeComplaint,
180
- ],
169
+ withdrawMethods: [PERMISSIONS.listWithdrawMethods, PERMISSIONS.updateWithdrawMethod],
170
+ complaint: [PERMISSIONS.listComplaints, PERMISSIONS.updateComplaint, PERMISSIONS.closeComplaint],
181
171
  contract: [
182
172
  PERMISSIONS.listContracts,
183
173
  PERMISSIONS.listContractsAnalysis,
@@ -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.291",
3
+ "version": "1.1.293",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [