@duvdu-v1/duvdu 1.1.88 → 1.1.90

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.
@@ -6,18 +6,18 @@ const checkRequiredFields = (options) => ((req, res, next) => {
6
6
  var _a;
7
7
  if (options.single) {
8
8
  if (!req.file || req.file.fieldname !== options.single)
9
- return next(new bad_request_error_1.BadRequestError(`${options.single} is required`));
9
+ return next(new bad_request_error_1.BadRequestError({ en: `${options.single} is required`, ar: `${options.single} مطلوب` }, req.lang));
10
10
  }
11
11
  else if (options.array) {
12
12
  if (!req.files || !Array.isArray(req.files) || req.files[0].fieldname !== options.array)
13
- return next(new bad_request_error_1.BadRequestError(`${options.array} is required`));
13
+ return next(new bad_request_error_1.BadRequestError({ en: `${options.array} is required`, ar: `${options.array} مطلوب` }, req.lang));
14
14
  }
15
15
  else if (options.fields) {
16
16
  if (!req.files)
17
- return next(new bad_request_error_1.BadRequestError(`${options.fields.join(' ')} is required`));
17
+ return next(new bad_request_error_1.BadRequestError({ en: `${options.fields.join(' ')} is required`, ar: `${options.fields.join(' ')} مطلوب` }, req.lang));
18
18
  for (const field of options.fields) {
19
19
  if (!((_a = req.files) === null || _a === void 0 ? void 0 : _a[field]))
20
- return next(new bad_request_error_1.BadRequestError(`${field} is required`));
20
+ return next(new bad_request_error_1.BadRequestError({ en: `${field} is required`, ar: `${field} مطلوب` }));
21
21
  }
22
22
  }
23
23
  next();
@@ -16,7 +16,7 @@ const isauthorized = (permission) => ((req, res, next) => __awaiter(void 0, void
16
16
  if (req.loggedUser.role.key === systemRoles_1.SystemRoles.admin)
17
17
  return next();
18
18
  if (!req.loggedUser.role.permissions.includes(permission))
19
- return next(new unauthorized_error_1.UnauthorizedError());
19
+ return next(new unauthorized_error_1.UnauthorizedError(undefined, req.lang));
20
20
  next();
21
21
  }));
22
22
  exports.isauthorized = isauthorized;
@@ -20,7 +20,10 @@ const optionalAuthenticated = (req, res, next) => __awaiter(void 0, void 0, void
20
20
  payload = (0, jsonwebtoken_1.verify)(req.session.access, process.env.JWT_KEY);
21
21
  req.loggedUser = payload;
22
22
  if (req.loggedUser.isBlocked.value)
23
- return next(new unauthorized_error_1.UnauthorizedError(`user is blocked:${req.loggedUser.isBlocked.reason}`));
23
+ return next(new unauthorized_error_1.UnauthorizedError({
24
+ en: `Forbidden: User is blocked ${req.loggedUser.isBlocked.reason}`,
25
+ ar: ` ممنوع: المستخدم محظور ${req.loggedUser.isBlocked.reason}`,
26
+ }, req.lang));
24
27
  }
25
28
  catch (error) {
26
29
  return next();
@@ -38,7 +38,7 @@ export interface IcopyRights {
38
38
  };
39
39
  searchKeywords: string[];
40
40
  showOnHome: boolean;
41
- cycle: number;
41
+ cycle: string;
42
42
  rate: {
43
43
  ratersCounter: number;
44
44
  totalRates: number;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CopyRights = 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");
6
7
  exports.CopyRights = (0, mongoose_1.model)(model_names_1.MODELS.copyrights, new mongoose_1.Schema({
7
8
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
@@ -11,7 +12,7 @@ exports.CopyRights = (0, mongoose_1.model)(model_names_1.MODELS.copyrights, new
11
12
  address: { type: String, default: null },
12
13
  searchKeywords: [String],
13
14
  showOnHome: { type: Boolean, default: true },
14
- cycle: { type: Number, default: 3 },
15
+ cycle: { type: String, default: cycles_1.CYCLES.copyRights },
15
16
  isDeleted: { type: Boolean, default: false },
16
17
  rate: {
17
18
  ratersCounter: { type: Number, default: 0 },
@@ -20,12 +21,12 @@ exports.CopyRights = (0, mongoose_1.model)(model_names_1.MODELS.copyrights, new
20
21
  tags: [{ ar: { type: String, default: null }, en: { type: String, default: null } }],
21
22
  subCategory: {
22
23
  ar: String,
23
- en: String
24
+ en: String,
24
25
  },
25
26
  location: {
26
27
  lat: { type: Number, default: null },
27
28
  lng: { type: Number, default: null },
28
- }
29
+ },
29
30
  }, {
30
31
  timestamps: true,
31
32
  collection: model_names_1.MODELS.copyrights,
@@ -56,7 +56,7 @@ export interface IportfolioPost {
56
56
  time: 'minutes' | 'hours';
57
57
  };
58
58
  showOnHome: boolean;
59
- cycle: number;
59
+ cycle: string;
60
60
  rate: {
61
61
  ratersCounter: number;
62
62
  totalRates: number;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PortfolioPosts = 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");
6
7
  exports.PortfolioPosts = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPost, new mongoose_1.Schema({
7
8
  user: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.user },
@@ -21,13 +22,13 @@ exports.PortfolioPosts = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPos
21
22
  tags: [{ ar: { type: String, default: null }, en: { type: String, default: null } }],
22
23
  subCategory: {
23
24
  ar: String,
24
- en: String
25
+ en: String,
25
26
  },
26
27
  projectBudget: { type: Number, default: null },
27
28
  category: { type: mongoose_1.Schema.Types.ObjectId, ref: model_names_1.MODELS.category, required: true },
28
29
  projectScale: { scale: { type: Number, default: 0 }, time: { type: String, default: null } },
29
30
  showOnHome: { type: Boolean, default: true },
30
- cycle: { type: Number, default: 1 },
31
+ cycle: { type: String, default: cycles_1.CYCLES.portfolioPost },
31
32
  isDeleted: { type: Boolean, default: false },
32
33
  rate: {
33
34
  ratersCounter: { type: Number, default: 0 },
@@ -43,7 +44,7 @@ exports.PortfolioPosts = (0, mongoose_1.model)(model_names_1.MODELS.portfolioPos
43
44
  if (ret.attachments)
44
45
  ret.attachments = ret.attachments.map((el) => process.env.BUCKET_HOST + '/' + el);
45
46
  },
46
- }
47
+ },
47
48
  })
48
49
  .index({ createdAt: 1, updatedAt: -1 })
49
50
  .index({ title: 'text', desc: 'text', tools: 'text', searchKeywords: 'text' }));
@@ -47,7 +47,7 @@ export interface IstudioBooking {
47
47
  insurance: number;
48
48
  showOnHome: boolean;
49
49
  category: Types.ObjectId;
50
- cycle: number;
50
+ cycle: string;
51
51
  rate: {
52
52
  ratersCounter: number;
53
53
  totalRates: number;
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.studioBooking = void 0;
27
27
  const mongoose_1 = __importStar(require("mongoose"));
28
+ const cycles_1 = require("../types/cycles");
28
29
  const model_names_1 = require("../types/model-names");
29
30
  exports.studioBooking = (0, mongoose_1.model)(model_names_1.MODELS.studioBooking, new mongoose_1.Schema({
30
31
  user: {
@@ -53,7 +54,7 @@ exports.studioBooking = (0, mongoose_1.model)(model_names_1.MODELS.studioBooking
53
54
  ref: model_names_1.MODELS.category,
54
55
  required: true,
55
56
  },
56
- cycle: { type: Number, default: 2 },
57
+ cycle: { type: String, default: cycles_1.CYCLES.studioBooking },
57
58
  isDeleted: { type: Boolean, default: false },
58
59
  creatives: [
59
60
  {
@@ -80,5 +81,5 @@ exports.studioBooking = (0, mongoose_1.model)(model_names_1.MODELS.studioBooking
80
81
  if (ret.attachments)
81
82
  ret.attachments = ret.attachments.map((el) => process.env.BUCKET_HOST + '/' + el);
82
83
  },
83
- }
84
+ },
84
85
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duvdu-v1/duvdu",
3
- "version": "1.1.88",
3
+ "version": "1.1.90",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [