@deallony/shared 1.1.96 → 1.1.97
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.
|
@@ -1,5 +1,72 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const createAdSchema: z.ZodObject<{
|
|
3
|
+
motor: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
4
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
5
|
+
trim_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
6
|
+
body_type_id: z.ZodCoercedNumber<unknown>;
|
|
7
|
+
regional_spec_id: z.ZodCoercedNumber<unknown>;
|
|
8
|
+
transmission_id: z.ZodCoercedNumber<unknown>;
|
|
9
|
+
fuel_type_id: z.ZodCoercedNumber<unknown>;
|
|
10
|
+
exterior_color_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
11
|
+
price_type_id: z.ZodCoercedNumber<unknown>;
|
|
12
|
+
publisher_type_id: z.ZodCoercedNumber<unknown>;
|
|
13
|
+
interior_color_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
14
|
+
mileage: z.ZodCoercedNumber<unknown>;
|
|
15
|
+
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
16
|
+
year: z.ZodCoercedNumber<unknown>;
|
|
17
|
+
doors: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
18
|
+
horsepower: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
19
|
+
seats_count: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
20
|
+
engine_capacity_cc: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
21
|
+
cylinders_count: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
22
|
+
feature_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
23
|
+
}, z.core.$strip>>>;
|
|
24
|
+
property: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
25
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
26
|
+
size_m2: z.ZodCoercedNumber<unknown>;
|
|
27
|
+
bedrooms: z.ZodCoercedNumber<unknown>;
|
|
28
|
+
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
29
|
+
district_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
30
|
+
property_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
31
|
+
price_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
32
|
+
publisher_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
33
|
+
bathrooms: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
34
|
+
furnished: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
35
|
+
parking: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
36
|
+
floor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
37
|
+
total_floors: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
38
|
+
feature_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
|
|
39
|
+
facility_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
|
|
40
|
+
property_facilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
41
|
+
property_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
42
|
+
facility_id: z.ZodCoercedNumber<unknown>;
|
|
43
|
+
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
44
|
+
}, z.core.$strip>>>;
|
|
45
|
+
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
46
|
+
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
47
|
+
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
48
|
+
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
49
|
+
}, z.core.$strip>>>;
|
|
50
|
+
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
51
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
52
|
+
condition_id: z.ZodCoercedNumber<unknown>;
|
|
53
|
+
age_id: z.ZodCoercedNumber<unknown>;
|
|
54
|
+
isFree: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
55
|
+
isDeliveryAvailable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
56
|
+
product_type_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
57
|
+
}, z.core.$strip>>>;
|
|
58
|
+
service: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
59
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
60
|
+
access_type_id: z.ZodCoercedNumber<unknown>;
|
|
61
|
+
work_type_id: z.ZodCoercedNumber<unknown>;
|
|
62
|
+
unit_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
63
|
+
locations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
64
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
service_id: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
city_id: z.ZodNumber;
|
|
67
|
+
district_id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
68
|
+
}, z.core.$strip>>>>;
|
|
69
|
+
}, z.core.$strip>>>;
|
|
3
70
|
title: z.ZodOptional<z.ZodString>;
|
|
4
71
|
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
5
72
|
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -10,7 +77,14 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
10
77
|
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
11
78
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
12
79
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
80
|
+
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
13
81
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
82
|
+
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
83
|
+
properties: "properties";
|
|
84
|
+
services: "services";
|
|
85
|
+
motors: "motors";
|
|
86
|
+
used_products: "used_products";
|
|
87
|
+
}>>;
|
|
14
88
|
base_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
15
89
|
contact_methods: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
16
90
|
by_message: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -18,11 +92,83 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
18
92
|
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
19
93
|
}, z.core.$strip>>>;
|
|
20
94
|
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
95
|
+
adLocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
96
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
97
|
+
admin_boundary_id: z.ZodCoercedNumber<unknown>;
|
|
98
|
+
}, z.core.$strip>>>>;
|
|
21
99
|
user_id: z.ZodCoercedNumber<unknown>;
|
|
22
100
|
id: z.ZodOptional<z.ZodNever>;
|
|
23
101
|
}, z.core.$strip>;
|
|
24
102
|
export declare const updateAdSchema: z.ZodObject<{
|
|
25
103
|
id: z.ZodCoercedNumber<unknown>;
|
|
104
|
+
motor: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
105
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
106
|
+
trim_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
107
|
+
body_type_id: z.ZodCoercedNumber<unknown>;
|
|
108
|
+
regional_spec_id: z.ZodCoercedNumber<unknown>;
|
|
109
|
+
transmission_id: z.ZodCoercedNumber<unknown>;
|
|
110
|
+
fuel_type_id: z.ZodCoercedNumber<unknown>;
|
|
111
|
+
exterior_color_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
112
|
+
price_type_id: z.ZodCoercedNumber<unknown>;
|
|
113
|
+
publisher_type_id: z.ZodCoercedNumber<unknown>;
|
|
114
|
+
interior_color_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
115
|
+
mileage: z.ZodCoercedNumber<unknown>;
|
|
116
|
+
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
117
|
+
year: z.ZodCoercedNumber<unknown>;
|
|
118
|
+
doors: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
119
|
+
horsepower: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
120
|
+
seats_count: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
121
|
+
engine_capacity_cc: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
122
|
+
cylinders_count: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
123
|
+
feature_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
124
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
125
|
+
}, z.core.$strip>>>;
|
|
126
|
+
property: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
127
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
128
|
+
size_m2: z.ZodCoercedNumber<unknown>;
|
|
129
|
+
bedrooms: z.ZodCoercedNumber<unknown>;
|
|
130
|
+
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
131
|
+
district_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
132
|
+
property_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
133
|
+
price_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
134
|
+
publisher_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
135
|
+
bathrooms: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
136
|
+
furnished: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
137
|
+
parking: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
138
|
+
floor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
139
|
+
total_floors: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
140
|
+
feature_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
|
|
141
|
+
facility_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
|
|
142
|
+
property_facilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
143
|
+
property_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
144
|
+
facility_id: z.ZodCoercedNumber<unknown>;
|
|
145
|
+
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
146
|
+
}, z.core.$strip>>>;
|
|
147
|
+
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
148
|
+
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
149
|
+
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
150
|
+
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
151
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
152
|
+
}, z.core.$strip>>>;
|
|
153
|
+
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
154
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
155
|
+
condition_id: z.ZodCoercedNumber<unknown>;
|
|
156
|
+
age_id: z.ZodCoercedNumber<unknown>;
|
|
157
|
+
isFree: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
158
|
+
isDeliveryAvailable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
159
|
+
product_type_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
160
|
+
}, z.core.$strip>>>;
|
|
161
|
+
service: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
162
|
+
id: z.ZodNumber;
|
|
163
|
+
ad_id: z.ZodCoercedNumber<unknown>;
|
|
164
|
+
access_type_id: z.ZodCoercedNumber<unknown>;
|
|
165
|
+
work_type_id: z.ZodCoercedNumber<unknown>;
|
|
166
|
+
unit_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
167
|
+
locations: z.ZodArray<z.ZodObject<{
|
|
168
|
+
city_id: z.ZodNumber;
|
|
169
|
+
district_id: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
170
|
+
}, z.core.$strip>>;
|
|
171
|
+
}, z.core.$strip>>>;
|
|
26
172
|
title: z.ZodOptional<z.ZodString>;
|
|
27
173
|
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
28
174
|
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -33,7 +179,14 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
33
179
|
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
34
180
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
35
181
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
182
|
+
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
36
183
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
184
|
+
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
185
|
+
properties: "properties";
|
|
186
|
+
services: "services";
|
|
187
|
+
motors: "motors";
|
|
188
|
+
used_products: "used_products";
|
|
189
|
+
}>>;
|
|
37
190
|
base_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
38
191
|
contact_methods: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
39
192
|
by_message: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -41,9 +194,80 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
41
194
|
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
42
195
|
}, z.core.$strip>>>;
|
|
43
196
|
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
197
|
+
adLocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
198
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
199
|
+
admin_boundary_id: z.ZodCoercedNumber<unknown>;
|
|
200
|
+
}, z.core.$strip>>>>;
|
|
44
201
|
user_id: z.ZodCoercedNumber<unknown>;
|
|
45
202
|
}, z.core.$strip>;
|
|
46
203
|
export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
204
|
+
motor: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
205
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
206
|
+
trim_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
207
|
+
body_type_id: z.ZodCoercedNumber<unknown>;
|
|
208
|
+
regional_spec_id: z.ZodCoercedNumber<unknown>;
|
|
209
|
+
transmission_id: z.ZodCoercedNumber<unknown>;
|
|
210
|
+
fuel_type_id: z.ZodCoercedNumber<unknown>;
|
|
211
|
+
exterior_color_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
212
|
+
price_type_id: z.ZodCoercedNumber<unknown>;
|
|
213
|
+
publisher_type_id: z.ZodCoercedNumber<unknown>;
|
|
214
|
+
interior_color_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
215
|
+
mileage: z.ZodCoercedNumber<unknown>;
|
|
216
|
+
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
217
|
+
year: z.ZodCoercedNumber<unknown>;
|
|
218
|
+
doors: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
219
|
+
horsepower: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
220
|
+
seats_count: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
221
|
+
engine_capacity_cc: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
222
|
+
cylinders_count: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
223
|
+
feature_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
224
|
+
}, z.core.$strip>>>;
|
|
225
|
+
property: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
226
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
227
|
+
size_m2: z.ZodCoercedNumber<unknown>;
|
|
228
|
+
bedrooms: z.ZodCoercedNumber<unknown>;
|
|
229
|
+
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
230
|
+
district_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
231
|
+
property_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
232
|
+
price_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
233
|
+
publisher_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
234
|
+
bathrooms: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
235
|
+
furnished: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
236
|
+
parking: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
237
|
+
floor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
238
|
+
total_floors: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
239
|
+
feature_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
|
|
240
|
+
facility_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
|
|
241
|
+
property_facilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
242
|
+
property_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
243
|
+
facility_id: z.ZodCoercedNumber<unknown>;
|
|
244
|
+
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
245
|
+
}, z.core.$strip>>>;
|
|
246
|
+
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
247
|
+
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
248
|
+
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
249
|
+
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
250
|
+
}, z.core.$strip>>>;
|
|
251
|
+
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
252
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
253
|
+
condition_id: z.ZodCoercedNumber<unknown>;
|
|
254
|
+
age_id: z.ZodCoercedNumber<unknown>;
|
|
255
|
+
isFree: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
256
|
+
isDeliveryAvailable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
257
|
+
product_type_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
258
|
+
}, z.core.$strip>>>;
|
|
259
|
+
service: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
260
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
261
|
+
access_type_id: z.ZodCoercedNumber<unknown>;
|
|
262
|
+
work_type_id: z.ZodCoercedNumber<unknown>;
|
|
263
|
+
unit_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
264
|
+
locations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
265
|
+
id: z.ZodOptional<z.ZodNumber>;
|
|
266
|
+
service_id: z.ZodOptional<z.ZodNumber>;
|
|
267
|
+
city_id: z.ZodNumber;
|
|
268
|
+
district_id: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
269
|
+
}, z.core.$strip>>>>;
|
|
270
|
+
}, z.core.$strip>>>;
|
|
47
271
|
title: z.ZodOptional<z.ZodString>;
|
|
48
272
|
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
49
273
|
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -54,7 +278,14 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
54
278
|
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
55
279
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
56
280
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
281
|
+
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
57
282
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
283
|
+
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
284
|
+
properties: "properties";
|
|
285
|
+
services: "services";
|
|
286
|
+
motors: "motors";
|
|
287
|
+
used_products: "used_products";
|
|
288
|
+
}>>;
|
|
58
289
|
base_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
59
290
|
contact_methods: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
60
291
|
by_message: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -62,10 +293,82 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
62
293
|
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
63
294
|
}, z.core.$strip>>>;
|
|
64
295
|
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
296
|
+
adLocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
297
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
298
|
+
admin_boundary_id: z.ZodCoercedNumber<unknown>;
|
|
299
|
+
}, z.core.$strip>>>>;
|
|
65
300
|
user_id: z.ZodCoercedNumber<unknown>;
|
|
66
301
|
id: z.ZodOptional<z.ZodNever>;
|
|
67
302
|
}, z.core.$strip>, z.ZodObject<{
|
|
68
303
|
id: z.ZodCoercedNumber<unknown>;
|
|
304
|
+
motor: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
305
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
306
|
+
trim_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
307
|
+
body_type_id: z.ZodCoercedNumber<unknown>;
|
|
308
|
+
regional_spec_id: z.ZodCoercedNumber<unknown>;
|
|
309
|
+
transmission_id: z.ZodCoercedNumber<unknown>;
|
|
310
|
+
fuel_type_id: z.ZodCoercedNumber<unknown>;
|
|
311
|
+
exterior_color_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
312
|
+
price_type_id: z.ZodCoercedNumber<unknown>;
|
|
313
|
+
publisher_type_id: z.ZodCoercedNumber<unknown>;
|
|
314
|
+
interior_color_id: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
315
|
+
mileage: z.ZodCoercedNumber<unknown>;
|
|
316
|
+
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
317
|
+
year: z.ZodCoercedNumber<unknown>;
|
|
318
|
+
doors: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
319
|
+
horsepower: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
320
|
+
seats_count: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
321
|
+
engine_capacity_cc: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
322
|
+
cylinders_count: z.ZodOptional<z.ZodNullable<z.ZodCoercedNumber<unknown>>>;
|
|
323
|
+
feature_ids: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
324
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
325
|
+
}, z.core.$strip>>>;
|
|
326
|
+
property: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
327
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
328
|
+
size_m2: z.ZodCoercedNumber<unknown>;
|
|
329
|
+
bedrooms: z.ZodCoercedNumber<unknown>;
|
|
330
|
+
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
331
|
+
district_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
332
|
+
property_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
333
|
+
price_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
334
|
+
publisher_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
335
|
+
bathrooms: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
336
|
+
furnished: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
337
|
+
parking: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
338
|
+
floor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
339
|
+
total_floors: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
340
|
+
feature_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
|
|
341
|
+
facility_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
|
|
342
|
+
property_facilities: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
343
|
+
property_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
344
|
+
facility_id: z.ZodCoercedNumber<unknown>;
|
|
345
|
+
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
346
|
+
}, z.core.$strip>>>;
|
|
347
|
+
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
348
|
+
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
349
|
+
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
350
|
+
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
351
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
352
|
+
}, z.core.$strip>>>;
|
|
353
|
+
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
354
|
+
id: z.ZodCoercedNumber<unknown>;
|
|
355
|
+
condition_id: z.ZodCoercedNumber<unknown>;
|
|
356
|
+
age_id: z.ZodCoercedNumber<unknown>;
|
|
357
|
+
isFree: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
358
|
+
isDeliveryAvailable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
359
|
+
product_type_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
360
|
+
}, z.core.$strip>>>;
|
|
361
|
+
service: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
362
|
+
id: z.ZodNumber;
|
|
363
|
+
ad_id: z.ZodCoercedNumber<unknown>;
|
|
364
|
+
access_type_id: z.ZodCoercedNumber<unknown>;
|
|
365
|
+
work_type_id: z.ZodCoercedNumber<unknown>;
|
|
366
|
+
unit_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
367
|
+
locations: z.ZodArray<z.ZodObject<{
|
|
368
|
+
city_id: z.ZodNumber;
|
|
369
|
+
district_id: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
370
|
+
}, z.core.$strip>>;
|
|
371
|
+
}, z.core.$strip>>>;
|
|
69
372
|
title: z.ZodOptional<z.ZodString>;
|
|
70
373
|
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
71
374
|
description: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
@@ -76,7 +379,14 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
76
379
|
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
77
380
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
78
381
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
382
|
+
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
79
383
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
384
|
+
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
385
|
+
properties: "properties";
|
|
386
|
+
services: "services";
|
|
387
|
+
motors: "motors";
|
|
388
|
+
used_products: "used_products";
|
|
389
|
+
}>>;
|
|
80
390
|
base_price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
81
391
|
contact_methods: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
82
392
|
by_message: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -84,5 +394,9 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
84
394
|
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
85
395
|
}, z.core.$strip>>>;
|
|
86
396
|
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
397
|
+
adLocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
398
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
399
|
+
admin_boundary_id: z.ZodCoercedNumber<unknown>;
|
|
400
|
+
}, z.core.$strip>>>>;
|
|
87
401
|
user_id: z.ZodCoercedNumber<unknown>;
|
|
88
402
|
}, z.core.$strip>]>;
|
|
@@ -2,6 +2,106 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.saveAdSchema = exports.updateAdSchema = exports.createAdSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const subjectTypeSchema = zod_1.z.enum(['properties', 'services', 'motors', 'used_products']);
|
|
6
|
+
const adLocationSchema = zod_1.z.object({
|
|
7
|
+
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
8
|
+
admin_boundary_id: zod_1.z.coerce.number().int().positive(),
|
|
9
|
+
});
|
|
10
|
+
const propertyFacilityRelationSchema = zod_1.z.object({
|
|
11
|
+
property_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
12
|
+
facility_id: zod_1.z.coerce.number().int().positive(),
|
|
13
|
+
distance_in_meters: zod_1.z.coerce.number().int().min(0).optional(),
|
|
14
|
+
});
|
|
15
|
+
const createMotorSchema = zod_1.z.object({
|
|
16
|
+
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
17
|
+
trim_id: zod_1.z.coerce.number().nullable().optional(),
|
|
18
|
+
body_type_id: zod_1.z.coerce.number().int().positive(),
|
|
19
|
+
regional_spec_id: zod_1.z.coerce.number().int().positive(),
|
|
20
|
+
transmission_id: zod_1.z.coerce.number().int().positive(),
|
|
21
|
+
fuel_type_id: zod_1.z.coerce.number().int().positive(),
|
|
22
|
+
exterior_color_id: zod_1.z.coerce.number().nullable().optional(),
|
|
23
|
+
price_type_id: zod_1.z.coerce.number().int().positive(),
|
|
24
|
+
publisher_type_id: zod_1.z.coerce.number(),
|
|
25
|
+
interior_color_id: zod_1.z.coerce.number().nullable().optional(),
|
|
26
|
+
mileage: zod_1.z.coerce.number().min(0),
|
|
27
|
+
offer_type_id: zod_1.z.coerce.number().int().positive(),
|
|
28
|
+
year: zod_1.z.coerce.number().int().min(1900).max(2100),
|
|
29
|
+
doors: zod_1.z.coerce.number().int().nullable().optional(),
|
|
30
|
+
horsepower: zod_1.z.coerce.number().nullable().optional(),
|
|
31
|
+
seats_count: zod_1.z.coerce.number().nullable().optional(),
|
|
32
|
+
engine_capacity_cc: zod_1.z.coerce.number().nullable().optional(),
|
|
33
|
+
cylinders_count: zod_1.z.coerce.number().nullable().optional(),
|
|
34
|
+
feature_ids: zod_1.z.array(zod_1.z.coerce.number().int().positive()).nullable().optional(),
|
|
35
|
+
});
|
|
36
|
+
const updateMotorSchema = createMotorSchema.extend({
|
|
37
|
+
id: zod_1.z.coerce.number().int().positive(),
|
|
38
|
+
});
|
|
39
|
+
const createPropertySchema = zod_1.z.object({
|
|
40
|
+
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
41
|
+
size_m2: zod_1.z.coerce.number().min(0),
|
|
42
|
+
bedrooms: zod_1.z.coerce.number().int().min(0),
|
|
43
|
+
offer_type_id: zod_1.z.coerce.number().int().positive(),
|
|
44
|
+
district_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
45
|
+
property_type_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
46
|
+
price_type_id: zod_1.z.coerce.number().int().optional(),
|
|
47
|
+
publisher_type_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
48
|
+
bathrooms: zod_1.z.coerce.number().int().min(0).optional(),
|
|
49
|
+
furnished: zod_1.z.coerce.boolean().optional(),
|
|
50
|
+
parking: zod_1.z.coerce.boolean().optional(),
|
|
51
|
+
floor: zod_1.z.coerce.number().int().min(0).optional(),
|
|
52
|
+
total_floors: zod_1.z.coerce.number().int().min(0).optional(),
|
|
53
|
+
feature_ids: zod_1.z.array(zod_1.z.coerce.number().int().positive()).optional(),
|
|
54
|
+
facility_ids: zod_1.z.array(zod_1.z.coerce.number().int().positive()).optional(),
|
|
55
|
+
property_facilities: zod_1.z.array(propertyFacilityRelationSchema).optional(),
|
|
56
|
+
condition_id: zod_1.z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
57
|
+
age_id: zod_1.z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
58
|
+
property_status_id: zod_1.z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
59
|
+
license_type_id: zod_1.z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
60
|
+
});
|
|
61
|
+
const updatePropertySchema = createPropertySchema.extend({
|
|
62
|
+
id: zod_1.z.coerce.number().int().positive(),
|
|
63
|
+
});
|
|
64
|
+
const createUsedProductSchema = zod_1.z.object({
|
|
65
|
+
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
66
|
+
condition_id: zod_1.z.coerce.number().int().positive(),
|
|
67
|
+
age_id: zod_1.z.coerce.number().int().positive(),
|
|
68
|
+
isFree: zod_1.z.coerce.boolean().optional().nullable(),
|
|
69
|
+
isDeliveryAvailable: zod_1.z.coerce.boolean().optional().nullable(),
|
|
70
|
+
product_type_id: zod_1.z.coerce.number().optional().nullable(),
|
|
71
|
+
});
|
|
72
|
+
const updateUsedProductSchema = zod_1.z.object({
|
|
73
|
+
id: zod_1.z.coerce.number().int().positive(),
|
|
74
|
+
condition_id: zod_1.z.coerce.number().int().positive(),
|
|
75
|
+
age_id: zod_1.z.coerce.number().int().positive(),
|
|
76
|
+
isFree: zod_1.z.coerce.boolean().optional().nullable(),
|
|
77
|
+
isDeliveryAvailable: zod_1.z.coerce.boolean().optional().nullable(),
|
|
78
|
+
product_type_id: zod_1.z.coerce.number().optional().nullable(),
|
|
79
|
+
});
|
|
80
|
+
const createServiceLocationSchema = zod_1.z.object({
|
|
81
|
+
id: zod_1.z.number().optional(),
|
|
82
|
+
service_id: zod_1.z.number().optional(),
|
|
83
|
+
city_id: zod_1.z.number(),
|
|
84
|
+
district_id: zod_1.z.number().optional().nullable(),
|
|
85
|
+
});
|
|
86
|
+
const updateServiceLocationSchema = zod_1.z.object({
|
|
87
|
+
city_id: zod_1.z.number(),
|
|
88
|
+
district_id: zod_1.z.preprocess((v) => (v === null || v === '' ? undefined : v), zod_1.z.coerce.number().int().optional()),
|
|
89
|
+
});
|
|
90
|
+
const createServiceSchema = zod_1.z.object({
|
|
91
|
+
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
92
|
+
access_type_id: zod_1.z.coerce.number().int().positive(),
|
|
93
|
+
work_type_id: zod_1.z.coerce.number().int().positive(),
|
|
94
|
+
unit_id: zod_1.z.coerce.number().int().optional().nullable(),
|
|
95
|
+
locations: zod_1.z.array(createServiceLocationSchema).optional().nullable(),
|
|
96
|
+
});
|
|
97
|
+
const updateServiceSchema = zod_1.z.object({
|
|
98
|
+
id: zod_1.z.number(),
|
|
99
|
+
ad_id: zod_1.z.coerce.number().int().positive(),
|
|
100
|
+
access_type_id: zod_1.z.coerce.number().int().positive(),
|
|
101
|
+
work_type_id: zod_1.z.coerce.number().int().positive(),
|
|
102
|
+
unit_id: zod_1.z.coerce.number().int().optional().nullable(),
|
|
103
|
+
locations: zod_1.z.array(updateServiceLocationSchema),
|
|
104
|
+
});
|
|
5
105
|
const baseAdCommon = zod_1.z.object({
|
|
6
106
|
title: zod_1.z.string().trim().optional(),
|
|
7
107
|
status_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
@@ -13,7 +113,13 @@ const baseAdCommon = zod_1.z.object({
|
|
|
13
113
|
city_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
14
114
|
latitude: zod_1.z.coerce.number().optional().nullable(),
|
|
15
115
|
longitude: zod_1.z.coerce.number().optional().nullable(),
|
|
116
|
+
baseAdminBoundaryId: zod_1.z.preprocess((value) => {
|
|
117
|
+
if (value === 0 || value === '0')
|
|
118
|
+
return undefined;
|
|
119
|
+
return value;
|
|
120
|
+
}, zod_1.z.coerce.number().optional().nullable()),
|
|
16
121
|
media: zod_1.z.array(zod_1.z.any()).optional().nullable(),
|
|
122
|
+
subject_type: subjectTypeSchema.optional(),
|
|
17
123
|
base_price: zod_1.z.coerce.number().optional().nullable(),
|
|
18
124
|
contact_methods: zod_1.z
|
|
19
125
|
.object({
|
|
@@ -24,14 +130,23 @@ const baseAdCommon = zod_1.z.object({
|
|
|
24
130
|
.optional()
|
|
25
131
|
.nullable(),
|
|
26
132
|
selected_phone: zod_1.z.string().trim().optional().nullable(),
|
|
133
|
+
adLocations: zod_1.z.array(adLocationSchema).optional().nullable(),
|
|
27
134
|
});
|
|
28
135
|
exports.createAdSchema = zod_1.z.object({
|
|
29
136
|
user_id: zod_1.z.coerce.number().int().positive(),
|
|
30
137
|
id: zod_1.z.never().optional(),
|
|
31
138
|
...baseAdCommon.shape,
|
|
139
|
+
motor: createMotorSchema.optional().nullable(),
|
|
140
|
+
property: createPropertySchema.optional().nullable(),
|
|
141
|
+
product: createUsedProductSchema.optional().nullable(),
|
|
142
|
+
service: createServiceSchema.optional().nullable(),
|
|
32
143
|
});
|
|
33
144
|
exports.updateAdSchema = zod_1.z.object({
|
|
34
145
|
...exports.createAdSchema.shape,
|
|
35
146
|
id: zod_1.z.coerce.number().int().positive(),
|
|
147
|
+
motor: updateMotorSchema.optional().nullable(),
|
|
148
|
+
property: updatePropertySchema.optional().nullable(),
|
|
149
|
+
product: updateUsedProductSchema.optional().nullable(),
|
|
150
|
+
service: updateServiceSchema.optional().nullable(),
|
|
36
151
|
});
|
|
37
152
|
exports.saveAdSchema = zod_1.z.union([exports.createAdSchema, exports.updateAdSchema]);
|
|
@@ -1,4 +1,104 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
const subjectTypeSchema = z.enum(['properties', 'services', 'motors', 'used_products']);
|
|
3
|
+
const adLocationSchema = z.object({
|
|
4
|
+
ad_id: z.coerce.number().int().positive().optional(),
|
|
5
|
+
admin_boundary_id: z.coerce.number().int().positive(),
|
|
6
|
+
});
|
|
7
|
+
const propertyFacilityRelationSchema = z.object({
|
|
8
|
+
property_id: z.coerce.number().int().positive().optional(),
|
|
9
|
+
facility_id: z.coerce.number().int().positive(),
|
|
10
|
+
distance_in_meters: z.coerce.number().int().min(0).optional(),
|
|
11
|
+
});
|
|
12
|
+
const createMotorSchema = z.object({
|
|
13
|
+
ad_id: z.coerce.number().int().positive().optional(),
|
|
14
|
+
trim_id: z.coerce.number().nullable().optional(),
|
|
15
|
+
body_type_id: z.coerce.number().int().positive(),
|
|
16
|
+
regional_spec_id: z.coerce.number().int().positive(),
|
|
17
|
+
transmission_id: z.coerce.number().int().positive(),
|
|
18
|
+
fuel_type_id: z.coerce.number().int().positive(),
|
|
19
|
+
exterior_color_id: z.coerce.number().nullable().optional(),
|
|
20
|
+
price_type_id: z.coerce.number().int().positive(),
|
|
21
|
+
publisher_type_id: z.coerce.number(),
|
|
22
|
+
interior_color_id: z.coerce.number().nullable().optional(),
|
|
23
|
+
mileage: z.coerce.number().min(0),
|
|
24
|
+
offer_type_id: z.coerce.number().int().positive(),
|
|
25
|
+
year: z.coerce.number().int().min(1900).max(2100),
|
|
26
|
+
doors: z.coerce.number().int().nullable().optional(),
|
|
27
|
+
horsepower: z.coerce.number().nullable().optional(),
|
|
28
|
+
seats_count: z.coerce.number().nullable().optional(),
|
|
29
|
+
engine_capacity_cc: z.coerce.number().nullable().optional(),
|
|
30
|
+
cylinders_count: z.coerce.number().nullable().optional(),
|
|
31
|
+
feature_ids: z.array(z.coerce.number().int().positive()).nullable().optional(),
|
|
32
|
+
});
|
|
33
|
+
const updateMotorSchema = createMotorSchema.extend({
|
|
34
|
+
id: z.coerce.number().int().positive(),
|
|
35
|
+
});
|
|
36
|
+
const createPropertySchema = z.object({
|
|
37
|
+
ad_id: z.coerce.number().int().positive().optional(),
|
|
38
|
+
size_m2: z.coerce.number().min(0),
|
|
39
|
+
bedrooms: z.coerce.number().int().min(0),
|
|
40
|
+
offer_type_id: z.coerce.number().int().positive(),
|
|
41
|
+
district_id: z.coerce.number().int().positive().optional(),
|
|
42
|
+
property_type_id: z.coerce.number().int().positive().optional(),
|
|
43
|
+
price_type_id: z.coerce.number().int().optional(),
|
|
44
|
+
publisher_type_id: z.coerce.number().int().positive().optional(),
|
|
45
|
+
bathrooms: z.coerce.number().int().min(0).optional(),
|
|
46
|
+
furnished: z.coerce.boolean().optional(),
|
|
47
|
+
parking: z.coerce.boolean().optional(),
|
|
48
|
+
floor: z.coerce.number().int().min(0).optional(),
|
|
49
|
+
total_floors: z.coerce.number().int().min(0).optional(),
|
|
50
|
+
feature_ids: z.array(z.coerce.number().int().positive()).optional(),
|
|
51
|
+
facility_ids: z.array(z.coerce.number().int().positive()).optional(),
|
|
52
|
+
property_facilities: z.array(propertyFacilityRelationSchema).optional(),
|
|
53
|
+
condition_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
54
|
+
age_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
55
|
+
property_status_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
56
|
+
license_type_id: z.coerce.number().int().min(0).optional().transform((val) => (val === 0 ? null : val)),
|
|
57
|
+
});
|
|
58
|
+
const updatePropertySchema = createPropertySchema.extend({
|
|
59
|
+
id: z.coerce.number().int().positive(),
|
|
60
|
+
});
|
|
61
|
+
const createUsedProductSchema = z.object({
|
|
62
|
+
ad_id: z.coerce.number().int().positive().optional(),
|
|
63
|
+
condition_id: z.coerce.number().int().positive(),
|
|
64
|
+
age_id: z.coerce.number().int().positive(),
|
|
65
|
+
isFree: z.coerce.boolean().optional().nullable(),
|
|
66
|
+
isDeliveryAvailable: z.coerce.boolean().optional().nullable(),
|
|
67
|
+
product_type_id: z.coerce.number().optional().nullable(),
|
|
68
|
+
});
|
|
69
|
+
const updateUsedProductSchema = z.object({
|
|
70
|
+
id: z.coerce.number().int().positive(),
|
|
71
|
+
condition_id: z.coerce.number().int().positive(),
|
|
72
|
+
age_id: z.coerce.number().int().positive(),
|
|
73
|
+
isFree: z.coerce.boolean().optional().nullable(),
|
|
74
|
+
isDeliveryAvailable: z.coerce.boolean().optional().nullable(),
|
|
75
|
+
product_type_id: z.coerce.number().optional().nullable(),
|
|
76
|
+
});
|
|
77
|
+
const createServiceLocationSchema = z.object({
|
|
78
|
+
id: z.number().optional(),
|
|
79
|
+
service_id: z.number().optional(),
|
|
80
|
+
city_id: z.number(),
|
|
81
|
+
district_id: z.number().optional().nullable(),
|
|
82
|
+
});
|
|
83
|
+
const updateServiceLocationSchema = z.object({
|
|
84
|
+
city_id: z.number(),
|
|
85
|
+
district_id: z.preprocess((v) => (v === null || v === '' ? undefined : v), z.coerce.number().int().optional()),
|
|
86
|
+
});
|
|
87
|
+
const createServiceSchema = z.object({
|
|
88
|
+
ad_id: z.coerce.number().int().positive().optional(),
|
|
89
|
+
access_type_id: z.coerce.number().int().positive(),
|
|
90
|
+
work_type_id: z.coerce.number().int().positive(),
|
|
91
|
+
unit_id: z.coerce.number().int().optional().nullable(),
|
|
92
|
+
locations: z.array(createServiceLocationSchema).optional().nullable(),
|
|
93
|
+
});
|
|
94
|
+
const updateServiceSchema = z.object({
|
|
95
|
+
id: z.number(),
|
|
96
|
+
ad_id: z.coerce.number().int().positive(),
|
|
97
|
+
access_type_id: z.coerce.number().int().positive(),
|
|
98
|
+
work_type_id: z.coerce.number().int().positive(),
|
|
99
|
+
unit_id: z.coerce.number().int().optional().nullable(),
|
|
100
|
+
locations: z.array(updateServiceLocationSchema),
|
|
101
|
+
});
|
|
2
102
|
const baseAdCommon = z.object({
|
|
3
103
|
title: z.string().trim().optional(),
|
|
4
104
|
status_id: z.coerce.number().int().positive().optional(),
|
|
@@ -10,7 +110,13 @@ const baseAdCommon = z.object({
|
|
|
10
110
|
city_id: z.coerce.number().int().positive().optional().nullable(),
|
|
11
111
|
latitude: z.coerce.number().optional().nullable(),
|
|
12
112
|
longitude: z.coerce.number().optional().nullable(),
|
|
113
|
+
baseAdminBoundaryId: z.preprocess((value) => {
|
|
114
|
+
if (value === 0 || value === '0')
|
|
115
|
+
return undefined;
|
|
116
|
+
return value;
|
|
117
|
+
}, z.coerce.number().optional().nullable()),
|
|
13
118
|
media: z.array(z.any()).optional().nullable(),
|
|
119
|
+
subject_type: subjectTypeSchema.optional(),
|
|
14
120
|
base_price: z.coerce.number().optional().nullable(),
|
|
15
121
|
contact_methods: z
|
|
16
122
|
.object({
|
|
@@ -21,14 +127,23 @@ const baseAdCommon = z.object({
|
|
|
21
127
|
.optional()
|
|
22
128
|
.nullable(),
|
|
23
129
|
selected_phone: z.string().trim().optional().nullable(),
|
|
130
|
+
adLocations: z.array(adLocationSchema).optional().nullable(),
|
|
24
131
|
});
|
|
25
132
|
export const createAdSchema = z.object({
|
|
26
133
|
user_id: z.coerce.number().int().positive(),
|
|
27
134
|
id: z.never().optional(),
|
|
28
135
|
...baseAdCommon.shape,
|
|
136
|
+
motor: createMotorSchema.optional().nullable(),
|
|
137
|
+
property: createPropertySchema.optional().nullable(),
|
|
138
|
+
product: createUsedProductSchema.optional().nullable(),
|
|
139
|
+
service: createServiceSchema.optional().nullable(),
|
|
29
140
|
});
|
|
30
141
|
export const updateAdSchema = z.object({
|
|
31
142
|
...createAdSchema.shape,
|
|
32
143
|
id: z.coerce.number().int().positive(),
|
|
144
|
+
motor: updateMotorSchema.optional().nullable(),
|
|
145
|
+
property: updatePropertySchema.optional().nullable(),
|
|
146
|
+
product: updateUsedProductSchema.optional().nullable(),
|
|
147
|
+
service: updateServiceSchema.optional().nullable(),
|
|
33
148
|
});
|
|
34
149
|
export const saveAdSchema = z.union([createAdSchema, updateAdSchema]);
|