@alba-cars/common-modules 1.2.0 → 1.2.2

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.
Files changed (104) hide show
  1. package/dist/core/enums/HttpMethods.d.ts +12 -0
  2. package/dist/core/enums/HttpMethods.js +14 -0
  3. package/dist/core/enums/HttpStatusCodes.d.ts +18 -0
  4. package/dist/core/enums/HttpStatusCodes.js +19 -0
  5. package/dist/core/enums/index.d.ts +2 -0
  6. package/dist/core/enums/index.js +18 -0
  7. package/dist/core/error-handling/AppError.d.ts +21 -0
  8. package/dist/core/error-handling/AppError.js +46 -0
  9. package/dist/core/error-handling/errorHandler.d.ts +5 -0
  10. package/dist/core/error-handling/errorHandler.js +43 -0
  11. package/dist/core/error-handling/index.d.ts +2 -0
  12. package/dist/core/error-handling/index.js +18 -0
  13. package/dist/core/index.d.ts +5 -0
  14. package/dist/core/index.js +21 -0
  15. package/dist/core/models/index.d.ts +1 -0
  16. package/dist/core/models/index.js +17 -0
  17. package/dist/core/models/pagination/index.d.ts +1 -0
  18. package/dist/core/models/pagination/index.js +17 -0
  19. package/dist/core/models/pagination/paginated_data.d.ts +6 -0
  20. package/dist/core/models/pagination/paginated_data.js +2 -0
  21. package/dist/core/network/api-client.d.ts +1 -0
  22. package/dist/core/network/api-client.js +32 -0
  23. package/dist/core/network/endpoint-config.d.ts +15 -0
  24. package/dist/core/network/endpoint-config.js +82 -0
  25. package/dist/core/network/fetch-api.d.ts +6 -0
  26. package/dist/core/network/fetch-api.js +64 -0
  27. package/dist/core/network/index.d.ts +4 -0
  28. package/dist/core/network/index.js +20 -0
  29. package/dist/core/network/react-query.d.ts +12 -0
  30. package/dist/core/network/react-query.js +15 -0
  31. package/dist/core/utils/global-constants.d.ts +6 -0
  32. package/dist/core/utils/global-constants.js +9 -0
  33. package/dist/core/utils/global-utils.d.ts +42 -0
  34. package/dist/core/utils/global-utils.js +87 -0
  35. package/dist/core/utils/index.d.ts +2 -0
  36. package/dist/core/utils/index.js +18 -0
  37. package/dist/features/blog/data/dto/BlogDTO.js +1 -1
  38. package/dist/features/blog/index.d.ts +1 -0
  39. package/dist/features/blog/index.js +17 -0
  40. package/dist/features/index.d.ts +6 -0
  41. package/dist/features/index.js +22 -0
  42. package/dist/features/newsletter/index.d.ts +1 -0
  43. package/dist/features/newsletter/index.js +17 -0
  44. package/dist/features/sales-team/api/AddAgent.d.ts +2 -0
  45. package/dist/features/sales-team/api/AddAgent.js +20 -0
  46. package/dist/features/sales-team/api/EditAgent.d.ts +2 -0
  47. package/dist/features/sales-team/api/EditAgent.js +21 -0
  48. package/dist/features/sales-team/api/GetAgent.d.ts +3 -0
  49. package/dist/features/sales-team/api/GetAgent.js +19 -0
  50. package/dist/features/sales-team/api/RemoveAgent.d.ts +1 -0
  51. package/dist/features/sales-team/api/RemoveAgent.js +15 -0
  52. package/dist/features/sales-team/api/index.d.ts +4 -0
  53. package/dist/features/sales-team/api/index.js +20 -0
  54. package/dist/features/sales-team/data/dto/SalesAgentDTO.d.ts +11 -9
  55. package/dist/features/sales-team/data/dto/SalesAgentDTO.js +11 -1
  56. package/dist/features/sales-team/data/index.d.ts +1 -0
  57. package/dist/features/sales-team/data/index.js +17 -0
  58. package/dist/features/sales-team/index.d.ts +2 -0
  59. package/dist/features/sales-team/index.js +18 -0
  60. package/dist/features/showroom-visit/data/index.d.ts +1 -0
  61. package/dist/features/showroom-visit/data/index.js +17 -0
  62. package/dist/features/showroom-visit/index.d.ts +1 -0
  63. package/dist/features/showroom-visit/index.js +17 -0
  64. package/dist/features/test-drive-request/api/GetTestDriveVehicles.d.ts +3 -0
  65. package/dist/features/test-drive-request/api/GetTestDriveVehicles.js +8 -0
  66. package/dist/features/test-drive-request/api/index.d.ts +1 -0
  67. package/dist/features/test-drive-request/api/index.js +17 -0
  68. package/dist/features/test-drive-request/data/index.d.ts +4 -0
  69. package/dist/features/test-drive-request/data/index.js +20 -0
  70. package/dist/features/test-drive-request/index.d.ts +2 -0
  71. package/dist/features/test-drive-request/index.js +18 -0
  72. package/dist/features/vehicle/api/make/CreateMake.d.ts +0 -0
  73. package/dist/features/vehicle/api/make/CreateMake.js +1 -0
  74. package/dist/features/vehicle/api/make/DeleteMake.d.ts +0 -0
  75. package/dist/features/vehicle/api/make/DeleteMake.js +1 -0
  76. package/dist/features/vehicle/api/make/GetAllMakes.d.ts +0 -0
  77. package/dist/features/vehicle/api/make/GetAllMakes.js +1 -0
  78. package/dist/features/vehicle/api/make/UpdateMake.d.ts +2 -0
  79. package/dist/features/vehicle/api/make/UpdateMake.js +17 -0
  80. package/dist/features/vehicle/api/models/CreateModel.d.ts +0 -0
  81. package/dist/features/vehicle/api/models/CreateModel.js +1 -0
  82. package/dist/features/vehicle/api/models/DeleteModel.d.ts +0 -0
  83. package/dist/features/vehicle/api/models/DeleteModel.js +1 -0
  84. package/dist/features/vehicle/api/models/GetAllModels.d.ts +0 -0
  85. package/dist/features/vehicle/api/models/GetAllModels.js +1 -0
  86. package/dist/features/vehicle/api/models/UpdateModel.d.ts +0 -0
  87. package/dist/features/vehicle/api/models/UpdateModel.js +1 -0
  88. package/dist/features/vehicle/data/dto/index.d.ts +12 -0
  89. package/dist/features/vehicle/data/dto/index.js +28 -0
  90. package/dist/features/vehicle/data/index.d.ts +4 -0
  91. package/dist/features/vehicle/data/index.js +20 -0
  92. package/dist/features/vehicle/data/models/_index.d.ts +14 -0
  93. package/dist/features/vehicle/data/models/_index.js +30 -0
  94. package/dist/features/vehicle/index.d.ts +1 -0
  95. package/dist/features/vehicle/index.js +17 -0
  96. package/dist/global/dto/index.d.ts +1 -0
  97. package/dist/global/dto/index.js +17 -0
  98. package/dist/global/index.d.ts +2 -0
  99. package/dist/global/index.js +18 -0
  100. package/dist/index.d.ts +4 -17
  101. package/dist/index.js +4 -17
  102. package/dist/models.d.ts +2 -0
  103. package/dist/models.js +2 -0
  104. package/package.json +15 -4
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatValue = exports.generateRandomBase64 = exports.sortBy = exports.isFunction = exports.isPlainObject = exports.deepEqual = exports.makeArray = void 0;
4
+ /**
5
+ * Converts a value to an array.
6
+ *
7
+ * @param value - The value to convert.
8
+ * @returns An array containing the value, or the value itself if it is already an array.
9
+ */
10
+ const makeArray = (value) => (Array.isArray(value) ? value : [value]);
11
+ exports.makeArray = makeArray;
12
+ /**
13
+ * Deeply compares two objects for equality.
14
+ *
15
+ * @param obj1 - The first object to compare.
16
+ * @param obj2 - The second object to compare.
17
+ * @returns `true` if the objects are deeply equal, `false` otherwise.
18
+ */
19
+ const deepEqual = (obj1, obj2) => {
20
+ // this handles primitive types
21
+ if (obj1 === obj2) {
22
+ return true;
23
+ }
24
+ if (typeof obj1 !== "object" || obj1 === null || typeof obj2 !== "object" || obj2 === null) {
25
+ return false;
26
+ }
27
+ const keys1 = Object.keys(obj1);
28
+ const keys2 = Object.keys(obj2);
29
+ if (keys1.length !== keys2.length) {
30
+ return false;
31
+ }
32
+ for (const key of keys1) {
33
+ if (!keys2.includes(key)) {
34
+ return false;
35
+ }
36
+ }
37
+ for (const key of keys1) {
38
+ const value1 = obj1[key];
39
+ const value2 = obj2[key];
40
+ if (!(0, exports.deepEqual)(value1, value2)) {
41
+ return false;
42
+ }
43
+ }
44
+ return true;
45
+ };
46
+ exports.deepEqual = deepEqual;
47
+ /**
48
+ * Checks if a value is a plain object (not an array or null)
49
+ *
50
+ * @template T
51
+ * @param {T} obj
52
+ * @returns {boolean}
53
+ */
54
+ const isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
55
+ exports.isPlainObject = isPlainObject;
56
+ /**
57
+ * Checks if a value is a function
58
+ *
59
+ * @param {*} value
60
+ * @returns {boolean}
61
+ */
62
+ const isFunction = (value) => typeof value === "function";
63
+ exports.isFunction = isFunction;
64
+ /**
65
+ * Function to sort an array by a specific key (for arrays of objects) or a comparator function
66
+ *
67
+ * @param {any[]} array
68
+ * @param {(string | ComparatorFunction)} key
69
+ * @returns {any[]}
70
+ */
71
+ const sortBy = (array, key) => {
72
+ const compareFn = typeof key === "function" ? key : (a, b) => a[key] - b[key];
73
+ return array.slice().sort(compareFn);
74
+ };
75
+ exports.sortBy = sortBy;
76
+ function generateRandomBase64(length) {
77
+ const randomBytes = new Uint8Array(length);
78
+ crypto.getRandomValues(randomBytes);
79
+ return btoa(String.fromCharCode(...Array.from(randomBytes)));
80
+ }
81
+ exports.generateRandomBase64 = generateRandomBase64;
82
+ const formatValue = (n) => {
83
+ return Number(n)
84
+ .toString()
85
+ .replace(/\B(?=(\d{3})+(?!\d))/g, ",");
86
+ };
87
+ exports.formatValue = formatValue;
@@ -0,0 +1,2 @@
1
+ export * from "./global-utils";
2
+ export * from "./global-constants";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./global-utils"), exports);
18
+ __exportStar(require("./global-constants"), exports);
@@ -10,8 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BlogUpdateDTO = exports.BlogCreateDTO = exports.BlogGetDTO = void 0;
13
- const class_validator_1 = require("class-validator");
14
13
  const class_transformer_1 = require("class-transformer");
14
+ const class_validator_1 = require("class-validator");
15
15
  class BlogGetDTO {
16
16
  static fromEntity(entity) {
17
17
  return (0, class_transformer_1.plainToClass)(BlogGetDTO, entity);
@@ -0,0 +1 @@
1
+ export * from "./data/dto/BlogDTO";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data/dto/BlogDTO"), exports);
@@ -0,0 +1,6 @@
1
+ export * from "./blog";
2
+ export * from './newsletter';
3
+ export * from './sales-team';
4
+ export * from './showroom-visit';
5
+ export * from './test-drive-request';
6
+ export * from './vehicle';
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./blog"), exports);
18
+ __exportStar(require("./newsletter"), exports);
19
+ __exportStar(require("./sales-team"), exports);
20
+ __exportStar(require("./showroom-visit"), exports);
21
+ __exportStar(require("./test-drive-request"), exports);
22
+ __exportStar(require("./vehicle"), exports);
@@ -0,0 +1 @@
1
+ export * from "./data/dto/NewsletterDTO";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data/dto/NewsletterDTO"), exports);
@@ -0,0 +1,2 @@
1
+ import { SalesAgentCreateDTO, SalesAgentGetDTO } from "../data/dto/SalesAgentDTO";
2
+ export declare function addAgent(agentDTO: SalesAgentCreateDTO): Promise<SalesAgentGetDTO>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ "use server";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.addAgent = void 0;
5
+ const core_1 = require("../../../core");
6
+ async function addAgent(agentDTO) {
7
+ try {
8
+ const formattedAgentDTO = {
9
+ ...agentDTO,
10
+ dob: agentDTO.dob ? new Date(agentDTO.dob).toISOString() : null,
11
+ };
12
+ const res = await (0, core_1.apiRequest)(core_1.API_ENDPOINTS.agents.create.toString(), { method: "POST", body: JSON.stringify(formattedAgentDTO) });
13
+ return res;
14
+ }
15
+ catch (error) {
16
+ console.error('Failed to add agent:', error);
17
+ return Promise.reject(error);
18
+ }
19
+ }
20
+ exports.addAgent = addAgent;
@@ -0,0 +1,2 @@
1
+ import { SalesAgentGetDTO, SalesAgentUpdateDTO } from "../data/dto/SalesAgentDTO";
2
+ export declare function editAgent(id: number | string, agentDTO: SalesAgentUpdateDTO): Promise<SalesAgentGetDTO>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ "use server";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.editAgent = void 0;
5
+ const core_1 = require("../../../core");
6
+ async function editAgent(id, agentDTO) {
7
+ try {
8
+ const formattedAgentDTO = {
9
+ ...agentDTO,
10
+ dob: agentDTO.dob ? new Date(agentDTO.dob).toISOString() : null, // Ensure this is a valid ISO date string
11
+ };
12
+ const res = await (0, core_1.apiRequest)(`${core_1.API_ENDPOINTS.agents.updateOne(id)}`, // Pass the ID in the endpoint
13
+ { method: "PUT", body: JSON.stringify(formattedAgentDTO) });
14
+ return res;
15
+ }
16
+ catch (error) {
17
+ console.error('Failed to edit agent:', error);
18
+ return Promise.reject(error);
19
+ }
20
+ }
21
+ exports.editAgent = editAgent;
@@ -0,0 +1,3 @@
1
+ import { SalesAgentGetDTO } from "../data/dto/SalesAgentDTO";
2
+ import { PaginatedData } from "../../../core";
3
+ export declare const fetchAgents: (page: number, searchQuery?: string) => Promise<PaginatedData<SalesAgentGetDTO>>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchAgents = void 0;
4
+ const core_1 = require("../../../core");
5
+ const fetchAgents = async (page, searchQuery) => {
6
+ try {
7
+ const queryParams = { page: `${page}`, limit: "10" };
8
+ if ((searchQuery !== null && searchQuery !== void 0 ? searchQuery : "").trim().length > 1) {
9
+ queryParams.searchQuery = searchQuery;
10
+ }
11
+ const res = await (0, core_1.apiRequest)(core_1.API_ENDPOINTS.agents.getAll.toString(), { query: queryParams });
12
+ return res;
13
+ }
14
+ catch (error) {
15
+ console.error('Failed to fetch agents:', error);
16
+ return Promise.reject(error);
17
+ }
18
+ };
19
+ exports.fetchAgents = fetchAgents;
@@ -0,0 +1 @@
1
+ export declare const removeAgent: (agentId: string) => Promise<boolean>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeAgent = void 0;
4
+ const core_1 = require("../../../core");
5
+ const removeAgent = async (agentId) => {
6
+ try {
7
+ const result = await (0, core_1.apiRequest)(core_1.API_ENDPOINTS.agents.deleteOne(agentId), { method: "DELETE" });
8
+ console.log("Agent delete result is ", result);
9
+ return true;
10
+ }
11
+ catch (error) {
12
+ return false;
13
+ }
14
+ };
15
+ exports.removeAgent = removeAgent;
@@ -0,0 +1,4 @@
1
+ export * from "./AddAgent";
2
+ export * from "./EditAgent";
3
+ export * from "./GetAgent";
4
+ export * from "./RemoveAgent";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./AddAgent"), exports);
18
+ __exportStar(require("./EditAgent"), exports);
19
+ __exportStar(require("./GetAgent"), exports);
20
+ __exportStar(require("./RemoveAgent"), exports);
@@ -1,5 +1,6 @@
1
1
  export declare enum Designation {
2
- AGENT = "agent"
2
+ MANAGER = "sales-manager",
3
+ EXECUTIVE = "sales-executive"
3
4
  }
4
5
  export declare enum Gender {
5
6
  MALE = "male",
@@ -11,11 +12,11 @@ export declare class SalesAgentGetDTO {
11
12
  email?: string;
12
13
  status: number;
13
14
  designation: Designation;
14
- dob: Date;
15
+ dob?: Date;
15
16
  gender: Gender;
16
- address: string;
17
- phone: string;
18
- photo: string;
17
+ address?: string;
18
+ phone?: string;
19
+ photo?: string;
19
20
  static fromEntity(entity: any): SalesAgentGetDTO;
20
21
  toPlain(): Record<string, unknown>;
21
22
  }
@@ -23,16 +24,17 @@ export declare class SalesAgentCreateDTO {
23
24
  name: string;
24
25
  email?: string;
25
26
  status: number;
26
- designation: Designation;
27
- dob: Date;
27
+ designation?: Designation;
28
+ dob?: Date;
28
29
  gender: Gender;
29
- address: string;
30
+ address?: string;
30
31
  phone: string;
31
- photo: string;
32
+ photo?: string;
32
33
  validate(): string[];
33
34
  static fromPlain(plain: Record<string, unknown>): SalesAgentCreateDTO;
34
35
  }
35
36
  export declare class SalesAgentUpdateDTO {
37
+ id?: string;
36
38
  name?: string;
37
39
  email?: string;
38
40
  status?: number;
@@ -14,7 +14,8 @@ const class_validator_1 = require("class-validator");
14
14
  const class_transformer_1 = require("class-transformer");
15
15
  var Designation;
16
16
  (function (Designation) {
17
- Designation["AGENT"] = "agent";
17
+ Designation["MANAGER"] = "sales-manager";
18
+ Designation["EXECUTIVE"] = "sales-executive";
18
19
  })(Designation = exports.Designation || (exports.Designation = {}));
19
20
  var Gender;
20
21
  (function (Gender) {
@@ -49,14 +50,17 @@ __decorate([
49
50
  __metadata("design:type", String)
50
51
  ], SalesAgentCreateDTO.prototype, "email", void 0);
51
52
  __decorate([
53
+ (0, class_validator_1.IsOptional)(),
52
54
  (0, class_validator_1.IsNumber)(),
53
55
  __metadata("design:type", Number)
54
56
  ], SalesAgentCreateDTO.prototype, "status", void 0);
55
57
  __decorate([
58
+ (0, class_validator_1.IsOptional)(),
56
59
  (0, class_validator_1.IsEnum)(Designation),
57
60
  __metadata("design:type", String)
58
61
  ], SalesAgentCreateDTO.prototype, "designation", void 0);
59
62
  __decorate([
63
+ (0, class_validator_1.IsOptional)(),
60
64
  (0, class_validator_1.IsDate)(),
61
65
  __metadata("design:type", Date)
62
66
  ], SalesAgentCreateDTO.prototype, "dob", void 0);
@@ -65,6 +69,7 @@ __decorate([
65
69
  __metadata("design:type", String)
66
70
  ], SalesAgentCreateDTO.prototype, "gender", void 0);
67
71
  __decorate([
72
+ (0, class_validator_1.IsOptional)(),
68
73
  (0, class_validator_1.IsString)(),
69
74
  __metadata("design:type", String)
70
75
  ], SalesAgentCreateDTO.prototype, "address", void 0);
@@ -73,6 +78,7 @@ __decorate([
73
78
  __metadata("design:type", String)
74
79
  ], SalesAgentCreateDTO.prototype, "phone", void 0);
75
80
  __decorate([
81
+ (0, class_validator_1.IsOptional)(),
76
82
  (0, class_validator_1.IsString)(),
77
83
  __metadata("design:type", String)
78
84
  ], SalesAgentCreateDTO.prototype, "photo", void 0);
@@ -86,6 +92,10 @@ class SalesAgentUpdateDTO {
86
92
  return (0, class_transformer_1.plainToClass)(SalesAgentUpdateDTO, plain);
87
93
  }
88
94
  }
95
+ __decorate([
96
+ (0, class_validator_1.IsOptional)(),
97
+ __metadata("design:type", String)
98
+ ], SalesAgentUpdateDTO.prototype, "id", void 0);
89
99
  __decorate([
90
100
  (0, class_validator_1.IsOptional)(),
91
101
  (0, class_validator_1.IsString)(),
@@ -0,0 +1 @@
1
+ export * from "./dto/SalesAgentDTO";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./dto/SalesAgentDTO"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ export * from "./data";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./api"), exports);
18
+ __exportStar(require("./data"), exports);
@@ -0,0 +1 @@
1
+ export * from "./dto/ShowroomVisit";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./dto/ShowroomVisit"), exports);
@@ -0,0 +1 @@
1
+ export * from "./data";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data"), exports);
@@ -0,0 +1,3 @@
1
+ import { TestDriveRequest } from "../data";
2
+ declare const getTestDriveVehicles: () => Promise<TestDriveRequest[]>;
3
+ export default getTestDriveVehicles;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("../../../core");
4
+ const getTestDriveVehicles = async () => {
5
+ const response = await (0, core_1.apiRequest)(core_1.API_ENDPOINTS.TestDrive.getAll.toString());
6
+ return response.data.result;
7
+ };
8
+ exports.default = getTestDriveVehicles;
@@ -0,0 +1 @@
1
+ export * from "./GetTestDriveVehicles";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./GetTestDriveVehicles"), exports);
@@ -0,0 +1,4 @@
1
+ export * from "./dto/TestDriveRequestDTO";
2
+ export * from "./enums/index";
3
+ export * from "./models";
4
+ export * from "./utilities";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./dto/TestDriveRequestDTO"), exports);
18
+ __exportStar(require("./enums/index"), exports);
19
+ __exportStar(require("./models"), exports);
20
+ __exportStar(require("./utilities"), exports);
@@ -0,0 +1,2 @@
1
+ export * from "./data";
2
+ export * from "./api";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data"), exports);
18
+ __exportStar(require("./api"), exports);
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,2 @@
1
+ import { VehicleMakeGetDTO, VehicleMakeUpdateDTO } from "../../data";
2
+ export default function updateMake(makeID: string | number, params: VehicleMakeUpdateDTO): Promise<VehicleMakeGetDTO>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const core_1 = require("../../../../core");
4
+ async function updateMake(makeID, params) {
5
+ try {
6
+ const res = await (0, core_1.apiRequest)(core_1.API_ENDPOINTS.vehicleMake.updateOne(makeID), {
7
+ method: core_1.HttpMethods.PUT,
8
+ body: JSON.stringify(params),
9
+ });
10
+ return res;
11
+ }
12
+ catch (error) {
13
+ console.log('Failed to update make with id:', makeID, 'Error:', error);
14
+ return await Promise.reject(error);
15
+ }
16
+ }
17
+ exports.default = updateMake;