@deallony/shared 1.2.7 → 1.2.9
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/cjs/constants/company/Company.d.ts +9 -0
- package/dist/cjs/constants/company/Company.js +12 -0
- package/dist/cjs/constants/company/index.d.ts +1 -0
- package/dist/cjs/constants/company/index.js +17 -0
- package/dist/cjs/constants/index.d.ts +1 -0
- package/dist/cjs/constants/index.js +2 -1
- package/dist/cjs/dto/events/Event.d.ts +2 -0
- package/dist/cjs/dto/events/Event.js +5 -0
- package/dist/cjs/dto/events/EventTemplate.d.ts +14 -0
- package/dist/cjs/dto/events/EventTemplate.dto.d.ts +18 -0
- package/dist/cjs/dto/events/EventTemplate.dto.js +11 -0
- package/dist/cjs/dto/events/EventTemplate.js +14 -0
- package/dist/cjs/dto/events/EventType.d.ts +2 -0
- package/dist/cjs/dto/events/EventType.dto.d.ts +16 -0
- package/dist/cjs/dto/events/EventType.dto.js +10 -0
- package/dist/cjs/dto/events/EventType.js +5 -0
- package/dist/cjs/dto/events/EventWedding.d.ts +11 -0
- package/dist/cjs/dto/events/EventWedding.js +9 -0
- package/dist/cjs/dto/events/common.d.ts +5 -0
- package/dist/cjs/dto/events/common.js +8 -0
- package/dist/cjs/types/attributes/CarBody.d.ts +5 -0
- package/dist/cjs/types/attributes/CarBody.js +2 -0
- package/dist/cjs/types/attributes/Facility.d.ts +6 -0
- package/dist/cjs/types/attributes/Facility.js +2 -0
- package/dist/cjs/types/attributes/Feature.d.ts +7 -0
- package/dist/cjs/types/attributes/Feature.js +2 -0
- package/dist/cjs/types/attributes/FuelType.d.ts +5 -0
- package/dist/cjs/types/attributes/FuelType.js +2 -0
- package/dist/cjs/types/attributes/LicenseType.d.ts +5 -0
- package/dist/cjs/types/attributes/LicenseType.js +2 -0
- package/dist/cjs/types/attributes/OfferType.d.ts +5 -0
- package/dist/cjs/types/attributes/OfferType.js +2 -0
- package/dist/cjs/types/attributes/PriceType.d.ts +7 -0
- package/dist/cjs/types/attributes/PriceType.js +2 -0
- package/dist/cjs/types/attributes/PropertyStatus.d.ts +5 -0
- package/dist/cjs/types/attributes/PropertyStatus.js +2 -0
- package/dist/cjs/types/attributes/PublisherType.d.ts +5 -0
- package/dist/cjs/types/attributes/PublisherType.js +2 -0
- package/dist/cjs/types/attributes/RegionalSpec.d.ts +5 -0
- package/dist/cjs/types/attributes/RegionalSpec.js +2 -0
- package/dist/cjs/types/attributes/Transmission.d.ts +5 -0
- package/dist/cjs/types/attributes/Transmission.js +2 -0
- package/dist/cjs/types/attributes/Unit.d.ts +5 -0
- package/dist/cjs/types/attributes/Unit.js +2 -0
- package/dist/cjs/types/attributes/UsedProductAge.d.ts +7 -0
- package/dist/cjs/types/attributes/UsedProductAge.js +2 -0
- package/dist/cjs/types/attributes/UsedProductCondition.d.ts +7 -0
- package/dist/cjs/types/attributes/UsedProductCondition.js +2 -0
- package/dist/cjs/types/attributes/WorkType.d.ts +6 -0
- package/dist/cjs/types/attributes/WorkType.js +2 -0
- package/dist/cjs/types/common/AccessType.d.ts +5 -0
- package/dist/cjs/types/common/AccessType.js +2 -0
- package/dist/cjs/types/company/Company.d.ts +1 -0
- package/dist/cjs/types/events/EventTemplate.d.ts +14 -0
- package/dist/cjs/types/events/EventTemplate.js +14 -0
- package/dist/cjs/types/events/EventType.d.ts +10 -0
- package/dist/cjs/types/events/EventType.js +11 -0
- package/dist/cjs/types/listings/Ad.d.ts +93 -0
- package/dist/cjs/types/listings/Ad.js +25 -0
- package/dist/cjs/types/listings/AdLocation.d.ts +5 -0
- package/dist/cjs/types/listings/AdLocation.js +2 -0
- package/dist/cjs/types/listings/AdPromotion.d.ts +12 -0
- package/dist/cjs/types/listings/AdPromotion.js +2 -0
- package/dist/cjs/types/listings/Motor.d.ts +24 -0
- package/dist/cjs/types/listings/Motor.js +17 -0
- package/dist/cjs/types/listings/MotorTrim.d.ts +6 -0
- package/dist/cjs/types/listings/MotorTrim.js +2 -0
- package/dist/cjs/types/listings/Property.d.ts +37 -0
- package/dist/cjs/types/listings/Property.js +14 -0
- package/dist/cjs/types/listings/PropertySubType.d.ts +6 -0
- package/dist/cjs/types/listings/PropertySubType.js +2 -0
- package/dist/cjs/types/listings/Service.d.ts +14 -0
- package/dist/cjs/types/listings/Service.js +9 -0
- package/dist/cjs/types/listings/UsedProduct.d.ts +8 -0
- package/dist/cjs/types/listings/UsedProduct.js +7 -0
- package/dist/cjs/types/listings/index.d.ts +5 -0
- package/dist/cjs/types/listings/index.js +21 -0
- package/dist/cjs/validation/ad/save-ad.d.ts +45 -0
- package/dist/cjs/validation/ad/save-ad.js +55 -0
- package/dist/esm/constants/company/Company.js +9 -0
- package/dist/esm/constants/company/index.js +1 -0
- package/dist/esm/constants/index.js +1 -0
- package/dist/esm/dto/events/Event.js +1 -0
- package/dist/esm/dto/events/EventTemplate.dto.js +8 -0
- package/dist/esm/dto/events/EventTemplate.js +11 -0
- package/dist/esm/dto/events/EventType.dto.js +7 -0
- package/dist/esm/dto/events/EventType.js +1 -0
- package/dist/esm/dto/events/EventWedding.js +6 -0
- package/dist/esm/dto/events/common.js +5 -0
- package/dist/esm/types/attributes/CarBody.js +1 -0
- package/dist/esm/types/attributes/Facility.js +1 -0
- package/dist/esm/types/attributes/Feature.js +1 -0
- package/dist/esm/types/attributes/FuelType.js +1 -0
- package/dist/esm/types/attributes/LicenseType.js +1 -0
- package/dist/esm/types/attributes/OfferType.js +1 -0
- package/dist/esm/types/attributes/PriceType.js +1 -0
- package/dist/esm/types/attributes/PropertyStatus.js +1 -0
- package/dist/esm/types/attributes/PublisherType.js +1 -0
- package/dist/esm/types/attributes/RegionalSpec.js +1 -0
- package/dist/esm/types/attributes/Transmission.js +1 -0
- package/dist/esm/types/attributes/Unit.js +1 -0
- package/dist/esm/types/attributes/UsedProductAge.js +1 -0
- package/dist/esm/types/attributes/UsedProductCondition.js +1 -0
- package/dist/esm/types/attributes/WorkType.js +1 -0
- package/dist/esm/types/common/AccessType.js +1 -0
- package/dist/esm/types/events/EventTemplate.js +11 -0
- package/dist/esm/types/events/EventType.js +8 -0
- package/dist/esm/types/listings/Ad.js +22 -0
- package/dist/esm/types/listings/AdLocation.js +1 -0
- package/dist/esm/types/listings/AdPromotion.js +1 -0
- package/dist/esm/types/listings/Motor.js +14 -0
- package/dist/esm/types/listings/MotorTrim.js +1 -0
- package/dist/esm/types/listings/Property.js +11 -0
- package/dist/esm/types/listings/PropertySubType.js +1 -0
- package/dist/esm/types/listings/Service.js +6 -0
- package/dist/esm/types/listings/UsedProduct.js +4 -0
- package/dist/esm/types/listings/index.js +5 -0
- package/dist/esm/validation/ad/save-ad.js +52 -0
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SubjectTableEnum } from "../common/Subject";
|
|
2
|
+
export type MotorDoors = number | null;
|
|
3
|
+
export type IMotor = {
|
|
4
|
+
id: number;
|
|
5
|
+
componentType?: SubjectTableEnum.MOTORS;
|
|
6
|
+
trim_id?: number | null;
|
|
7
|
+
body_type_id: number;
|
|
8
|
+
regional_spec_id: number;
|
|
9
|
+
transmission_id: number;
|
|
10
|
+
fuel_type_id: number;
|
|
11
|
+
interior_color_id: number | null;
|
|
12
|
+
exterior_color_id?: number | null;
|
|
13
|
+
mileage: number;
|
|
14
|
+
offer_type_id: number;
|
|
15
|
+
year: number | null;
|
|
16
|
+
doors?: MotorDoors;
|
|
17
|
+
horsepower?: number | null;
|
|
18
|
+
created_at: string;
|
|
19
|
+
updated_at: string;
|
|
20
|
+
publisher_type_id?: number;
|
|
21
|
+
price_type_id?: number;
|
|
22
|
+
seats_count: number | null;
|
|
23
|
+
};
|
|
24
|
+
export declare const emptyMotor: IMotor;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emptyMotor = void 0;
|
|
4
|
+
exports.emptyMotor = {
|
|
5
|
+
id: 0,
|
|
6
|
+
body_type_id: 0,
|
|
7
|
+
regional_spec_id: 0,
|
|
8
|
+
transmission_id: 0,
|
|
9
|
+
fuel_type_id: 0,
|
|
10
|
+
interior_color_id: null,
|
|
11
|
+
mileage: 0,
|
|
12
|
+
offer_type_id: 0,
|
|
13
|
+
year: null,
|
|
14
|
+
created_at: "",
|
|
15
|
+
updated_at: "",
|
|
16
|
+
seats_count: null,
|
|
17
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SubjectTableEnum } from "../common/Subject";
|
|
2
|
+
export type PropertyBathrooms = "0" | "1" | "2" | "3" | "4" | "5" | "6";
|
|
3
|
+
export type PropertyFurnished = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "+10";
|
|
4
|
+
export type IPropertyFacility = {
|
|
5
|
+
distance_in_meters: number;
|
|
6
|
+
facility_id: number;
|
|
7
|
+
};
|
|
8
|
+
export type IPropertyFeature = {
|
|
9
|
+
id: number;
|
|
10
|
+
properties_id: number;
|
|
11
|
+
feature_id: number;
|
|
12
|
+
};
|
|
13
|
+
export type IProperty = {
|
|
14
|
+
id: number;
|
|
15
|
+
componentType?: SubjectTableEnum.PROPERTIES;
|
|
16
|
+
offer_type_id: number;
|
|
17
|
+
price_type_id: number;
|
|
18
|
+
size_m2: number;
|
|
19
|
+
bedrooms: number;
|
|
20
|
+
district_id?: number;
|
|
21
|
+
created_at: string;
|
|
22
|
+
updated_at: string;
|
|
23
|
+
property_facilities: IPropertyFacility[];
|
|
24
|
+
property_features?: IPropertyFeature[];
|
|
25
|
+
feature_ids: number[];
|
|
26
|
+
property_status_id?: number;
|
|
27
|
+
license_type_id?: number;
|
|
28
|
+
floor?: number;
|
|
29
|
+
total_floors?: number;
|
|
30
|
+
age_id?: number;
|
|
31
|
+
bathrooms?: number;
|
|
32
|
+
condition_id?: number;
|
|
33
|
+
publisher_type_id?: number;
|
|
34
|
+
furnished?: boolean;
|
|
35
|
+
parking?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export declare const emptyProperty: IProperty;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.emptyProperty = void 0;
|
|
4
|
+
exports.emptyProperty = {
|
|
5
|
+
id: 0,
|
|
6
|
+
offer_type_id: 0,
|
|
7
|
+
price_type_id: 0,
|
|
8
|
+
size_m2: 0,
|
|
9
|
+
bedrooms: 0,
|
|
10
|
+
created_at: "",
|
|
11
|
+
updated_at: "",
|
|
12
|
+
property_facilities: [],
|
|
13
|
+
feature_ids: [],
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type IServiceLocation = {
|
|
2
|
+
id?: number;
|
|
3
|
+
service_id?: number;
|
|
4
|
+
district_id?: number;
|
|
5
|
+
city_id: number;
|
|
6
|
+
};
|
|
7
|
+
export type IService = {
|
|
8
|
+
id?: number;
|
|
9
|
+
unit_id: number | null;
|
|
10
|
+
access_type_id: number | null;
|
|
11
|
+
work_type_id: number | null;
|
|
12
|
+
locations: IServiceLocation[];
|
|
13
|
+
};
|
|
14
|
+
export declare const emptyService: IService;
|
|
@@ -0,0 +1,21 @@
|
|
|
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("../ad"), exports);
|
|
18
|
+
__exportStar(require("../motor"), exports);
|
|
19
|
+
__exportStar(require("../property"), exports);
|
|
20
|
+
__exportStar(require("../service"), exports);
|
|
21
|
+
__exportStar(require("../used-product"), exports);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const createAdSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodOptional<z.ZodString>;
|
|
4
|
+
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
5
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
6
|
+
category_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
7
|
+
price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
8
|
+
currency_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
9
|
+
negotiable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
10
|
+
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
11
|
+
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
12
|
+
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
13
|
+
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
14
|
+
base_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
15
|
+
contact_methods: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
16
|
+
by_message: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
by_whatsapp: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
21
|
+
user_id: z.ZodCoercedNumber<unknown>;
|
|
22
|
+
id: z.ZodOptional<z.ZodNever>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export declare const updateAdSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
26
|
+
title: z.ZodOptional<z.ZodString>;
|
|
27
|
+
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
28
|
+
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
29
|
+
category_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
30
|
+
price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
31
|
+
currency_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
32
|
+
negotiable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
33
|
+
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
34
|
+
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
35
|
+
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
36
|
+
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
37
|
+
base_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
38
|
+
contact_methods: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
39
|
+
by_message: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
by_whatsapp: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
}, z.core.$strip>>>;
|
|
43
|
+
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
44
|
+
user_id: z.ZodCoercedNumber<unknown>;
|
|
45
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateAdSchema = exports.createAdSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const baseAdCommon = zod_1.z.object({
|
|
6
|
+
title: zod_1.z.string().trim().optional(),
|
|
7
|
+
status_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
8
|
+
description: zod_1.z.string().trim().optional().nullable(),
|
|
9
|
+
category_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
10
|
+
price: zod_1.z.coerce.number().min(0).optional().nullable(),
|
|
11
|
+
currency_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
12
|
+
negotiable: zod_1.z.coerce.boolean().optional().nullable(),
|
|
13
|
+
city_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
14
|
+
latitude: zod_1.z.coerce.number().optional().nullable(),
|
|
15
|
+
longitude: zod_1.z.coerce.number().optional().nullable(),
|
|
16
|
+
media: zod_1.z.array(zod_1.z.any()).optional().nullable(),
|
|
17
|
+
// subject_type: SubjectTypeSchema.optional(),
|
|
18
|
+
base_price: zod_1.z.coerce.number().optional().nullable(),
|
|
19
|
+
contact_methods: zod_1.z.object({
|
|
20
|
+
by_message: zod_1.z.boolean().optional(),
|
|
21
|
+
by_whatsapp: zod_1.z.boolean().optional(),
|
|
22
|
+
by_call: zod_1.z.boolean().optional(),
|
|
23
|
+
}).optional().nullable(),
|
|
24
|
+
selected_phone: zod_1.z.string().trim().optional().nullable(),
|
|
25
|
+
});
|
|
26
|
+
exports.createAdSchema = zod_1.z.object({
|
|
27
|
+
user_id: zod_1.z.coerce.number().int().positive(),
|
|
28
|
+
id: zod_1.z.never().optional(), // disallow id on create
|
|
29
|
+
...baseAdCommon.shape,
|
|
30
|
+
// motor: createMotorSchema
|
|
31
|
+
// .extend({ ad_id: z.coerce.number().optional() })
|
|
32
|
+
// .optional()
|
|
33
|
+
// .nullable(),
|
|
34
|
+
// // Make nested ad_id optional/nullable without changing original schemas
|
|
35
|
+
// property: createPropertySchema
|
|
36
|
+
// .extend({ ad_id: z.coerce.number().optional() })
|
|
37
|
+
// .optional()
|
|
38
|
+
// .nullable(),
|
|
39
|
+
// product: createUsedProductSchema
|
|
40
|
+
// .extend({ ad_id: z.coerce.number().optional() })
|
|
41
|
+
// .optional()
|
|
42
|
+
// .nullable(),
|
|
43
|
+
// service: createServiceSchema
|
|
44
|
+
// .extend({ ad_id: z.coerce.number().optional() })
|
|
45
|
+
// .optional()
|
|
46
|
+
// .nullable(),
|
|
47
|
+
});
|
|
48
|
+
exports.updateAdSchema = zod_1.z.object({
|
|
49
|
+
...exports.createAdSchema.shape,
|
|
50
|
+
id: zod_1.z.coerce.number().int().positive(),
|
|
51
|
+
// motor: updateMotorSchema.optional().nullable(),
|
|
52
|
+
// property: updatePropertySchema.optional().nullable(),
|
|
53
|
+
// product: updateUsedProductSchema.optional().nullable(),
|
|
54
|
+
// service: updateServiceSchema.optional().nullable(),
|
|
55
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const COMPANY_STATUS = {
|
|
2
|
+
PENDING: 'pending',
|
|
3
|
+
APPROVED: 'approved',
|
|
4
|
+
REJECTED: 'rejected',
|
|
5
|
+
};
|
|
6
|
+
export const CompanyStatusOptions = Object.values(COMPANY_STATUS).map((status) => ({
|
|
7
|
+
value: status,
|
|
8
|
+
label: status.charAt(0).toUpperCase() + status.slice(1),
|
|
9
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Company.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * as Subject from "./common/Subject.js";
|
|
2
2
|
export * as COMMON from "./common/index.js";
|
|
3
3
|
export * as AD from "./ad/index.js";
|
|
4
|
+
export * as COMPANY from "./company/index.js";
|
|
4
5
|
export * as EVENTS from "./events/index.js";
|
|
5
6
|
export * as MOTOR from "./motor/index.js";
|
|
6
7
|
export * as PROPERTY from "./property/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { emptyEvent } from './Event.dto.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const EventTemplate = {
|
|
2
|
+
WEDDING: { value: 'wedding-1', name: { en: 'Wedding', ar: 'زفاف' }, event_types: ['wedding'] },
|
|
3
|
+
};
|
|
4
|
+
export const EventTemplateOptions = Object.values(EventTemplate).map((type) => ({
|
|
5
|
+
value: type.value,
|
|
6
|
+
name: type.name,
|
|
7
|
+
event_types: type.event_types,
|
|
8
|
+
}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createEmptyLocalizedName } from '../../types/common/LocalizedName.js';
|
|
2
|
+
export const emptyEventTemplate = {
|
|
3
|
+
id: 0,
|
|
4
|
+
code: '',
|
|
5
|
+
name: createEmptyLocalizedName(),
|
|
6
|
+
active: true,
|
|
7
|
+
religion: null,
|
|
8
|
+
event_type_id: 0,
|
|
9
|
+
eventType: undefined,
|
|
10
|
+
weddings: [],
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { emptyEventType } from './EventType.dto.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createEmptyLocalizedName } from '../common/LocalizedName.js';
|
|
2
|
+
export const emptyEventTemplate = {
|
|
3
|
+
id: 0,
|
|
4
|
+
code: '',
|
|
5
|
+
name: createEmptyLocalizedName(),
|
|
6
|
+
active: true,
|
|
7
|
+
religion: null,
|
|
8
|
+
event_type_id: 0,
|
|
9
|
+
eventType: undefined,
|
|
10
|
+
weddings: [],
|
|
11
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { emptyMotor } from "./Motor.js";
|
|
2
|
+
import { emptyProperty } from "./Property.js";
|
|
3
|
+
import { emptyService } from "./Service.js";
|
|
4
|
+
import { emptyUsedProduct } from "./UsedProduct.js";
|
|
5
|
+
export const emptyAd = {
|
|
6
|
+
id: 0,
|
|
7
|
+
user_id: 0,
|
|
8
|
+
status_id: 0,
|
|
9
|
+
title: "",
|
|
10
|
+
description: "",
|
|
11
|
+
negotiable: false,
|
|
12
|
+
latitude: 0,
|
|
13
|
+
longitude: 0,
|
|
14
|
+
baseAdminBoundaryId: 0,
|
|
15
|
+
contact_methods: null,
|
|
16
|
+
selected_phone: null,
|
|
17
|
+
media: [],
|
|
18
|
+
property: emptyProperty,
|
|
19
|
+
motor: emptyMotor,
|
|
20
|
+
service: emptyService,
|
|
21
|
+
product: emptyUsedProduct,
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const emptyMotor = {
|
|
2
|
+
id: 0,
|
|
3
|
+
body_type_id: 0,
|
|
4
|
+
regional_spec_id: 0,
|
|
5
|
+
transmission_id: 0,
|
|
6
|
+
fuel_type_id: 0,
|
|
7
|
+
interior_color_id: null,
|
|
8
|
+
mileage: 0,
|
|
9
|
+
offer_type_id: 0,
|
|
10
|
+
year: null,
|
|
11
|
+
created_at: "",
|
|
12
|
+
updated_at: "",
|
|
13
|
+
seats_count: null,
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const baseAdCommon = z.object({
|
|
3
|
+
title: z.string().trim().optional(),
|
|
4
|
+
status_id: z.coerce.number().int().positive().optional(),
|
|
5
|
+
description: z.string().trim().optional().nullable(),
|
|
6
|
+
category_id: z.coerce.number().int().positive().optional().nullable(),
|
|
7
|
+
price: z.coerce.number().min(0).optional().nullable(),
|
|
8
|
+
currency_id: z.coerce.number().int().positive().optional().nullable(),
|
|
9
|
+
negotiable: z.coerce.boolean().optional().nullable(),
|
|
10
|
+
city_id: z.coerce.number().int().positive().optional().nullable(),
|
|
11
|
+
latitude: z.coerce.number().optional().nullable(),
|
|
12
|
+
longitude: z.coerce.number().optional().nullable(),
|
|
13
|
+
media: z.array(z.any()).optional().nullable(),
|
|
14
|
+
// subject_type: SubjectTypeSchema.optional(),
|
|
15
|
+
base_price: z.coerce.number().optional().nullable(),
|
|
16
|
+
contact_methods: z.object({
|
|
17
|
+
by_message: z.boolean().optional(),
|
|
18
|
+
by_whatsapp: z.boolean().optional(),
|
|
19
|
+
by_call: z.boolean().optional(),
|
|
20
|
+
}).optional().nullable(),
|
|
21
|
+
selected_phone: z.string().trim().optional().nullable(),
|
|
22
|
+
});
|
|
23
|
+
export const createAdSchema = z.object({
|
|
24
|
+
user_id: z.coerce.number().int().positive(),
|
|
25
|
+
id: z.never().optional(), // disallow id on create
|
|
26
|
+
...baseAdCommon.shape,
|
|
27
|
+
// motor: createMotorSchema
|
|
28
|
+
// .extend({ ad_id: z.coerce.number().optional() })
|
|
29
|
+
// .optional()
|
|
30
|
+
// .nullable(),
|
|
31
|
+
// // Make nested ad_id optional/nullable without changing original schemas
|
|
32
|
+
// property: createPropertySchema
|
|
33
|
+
// .extend({ ad_id: z.coerce.number().optional() })
|
|
34
|
+
// .optional()
|
|
35
|
+
// .nullable(),
|
|
36
|
+
// product: createUsedProductSchema
|
|
37
|
+
// .extend({ ad_id: z.coerce.number().optional() })
|
|
38
|
+
// .optional()
|
|
39
|
+
// .nullable(),
|
|
40
|
+
// service: createServiceSchema
|
|
41
|
+
// .extend({ ad_id: z.coerce.number().optional() })
|
|
42
|
+
// .optional()
|
|
43
|
+
// .nullable(),
|
|
44
|
+
});
|
|
45
|
+
export const updateAdSchema = z.object({
|
|
46
|
+
...createAdSchema.shape,
|
|
47
|
+
id: z.coerce.number().int().positive(),
|
|
48
|
+
// motor: updateMotorSchema.optional().nullable(),
|
|
49
|
+
// property: updatePropertySchema.optional().nullable(),
|
|
50
|
+
// product: updateUsedProductSchema.optional().nullable(),
|
|
51
|
+
// service: updateServiceSchema.optional().nullable(),
|
|
52
|
+
});
|