@duvdu-v1/duvdu 1.1.179 → 1.1.181

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.
@@ -22,38 +22,82 @@
22
22
  /// <reference types="mongoose/types/validation" />
23
23
  /// <reference types="mongoose/types/virtuals" />
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
- import { Document, Types } from 'mongoose';
25
+ import { Types } from 'mongoose';
26
26
  import { Icategory } from '../types/Category';
27
- export interface IteamProject extends Document {
28
- user: Types.ObjectId;
27
+ import { CYCLES } from '../types/cycles';
28
+ import { Iuser } from '../types/User';
29
+ export declare enum UserStatus {
30
+ accepted = "accepted",
31
+ rejected = "rejected",
32
+ pending = "pending",
33
+ canceled = "canceled"
34
+ }
35
+ export interface ITeamProject {
36
+ user: Types.ObjectId | Iuser;
29
37
  cover: string;
30
38
  title: string;
31
- budget: number;
32
39
  desc: string;
33
40
  location: {
34
41
  lat: number;
35
42
  lng: number;
36
43
  };
37
44
  address: string;
38
- attachments: string[];
39
- shootingDays: number;
40
- startDate: Date;
41
- status: 'pending' | 'completed';
45
+ cycle: string;
42
46
  creatives: [
43
47
  {
44
48
  category: Types.ObjectId | Icategory;
45
49
  users: [
46
50
  {
47
- user: Types.ObjectId;
51
+ user: Types.ObjectId | Iuser;
52
+ attachments: string[];
53
+ duration: number;
54
+ startDate: Date;
48
55
  workHours: number;
56
+ hourPrice: number;
57
+ details: string;
58
+ deadLine: Date;
49
59
  totalAmount: number;
50
- status: 'pending' | 'rejected' | 'accepted';
60
+ status: UserStatus;
51
61
  }
52
62
  ];
53
63
  }
54
64
  ];
55
65
  isDeleted: boolean;
56
66
  }
57
- export declare const TeamProject: import("mongoose").Model<IteamProject, {}, {}, {}, Document<unknown, {}, IteamProject> & IteamProject & {
67
+ export declare const TeamProject: import("mongoose").Model<ITeamProject, {}, {}, {}, import("mongoose").Document<unknown, {}, ITeamProject> & ITeamProject & {
68
+ _id: Types.ObjectId;
69
+ }, any>;
70
+ export declare enum ContractStatus {
71
+ canceled = "canceled",
72
+ pending = "pending",
73
+ waitingForTotalPayment = "waiting-for-total-payment",
74
+ ongoing = "ongoing",
75
+ completed = "completed",
76
+ rejected = "rejected"
77
+ }
78
+ export interface ITeamContract {
79
+ sp: Types.ObjectId | Iuser;
80
+ customer: Types.ObjectId | Iuser;
81
+ project: Types.ObjectId | ITeamProject;
82
+ category: Types.ObjectId | Icategory;
83
+ startDate: Date;
84
+ duration: Date;
85
+ workHours: number;
86
+ hourPrice: number;
87
+ deadline: Date;
88
+ details: string;
89
+ attachments: string[];
90
+ totalAmount: number;
91
+ actionAt: Date;
92
+ rejectedBy?: 'customer' | 'sp';
93
+ paymentLink: string;
94
+ stageExpiration: number;
95
+ status: ContractStatus;
96
+ cycle: CYCLES;
97
+ createdAt: Date;
98
+ paymentAmount: number;
99
+ totalCheckoutAt: Date;
100
+ }
101
+ export declare const TeamContract: import("mongoose").Model<ITeamContract, {}, {}, {}, import("mongoose").Document<unknown, {}, ITeamContract> & ITeamContract & {
58
102
  _id: Types.ObjectId;
59
103
  }, any>;
@@ -1,30 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TeamProject = void 0;
3
+ exports.TeamContract = exports.ContractStatus = exports.TeamProject = exports.UserStatus = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
+ const cycles_1 = require("../types/cycles");
5
6
  const model_names_1 = require("../types/model-names");
7
+ var UserStatus;
8
+ (function (UserStatus) {
9
+ UserStatus["accepted"] = "accepted";
10
+ UserStatus["rejected"] = "rejected";
11
+ UserStatus["pending"] = "pending";
12
+ UserStatus["canceled"] = "canceled";
13
+ })(UserStatus || (exports.UserStatus = UserStatus = {}));
6
14
  const UserSchema = new mongoose_1.Schema({
7
- user: {
8
- type: mongoose_1.Schema.Types.ObjectId,
9
- ref: model_names_1.MODELS.user,
10
- required: true,
11
- },
12
- workHours: {
13
- type: Number,
14
- required: true,
15
- default: null,
16
- },
17
- totalAmount: {
18
- type: Number,
19
- required: true,
20
- default: null,
21
- },
22
- status: {
23
- type: String,
24
- enum: ['pending', 'rejected', 'accepted'],
25
- required: true,
26
- default: 'pending',
27
- },
15
+ user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
16
+ attachments: [String],
17
+ duration: { type: Number, default: 0 },
18
+ startDate: Date,
19
+ workHours: { type: Number, default: 0 },
20
+ hourPrice: { type: Number, default: 0 },
21
+ details: { type: String, default: null },
22
+ deadLine: Date,
23
+ totalAmount: { type: Number, default: 0 },
24
+ status: { type: String, enum: UserStatus, default: UserStatus.pending },
28
25
  });
29
26
  const CreativeSchema = new mongoose_1.Schema({
30
27
  category: {
@@ -35,62 +32,15 @@ const CreativeSchema = new mongoose_1.Schema({
35
32
  users: [UserSchema],
36
33
  });
37
34
  exports.TeamProject = (0, mongoose_1.model)(model_names_1.MODELS.teamProject, new mongoose_1.Schema({
38
- user: {
39
- type: mongoose_1.Schema.Types.ObjectId,
40
- ref: model_names_1.MODELS.user,
41
- },
42
- cover: {
43
- type: String,
44
- default: null,
45
- },
46
- title: {
47
- type: String,
48
- default: null,
49
- },
50
- budget: {
51
- type: Number,
52
- default: null,
53
- },
54
- desc: {
55
- type: String,
56
- default: null,
57
- },
58
- location: {
59
- lat: {
60
- type: Number,
61
- default: null,
62
- },
63
- lng: {
64
- type: Number,
65
- default: null,
66
- },
67
- },
68
- address: {
69
- type: String,
70
- default: null,
71
- },
72
- attachments: {
73
- type: [String],
74
- default: null,
75
- },
76
- shootingDays: {
77
- type: Number,
78
- default: null,
79
- },
80
- startDate: {
81
- type: Date,
82
- default: null,
83
- },
84
- status: {
85
- type: String,
86
- enum: ['pending', 'completed'],
87
- default: 'pending',
88
- },
35
+ user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
36
+ cover: { type: String, default: null },
37
+ title: { type: String, default: null },
38
+ desc: { type: String, default: null },
39
+ location: { lat: { type: Number, default: null }, lng: { type: Number, default: null } },
40
+ address: { type: String, default: null },
89
41
  creatives: [CreativeSchema],
90
- isDeleted: {
91
- type: Boolean,
92
- default: false,
93
- },
42
+ isDeleted: { type: Boolean, default: false },
43
+ cycle: { type: String, default: cycles_1.CYCLES.teamProject },
94
44
  }, {
95
45
  timestamps: true,
96
46
  collection: model_names_1.MODELS.teamProject,
@@ -98,8 +48,49 @@ exports.TeamProject = (0, mongoose_1.model)(model_names_1.MODELS.teamProject, ne
98
48
  transform(doc, ret) {
99
49
  if (ret.cover)
100
50
  ret.cover = process.env.BUCKET_HOST + '/' + ret.cover;
101
- if (ret.attachments)
102
- ret.attachments = ret.attachments.map((el) => process.env.BUCKET_HOST + '/' + el);
51
+ if (ret.creatives && ret.creatives.length > 0) {
52
+ ret.creatives.forEach((creative) => {
53
+ if (creative.users && creative.users.length > 0) {
54
+ creative.users.forEach((user) => {
55
+ if (user.attachments && user.attachments.length > 0) {
56
+ user.attachments = user.attachments.map((attachment) => process.env.BUCKET_HOST + '/' + attachment);
57
+ }
58
+ });
59
+ }
60
+ });
61
+ }
103
62
  },
104
63
  },
105
64
  }));
65
+ // contract
66
+ var ContractStatus;
67
+ (function (ContractStatus) {
68
+ ContractStatus["canceled"] = "canceled";
69
+ ContractStatus["pending"] = "pending";
70
+ ContractStatus["waitingForTotalPayment"] = "waiting-for-total-payment";
71
+ ContractStatus["ongoing"] = "ongoing";
72
+ ContractStatus["completed"] = "completed";
73
+ ContractStatus["rejected"] = "rejected";
74
+ })(ContractStatus || (exports.ContractStatus = ContractStatus = {}));
75
+ exports.TeamContract = (0, mongoose_1.model)('team_contracts', new mongoose_1.Schema({
76
+ sp: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
77
+ customer: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
78
+ project: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.teamProject },
79
+ category: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.category },
80
+ startDate: Date,
81
+ duration: Date,
82
+ workHours: { type: Number, default: 0 },
83
+ hourPrice: { type: Number, default: 0 },
84
+ deadline: Date,
85
+ details: { type: String, default: null },
86
+ totalAmount: { type: Number, default: 0 },
87
+ actionAt: Date,
88
+ rejectedBy: { type: String, enum: ['customer', 'sp'] },
89
+ paymentLink: { type: String, default: null },
90
+ stageExpiration: { type: Number, default: 0 },
91
+ status: { type: String, enum: ContractStatus, default: ContractStatus.pending },
92
+ cycle: { type: String, default: cycles_1.CYCLES.teamProject },
93
+ paymentAmount: { type: Number, default: 0 },
94
+ attachments: [String],
95
+ totalCheckoutAt: Date
96
+ }, { timestamps: true, collection: 'team_contracts' }));
package/package.json CHANGED
@@ -1,56 +1,56 @@
1
- {
2
- "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.179",
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
- "@types/express": "^4.17.21",
23
- "@types/express-session": "^1.18.0",
24
- "@types/jsonwebtoken": "^9.0.5",
25
- "@types/multer": "^1.4.11",
26
- "@types/node": "^20.11.0",
27
- "@typescript-eslint/eslint-plugin": "^6.19.0",
28
- "@typescript-eslint/parser": "^6.19.0",
29
- "aws-sdk": "^2.1595.0",
30
- "connect-redis": "^7.1.1",
31
- "express": "^4.18.2",
32
- "express-async-errors": "^3.1.1",
33
- "express-session": "^1.18.0",
34
- "express-validator": "^7.0.1",
35
- "jsonwebtoken": "^9.0.2",
36
- "mongoose": "^8.0.4",
37
- "multer": "^1.4.5-lts.1",
38
- "node-nats-streaming": "^0.3.2",
39
- "redis": "^4.6.13",
40
- "rimraf": "^5.0.5",
41
- "typescript": "^5.3.3",
42
- "uuid": "^9.0.1",
43
- "winston": "^3.13.0",
44
- "winston-daily-rotate-file": "^5.0.0"
45
- },
46
- "devDependencies": {
47
- "@types/uuid": "^9.0.8",
48
- "del-cli": "^5.1.0",
49
- "eslint": "^8.56.0",
50
- "eslint-config-prettier": "^9.1.0",
51
- "eslint-plugin-import": "^2.29.1",
52
- "eslint-plugin-prettier": "^5.1.3",
53
- "prettier": "^3.2.4"
54
- },
55
- "description": ""
56
- }
1
+ {
2
+ "name": "@duvdu-v1/duvdu",
3
+ "version": "1.1.181",
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
+ "@types/express": "^4.17.21",
23
+ "@types/express-session": "^1.18.0",
24
+ "@types/jsonwebtoken": "^9.0.5",
25
+ "@types/multer": "^1.4.11",
26
+ "@types/node": "^20.11.0",
27
+ "@typescript-eslint/eslint-plugin": "^6.19.0",
28
+ "@typescript-eslint/parser": "^6.19.0",
29
+ "aws-sdk": "^2.1595.0",
30
+ "connect-redis": "^7.1.1",
31
+ "express": "^4.18.2",
32
+ "express-async-errors": "^3.1.1",
33
+ "express-session": "^1.18.0",
34
+ "express-validator": "^7.0.1",
35
+ "jsonwebtoken": "^9.0.2",
36
+ "mongoose": "^8.0.4",
37
+ "multer": "^1.4.5-lts.1",
38
+ "node-nats-streaming": "^0.3.2",
39
+ "redis": "^4.6.13",
40
+ "rimraf": "^5.0.5",
41
+ "typescript": "^5.3.3",
42
+ "uuid": "^9.0.1",
43
+ "winston": "^3.13.0",
44
+ "winston-daily-rotate-file": "^5.0.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/uuid": "^9.0.8",
48
+ "del-cli": "^5.1.0",
49
+ "eslint": "^8.56.0",
50
+ "eslint-config-prettier": "^9.1.0",
51
+ "eslint-plugin-import": "^2.29.1",
52
+ "eslint-plugin-prettier": "^5.1.3",
53
+ "prettier": "^3.2.4"
54
+ },
55
+ "description": ""
56
+ }