@alba-cars/common-modules 2.0.0 → 2.1.0
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/dist/index.js +1 -21
- package/package.json +10 -6
- package/dist/core/enums/HttpMethods.js +0 -14
- package/dist/core/enums/HttpStatusCodes.js +0 -19
- package/dist/core/enums/index.js +0 -18
- package/dist/core/error-handling/AppError.js +0 -48
- package/dist/core/error-handling/index.js +0 -17
- package/dist/core/index.js +0 -21
- package/dist/core/models/index.js +0 -19
- package/dist/core/models/media/index.js +0 -17
- package/dist/core/models/media/media_data.js +0 -2
- package/dist/core/models/pagination/index.js +0 -17
- package/dist/core/models/pagination/paginated_data.js +0 -21
- package/dist/core/models/range.js +0 -26
- package/dist/core/network/api-client.d.ts +0 -1
- package/dist/core/network/api-client.js +0 -22
- package/dist/core/network/endpoint-config.js +0 -260
- package/dist/core/network/fetch-api.js +0 -206
- package/dist/core/network/index.js +0 -18
- package/dist/core/utils/formatCurrency.js +0 -39
- package/dist/core/utils/global-constants.js +0 -9
- package/dist/core/utils/global-utils.js +0 -190
- package/dist/core/utils/global_validators.js +0 -20
- package/dist/core/utils/index.js +0 -20
- package/dist/core/utils/query_flatten.js +0 -15
- package/dist/features/auth/data/dto/AuthDTO.js +0 -106
- package/dist/features/auth/data/dto/RoleDTO.js +0 -132
- package/dist/features/auth/data/dto/UserDTO.js +0 -222
- package/dist/features/auth/data/index.js +0 -19
- package/dist/features/auth/index.js +0 -17
- package/dist/features/bank-valuation-request/data/dto/BankValuationRequestDTO.js +0 -132
- package/dist/features/bank-valuation-request/index.js +0 -17
- package/dist/features/blog/data/dto/BlogDTO.js +0 -176
- package/dist/features/blog/index.js +0 -17
- package/dist/features/callback-request/data/dto/CallBackRequestDTO.js +0 -110
- package/dist/features/callback-request/index.js +0 -17
- package/dist/features/deposits/data/dto/DepositDTOs.js +0 -303
- package/dist/features/deposits/data/index.js +0 -17
- package/dist/features/deposits/index.js +0 -17
- package/dist/features/faq/data/dtos/CreateFaqDTO.js +0 -87
- package/dist/features/faq/data/dtos/FaqFetchDTO.js +0 -349
- package/dist/features/faq/data/dtos/UpdateFaqDTO.js +0 -91
- package/dist/features/faq/data/dtos/index.js +0 -19
- package/dist/features/faq/data/enums/index.js +0 -10
- package/dist/features/faq/data/index.js +0 -18
- package/dist/features/faq/index.js +0 -17
- package/dist/features/finance-eligibilty-request/data/dto/FinanceEligibilityRequestDTO.js +0 -429
- package/dist/features/finance-eligibilty-request/data/index.js +0 -17
- package/dist/features/finance-eligibilty-request/index.js +0 -17
- package/dist/features/google-review/data/dto/google_review_dto.js +0 -466
- package/dist/features/google-review/data/dto/index.js +0 -17
- package/dist/features/google-review/data/enums/index.js +0 -8
- package/dist/features/google-review/data/index.js +0 -18
- package/dist/features/google-review/index.js +0 -17
- package/dist/features/index.js +0 -34
- package/dist/features/lead/data/dto/index.js +0 -20
- package/dist/features/lead/data/dto/lead_documents_dto.js +0 -73
- package/dist/features/lead/data/dto/lead_dto.js +0 -435
- package/dist/features/lead/data/dto/lead_preference_history_dto.js +0 -321
- package/dist/features/lead/data/dto/lead_prefernce_dto.js +0 -308
- package/dist/features/lead/data/enum/index.js +0 -18
- package/dist/features/lead/data/enum/lead_source_status_types.js +0 -19
- package/dist/features/lead/data/enum/lead_status_type.js +0 -12
- package/dist/features/lead/index.js +0 -18
- package/dist/features/models/BankValuationRequest.js +0 -6
- package/dist/features/models/Base.js +0 -6
- package/dist/features/models/Deposit.js +0 -6
- package/dist/features/models/Lead.js +0 -6
- package/dist/features/models/Payment.js +0 -7
- package/dist/features/models/Roles.js +0 -2
- package/dist/features/models/Ticket.js +0 -12
- package/dist/features/models/User.js +0 -2
- package/dist/features/models/UserFavoriteVehicle.js +0 -6
- package/dist/features/models/Vehicle.js +0 -17
- package/dist/features/models/VehicleBodyType.js +0 -7
- package/dist/features/models/VehicleCategory.js +0 -7
- package/dist/features/models/VehicleFeature.js +0 -7
- package/dist/features/models/VehicleFeatureCategory.js +0 -7
- package/dist/features/models/VehicleFinance.js +0 -7
- package/dist/features/models/VehicleMake.js +0 -7
- package/dist/features/models/VehicleMedia.js +0 -7
- package/dist/features/models/VehicleMetaData.js +0 -7
- package/dist/features/models/VehicleModel.js +0 -7
- package/dist/features/models/VehicleOrder.js +0 -7
- package/dist/features/models/_index.js +0 -30
- package/dist/features/models/index.js +0 -37
- package/dist/features/newsletter/data/dto/NewsletterDTO.js +0 -79
- package/dist/features/newsletter/index.js +0 -17
- package/dist/features/sales-team/data/dto/LanguageDTO.js +0 -89
- package/dist/features/sales-team/data/dto/SalesAgentDTO.js +0 -613
- package/dist/features/sales-team/data/index.js +0 -18
- package/dist/features/sales-team/index.js +0 -17
- package/dist/features/sell-car-request/data/dto/SellCarRequestDTO.js +0 -672
- package/dist/features/sell-car-request/data/index.js +0 -17
- package/dist/features/sell-car-request/index.js +0 -17
- package/dist/features/showroom-visit/data/dto/ShowroomVisit.js +0 -237
- package/dist/features/showroom-visit/data/enums/index.js +0 -17
- package/dist/features/showroom-visit/data/index.js +0 -18
- package/dist/features/showroom-visit/index.js +0 -17
- package/dist/features/test-drive-request/api/GetTestDriveVehicles.js +0 -8
- package/dist/features/test-drive-request/api/index.js +0 -17
- package/dist/features/test-drive-request/data/dto/TestDriveRequestDTO.js +0 -179
- package/dist/features/test-drive-request/data/enums/index.js +0 -29
- package/dist/features/test-drive-request/data/index.js +0 -20
- package/dist/features/test-drive-request/data/models/TestDriveRequest.js +0 -7
- package/dist/features/test-drive-request/data/models/index.js +0 -5
- package/dist/features/test-drive-request/data/utilities.js +0 -100
- package/dist/features/test-drive-request/index.js +0 -18
- package/dist/features/tickets/data/dto/TicketDto.js +0 -293
- package/dist/features/tickets/data/enums/index.js +0 -18
- package/dist/features/tickets/index.js +0 -18
- package/dist/features/vehicle/data/dto/BaseDTO.js +0 -34
- package/dist/features/vehicle/data/dto/MediaDTO.js +0 -2
- package/dist/features/vehicle/data/dto/PaymentDTO.js +0 -161
- package/dist/features/vehicle/data/dto/SimilarVehicleDTO.js +0 -38
- package/dist/features/vehicle/data/dto/VehicleCategoryDTO.js +0 -114
- package/dist/features/vehicle/data/dto/VehicleDTO.js +0 -587
- package/dist/features/vehicle/data/dto/VehicleFavoritesDTO.js +0 -60
- package/dist/features/vehicle/data/dto/VehicleFeatureCategoriesDTO.js +0 -114
- package/dist/features/vehicle/data/dto/VehicleFeatureDTO.js +0 -125
- package/dist/features/vehicle/data/dto/VehicleFilterDTO.js +0 -771
- package/dist/features/vehicle/data/dto/VehicleFinanceDTO.js +0 -183
- package/dist/features/vehicle/data/dto/VehicleInspectionDTO.js +0 -765
- package/dist/features/vehicle/data/dto/VehicleMakeDTO.js +0 -189
- package/dist/features/vehicle/data/dto/VehicleMedia.js +0 -152
- package/dist/features/vehicle/data/dto/VehicleModelDTO.js +0 -182
- package/dist/features/vehicle/data/dto/VehicleOrderDTO.js +0 -139
- package/dist/features/vehicle/data/dto/VehicleTypeDTO.js +0 -102
- package/dist/features/vehicle/data/dto/VehicleWarrantyDTO.js +0 -47
- package/dist/features/vehicle/data/dto/index.js +0 -35
- package/dist/features/vehicle/data/enums/index.js +0 -46
- package/dist/features/vehicle/data/index.js +0 -20
- package/dist/features/vehicle/data/utilities.js +0 -520
- package/dist/features/vehicle/index.js +0 -17
- package/dist/features/vehicle-reservations/data/dto/VehicleReservationDTO.js +0 -346
- package/dist/features/vehicle-reservations/data/dto/index.js +0 -17
- package/dist/features/vehicle-reservations/data/enums/finance-type.js +0 -9
- package/dist/features/vehicle-reservations/data/enums/index.js +0 -19
- package/dist/features/vehicle-reservations/data/enums/reservation-type.js +0 -13
- package/dist/features/vehicle-reservations/data/enums/vehicle-reservation-type.js +0 -8
- package/dist/features/vehicle-reservations/index.js +0 -18
- package/dist/global/dto/BaseGetDTO.js +0 -18
- package/dist/global/dto/index.js +0 -17
- package/dist/global/index.js +0 -18
- package/dist/global/utilities.js +0 -173
- package/dist/models.js +0 -17
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CreateFaqDTO = exports.MultilingualContent = void 0;
|
|
13
|
-
const class_transformer_1 = require("class-transformer");
|
|
14
|
-
const class_validator_1 = require("class-validator");
|
|
15
|
-
const enums_1 = require("../enums");
|
|
16
|
-
class MultilingualContent {
|
|
17
|
-
}
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
20
|
-
(0, class_validator_1.IsString)(),
|
|
21
|
-
__metadata("design:type", String)
|
|
22
|
-
], MultilingualContent.prototype, "en", void 0);
|
|
23
|
-
__decorate([
|
|
24
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
25
|
-
(0, class_validator_1.IsString)(),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], MultilingualContent.prototype, "ar", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
30
|
-
(0, class_validator_1.IsString)(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], MultilingualContent.prototype, "ru", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
35
|
-
(0, class_validator_1.IsString)(),
|
|
36
|
-
__metadata("design:type", String)
|
|
37
|
-
], MultilingualContent.prototype, "zh", void 0);
|
|
38
|
-
exports.MultilingualContent = MultilingualContent;
|
|
39
|
-
class CreateFaqDTO {
|
|
40
|
-
static fromPlain(plain) {
|
|
41
|
-
const dto = new CreateFaqDTO();
|
|
42
|
-
dto.question = {
|
|
43
|
-
en: plain.question.en,
|
|
44
|
-
ar: plain.question.ar,
|
|
45
|
-
ru: plain.question.ru,
|
|
46
|
-
zh: plain.question.zh
|
|
47
|
-
};
|
|
48
|
-
dto.answer = {
|
|
49
|
-
en: plain.answer.en,
|
|
50
|
-
ar: plain.answer.ar,
|
|
51
|
-
ru: plain.answer.ru,
|
|
52
|
-
zh: plain.answer.zh
|
|
53
|
-
};
|
|
54
|
-
dto.category = plain.category;
|
|
55
|
-
dto.isActive = plain.isActive;
|
|
56
|
-
dto.order = plain.order;
|
|
57
|
-
return dto;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
62
|
-
(0, class_validator_1.ValidateNested)(),
|
|
63
|
-
(0, class_transformer_1.Type)(() => MultilingualContent),
|
|
64
|
-
__metadata("design:type", MultilingualContent)
|
|
65
|
-
], CreateFaqDTO.prototype, "question", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
68
|
-
(0, class_validator_1.ValidateNested)(),
|
|
69
|
-
(0, class_transformer_1.Type)(() => MultilingualContent),
|
|
70
|
-
__metadata("design:type", MultilingualContent)
|
|
71
|
-
], CreateFaqDTO.prototype, "answer", void 0);
|
|
72
|
-
__decorate([
|
|
73
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
74
|
-
(0, class_validator_1.IsEnum)(enums_1.FaqCategory),
|
|
75
|
-
__metadata("design:type", String)
|
|
76
|
-
], CreateFaqDTO.prototype, "category", void 0);
|
|
77
|
-
__decorate([
|
|
78
|
-
(0, class_validator_1.IsOptional)(),
|
|
79
|
-
(0, class_validator_1.IsBoolean)(),
|
|
80
|
-
__metadata("design:type", Boolean)
|
|
81
|
-
], CreateFaqDTO.prototype, "isActive", void 0);
|
|
82
|
-
__decorate([
|
|
83
|
-
(0, class_validator_1.IsOptional)(),
|
|
84
|
-
(0, class_validator_1.IsNumber)(),
|
|
85
|
-
__metadata("design:type", Number)
|
|
86
|
-
], CreateFaqDTO.prototype, "order", void 0);
|
|
87
|
-
exports.CreateFaqDTO = CreateFaqDTO;
|
|
@@ -1,349 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.FaqResponseDTO = exports.FaqFetchDTO = exports.FaqOptionsDTO = exports.SortDTO = exports.FaqFilterDTO = exports.MultilingualContentFetch = void 0;
|
|
13
|
-
const class_transformer_1 = require("class-transformer");
|
|
14
|
-
const class_validator_1 = require("class-validator");
|
|
15
|
-
const enums_1 = require("../enums");
|
|
16
|
-
class MultilingualContentFetch {
|
|
17
|
-
toPlain() {
|
|
18
|
-
return {
|
|
19
|
-
en: this.en,
|
|
20
|
-
ar: this.ar,
|
|
21
|
-
ru: this.ru,
|
|
22
|
-
zh: this.zh
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
static fromPlain(plain) {
|
|
26
|
-
const content = new MultilingualContentFetch();
|
|
27
|
-
content.en = plain.en;
|
|
28
|
-
content.ar = plain.ar;
|
|
29
|
-
content.ru = plain.ru;
|
|
30
|
-
content.zh = plain.zh;
|
|
31
|
-
return content;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
__decorate([
|
|
35
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
36
|
-
(0, class_validator_1.IsString)(),
|
|
37
|
-
__metadata("design:type", String)
|
|
38
|
-
], MultilingualContentFetch.prototype, "en", void 0);
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
41
|
-
(0, class_validator_1.IsString)(),
|
|
42
|
-
__metadata("design:type", String)
|
|
43
|
-
], MultilingualContentFetch.prototype, "ar", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
46
|
-
(0, class_validator_1.IsString)(),
|
|
47
|
-
__metadata("design:type", String)
|
|
48
|
-
], MultilingualContentFetch.prototype, "ru", void 0);
|
|
49
|
-
__decorate([
|
|
50
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
51
|
-
(0, class_validator_1.IsString)(),
|
|
52
|
-
__metadata("design:type", String)
|
|
53
|
-
], MultilingualContentFetch.prototype, "zh", void 0);
|
|
54
|
-
exports.MultilingualContentFetch = MultilingualContentFetch;
|
|
55
|
-
class FaqFilterDTO {
|
|
56
|
-
constructor(init) {
|
|
57
|
-
Object.assign(this, init);
|
|
58
|
-
}
|
|
59
|
-
validate(shouldValidate = true) {
|
|
60
|
-
const errors = [];
|
|
61
|
-
if (shouldValidate) {
|
|
62
|
-
if (this.category && !Object.values(enums_1.FaqCategory).includes(this.category)) {
|
|
63
|
-
errors.push(`Invalid category: ${this.category}. Valid categories are: ${Object.values(enums_1.FaqCategory).join(', ')}`);
|
|
64
|
-
}
|
|
65
|
-
if (this.searchLanguage && !['en', 'ar', 'ru', 'zh'].includes(this.searchLanguage)) {
|
|
66
|
-
errors.push(`Invalid search language: ${this.searchLanguage}. Valid languages are: en, ar, ru, zh`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return errors;
|
|
70
|
-
}
|
|
71
|
-
static fromPlain(plain) {
|
|
72
|
-
const dto = new FaqFilterDTO();
|
|
73
|
-
if (plain) {
|
|
74
|
-
dto.search = plain.search;
|
|
75
|
-
dto.searchLanguage = plain.searchLanguage;
|
|
76
|
-
dto.searchInAnswers = plain.searchInAnswers;
|
|
77
|
-
// Handle category
|
|
78
|
-
if (plain.category) {
|
|
79
|
-
const categoryValue = plain.category.value || plain.category;
|
|
80
|
-
if (Object.values(enums_1.FaqCategory).includes(categoryValue)) {
|
|
81
|
-
dto.category = categoryValue;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
// Handle boolean conversions
|
|
85
|
-
if (typeof plain.isActive === 'string') {
|
|
86
|
-
dto.isActive = plain.isActive.toLowerCase() === 'true';
|
|
87
|
-
}
|
|
88
|
-
else {
|
|
89
|
-
dto.isActive = plain.isActive;
|
|
90
|
-
}
|
|
91
|
-
if (typeof plain.searchInAnswers === 'string') {
|
|
92
|
-
dto.searchInAnswers = plain.searchInAnswers.toLowerCase() === 'true';
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
dto.searchInAnswers = plain.searchInAnswers;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return dto;
|
|
99
|
-
}
|
|
100
|
-
static toPlain(instance) {
|
|
101
|
-
return (0, class_transformer_1.instanceToPlain)(instance);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
__decorate([
|
|
105
|
-
(0, class_validator_1.IsOptional)(),
|
|
106
|
-
(0, class_validator_1.IsString)(),
|
|
107
|
-
__metadata("design:type", String)
|
|
108
|
-
], FaqFilterDTO.prototype, "search", void 0);
|
|
109
|
-
__decorate([
|
|
110
|
-
(0, class_validator_1.IsOptional)(),
|
|
111
|
-
(0, class_validator_1.IsString)(),
|
|
112
|
-
__metadata("design:type", String)
|
|
113
|
-
], FaqFilterDTO.prototype, "searchLanguage", void 0);
|
|
114
|
-
__decorate([
|
|
115
|
-
(0, class_validator_1.IsOptional)(),
|
|
116
|
-
(0, class_validator_1.IsBoolean)(),
|
|
117
|
-
__metadata("design:type", Boolean)
|
|
118
|
-
], FaqFilterDTO.prototype, "searchInAnswers", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
(0, class_validator_1.IsOptional)(),
|
|
121
|
-
(0, class_validator_1.IsEnum)(enums_1.FaqCategory, { message: 'Invalid category provided' }),
|
|
122
|
-
__metadata("design:type", String)
|
|
123
|
-
], FaqFilterDTO.prototype, "category", void 0);
|
|
124
|
-
__decorate([
|
|
125
|
-
(0, class_validator_1.IsOptional)(),
|
|
126
|
-
(0, class_validator_1.IsBoolean)(),
|
|
127
|
-
__metadata("design:type", Boolean)
|
|
128
|
-
], FaqFilterDTO.prototype, "isActive", void 0);
|
|
129
|
-
exports.FaqFilterDTO = FaqFilterDTO;
|
|
130
|
-
class SortDTO {
|
|
131
|
-
}
|
|
132
|
-
__decorate([
|
|
133
|
-
(0, class_validator_1.IsString)(),
|
|
134
|
-
__metadata("design:type", String)
|
|
135
|
-
], SortDTO.prototype, "field", void 0);
|
|
136
|
-
__decorate([
|
|
137
|
-
(0, class_validator_1.IsString)(),
|
|
138
|
-
__metadata("design:type", String)
|
|
139
|
-
], SortDTO.prototype, "direction", void 0);
|
|
140
|
-
exports.SortDTO = SortDTO;
|
|
141
|
-
class FaqOptionsDTO {
|
|
142
|
-
constructor(init) {
|
|
143
|
-
this.page = 1;
|
|
144
|
-
this.limit = 10;
|
|
145
|
-
Object.assign(this, init);
|
|
146
|
-
}
|
|
147
|
-
validate(shouldValidate = true) {
|
|
148
|
-
const errors = [];
|
|
149
|
-
if (shouldValidate) {
|
|
150
|
-
// Validate page
|
|
151
|
-
if (this.page < 1) {
|
|
152
|
-
errors.push('Page must be greater than 0');
|
|
153
|
-
}
|
|
154
|
-
// Validate limit
|
|
155
|
-
if (this.limit < 1) {
|
|
156
|
-
errors.push('Limit must be greater than 0');
|
|
157
|
-
}
|
|
158
|
-
if (this.limit > 100) {
|
|
159
|
-
errors.push('Limit cannot exceed 100');
|
|
160
|
-
}
|
|
161
|
-
// Validate sort if present
|
|
162
|
-
if (this.sort) {
|
|
163
|
-
if (!this.sort.field) {
|
|
164
|
-
errors.push('Sort field is required when sort is provided');
|
|
165
|
-
}
|
|
166
|
-
if (this.sort.direction && !['asc', 'desc'].includes(this.sort.direction.toLowerCase())) {
|
|
167
|
-
errors.push('Sort direction must be either "asc" or "desc"');
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return errors;
|
|
172
|
-
}
|
|
173
|
-
static toPlain(instance) {
|
|
174
|
-
return (0, class_transformer_1.instanceToPlain)(instance);
|
|
175
|
-
}
|
|
176
|
-
static fromPlain(plain) {
|
|
177
|
-
var _a;
|
|
178
|
-
const dto = new FaqOptionsDTO();
|
|
179
|
-
if (plain) {
|
|
180
|
-
// Convert and validate page
|
|
181
|
-
dto.page = plain.page ? Number(plain.page) : 1;
|
|
182
|
-
// Convert and validate limit
|
|
183
|
-
dto.limit = plain.limit ? Number(plain.limit) : 10;
|
|
184
|
-
// Handle sort if present
|
|
185
|
-
if (plain.sort) {
|
|
186
|
-
dto.sort = {
|
|
187
|
-
field: plain.sort.field,
|
|
188
|
-
direction: (_a = plain.sort.direction) === null || _a === void 0 ? void 0 : _a.toLowerCase()
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return dto;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
__decorate([
|
|
196
|
-
(0, class_validator_1.IsNumber)(),
|
|
197
|
-
(0, class_validator_1.Min)(1),
|
|
198
|
-
__metadata("design:type", Number)
|
|
199
|
-
], FaqOptionsDTO.prototype, "page", void 0);
|
|
200
|
-
__decorate([
|
|
201
|
-
(0, class_transformer_1.Type)(() => SortDTO),
|
|
202
|
-
(0, class_validator_1.IsNumber)(),
|
|
203
|
-
(0, class_validator_1.Min)(1),
|
|
204
|
-
(0, class_validator_1.Max)(100) // Optional: add max limit to prevent excessive requests
|
|
205
|
-
,
|
|
206
|
-
__metadata("design:type", Number)
|
|
207
|
-
], FaqOptionsDTO.prototype, "limit", void 0);
|
|
208
|
-
__decorate([
|
|
209
|
-
(0, class_validator_1.IsOptional)(),
|
|
210
|
-
(0, class_validator_1.ValidateNested)(),
|
|
211
|
-
(0, class_transformer_1.Type)(() => SortDTO),
|
|
212
|
-
__metadata("design:type", Object)
|
|
213
|
-
], FaqOptionsDTO.prototype, "sort", void 0);
|
|
214
|
-
exports.FaqOptionsDTO = FaqOptionsDTO;
|
|
215
|
-
class FaqFetchDTO {
|
|
216
|
-
static fromPlain(plain) {
|
|
217
|
-
return (0, class_transformer_1.plainToClass)(FaqFetchDTO, {
|
|
218
|
-
filter: plain.filter,
|
|
219
|
-
options: plain.options
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
constructor(init) {
|
|
223
|
-
Object.assign(this, init);
|
|
224
|
-
}
|
|
225
|
-
static toPlain(instance) {
|
|
226
|
-
return (0, class_transformer_1.instanceToPlain)(instance);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
__decorate([
|
|
230
|
-
(0, class_transformer_1.Type)(() => FaqFilterDTO),
|
|
231
|
-
(0, class_validator_1.ValidateNested)(),
|
|
232
|
-
(0, class_validator_1.IsOptional)(),
|
|
233
|
-
__metadata("design:type", FaqFilterDTO)
|
|
234
|
-
], FaqFetchDTO.prototype, "filter", void 0);
|
|
235
|
-
__decorate([
|
|
236
|
-
(0, class_transformer_1.Type)(() => FaqOptionsDTO),
|
|
237
|
-
(0, class_validator_1.ValidateNested)(),
|
|
238
|
-
(0, class_validator_1.IsOptional)(),
|
|
239
|
-
__metadata("design:type", FaqOptionsDTO)
|
|
240
|
-
], FaqFetchDTO.prototype, "options", void 0);
|
|
241
|
-
exports.FaqFetchDTO = FaqFetchDTO;
|
|
242
|
-
class FaqResponseDTO {
|
|
243
|
-
toPlain() {
|
|
244
|
-
return {
|
|
245
|
-
id: this.id,
|
|
246
|
-
question: this.question.toPlain(),
|
|
247
|
-
answer: this.answer.toPlain(),
|
|
248
|
-
category: this.category,
|
|
249
|
-
isActive: this.isActive,
|
|
250
|
-
order: this.order,
|
|
251
|
-
createdAt: this.createdAt,
|
|
252
|
-
updatedAt: this.updatedAt
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
static fromPlain(plain) {
|
|
256
|
-
if (!plain) {
|
|
257
|
-
throw new Error('Cannot create FaqResponseDTO from null or undefined');
|
|
258
|
-
}
|
|
259
|
-
const dto = new FaqResponseDTO();
|
|
260
|
-
try {
|
|
261
|
-
dto.id = plain.id;
|
|
262
|
-
dto.question = MultilingualContentFetch.fromPlain(plain.question);
|
|
263
|
-
dto.answer = MultilingualContentFetch.fromPlain(plain.answer);
|
|
264
|
-
dto.category = plain.category;
|
|
265
|
-
dto.isActive = Boolean(plain.isActive);
|
|
266
|
-
dto.order = Number(plain.order);
|
|
267
|
-
dto.createdAt = plain.createdAt;
|
|
268
|
-
dto.updatedAt = plain.updatedAt;
|
|
269
|
-
return dto;
|
|
270
|
-
}
|
|
271
|
-
catch (error) {
|
|
272
|
-
if (error instanceof Error) {
|
|
273
|
-
throw new Error(`Failed to create FaqResponseDTO: ${error.message}`);
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
throw new Error('Failed to create FaqResponseDTO: Unknown error');
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
// Optional: Add a validate method if needed
|
|
281
|
-
validate() {
|
|
282
|
-
const errors = [];
|
|
283
|
-
if (!this.id)
|
|
284
|
-
errors.push('ID is required');
|
|
285
|
-
if (!this.question)
|
|
286
|
-
errors.push('Question is required');
|
|
287
|
-
if (!this.answer)
|
|
288
|
-
errors.push('Answer is required');
|
|
289
|
-
if (!this.category)
|
|
290
|
-
errors.push('Category is required');
|
|
291
|
-
if (this.isActive === undefined)
|
|
292
|
-
errors.push('isActive is required');
|
|
293
|
-
if (this.order === undefined)
|
|
294
|
-
errors.push('Order is required');
|
|
295
|
-
if (!this.createdAt)
|
|
296
|
-
errors.push('CreatedAt is required');
|
|
297
|
-
if (!this.updatedAt)
|
|
298
|
-
errors.push('UpdatedAt is required');
|
|
299
|
-
// Add any additional validation logic here
|
|
300
|
-
return errors;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
__decorate([
|
|
304
|
-
(0, class_validator_1.IsString)(),
|
|
305
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
306
|
-
__metadata("design:type", String)
|
|
307
|
-
], FaqResponseDTO.prototype, "id", void 0);
|
|
308
|
-
__decorate([
|
|
309
|
-
(0, class_validator_1.ValidateNested)(),
|
|
310
|
-
(0, class_transformer_1.Type)(() => MultilingualContentFetch),
|
|
311
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
312
|
-
__metadata("design:type", MultilingualContentFetch)
|
|
313
|
-
], FaqResponseDTO.prototype, "question", void 0);
|
|
314
|
-
__decorate([
|
|
315
|
-
(0, class_validator_1.ValidateNested)(),
|
|
316
|
-
(0, class_transformer_1.Type)(() => MultilingualContentFetch),
|
|
317
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
318
|
-
__metadata("design:type", MultilingualContentFetch)
|
|
319
|
-
], FaqResponseDTO.prototype, "answer", void 0);
|
|
320
|
-
__decorate([
|
|
321
|
-
(0, class_validator_1.IsString)(),
|
|
322
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
323
|
-
(0, class_validator_1.IsEnum)(enums_1.FaqCategory) // Add enum validation if you have FaqCategory enum
|
|
324
|
-
,
|
|
325
|
-
__metadata("design:type", String)
|
|
326
|
-
], FaqResponseDTO.prototype, "category", void 0);
|
|
327
|
-
__decorate([
|
|
328
|
-
(0, class_validator_1.IsBoolean)(),
|
|
329
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
330
|
-
__metadata("design:type", Boolean)
|
|
331
|
-
], FaqResponseDTO.prototype, "isActive", void 0);
|
|
332
|
-
__decorate([
|
|
333
|
-
(0, class_validator_1.IsNumber)(),
|
|
334
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
335
|
-
(0, class_validator_1.Min)(0) // Add minimum value validation
|
|
336
|
-
,
|
|
337
|
-
__metadata("design:type", Number)
|
|
338
|
-
], FaqResponseDTO.prototype, "order", void 0);
|
|
339
|
-
__decorate([
|
|
340
|
-
(0, class_validator_1.IsString)(),
|
|
341
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
342
|
-
__metadata("design:type", String)
|
|
343
|
-
], FaqResponseDTO.prototype, "createdAt", void 0);
|
|
344
|
-
__decorate([
|
|
345
|
-
(0, class_validator_1.IsString)(),
|
|
346
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
347
|
-
__metadata("design:type", String)
|
|
348
|
-
], FaqResponseDTO.prototype, "updatedAt", void 0);
|
|
349
|
-
exports.FaqResponseDTO = FaqResponseDTO;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.UpdateFaqDTO = exports.UpdateMultilingualContent = void 0;
|
|
13
|
-
const class_transformer_1 = require("class-transformer");
|
|
14
|
-
const class_validator_1 = require("class-validator");
|
|
15
|
-
const enums_1 = require("../enums");
|
|
16
|
-
class UpdateMultilingualContent {
|
|
17
|
-
}
|
|
18
|
-
__decorate([
|
|
19
|
-
(0, class_validator_1.IsOptional)(),
|
|
20
|
-
(0, class_validator_1.IsString)(),
|
|
21
|
-
__metadata("design:type", String)
|
|
22
|
-
], UpdateMultilingualContent.prototype, "en", void 0);
|
|
23
|
-
__decorate([
|
|
24
|
-
(0, class_validator_1.IsOptional)(),
|
|
25
|
-
(0, class_validator_1.IsString)(),
|
|
26
|
-
__metadata("design:type", String)
|
|
27
|
-
], UpdateMultilingualContent.prototype, "ar", void 0);
|
|
28
|
-
__decorate([
|
|
29
|
-
(0, class_validator_1.IsOptional)(),
|
|
30
|
-
(0, class_validator_1.IsString)(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], UpdateMultilingualContent.prototype, "ru", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, class_validator_1.IsOptional)(),
|
|
35
|
-
(0, class_validator_1.IsString)(),
|
|
36
|
-
__metadata("design:type", String)
|
|
37
|
-
], UpdateMultilingualContent.prototype, "zh", void 0);
|
|
38
|
-
exports.UpdateMultilingualContent = UpdateMultilingualContent;
|
|
39
|
-
class UpdateFaqDTO {
|
|
40
|
-
static fromPlain(plain) {
|
|
41
|
-
const dto = new UpdateFaqDTO();
|
|
42
|
-
if (plain.question) {
|
|
43
|
-
dto.question = {
|
|
44
|
-
en: plain.question.en,
|
|
45
|
-
ar: plain.question.ar,
|
|
46
|
-
ru: plain.question.ru,
|
|
47
|
-
zh: plain.question.zh
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (plain.answer) {
|
|
51
|
-
dto.answer = {
|
|
52
|
-
en: plain.answer.en,
|
|
53
|
-
ar: plain.answer.ar,
|
|
54
|
-
ru: plain.answer.ru,
|
|
55
|
-
zh: plain.answer.zh
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
dto.isActive = plain.isActive;
|
|
59
|
-
dto.order = plain.order;
|
|
60
|
-
return dto;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
__decorate([
|
|
64
|
-
(0, class_validator_1.IsOptional)(),
|
|
65
|
-
(0, class_validator_1.ValidateNested)(),
|
|
66
|
-
(0, class_transformer_1.Type)(() => UpdateMultilingualContent),
|
|
67
|
-
__metadata("design:type", UpdateMultilingualContent)
|
|
68
|
-
], UpdateFaqDTO.prototype, "question", void 0);
|
|
69
|
-
__decorate([
|
|
70
|
-
(0, class_validator_1.IsOptional)(),
|
|
71
|
-
(0, class_validator_1.ValidateNested)(),
|
|
72
|
-
(0, class_transformer_1.Type)(() => UpdateMultilingualContent),
|
|
73
|
-
__metadata("design:type", UpdateMultilingualContent)
|
|
74
|
-
], UpdateFaqDTO.prototype, "answer", void 0);
|
|
75
|
-
__decorate([
|
|
76
|
-
(0, class_validator_1.IsOptional)(),
|
|
77
|
-
(0, class_validator_1.ValidateNested)(),
|
|
78
|
-
(0, class_validator_1.IsEnum)(enums_1.FaqCategory),
|
|
79
|
-
__metadata("design:type", String)
|
|
80
|
-
], UpdateFaqDTO.prototype, "category", void 0);
|
|
81
|
-
__decorate([
|
|
82
|
-
(0, class_validator_1.IsOptional)(),
|
|
83
|
-
(0, class_validator_1.IsBoolean)(),
|
|
84
|
-
__metadata("design:type", Boolean)
|
|
85
|
-
], UpdateFaqDTO.prototype, "isActive", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
(0, class_validator_1.IsOptional)(),
|
|
88
|
-
(0, class_validator_1.IsNumber)(),
|
|
89
|
-
__metadata("design:type", Number)
|
|
90
|
-
], UpdateFaqDTO.prototype, "order", void 0);
|
|
91
|
-
exports.UpdateFaqDTO = UpdateFaqDTO;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./CreateFaqDTO"), exports);
|
|
18
|
-
__exportStar(require("./UpdateFaqDTO"), exports);
|
|
19
|
-
__exportStar(require("./FaqFetchDTO"), exports);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FaqCategory = void 0;
|
|
4
|
-
var FaqCategory;
|
|
5
|
-
(function (FaqCategory) {
|
|
6
|
-
FaqCategory["FINANCE"] = "FINANCE";
|
|
7
|
-
FaqCategory["SELL_CAR"] = "SELL_CAR";
|
|
8
|
-
FaqCategory["BUY_CAR"] = "BUY_CAR";
|
|
9
|
-
FaqCategory["HOME_PAGE"] = "HOME_PAGE";
|
|
10
|
-
})(FaqCategory = exports.FaqCategory || (exports.FaqCategory = {}));
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./dtos/index"), exports);
|
|
18
|
-
__exportStar(require("./enums/index"), exports);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./data"), exports);
|