@alba-cars/common-modules 1.2.5 → 1.2.7
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/core/network/index.d.ts +0 -1
- package/dist/core/network/index.js +0 -1
- package/dist/core/network/react-query.d.ts +3 -9
- package/dist/features/sales-team/index.d.ts +0 -1
- package/dist/features/sales-team/index.js +0 -1
- package/dist/features/vehicle/api/body_types/GetAllBodyTypes.js +15 -4
- package/dist/features/vehicle/data/dto/VehicleTypeDTO.d.ts +1 -1
- package/dist/features/vehicle/data/dto/VehicleTypeDTO.js +2 -2
- package/dist/features/vehicle/data/utilities.d.ts +6 -6
- package/dist/features/vehicle/index.d.ts +0 -1
- package/dist/features/vehicle/index.js +0 -1
- package/package.json +1 -2
|
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./api-client"), exports);
|
|
18
18
|
__exportStar(require("./endpoint-config"), exports);
|
|
19
19
|
__exportStar(require("./fetch-api"), exports);
|
|
20
|
-
__exportStar(require("./react-query"), exports);
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const queryConfig:
|
|
3
|
-
|
|
4
|
-
refetchOnWindowFocus: false;
|
|
5
|
-
retry: false;
|
|
6
|
-
staleTime: number;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export declare const queryClient: QueryClient;
|
|
1
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
export declare const queryConfig: DefaultOptions;
|
|
3
|
+
export declare const queryClient: any;
|
|
10
4
|
export type ApiFnReturnType<FnType extends (..._args: any) => Promise<any>> = Awaited<ReturnType<FnType>>;
|
|
11
5
|
export type QueryConfig<T extends (..._args: any[]) => any> = Omit<ReturnType<T>, "queryKey" | "queryFn">;
|
|
12
6
|
export type MutationConfig<MutationFnType extends (..._args: any) => Promise<any>> = UseMutationOptions<ApiFnReturnType<MutationFnType>, Error, Parameters<MutationFnType>[0]>;
|
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./api"), exports);
|
|
18
17
|
__exportStar(require("./data"), exports);
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.getAllVehicleBodyTypes = void 0;
|
|
7
|
+
const qs_1 = __importDefault(require("qs"));
|
|
4
8
|
const core_1 = require("../../../../core");
|
|
9
|
+
const data_1 = require("../../data");
|
|
5
10
|
const getAllVehicleBodyTypes = async (page, searchQuery) => {
|
|
6
11
|
var _a, _b, _c;
|
|
7
12
|
try {
|
|
8
|
-
|
|
13
|
+
let getDTO = new data_1.VehicleBodyTypeGetDTO();
|
|
14
|
+
let options = new data_1.VehicleBodyTypeOptions();
|
|
9
15
|
if ((searchQuery !== null && searchQuery !== void 0 ? searchQuery : "").trim().length > 1) {
|
|
10
|
-
|
|
16
|
+
let filter = new data_1.VehicleBodyTypeFilter();
|
|
17
|
+
filter.search = searchQuery;
|
|
18
|
+
getDTO.filter = filter;
|
|
11
19
|
}
|
|
12
|
-
|
|
20
|
+
// options.withVehicles = true;
|
|
21
|
+
options.page = (page !== null && page !== void 0 ? page : 0) + 1;
|
|
22
|
+
getDTO.options = options;
|
|
23
|
+
const endpoint = `${core_1.API_ENDPOINTS.vehicleType.getAll.toString()}?${qs_1.default.stringify(getDTO.toPlain(), { arrayFormat: 'brackets', allowEmptyArrays: false, skipNulls: true })}`;
|
|
24
|
+
const response = await (0, core_1.apiRequest)(endpoint, {
|
|
13
25
|
method: core_1.HttpMethods.GET,
|
|
14
|
-
query: queryParams
|
|
15
26
|
});
|
|
16
27
|
if (!response.success) {
|
|
17
28
|
throw Error((_a = response.message) !== null && _a !== void 0 ? _a : (_b = response.error) === null || _b === void 0 ? void 0 : _b.message);
|
|
@@ -5,7 +5,7 @@ export declare class VehicleBodyTypeGetDTO {
|
|
|
5
5
|
options?: VehicleBodyTypeOptions;
|
|
6
6
|
validate(): string[];
|
|
7
7
|
static fromPlain(plain: Record<string, unknown>): VehicleBodyTypeGetDTO;
|
|
8
|
-
|
|
8
|
+
toPlain(): Record<string, any>;
|
|
9
9
|
}
|
|
10
10
|
export declare class VehicleBodyTypeGetUniqueDTO {
|
|
11
11
|
filter?: VehicleBodyTypeUniqueFilter;
|
|
@@ -22,8 +22,8 @@ class VehicleBodyTypeGetDTO {
|
|
|
22
22
|
static fromPlain(plain) {
|
|
23
23
|
return (0, class_transformer_1.plainToClass)(VehicleBodyTypeGetDTO, plain);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
return (0, class_transformer_1.instanceToPlain)(
|
|
25
|
+
toPlain() {
|
|
26
|
+
return (0, class_transformer_1.instanceToPlain)(this);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
exports.VehicleBodyTypeGetDTO = VehicleBodyTypeGetDTO;
|
|
@@ -33,7 +33,7 @@ export declare class VehicleMakeUniqueFilter extends BaseFilter {
|
|
|
33
33
|
static fromPlain(plain: Record<string, unknown>): VehicleMakeFilter;
|
|
34
34
|
static toPlain(entity: any): Record<string, unknown>;
|
|
35
35
|
}
|
|
36
|
-
export type VehicleMakeSort = Record<keyof Pick<VehicleMake, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'
|
|
36
|
+
export type VehicleMakeSort = Partial<Record<keyof Pick<VehicleMake, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'>>;
|
|
37
37
|
export declare class VehicleMakeOptions extends PaginationOptions {
|
|
38
38
|
sort?: VehicleMakeSort;
|
|
39
39
|
withModels?: boolean;
|
|
@@ -63,7 +63,7 @@ export declare class VehicleModelUniqueFilter extends BaseFilter {
|
|
|
63
63
|
static fromPlain(plain: Record<string, unknown>): VehicleModelUniqueFilter;
|
|
64
64
|
static toPlain(entity: any): Record<string, unknown>;
|
|
65
65
|
}
|
|
66
|
-
export type VehicleModelSort = Record<keyof Pick<VehicleModel, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'
|
|
66
|
+
export type VehicleModelSort = Partial<Record<keyof Pick<VehicleModel, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'>>;
|
|
67
67
|
export declare class VehicleModelOptions extends PaginationOptions {
|
|
68
68
|
sort?: VehicleModelSort;
|
|
69
69
|
withVehicles?: boolean;
|
|
@@ -92,7 +92,7 @@ export declare class VehicleBodyTypeUniqueFilter {
|
|
|
92
92
|
static fromPlain(plain: Record<string, unknown>): VehicleModelFilter;
|
|
93
93
|
static toPlain(entity: any): Record<string, unknown>;
|
|
94
94
|
}
|
|
95
|
-
export type VehicleBodyTypeSort = Record<keyof Pick<VehicleBodyType, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'
|
|
95
|
+
export type VehicleBodyTypeSort = Partial<Record<keyof Pick<VehicleBodyType, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'>>;
|
|
96
96
|
export declare class VehicleBodyTypeOptions extends PaginationOptions {
|
|
97
97
|
sort?: VehicleBodyTypeSort;
|
|
98
98
|
withVehicles?: boolean;
|
|
@@ -119,7 +119,7 @@ export declare class VehicleFeatureUniqueFilter {
|
|
|
119
119
|
static fromPlain(plain: Record<string, unknown>): VehicleModelFilter;
|
|
120
120
|
static toPlain(entity: any): Record<string, unknown>;
|
|
121
121
|
}
|
|
122
|
-
export type VehicleFeatureSort = Record<keyof Pick<VehicleFeature, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'
|
|
122
|
+
export type VehicleFeatureSort = Partial<Record<keyof Pick<VehicleFeature, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'>>;
|
|
123
123
|
export declare class VehicleFeatureOptions extends PaginationOptions {
|
|
124
124
|
sort?: VehicleFeatureSort;
|
|
125
125
|
withCategories?: boolean;
|
|
@@ -146,7 +146,7 @@ export declare class VehicleFeatureCategoryUniqueFilter {
|
|
|
146
146
|
static fromPlain(plain: Record<string, unknown>): VehicleModelFilter;
|
|
147
147
|
static toPlain(entity: any): Record<string, unknown>;
|
|
148
148
|
}
|
|
149
|
-
export type VehicleFeatureCategorySort = Record<keyof Pick<VehicleCategory, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'
|
|
149
|
+
export type VehicleFeatureCategorySort = Partial<Record<keyof Pick<VehicleCategory, 'name' | 'isActive' | 'createdAt' | 'updatedAt'>, 'asc' | 'desc'>>;
|
|
150
150
|
export declare class VehicleFeatureCategoryOptions extends PaginationOptions {
|
|
151
151
|
sort?: VehicleFeatureCategorySort;
|
|
152
152
|
withFeatures?: boolean;
|
|
@@ -195,7 +195,7 @@ export declare class VehicleUniqueFilter {
|
|
|
195
195
|
static fromPlain(plain: Record<string, unknown>): VehicleUniqueFilter;
|
|
196
196
|
static toPlain(entity: any): Record<string, unknown>;
|
|
197
197
|
}
|
|
198
|
-
export type VehicleSort = Record<keyof Pick<Vehicle, 'referenceNumber' | 'mileage' | 'year' | 'createdAt' | 'updatedAt' | 'engineCapacity' | 'doors' | 'seats' | 'keys' | 'transmission' | 'driveType' | 'price' | 'status'>, 'asc' | 'desc'
|
|
198
|
+
export type VehicleSort = Partial<Record<keyof Pick<Vehicle, 'referenceNumber' | 'mileage' | 'year' | 'createdAt' | 'updatedAt' | 'engineCapacity' | 'doors' | 'seats' | 'keys' | 'transmission' | 'driveType' | 'price' | 'status'>, 'asc' | 'desc'>>;
|
|
199
199
|
export declare class VehicleOptions extends PaginationOptions {
|
|
200
200
|
sort?: VehicleSort;
|
|
201
201
|
select?: (VehicleSelectFields | `make.${VehicleMakeSelectFields}` | `model.${VehicleModelSelectFields}` | `bodyType.${VehicleBodyTypeSelectFields}` | `features.${VehicleFeatureSelectFields}` | `metaData.${VehicleMetaDataSelectFields}`)[];
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.2.
|
|
6
|
+
"version": "1.2.7",
|
|
7
7
|
"description": "A package containing DTOs, validation classes and common modules and interfaces for Alba Cars",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"url": "git+https://github.com/alba-cars/AlbaCarsCommonModules.git"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@tanstack/react-query": "^5.62.2",
|
|
36
35
|
"axios": "^1.7.9",
|
|
37
36
|
"class-transformer": "^0.5.1",
|
|
38
37
|
"class-validator": "^0.14.1",
|