@alba-cars/common-modules
Version:
A package containing DTOs, validation classes and common modules and interfaces for Alba Cars
309 lines (308 loc) • 13.1 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LeadPreferencesGetDTO = exports.LeadPreferencesFilter = exports.LeadPreferencesCreateDTO = exports.LeadPreferencesUpdateDTO = exports.LeadPreferencesDTO = void 0;
const class_validator_1 = require("class-validator");
const class_transformer_1 = require("class-transformer");
const global_1 = require("../../../../global");
const core_1 = require("../../../../core");
class LeadPreferencesDTO {
validate() {
const errors = (0, class_validator_1.validateSync)(this);
return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
}
static fromPlain(plain) {
return (0, class_transformer_1.plainToClass)(LeadPreferencesDTO, plain);
}
toPlain() {
return (0, class_transformer_1.classToPlain)(this);
}
}
__decorate([
(0, class_validator_1.IsUUID)(),
__metadata("design:type", String)
], LeadPreferencesDTO.prototype, "id", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesDTO.prototype, "budgetMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesDTO.prototype, "budgetMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesDTO.prototype, "preferredMake", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesDTO.prototype, "preferredModel", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesDTO.prototype, "preferredYearMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesDTO.prototype, "preferredYearMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesDTO.prototype, "mileageMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesDTO.prototype, "mileageMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], LeadPreferencesDTO.prototype, "preferredColors", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], LeadPreferencesDTO.prototype, "preferredFeatures", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesDTO.prototype, "additionalPreferences", void 0);
exports.LeadPreferencesDTO = LeadPreferencesDTO;
class LeadPreferencesUpdateDTO {
validate() {
const errors = (0, class_validator_1.validateSync)(this);
return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
}
static fromPlain(plain) {
return (0, class_transformer_1.plainToClass)(LeadPreferencesUpdateDTO, plain);
}
toPlain() {
return (0, class_transformer_1.classToPlain)(this);
}
}
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesUpdateDTO.prototype, "budgetMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesUpdateDTO.prototype, "budgetMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesUpdateDTO.prototype, "preferredMake", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesUpdateDTO.prototype, "preferredModel", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesUpdateDTO.prototype, "preferredYearMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesUpdateDTO.prototype, "preferredYearMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesUpdateDTO.prototype, "mileageMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesUpdateDTO.prototype, "mileageMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], LeadPreferencesUpdateDTO.prototype, "preferredColors", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], LeadPreferencesUpdateDTO.prototype, "preferredFeatures", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesUpdateDTO.prototype, "additionalPreferences", void 0);
exports.LeadPreferencesUpdateDTO = LeadPreferencesUpdateDTO;
class LeadPreferencesCreateDTO {
validate() {
const errors = (0, class_validator_1.validateSync)(this);
return errors.map((error) => { var _a; return Object.values((_a = error.constraints) !== null && _a !== void 0 ? _a : {}); }).flat();
}
static fromPlain(plain) {
return (0, class_transformer_1.plainToClass)(LeadPreferencesCreateDTO, plain);
}
toPlain() {
return (0, class_transformer_1.classToPlain)(this);
}
}
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesCreateDTO.prototype, "budgetMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesCreateDTO.prototype, "budgetMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesCreateDTO.prototype, "preferredMake", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesCreateDTO.prototype, "preferredModel", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesCreateDTO.prototype, "preferredYearMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesCreateDTO.prototype, "preferredYearMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesCreateDTO.prototype, "mileageMin", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], LeadPreferencesCreateDTO.prototype, "mileageMax", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], LeadPreferencesCreateDTO.prototype, "preferredColors", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], LeadPreferencesCreateDTO.prototype, "preferredFeatures", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesCreateDTO.prototype, "additionalPreferences", void 0);
exports.LeadPreferencesCreateDTO = LeadPreferencesCreateDTO;
class LeadPreferencesFilter extends global_1.TypedFilter {
}
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Object)
], LeadPreferencesFilter.prototype, "id", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => core_1.Range),
__metadata("design:type", core_1.Range)
], LeadPreferencesFilter.prototype, "budgetRange", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesFilter.prototype, "make", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesFilter.prototype, "model", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => core_1.Range),
__metadata("design:type", core_1.Range)
], LeadPreferencesFilter.prototype, "yearRange", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => core_1.Range),
__metadata("design:type", core_1.Range)
], LeadPreferencesFilter.prototype, "mileageRange", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], LeadPreferencesFilter.prototype, "colors", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsString)({ each: true }),
__metadata("design:type", Array)
], LeadPreferencesFilter.prototype, "features", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], LeadPreferencesFilter.prototype, "search", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Type)(() => Date),
__metadata("design:type", Date)
], LeadPreferencesFilter.prototype, "fromDate", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_transformer_1.Type)(() => Date),
__metadata("design:type", Date)
], LeadPreferencesFilter.prototype, "toDate", void 0);
exports.LeadPreferencesFilter = LeadPreferencesFilter;
class LeadPreferencesGetDTO extends global_1.BaseGetDTO {
}
__decorate([
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => LeadPreferencesFilter),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", LeadPreferencesFilter)
], LeadPreferencesGetDTO.prototype, "filters", void 0);
__decorate([
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => global_1.TypedOptions),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", global_1.TypedOptions)
], LeadPreferencesGetDTO.prototype, "options", void 0);
exports.LeadPreferencesGetDTO = LeadPreferencesGetDTO;