@deallony/shared 1.2.41 → 1.2.50
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/README.md +44 -0
- package/dist/cjs/constants/used-product/UsedProduct.js +1 -1
- package/dist/cjs/dto/ad/Ad.dto.d.ts +8 -3
- package/dist/cjs/dto/ad/Ad.dto.js +1 -3
- package/dist/cjs/dto/index.d.ts +1 -0
- package/dist/cjs/dto/index.js +2 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +2 -1
- package/dist/cjs/schema/ad/save-ad.schema.d.ts +51 -53
- package/dist/cjs/schema/ad/save-ad.schema.js +62 -51
- package/dist/cjs/schema/communication/ai-conversation.schema.d.ts +65 -0
- package/dist/cjs/schema/communication/ai-conversation.schema.js +43 -0
- package/dist/cjs/schema/communication/index.d.ts +2 -0
- package/dist/cjs/schema/communication/index.js +18 -0
- package/dist/cjs/schema/communication/support-ticket.schema.d.ts +119 -0
- package/dist/cjs/schema/communication/support-ticket.schema.js +35 -0
- package/dist/cjs/schema/index.d.ts +1 -0
- package/dist/cjs/schema/index.js +2 -1
- package/dist/cjs/types/ad/AdPromotion.d.ts +28 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/index.js +3 -1
- package/dist/cjs/types/kyc/Kyc.d.ts +39 -0
- package/dist/cjs/types/kyc/Kyc.js +25 -0
- package/dist/cjs/types/kyc/index.d.ts +1 -0
- package/dist/cjs/types/kyc/index.js +17 -0
- package/dist/cjs/types/used-product/UsedProduct.d.ts +1 -1
- package/dist/cjs/types/used-product/UsedProduct.js +1 -1
- package/dist/cjs/types/user/PotentialUser.d.ts +8 -0
- package/dist/esm/constants/used-product/UsedProduct.js +1 -1
- package/dist/esm/dto/ad/Ad.dto.js +1 -3
- package/dist/esm/dto/index.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/schema/ad/save-ad.schema.js +63 -52
- package/dist/esm/schema/communication/ai-conversation.schema.js +40 -0
- package/dist/esm/schema/communication/index.js +2 -0
- package/dist/esm/schema/communication/support-ticket.schema.js +32 -0
- package/dist/esm/schema/index.js +1 -0
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/kyc/Kyc.js +22 -0
- package/dist/esm/types/kyc/index.js +1 -0
- package/dist/esm/types/used-product/UsedProduct.js +1 -1
- package/package.json +58 -44
package/README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# @deallony/shared
|
|
2
|
+
|
|
3
|
+
Shared TypeScript types, DTOs, Zod schemas, and utilities for Deallony projects.
|
|
4
|
+
|
|
5
|
+
## One-command releases
|
|
6
|
+
|
|
7
|
+
Run from a clean, synchronized `main` branch with push access to `origin/main`.
|
|
8
|
+
|
|
9
|
+
| Command | Action |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `npm run deploy` | Bump patch, build, publish to npm, commit/tag/push GitLab |
|
|
12
|
+
| `npm run deploy:minor` | npm + GitLab minor release |
|
|
13
|
+
| `npm run deploy:major` | npm + GitLab major release |
|
|
14
|
+
| `npm run deploy:dry-run` | Preview version and inspect current package, no mutation |
|
|
15
|
+
| `npm run deploy:git` | Bump patch, build, commit/tag/push GitLab without npm publish |
|
|
16
|
+
| `npm run deploy:git:minor` | GitLab-only minor release |
|
|
17
|
+
| `npm run deploy:git:major` | GitLab-only major release |
|
|
18
|
+
| `npm run deploy:git:dry-run` | Preview GitLab-only release |
|
|
19
|
+
| `npm run test:release` | Unit tests for release helpers |
|
|
20
|
+
|
|
21
|
+
Version increments follow semantic versioning; `1.2.99` becomes `1.2.100`.
|
|
22
|
+
|
|
23
|
+
### Automatic npm login
|
|
24
|
+
|
|
25
|
+
`npm run deploy` first checks `npm whoami`. If npm returns E401 or ENEEDAUTH,
|
|
26
|
+
the script runs `npm login --registry=https://registry.npmjs.org/ --auth-type=web` and
|
|
27
|
+
opens the browser sign-in flow. After you finish logging in, it rechecks your
|
|
28
|
+
identity and continues the same release. Network failures and canceled logins
|
|
29
|
+
stop the release before modifying the package version. `deploy:git` never logs
|
|
30
|
+
into npm.
|
|
31
|
+
|
|
32
|
+
### npm authentication
|
|
33
|
+
|
|
34
|
+
Run `npm login --registry=https://registry.npmjs.org/` and ensure your account has
|
|
35
|
+
publishing permission for the public scoped package `@deallony/shared`.
|
|
36
|
+
Complete any npm 2FA prompts when required. Never commit npm tokens.
|
|
37
|
+
|
|
38
|
+
### Failure recovery
|
|
39
|
+
|
|
40
|
+
If publishing fails, inspect and restore generated local changes before retrying.
|
|
41
|
+
If npm publication succeeds but Git push/commit fails, **do not republish that version**.
|
|
42
|
+
Resolve the Git issue and push the existing release commit and `vX.Y.Z` tag.
|
|
43
|
+
|
|
44
|
+
Merge this feature branch first; merging does not trigger publication automatically.
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { IAd } from "../../types/ad/Ad";
|
|
3
|
+
import { createAdSchema, saveAdSchema, updateAdSchema } from "../../schema/ad/save-ad.schema";
|
|
4
|
+
export type CreateAdDto = z.infer<typeof createAdSchema>;
|
|
5
|
+
export type UpdateAdDto = z.infer<typeof updateAdSchema>;
|
|
6
|
+
export type SaveAdDto = z.infer<typeof saveAdSchema>;
|
|
2
7
|
export declare const AdDto: (params: {
|
|
3
|
-
ad:
|
|
4
|
-
}) =>
|
|
8
|
+
ad: IAd;
|
|
9
|
+
}) => IAd;
|
package/dist/cjs/dto/index.d.ts
CHANGED
package/dist/cjs/dto/index.js
CHANGED
|
@@ -33,9 +33,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.PAYMENTS = exports.Ai = exports.EVENTS = exports.AdDto = void 0;
|
|
36
|
+
exports.PAYMENTS = exports.Ai = exports.EVENTS = exports.AD = exports.AdDto = void 0;
|
|
37
37
|
var Ad_dto_1 = require("./ad/Ad.dto");
|
|
38
38
|
Object.defineProperty(exports, "AdDto", { enumerable: true, get: function () { return Ad_dto_1.AdDto; } });
|
|
39
|
+
exports.AD = __importStar(require("./ad/Ad.dto"));
|
|
39
40
|
exports.EVENTS = __importStar(require("./events"));
|
|
40
41
|
exports.Ai = __importStar(require("./ai/Ai.dto"));
|
|
41
42
|
exports.PAYMENTS = __importStar(require("./payments"));
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * as CONSTANTS from './constants/index';
|
|
|
3
3
|
export * as DTO from './dto/index';
|
|
4
4
|
export * as SCHEMA from './schema/index';
|
|
5
5
|
export * as ABSTRACT from './abstract';
|
|
6
|
-
export { IObjectService } from './abstract/baseService';
|
|
6
|
+
export type { IObjectService } from './abstract/baseService';
|
|
7
|
+
export * as Kyc from './types/kyc/Kyc';
|
|
7
8
|
export * as UTILS from './utils';
|
|
8
9
|
export type { FilterParams } from './types/common/FilterParams';
|
package/dist/cjs/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
};
|
|
40
40
|
})();
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.UTILS = exports.ABSTRACT = exports.SCHEMA = exports.DTO = exports.CONSTANTS = exports.TYPES = void 0;
|
|
42
|
+
exports.UTILS = exports.Kyc = exports.ABSTRACT = exports.SCHEMA = exports.DTO = exports.CONSTANTS = exports.TYPES = void 0;
|
|
43
43
|
exports.TYPES = __importStar(require("./types/index"));
|
|
44
44
|
// CONSTANTS
|
|
45
45
|
// Contains static values that never change at runtime.
|
|
@@ -75,6 +75,7 @@ exports.SCHEMA = __importStar(require("./schema/index"));
|
|
|
75
75
|
// abstract findById(id: number): Promise<any>;
|
|
76
76
|
// }
|
|
77
77
|
exports.ABSTRACT = __importStar(require("./abstract"));
|
|
78
|
+
exports.Kyc = __importStar(require("./types/kyc/Kyc"));
|
|
78
79
|
// UTILS
|
|
79
80
|
// Contains pure helper functions with no side effects.
|
|
80
81
|
// Reusable logic across the application.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
export declare const subjectTypeSchema: z.ZodEnum<{
|
|
3
3
|
properties: "properties";
|
|
4
4
|
services: "services";
|
|
@@ -32,7 +32,6 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
32
32
|
size_m2: z.ZodCoercedNumber<unknown>;
|
|
33
33
|
bedrooms: z.ZodCoercedNumber<unknown>;
|
|
34
34
|
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
35
|
-
district_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
36
35
|
property_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
37
36
|
price_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
38
37
|
publisher_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -41,18 +40,22 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
41
40
|
parking: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
42
41
|
floor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
43
42
|
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.ZodPipe<z.ZodTransform<
|
|
43
|
+
feature_ids: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
44
|
+
facility_ids: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
45
|
+
property_facilities: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
47
46
|
property_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
48
47
|
facility_id: z.ZodCoercedNumber<unknown>;
|
|
49
48
|
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
50
49
|
}, z.core.$strip>>>>;
|
|
50
|
+
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
51
|
+
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
52
|
+
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
53
|
+
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
51
54
|
}, z.core.$strip>>>;
|
|
52
55
|
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
53
56
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
54
|
-
condition_id: z.ZodCoercedNumber<unknown
|
|
55
|
-
age_id: z.ZodCoercedNumber<unknown
|
|
57
|
+
condition_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
58
|
+
age_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
56
59
|
isFree: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
57
60
|
isDeliveryAvailable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
58
61
|
product_type_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
@@ -62,12 +65,6 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
62
65
|
access_type_id: z.ZodCoercedNumber<unknown>;
|
|
63
66
|
work_type_id: z.ZodCoercedNumber<unknown>;
|
|
64
67
|
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
68
|
}, z.core.$strip>>>;
|
|
72
69
|
title: z.ZodOptional<z.ZodString>;
|
|
73
70
|
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -76,9 +73,9 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
76
73
|
price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
77
74
|
currency_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
78
75
|
negotiable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
79
|
-
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
80
76
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
81
77
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
78
|
+
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
82
79
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
83
80
|
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
84
81
|
properties: "properties";
|
|
@@ -93,12 +90,13 @@ export declare const createAdSchema: z.ZodObject<{
|
|
|
93
90
|
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
94
91
|
}, z.core.$strip>>>;
|
|
95
92
|
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
93
|
+
expires_at: z.ZodNullable<z.ZodOptional<z.ZodISODateTime>>;
|
|
96
94
|
adLocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
97
95
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
98
96
|
admin_boundary_id: z.ZodCoercedNumber<unknown>;
|
|
99
97
|
}, z.core.$strip>>>>;
|
|
100
98
|
user_id: z.ZodCoercedNumber<unknown>;
|
|
101
|
-
id: z.ZodOptional<z.
|
|
99
|
+
id: z.ZodOptional<z.ZodNull>;
|
|
102
100
|
}, z.core.$strip>;
|
|
103
101
|
export declare const updateAdSchema: z.ZodObject<{
|
|
104
102
|
id: z.ZodCoercedNumber<unknown>;
|
|
@@ -129,7 +127,6 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
129
127
|
size_m2: z.ZodCoercedNumber<unknown>;
|
|
130
128
|
bedrooms: z.ZodCoercedNumber<unknown>;
|
|
131
129
|
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
132
|
-
district_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
133
130
|
property_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
134
131
|
price_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
135
132
|
publisher_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -138,32 +135,33 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
138
135
|
parking: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
139
136
|
floor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
140
137
|
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.ZodPipe<z.ZodTransform<
|
|
138
|
+
feature_ids: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
139
|
+
facility_ids: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
140
|
+
property_facilities: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
144
141
|
property_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
145
142
|
facility_id: z.ZodCoercedNumber<unknown>;
|
|
146
143
|
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
147
144
|
}, z.core.$strip>>>>;
|
|
145
|
+
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
146
|
+
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
147
|
+
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
148
|
+
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
148
149
|
id: z.ZodCoercedNumber<unknown>;
|
|
149
150
|
}, z.core.$strip>>>;
|
|
150
151
|
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
151
152
|
id: z.ZodCoercedNumber<unknown>;
|
|
152
|
-
condition_id: z.ZodCoercedNumber<unknown
|
|
153
|
-
age_id: z.ZodCoercedNumber<unknown
|
|
153
|
+
condition_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
154
|
+
age_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
154
155
|
isFree: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
155
156
|
isDeliveryAvailable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
156
157
|
product_type_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
157
158
|
}, z.core.$strip>>>;
|
|
158
159
|
service: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
159
|
-
|
|
160
|
-
ad_id: z.ZodCoercedNumber<unknown>;
|
|
160
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
161
161
|
access_type_id: z.ZodCoercedNumber<unknown>;
|
|
162
162
|
work_type_id: z.ZodCoercedNumber<unknown>;
|
|
163
163
|
unit_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
164
|
-
|
|
165
|
-
city_id: z.ZodNumber;
|
|
166
|
-
}, z.core.$strip>>;
|
|
164
|
+
id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
167
165
|
}, z.core.$strip>>>;
|
|
168
166
|
title: z.ZodOptional<z.ZodString>;
|
|
169
167
|
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -172,9 +170,9 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
172
170
|
price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
173
171
|
currency_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
174
172
|
negotiable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
175
|
-
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
176
173
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
177
174
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
175
|
+
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
178
176
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
179
177
|
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
180
178
|
properties: "properties";
|
|
@@ -189,6 +187,7 @@ export declare const updateAdSchema: z.ZodObject<{
|
|
|
189
187
|
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
190
188
|
}, z.core.$strip>>>;
|
|
191
189
|
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
190
|
+
expires_at: z.ZodNullable<z.ZodOptional<z.ZodISODateTime>>;
|
|
192
191
|
adLocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
193
192
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
194
193
|
admin_boundary_id: z.ZodCoercedNumber<unknown>;
|
|
@@ -222,7 +221,6 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
222
221
|
size_m2: z.ZodCoercedNumber<unknown>;
|
|
223
222
|
bedrooms: z.ZodCoercedNumber<unknown>;
|
|
224
223
|
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
225
|
-
district_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
226
224
|
property_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
227
225
|
price_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
228
226
|
publisher_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -231,18 +229,22 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
231
229
|
parking: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
232
230
|
floor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
233
231
|
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.ZodPipe<z.ZodTransform<
|
|
232
|
+
feature_ids: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
233
|
+
facility_ids: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
234
|
+
property_facilities: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
237
235
|
property_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
238
236
|
facility_id: z.ZodCoercedNumber<unknown>;
|
|
239
237
|
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
240
238
|
}, z.core.$strip>>>>;
|
|
239
|
+
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
240
|
+
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
241
|
+
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
242
|
+
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
241
243
|
}, z.core.$strip>>>;
|
|
242
244
|
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
243
245
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
244
|
-
condition_id: z.ZodCoercedNumber<unknown
|
|
245
|
-
age_id: z.ZodCoercedNumber<unknown
|
|
246
|
+
condition_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
247
|
+
age_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
246
248
|
isFree: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
247
249
|
isDeliveryAvailable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
248
250
|
product_type_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
@@ -252,12 +254,6 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
252
254
|
access_type_id: z.ZodCoercedNumber<unknown>;
|
|
253
255
|
work_type_id: z.ZodCoercedNumber<unknown>;
|
|
254
256
|
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
257
|
}, z.core.$strip>>>;
|
|
262
258
|
title: z.ZodOptional<z.ZodString>;
|
|
263
259
|
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -266,9 +262,9 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
266
262
|
price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
267
263
|
currency_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
268
264
|
negotiable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
269
|
-
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
270
265
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
271
266
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
267
|
+
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
272
268
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
273
269
|
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
274
270
|
properties: "properties";
|
|
@@ -283,12 +279,13 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
283
279
|
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
284
280
|
}, z.core.$strip>>>;
|
|
285
281
|
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
282
|
+
expires_at: z.ZodNullable<z.ZodOptional<z.ZodISODateTime>>;
|
|
286
283
|
adLocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
287
284
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
288
285
|
admin_boundary_id: z.ZodCoercedNumber<unknown>;
|
|
289
286
|
}, z.core.$strip>>>>;
|
|
290
287
|
user_id: z.ZodCoercedNumber<unknown>;
|
|
291
|
-
id: z.ZodOptional<z.
|
|
288
|
+
id: z.ZodOptional<z.ZodNull>;
|
|
292
289
|
}, z.core.$strip>, z.ZodObject<{
|
|
293
290
|
id: z.ZodCoercedNumber<unknown>;
|
|
294
291
|
motor: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -318,7 +315,6 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
318
315
|
size_m2: z.ZodCoercedNumber<unknown>;
|
|
319
316
|
bedrooms: z.ZodCoercedNumber<unknown>;
|
|
320
317
|
offer_type_id: z.ZodCoercedNumber<unknown>;
|
|
321
|
-
district_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
322
318
|
property_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
323
319
|
price_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
324
320
|
publisher_type_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -327,32 +323,33 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
327
323
|
parking: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
328
324
|
floor: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
329
325
|
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.ZodPipe<z.ZodTransform<
|
|
326
|
+
feature_ids: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
327
|
+
facility_ids: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>>;
|
|
328
|
+
property_facilities: z.ZodPipe<z.ZodTransform<{} | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
333
329
|
property_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
334
330
|
facility_id: z.ZodCoercedNumber<unknown>;
|
|
335
331
|
distance_in_meters: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
336
332
|
}, z.core.$strip>>>>;
|
|
333
|
+
condition_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
334
|
+
age_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
335
|
+
property_status_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
336
|
+
license_type_id: z.ZodPipe<z.ZodOptional<z.ZodCoercedNumber<unknown>>, z.ZodTransform<number | null | undefined, number | undefined>>;
|
|
337
337
|
id: z.ZodCoercedNumber<unknown>;
|
|
338
338
|
}, z.core.$strip>>>;
|
|
339
339
|
product: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
340
340
|
id: z.ZodCoercedNumber<unknown>;
|
|
341
|
-
condition_id: z.ZodCoercedNumber<unknown
|
|
342
|
-
age_id: z.ZodCoercedNumber<unknown
|
|
341
|
+
condition_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
342
|
+
age_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
343
343
|
isFree: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
344
344
|
isDeliveryAvailable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
345
345
|
product_type_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
346
346
|
}, z.core.$strip>>>;
|
|
347
347
|
service: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
348
|
-
|
|
349
|
-
ad_id: z.ZodCoercedNumber<unknown>;
|
|
348
|
+
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
350
349
|
access_type_id: z.ZodCoercedNumber<unknown>;
|
|
351
350
|
work_type_id: z.ZodCoercedNumber<unknown>;
|
|
352
351
|
unit_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
353
|
-
|
|
354
|
-
city_id: z.ZodNumber;
|
|
355
|
-
}, z.core.$strip>>;
|
|
352
|
+
id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
356
353
|
}, z.core.$strip>>>;
|
|
357
354
|
title: z.ZodOptional<z.ZodString>;
|
|
358
355
|
status_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
@@ -361,9 +358,9 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
361
358
|
price: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
362
359
|
currency_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
363
360
|
negotiable: z.ZodNullable<z.ZodOptional<z.ZodCoercedBoolean<unknown>>>;
|
|
364
|
-
city_id: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
365
361
|
latitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
366
362
|
longitude: z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
|
|
363
|
+
baseAdminBoundaryId: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodNullable<z.ZodOptional<z.ZodCoercedNumber<unknown>>>>;
|
|
367
364
|
media: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodAny>>>;
|
|
368
365
|
subject_type: z.ZodOptional<z.ZodEnum<{
|
|
369
366
|
properties: "properties";
|
|
@@ -378,6 +375,7 @@ export declare const saveAdSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
378
375
|
by_call: z.ZodOptional<z.ZodBoolean>;
|
|
379
376
|
}, z.core.$strip>>>;
|
|
380
377
|
selected_phone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
378
|
+
expires_at: z.ZodNullable<z.ZodOptional<z.ZodISODateTime>>;
|
|
381
379
|
adLocations: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
382
380
|
ad_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
383
381
|
admin_boundary_id: z.ZodCoercedNumber<unknown>;
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
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([
|
|
5
|
+
exports.subjectTypeSchema = zod_1.z.enum([
|
|
6
|
+
"properties",
|
|
7
|
+
"services",
|
|
8
|
+
"motors",
|
|
9
|
+
"used_products",
|
|
10
|
+
]);
|
|
6
11
|
const adLocationSchema = zod_1.z.object({
|
|
7
12
|
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
8
13
|
admin_boundary_id: zod_1.z.coerce.number().int().positive(),
|
|
@@ -12,6 +17,7 @@ const propertyFacilityRelationSchema = zod_1.z.object({
|
|
|
12
17
|
facility_id: zod_1.z.coerce.number().int().positive(),
|
|
13
18
|
distance_in_meters: zod_1.z.coerce.number().int().min(0).optional(),
|
|
14
19
|
});
|
|
20
|
+
const nullableArray = (schema) => zod_1.z.preprocess((value) => (value === null ? undefined : value), schema.optional());
|
|
15
21
|
const createMotorSchema = zod_1.z.object({
|
|
16
22
|
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
17
23
|
trim_id: zod_1.z.coerce.number().nullable().optional(),
|
|
@@ -31,7 +37,10 @@ const createMotorSchema = zod_1.z.object({
|
|
|
31
37
|
seats_count: zod_1.z.coerce.number().nullable().optional(),
|
|
32
38
|
engine_capacity_cc: zod_1.z.coerce.number().nullable().optional(),
|
|
33
39
|
cylinders_count: zod_1.z.coerce.number().nullable().optional(),
|
|
34
|
-
feature_ids: zod_1.z
|
|
40
|
+
feature_ids: zod_1.z
|
|
41
|
+
.array(zod_1.z.coerce.number().int().positive())
|
|
42
|
+
.nullable()
|
|
43
|
+
.optional(),
|
|
35
44
|
});
|
|
36
45
|
const updateMotorSchema = createMotorSchema.extend({
|
|
37
46
|
id: zod_1.z.coerce.number().int().positive(),
|
|
@@ -41,7 +50,6 @@ const createPropertySchema = zod_1.z.object({
|
|
|
41
50
|
size_m2: zod_1.z.coerce.number().min(0),
|
|
42
51
|
bedrooms: zod_1.z.coerce.number().int().min(0),
|
|
43
52
|
offer_type_id: zod_1.z.coerce.number().int().positive(),
|
|
44
|
-
district_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
45
53
|
property_type_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
46
54
|
price_type_id: zod_1.z.coerce.number().int().optional(),
|
|
47
55
|
publisher_type_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
@@ -50,72 +58,77 @@ const createPropertySchema = zod_1.z.object({
|
|
|
50
58
|
parking: zod_1.z.coerce.boolean().optional(),
|
|
51
59
|
floor: zod_1.z.coerce.number().int().min(0).optional(),
|
|
52
60
|
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())
|
|
54
|
-
facility_ids: zod_1.z.array(zod_1.z.coerce.number().int().positive())
|
|
55
|
-
property_facilities: zod_1.z.preprocess((
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
feature_ids: nullableArray(zod_1.z.array(zod_1.z.coerce.number().int().positive())),
|
|
62
|
+
facility_ids: nullableArray(zod_1.z.array(zod_1.z.coerce.number().int().positive())),
|
|
63
|
+
property_facilities: zod_1.z.preprocess((value) => {
|
|
64
|
+
if (value === null || value === undefined)
|
|
65
|
+
return undefined;
|
|
66
|
+
if (!Array.isArray(value))
|
|
67
|
+
return value;
|
|
68
|
+
return value
|
|
69
|
+
.filter((item) => item && item.facility_id !== null && item.facility_id !== undefined)
|
|
60
70
|
.map((item) => ({
|
|
61
71
|
...item,
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
property_id: item.property_id === null ||
|
|
73
|
+
item.property_id === undefined ||
|
|
74
|
+
Number(item.property_id) <= 0
|
|
64
75
|
? undefined
|
|
65
76
|
: item.property_id,
|
|
66
77
|
}));
|
|
67
78
|
}, zod_1.z.array(propertyFacilityRelationSchema).optional()),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
condition_id: zod_1.z.coerce
|
|
80
|
+
.number()
|
|
81
|
+
.int()
|
|
82
|
+
.min(0)
|
|
83
|
+
.optional()
|
|
84
|
+
.transform((value) => (value === 0 ? null : value)),
|
|
85
|
+
age_id: zod_1.z.coerce
|
|
86
|
+
.number()
|
|
87
|
+
.int()
|
|
88
|
+
.min(0)
|
|
89
|
+
.optional()
|
|
90
|
+
.transform((value) => (value === 0 ? null : value)),
|
|
91
|
+
property_status_id: zod_1.z.coerce
|
|
92
|
+
.number()
|
|
93
|
+
.int()
|
|
94
|
+
.min(0)
|
|
95
|
+
.optional()
|
|
96
|
+
.transform((value) => (value === 0 ? null : value)),
|
|
97
|
+
license_type_id: zod_1.z.coerce
|
|
98
|
+
.number()
|
|
99
|
+
.int()
|
|
100
|
+
.min(0)
|
|
101
|
+
.optional()
|
|
102
|
+
.transform((value) => (value === 0 ? null : value)),
|
|
72
103
|
});
|
|
73
104
|
const updatePropertySchema = createPropertySchema.extend({
|
|
74
105
|
id: zod_1.z.coerce.number().int().positive(),
|
|
75
106
|
});
|
|
76
107
|
const createUsedProductSchema = zod_1.z.object({
|
|
77
108
|
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
78
|
-
condition_id: zod_1.z.coerce.number().int().positive(),
|
|
79
|
-
age_id: zod_1.z.coerce.number().int().positive(),
|
|
109
|
+
condition_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
110
|
+
age_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
80
111
|
isFree: zod_1.z.coerce.boolean().optional().nullable(),
|
|
81
112
|
isDeliveryAvailable: zod_1.z.coerce.boolean().optional().nullable(),
|
|
82
113
|
product_type_id: zod_1.z.coerce.number().optional().nullable(),
|
|
83
114
|
});
|
|
84
115
|
const updateUsedProductSchema = zod_1.z.object({
|
|
85
116
|
id: zod_1.z.coerce.number().int().positive(),
|
|
86
|
-
condition_id: zod_1.z.coerce.number().int().positive(),
|
|
87
|
-
age_id: zod_1.z.coerce.number().int().positive(),
|
|
117
|
+
condition_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
118
|
+
age_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
88
119
|
isFree: zod_1.z.coerce.boolean().optional().nullable(),
|
|
89
120
|
isDeliveryAvailable: zod_1.z.coerce.boolean().optional().nullable(),
|
|
90
121
|
product_type_id: zod_1.z.coerce.number().optional().nullable(),
|
|
91
122
|
});
|
|
92
|
-
const
|
|
93
|
-
id: zod_1.z.number().optional(),
|
|
94
|
-
service_id: zod_1.z.number().optional(),
|
|
95
|
-
city_id: zod_1.z.number(),
|
|
96
|
-
district_id: zod_1.z.number().optional().nullable(),
|
|
97
|
-
});
|
|
98
|
-
const updateServiceLocationSchema = zod_1.z.object({
|
|
99
|
-
city_id: zod_1.z.number(),
|
|
100
|
-
// district_id: z.preprocess(
|
|
101
|
-
// (v) => (v === null || v === '' ? undefined : v),
|
|
102
|
-
// z.coerce.number().int().optional(),
|
|
103
|
-
// ),
|
|
104
|
-
});
|
|
105
|
-
const createServiceSchema = zod_1.z.object({
|
|
123
|
+
const baseServiceSchema = zod_1.z.object({
|
|
106
124
|
ad_id: zod_1.z.coerce.number().int().positive().optional(),
|
|
107
125
|
access_type_id: zod_1.z.coerce.number().int().positive(),
|
|
108
126
|
work_type_id: zod_1.z.coerce.number().int().positive(),
|
|
109
127
|
unit_id: zod_1.z.coerce.number().int().optional().nullable(),
|
|
110
|
-
locations: zod_1.z.array(createServiceLocationSchema).optional().nullable(),
|
|
111
128
|
});
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
access_type_id: zod_1.z.coerce.number().int().positive(),
|
|
116
|
-
work_type_id: zod_1.z.coerce.number().int().positive(),
|
|
117
|
-
unit_id: zod_1.z.coerce.number().int().optional().nullable(),
|
|
118
|
-
locations: zod_1.z.array(updateServiceLocationSchema),
|
|
129
|
+
const createServiceSchema = baseServiceSchema;
|
|
130
|
+
const updateServiceSchema = baseServiceSchema.extend({
|
|
131
|
+
id: zod_1.z.coerce.number().int().positive().optional(),
|
|
119
132
|
});
|
|
120
133
|
const baseAdCommon = zod_1.z.object({
|
|
121
134
|
title: zod_1.z.string().trim().optional(),
|
|
@@ -125,16 +138,13 @@ const baseAdCommon = zod_1.z.object({
|
|
|
125
138
|
price: zod_1.z.coerce.number().min(0).optional().nullable(),
|
|
126
139
|
currency_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
127
140
|
negotiable: zod_1.z.coerce.boolean().optional().nullable(),
|
|
128
|
-
city_id: zod_1.z.coerce.number().int().positive().optional().nullable(),
|
|
129
141
|
latitude: zod_1.z.coerce.number().optional().nullable(),
|
|
130
142
|
longitude: zod_1.z.coerce.number().optional().nullable(),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// z.coerce.number().optional().nullable(),
|
|
137
|
-
// ),
|
|
143
|
+
baseAdminBoundaryId: zod_1.z.preprocess((value) => {
|
|
144
|
+
if (value === 0 || value === "0")
|
|
145
|
+
return undefined;
|
|
146
|
+
return value;
|
|
147
|
+
}, zod_1.z.coerce.number().optional().nullable()),
|
|
138
148
|
media: zod_1.z.array(zod_1.z.any()).optional().nullable(),
|
|
139
149
|
subject_type: exports.subjectTypeSchema.optional(),
|
|
140
150
|
base_price: zod_1.z.coerce.number().optional().nullable(),
|
|
@@ -147,11 +157,12 @@ const baseAdCommon = zod_1.z.object({
|
|
|
147
157
|
.optional()
|
|
148
158
|
.nullable(),
|
|
149
159
|
selected_phone: zod_1.z.string().trim().optional().nullable(),
|
|
160
|
+
expires_at: zod_1.z.iso.datetime().optional().nullable(),
|
|
150
161
|
adLocations: zod_1.z.array(adLocationSchema).optional().nullable(),
|
|
151
162
|
});
|
|
152
163
|
exports.createAdSchema = zod_1.z.object({
|
|
153
164
|
user_id: zod_1.z.coerce.number().int().positive(),
|
|
154
|
-
id: zod_1.z.
|
|
165
|
+
id: zod_1.z.null().optional(),
|
|
155
166
|
...baseAdCommon.shape,
|
|
156
167
|
motor: createMotorSchema.optional().nullable(),
|
|
157
168
|
property: createPropertySchema.optional().nullable(),
|