@duvdu-v1/duvdu 1.1.126 → 1.1.128

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/build/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './utils/api-feature';
10
10
  export * from './utils/generateToken';
11
11
  export * from './utils/bucket';
12
12
  export * from './utils/file';
13
+ export * from './utils/date';
13
14
  export * from './middlewares/global-error-handling.middleware';
14
15
  export * from './middlewares/database-connection';
15
16
  export * from './middlewares/global-validator.middleware';
package/build/index.js CHANGED
@@ -26,6 +26,7 @@ __exportStar(require("./utils/api-feature"), exports);
26
26
  __exportStar(require("./utils/generateToken"), exports);
27
27
  __exportStar(require("./utils/bucket"), exports);
28
28
  __exportStar(require("./utils/file"), exports);
29
+ __exportStar(require("./utils/date"), exports);
29
30
  __exportStar(require("./middlewares/global-error-handling.middleware"), exports);
30
31
  __exportStar(require("./middlewares/database-connection"), exports);
31
32
  __exportStar(require("./middlewares/global-validator.middleware"), exports);
@@ -35,3 +35,14 @@ export interface Icontract {
35
35
  export declare const Contracts: import("mongoose").Model<Icontract, {}, {}, {}, import("mongoose").Document<unknown, {}, Icontract> & Icontract & {
36
36
  _id: Types.ObjectId;
37
37
  }, any>;
38
+ export interface IcontractReport {
39
+ reporter: Types.ObjectId | Iuser;
40
+ contract: Types.ObjectId | Icontract;
41
+ ref: string;
42
+ desc: string;
43
+ createdAt: Date;
44
+ updatedAt: Date;
45
+ }
46
+ export declare const ContractReports: import("mongoose").Model<IcontractReport, {}, {}, {}, import("mongoose").Document<unknown, {}, IcontractReport> & IcontractReport & {
47
+ _id: Types.ObjectId;
48
+ }, any>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Contracts = void 0;
3
+ exports.ContractReports = exports.Contracts = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const model_names_1 = require("../types/model-names");
6
6
  exports.Contracts = (0, mongoose_1.model)('all_contracts', new mongoose_1.Schema({
@@ -8,5 +8,11 @@ exports.Contracts = (0, mongoose_1.model)('all_contracts', new mongoose_1.Schema
8
8
  sp: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
9
9
  contract: { type: mongoose_1.Schema.Types.ObjectId, refPath: 'ref' },
10
10
  ref: String,
11
- cycle: { type: String, default: null }
11
+ cycle: { type: String, default: null },
12
12
  }));
13
+ exports.ContractReports = (0, mongoose_1.model)('contract_reports', new mongoose_1.Schema({
14
+ reporter: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
15
+ contract: { type: mongoose_1.Schema.Types.ObjectId, refPath: 'ref' },
16
+ ref: String,
17
+ desc: String,
18
+ }, { collection: 'contract_reports', timestamps: true }));
@@ -22,47 +22,52 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
+ import { Iuser } from '@duvdu-v1/duvdu';
25
26
  import { Types } from 'mongoose';
26
- import { Iuser } from '../types/User';
27
- export interface IportfolioPost {
28
- id: string;
27
+ export interface IprojectCycle {
29
28
  user: Types.ObjectId | Iuser;
30
- attachments: string[];
29
+ category: Types.ObjectId | Iuser;
30
+ subCategory: {
31
+ ar: string;
32
+ en: string;
33
+ };
34
+ tags: {
35
+ ar: string;
36
+ en: string;
37
+ }[];
31
38
  cover: string;
32
- title: string;
33
- desc: string;
34
- address: string;
39
+ attachments: string[];
40
+ name: string;
41
+ description: string;
35
42
  tools: {
36
43
  name: string;
37
- fees: number;
38
- }[];
39
- searchKeywords: string[];
40
- creatives: {
41
- creative: Types.ObjectId | Iuser;
42
- fees: number;
44
+ unitPrice: number;
43
45
  }[];
44
- tags: {
45
- ar: string;
46
- en: string;
46
+ functions: {
47
+ name: string;
48
+ unitPrice: number;
47
49
  }[];
48
- subCategory: {
49
- ar: string;
50
- en: string;
50
+ creatives: Types.ObjectId[] | Iuser[];
51
+ location: {
52
+ lat: number;
53
+ lng: number;
51
54
  };
52
- projectBudget: number;
53
- category: Types.ObjectId;
55
+ address: string;
56
+ searchKeyWords: string[];
57
+ insurance: number;
58
+ showOnHome: boolean;
54
59
  projectScale: {
55
- scale: number;
56
- time: 'minutes' | 'hours';
60
+ unit: string;
61
+ minimum: number;
62
+ maximum: number;
63
+ pricerPerUnit: number;
57
64
  };
58
- showOnHome: boolean;
59
- cycle: string;
65
+ isDeleted: boolean;
60
66
  rate: {
61
67
  ratersCounter: number;
62
68
  totalRates: number;
63
69
  };
64
- isDeleted: boolean;
65
70
  }
66
- export declare const PortfolioPosts: import("mongoose").Model<IportfolioPost, {}, {}, {}, import("mongoose").Document<unknown, {}, IportfolioPost> & IportfolioPost & {
71
+ export declare const ProjectCycle: import("mongoose").Model<IprojectCycle, {}, {}, {}, import("mongoose").Document<unknown, {}, IprojectCycle> & IprojectCycle & {
67
72
  _id: Types.ObjectId;
68
73
  }, any>;
@@ -1,50 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PortfolioPosts = void 0;
3
+ exports.ProjectCycle = void 0;
4
+ const duvdu_1 = require("@duvdu-v1/duvdu");
4
5
  const mongoose_1 = require("mongoose");
5
- const cycles_1 = require("../types/cycles");
6
- const model_names_1 = require("../types/model-names");
7
- exports.PortfolioPosts = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPost, new mongoose_1.Schema({
8
- user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
9
- attachments: [String],
6
+ exports.ProjectCycle = (0, mongoose_1.model)(duvdu_1.MODELS.portfolioPost, new mongoose_1.Schema({
7
+ user: { type: mongoose_1.Schema.Types.ObjectId, ref: duvdu_1.MODELS.user },
8
+ category: { type: mongoose_1.Schema.Types.ObjectId, ref: duvdu_1.MODELS.category },
9
+ subCategory: { ar: { type: String, default: null }, en: { type: String, default: null } },
10
+ tags: [{ ar: { type: String, default: null }, en: { type: String, default: null } }],
10
11
  cover: { type: String, default: null },
11
- title: { type: String, default: null },
12
- desc: { type: String, default: null },
12
+ attachments: [{ type: String, default: null }],
13
+ name: { type: String, default: null },
14
+ description: { type: String, default: null },
15
+ tools: [{ name: { type: String, default: null }, unitPrice: { type: Number, default: 0 } }],
16
+ functions: [{ name: { type: String, default: null }, unitPrice: { type: Number, default: 0 } }],
17
+ creatives: [{ type: mongoose_1.Schema.Types.ObjectId, ref: duvdu_1.MODELS.user }],
18
+ location: { lat: { type: Number, default: 0 }, lng: { type: Number, default: 0 } },
13
19
  address: { type: String, default: null },
14
- tools: [{ name: { type: String, default: null }, fees: { type: Number, default: 0 } }],
15
- searchKeywords: [String],
16
- creatives: [
17
- {
18
- creative: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
19
- fees: { type: Number, default: null },
20
- },
21
- ],
22
- tags: [{ ar: { type: String, default: null }, en: { type: String, default: null } }],
23
- subCategory: {
24
- ar: String,
25
- en: String,
26
- },
27
- projectBudget: { type: Number, default: null },
28
- category: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.category, required: true },
29
- projectScale: { scale: { type: Number, default: 0 }, time: { type: String, default: null } },
20
+ searchKeyWords: [String],
21
+ insurance: { type: Number, default: 0 },
30
22
  showOnHome: { type: Boolean, default: true },
31
- cycle: { type: String, default: cycles_1.CYCLES.portfolioPost },
23
+ projectScale: { unit: String, minimum: Number, maximum: Number, pricerPerUnit: Number },
32
24
  isDeleted: { type: Boolean, default: false },
33
- rate: {
34
- ratersCounter: { type: Number, default: 0 },
35
- totalRates: { type: Number, default: 0 },
36
- },
37
- }, {
38
- timestamps: true,
39
- collection: model_names_1.MODELS.portfolioPost,
40
- toJSON: {
41
- transform(doc, ret) {
42
- if (ret.cover)
43
- ret.cover = process.env.BUCKET_HOST + '/' + ret.cover;
44
- if (ret.attachments)
45
- ret.attachments = ret.attachments.map((el) => process.env.BUCKET_HOST + '/' + el);
46
- },
47
- },
48
- })
49
- .index({ createdAt: 1, updatedAt: -1 })
50
- .index({ title: 'text', desc: 'text', tools: 'text', searchKeywords: 'text' }));
25
+ rate: { ratersCounter: Number, totalRates: Number },
26
+ }, { timestamps: true, collection: duvdu_1.MODELS.portfolioPost }));
@@ -0,0 +1,3 @@
1
+ type Units = 'minutes' | 'hours' | 'days' | 'months' | 'weeks';
2
+ export declare const addToDate: (initialDate: Date, unit: Units, value: number) => Date;
3
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addToDate = void 0;
4
+ const addToDate = (initialDate, unit, value) => {
5
+ switch (unit) {
6
+ case 'hours':
7
+ initialDate.setHours(initialDate.getHours() + value);
8
+ break;
9
+ case 'days':
10
+ initialDate.setDate(initialDate.getDate() + value);
11
+ break;
12
+ case 'months':
13
+ initialDate.setMonth(initialDate.getMonth() + value);
14
+ break;
15
+ case 'weeks':
16
+ initialDate.setDate(initialDate.getDate() + value * 7);
17
+ break;
18
+ case 'minutes':
19
+ initialDate.setMinutes(initialDate.getMinutes() + value);
20
+ break;
21
+ default:
22
+ break;
23
+ }
24
+ return initialDate;
25
+ };
26
+ exports.addToDate = addToDate;
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.126",
4
- "main": "./build/index.js",
5
- "types": "./build/index.d.ts",
6
- "files": [
7
- "build/**/*"
8
- ],
9
- "scripts": {
10
- "clean": "rimraf ./build",
11
- "build": "npm run clean && tsc",
12
- "fix:build": "mv ./build/common/src/* ./build && rm -rf ./build/auth ./build/common",
13
- "pub": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish",
14
- "lint": "eslint .",
15
- "lint:fix": "eslint --fix .",
16
- "format": "prettier --write ."
17
- },
18
- "keywords": [],
19
- "author": "motemed khaled",
20
- "license": "ISC",
21
- "dependencies": {
22
- "@duvdu-v1/duvdu": "^1.1.116",
23
- "@types/express": "^4.17.21",
24
- "@types/express-session": "^1.18.0",
25
- "@types/jsonwebtoken": "^9.0.5",
26
- "@types/multer": "^1.4.11",
27
- "@types/node": "^20.11.0",
28
- "@typescript-eslint/eslint-plugin": "^6.19.0",
29
- "@typescript-eslint/parser": "^6.19.0",
30
- "aws-sdk": "^2.1595.0",
31
- "connect-redis": "^7.1.1",
32
- "express": "^4.18.2",
33
- "express-async-errors": "^3.1.1",
34
- "express-session": "^1.18.0",
35
- "express-validator": "^7.0.1",
36
- "jsonwebtoken": "^9.0.2",
37
- "mongoose": "^8.0.4",
38
- "multer": "^1.4.5-lts.1",
39
- "node-nats-streaming": "^0.3.2",
40
- "redis": "^4.6.13",
41
- "rimraf": "^5.0.5",
42
- "typescript": "^5.3.3",
43
- "uuid": "^9.0.1",
44
- "winston": "^3.13.0",
45
- "winston-daily-rotate-file": "^5.0.0"
46
- },
47
- "devDependencies": {
48
- "@types/uuid": "^9.0.8",
49
- "del-cli": "^5.1.0",
50
- "eslint": "^8.56.0",
51
- "eslint-config-prettier": "^9.1.0",
52
- "eslint-plugin-import": "^2.29.1",
53
- "eslint-plugin-prettier": "^5.1.3",
54
- "prettier": "^3.2.4"
55
- },
56
- "description": ""
57
- }
1
+ {
2
+ "name": "@duvdu-v1/duvdu",
3
+ "version": "1.1.128",
4
+ "main": "./build/index.js",
5
+ "types": "./build/index.d.ts",
6
+ "files": [
7
+ "build/**/*"
8
+ ],
9
+ "scripts": {
10
+ "clean": "rimraf ./build",
11
+ "build": "npm run clean && tsc",
12
+ "fix:build": "mv ./build/common/src/* ./build && rm -rf ./build/auth ./build/common",
13
+ "pub": "git add . && git commit -m \"updates\" && npm version patch && npm run build && npm publish",
14
+ "lint": "eslint .",
15
+ "lint:fix": "eslint --fix .",
16
+ "format": "prettier --write ."
17
+ },
18
+ "keywords": [],
19
+ "author": "motemed khaled",
20
+ "license": "ISC",
21
+ "dependencies": {
22
+ "@duvdu-v1/duvdu": "^1.1.116",
23
+ "@types/express": "^4.17.21",
24
+ "@types/express-session": "^1.18.0",
25
+ "@types/jsonwebtoken": "^9.0.5",
26
+ "@types/multer": "^1.4.11",
27
+ "@types/node": "^20.11.0",
28
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
29
+ "@typescript-eslint/parser": "^6.19.0",
30
+ "aws-sdk": "^2.1595.0",
31
+ "connect-redis": "^7.1.1",
32
+ "express": "^4.18.2",
33
+ "express-async-errors": "^3.1.1",
34
+ "express-session": "^1.18.0",
35
+ "express-validator": "^7.0.1",
36
+ "jsonwebtoken": "^9.0.2",
37
+ "mongoose": "^8.0.4",
38
+ "multer": "^1.4.5-lts.1",
39
+ "node-nats-streaming": "^0.3.2",
40
+ "redis": "^4.6.13",
41
+ "rimraf": "^5.0.5",
42
+ "typescript": "^5.3.3",
43
+ "uuid": "^9.0.1",
44
+ "winston": "^3.13.0",
45
+ "winston-daily-rotate-file": "^5.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/uuid": "^9.0.8",
49
+ "del-cli": "^5.1.0",
50
+ "eslint": "^8.56.0",
51
+ "eslint-config-prettier": "^9.1.0",
52
+ "eslint-plugin-import": "^2.29.1",
53
+ "eslint-plugin-prettier": "^5.1.3",
54
+ "prettier": "^3.2.4"
55
+ },
56
+ "description": ""
57
+ }