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