@vulog/aima-unavailability 1.2.8 → 1.2.9
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/index.d.mts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +26 -2
- package/dist/index.mjs +25 -2
- package/package.json +3 -3
- package/src/createUnavailability.test.ts +1 -1
- package/src/deleteUnavailabilitiesByVehicle.test.ts +71 -0
- package/src/deleteUnavailabilitiesByVehicle.ts +28 -0
- package/src/deleteUnavailability.test.ts +4 -4
- package/src/deleteUnavailability.ts +2 -2
- package/src/getUnavailabilities.test.ts +2 -2
- package/src/getUnavailabilitiesByVehicle.test.ts +1 -1
- package/src/index.ts +1 -0
- package/src/types.ts +1 -1
- package/src/updateUnavailability.test.ts +3 -3
- package/src/updateUnavailability.ts +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Client } from '@vulog/aima-client';
|
|
2
2
|
|
|
3
3
|
type Unavailability = {
|
|
4
|
-
id:
|
|
4
|
+
id: number;
|
|
5
5
|
cronExpression: string;
|
|
6
6
|
duration: number;
|
|
7
7
|
maintenanceTitle: string;
|
|
@@ -26,9 +26,11 @@ declare const getUnavailabilities: (client: Client, options: UnavailabilityOptio
|
|
|
26
26
|
|
|
27
27
|
declare const createUnavailability: (client: Client, body: CreateUnavailabilityBody) => Promise<Unavailability>;
|
|
28
28
|
|
|
29
|
-
declare const updateUnavailability: (client: Client, id:
|
|
29
|
+
declare const updateUnavailability: (client: Client, id: number, body: UpdateUnavailabilityBody) => Promise<Unavailability>;
|
|
30
30
|
|
|
31
|
-
declare const deleteUnavailability: (client: Client, id:
|
|
31
|
+
declare const deleteUnavailability: (client: Client, id: number) => Promise<void>;
|
|
32
|
+
|
|
33
|
+
declare const deleteUnavailabilitiesByVehicle: (client: Client, vehicleId: string) => Promise<void>;
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* Generates a Quartz cron expression from a date.
|
|
@@ -43,4 +45,4 @@ declare const deleteUnavailability: (client: Client, id: string) => Promise<void
|
|
|
43
45
|
*/
|
|
44
46
|
declare const generateCronExpression: (date: Date | string, timezone?: string) => string;
|
|
45
47
|
|
|
46
|
-
export { type CreateUnavailabilityBody, type Unavailability, type UnavailabilityOptions, type UpdateUnavailabilityBody, createUnavailability, deleteUnavailability, generateCronExpression, getUnavailabilities, getUnavailabilitiesByVehicle, updateUnavailability };
|
|
48
|
+
export { type CreateUnavailabilityBody, type Unavailability, type UnavailabilityOptions, type UpdateUnavailabilityBody, createUnavailability, deleteUnavailabilitiesByVehicle, deleteUnavailability, generateCronExpression, getUnavailabilities, getUnavailabilitiesByVehicle, updateUnavailability };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Client } from '@vulog/aima-client';
|
|
2
2
|
|
|
3
3
|
type Unavailability = {
|
|
4
|
-
id:
|
|
4
|
+
id: number;
|
|
5
5
|
cronExpression: string;
|
|
6
6
|
duration: number;
|
|
7
7
|
maintenanceTitle: string;
|
|
@@ -26,9 +26,11 @@ declare const getUnavailabilities: (client: Client, options: UnavailabilityOptio
|
|
|
26
26
|
|
|
27
27
|
declare const createUnavailability: (client: Client, body: CreateUnavailabilityBody) => Promise<Unavailability>;
|
|
28
28
|
|
|
29
|
-
declare const updateUnavailability: (client: Client, id:
|
|
29
|
+
declare const updateUnavailability: (client: Client, id: number, body: UpdateUnavailabilityBody) => Promise<Unavailability>;
|
|
30
30
|
|
|
31
|
-
declare const deleteUnavailability: (client: Client, id:
|
|
31
|
+
declare const deleteUnavailability: (client: Client, id: number) => Promise<void>;
|
|
32
|
+
|
|
33
|
+
declare const deleteUnavailabilitiesByVehicle: (client: Client, vehicleId: string) => Promise<void>;
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* Generates a Quartz cron expression from a date.
|
|
@@ -43,4 +45,4 @@ declare const deleteUnavailability: (client: Client, id: string) => Promise<void
|
|
|
43
45
|
*/
|
|
44
46
|
declare const generateCronExpression: (date: Date | string, timezone?: string) => string;
|
|
45
47
|
|
|
46
|
-
export { type CreateUnavailabilityBody, type Unavailability, type UnavailabilityOptions, type UpdateUnavailabilityBody, createUnavailability, deleteUnavailability, generateCronExpression, getUnavailabilities, getUnavailabilitiesByVehicle, updateUnavailability };
|
|
48
|
+
export { type CreateUnavailabilityBody, type Unavailability, type UnavailabilityOptions, type UpdateUnavailabilityBody, createUnavailability, deleteUnavailabilitiesByVehicle, deleteUnavailability, generateCronExpression, getUnavailabilities, getUnavailabilitiesByVehicle, updateUnavailability };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
createUnavailability: () => createUnavailability,
|
|
24
|
+
deleteUnavailabilitiesByVehicle: () => deleteUnavailabilitiesByVehicle,
|
|
24
25
|
deleteUnavailability: () => deleteUnavailability,
|
|
25
26
|
generateCronExpression: () => generateCronExpression,
|
|
26
27
|
getUnavailabilities: () => getUnavailabilities,
|
|
@@ -128,7 +129,7 @@ var createUnavailability = async (client, body) => {
|
|
|
128
129
|
// src/updateUnavailability.ts
|
|
129
130
|
var import_zod4 = require("zod");
|
|
130
131
|
var schema4 = import_zod4.z.object({
|
|
131
|
-
id: import_zod4.z.
|
|
132
|
+
id: import_zod4.z.number().int().positive(),
|
|
132
133
|
cronExpression: import_zod4.z.string().min(1),
|
|
133
134
|
duration: import_zod4.z.number().int().positive(),
|
|
134
135
|
maintenanceTitle: import_zod4.z.string().min(1),
|
|
@@ -158,7 +159,7 @@ var updateUnavailability = async (client, id, body) => {
|
|
|
158
159
|
// src/deleteUnavailability.ts
|
|
159
160
|
var import_zod5 = require("zod");
|
|
160
161
|
var schema5 = import_zod5.z.object({
|
|
161
|
-
id: import_zod5.z.
|
|
162
|
+
id: import_zod5.z.number().int().positive()
|
|
162
163
|
});
|
|
163
164
|
var deleteUnavailability = async (client, id) => {
|
|
164
165
|
const result = schema5.safeParse({ id });
|
|
@@ -177,6 +178,28 @@ var deleteUnavailability = async (client, id) => {
|
|
|
177
178
|
});
|
|
178
179
|
};
|
|
179
180
|
|
|
181
|
+
// src/deleteUnavailabilitiesByVehicle.ts
|
|
182
|
+
var import_zod6 = require("zod");
|
|
183
|
+
var schema6 = import_zod6.z.object({
|
|
184
|
+
vehicleId: import_zod6.z.string().trim().min(1).uuid()
|
|
185
|
+
});
|
|
186
|
+
var deleteUnavailabilitiesByVehicle = async (client, vehicleId) => {
|
|
187
|
+
const result = schema6.safeParse({ vehicleId });
|
|
188
|
+
if (!result.success) {
|
|
189
|
+
throw new TypeError("Invalid args", {
|
|
190
|
+
cause: result.error.issues
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return client.delete(
|
|
194
|
+
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/vehicles/${result.data.vehicleId}`
|
|
195
|
+
).then(() => void 0).catch((error) => {
|
|
196
|
+
if (error.formattedError?.status === 404) {
|
|
197
|
+
return void 0;
|
|
198
|
+
}
|
|
199
|
+
throw error;
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
|
|
180
203
|
// src/generateCronExpression.ts
|
|
181
204
|
var generateCronExpression = (date, timezone) => {
|
|
182
205
|
let dateObj;
|
|
@@ -219,6 +242,7 @@ var generateCronExpression = (date, timezone) => {
|
|
|
219
242
|
// Annotate the CommonJS export names for ESM import in node:
|
|
220
243
|
0 && (module.exports = {
|
|
221
244
|
createUnavailability,
|
|
245
|
+
deleteUnavailabilitiesByVehicle,
|
|
222
246
|
deleteUnavailability,
|
|
223
247
|
generateCronExpression,
|
|
224
248
|
getUnavailabilities,
|
package/dist/index.mjs
CHANGED
|
@@ -97,7 +97,7 @@ var createUnavailability = async (client, body) => {
|
|
|
97
97
|
// src/updateUnavailability.ts
|
|
98
98
|
import { z as z4 } from "zod";
|
|
99
99
|
var schema4 = z4.object({
|
|
100
|
-
id: z4.
|
|
100
|
+
id: z4.number().int().positive(),
|
|
101
101
|
cronExpression: z4.string().min(1),
|
|
102
102
|
duration: z4.number().int().positive(),
|
|
103
103
|
maintenanceTitle: z4.string().min(1),
|
|
@@ -127,7 +127,7 @@ var updateUnavailability = async (client, id, body) => {
|
|
|
127
127
|
// src/deleteUnavailability.ts
|
|
128
128
|
import { z as z5 } from "zod";
|
|
129
129
|
var schema5 = z5.object({
|
|
130
|
-
id: z5.
|
|
130
|
+
id: z5.number().int().positive()
|
|
131
131
|
});
|
|
132
132
|
var deleteUnavailability = async (client, id) => {
|
|
133
133
|
const result = schema5.safeParse({ id });
|
|
@@ -146,6 +146,28 @@ var deleteUnavailability = async (client, id) => {
|
|
|
146
146
|
});
|
|
147
147
|
};
|
|
148
148
|
|
|
149
|
+
// src/deleteUnavailabilitiesByVehicle.ts
|
|
150
|
+
import { z as z6 } from "zod";
|
|
151
|
+
var schema6 = z6.object({
|
|
152
|
+
vehicleId: z6.string().trim().min(1).uuid()
|
|
153
|
+
});
|
|
154
|
+
var deleteUnavailabilitiesByVehicle = async (client, vehicleId) => {
|
|
155
|
+
const result = schema6.safeParse({ vehicleId });
|
|
156
|
+
if (!result.success) {
|
|
157
|
+
throw new TypeError("Invalid args", {
|
|
158
|
+
cause: result.error.issues
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return client.delete(
|
|
162
|
+
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/vehicles/${result.data.vehicleId}`
|
|
163
|
+
).then(() => void 0).catch((error) => {
|
|
164
|
+
if (error.formattedError?.status === 404) {
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
|
|
149
171
|
// src/generateCronExpression.ts
|
|
150
172
|
var generateCronExpression = (date, timezone) => {
|
|
151
173
|
let dateObj;
|
|
@@ -187,6 +209,7 @@ var generateCronExpression = (date, timezone) => {
|
|
|
187
209
|
};
|
|
188
210
|
export {
|
|
189
211
|
createUnavailability,
|
|
212
|
+
deleteUnavailabilitiesByVehicle,
|
|
190
213
|
deleteUnavailability,
|
|
191
214
|
generateCronExpression,
|
|
192
215
|
getUnavailabilities,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-unavailability",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.9",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"author": "Vulog",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@vulog/aima-client": "1.2.
|
|
23
|
-
"@vulog/aima-core": "1.2.
|
|
22
|
+
"@vulog/aima-client": "1.2.9",
|
|
23
|
+
"@vulog/aima-core": "1.2.9"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"zod": "^3.25.76"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { describe, test, vi, expect, beforeEach } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { Client } from '@vulog/aima-client';
|
|
4
|
+
import { deleteUnavailabilitiesByVehicle } from './deleteUnavailabilitiesByVehicle';
|
|
5
|
+
|
|
6
|
+
describe('deleteUnavailabilitiesByVehicle', () => {
|
|
7
|
+
const deleteMock = vi.fn();
|
|
8
|
+
const client = {
|
|
9
|
+
delete: deleteMock,
|
|
10
|
+
clientOptions: {
|
|
11
|
+
fleetId: 'FLEET_ID',
|
|
12
|
+
},
|
|
13
|
+
} as unknown as Client;
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
vi.clearAllMocks();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test('should return invalid args for invalid vehicleId', async () => {
|
|
20
|
+
const vehicleId = 'INVALID_VEHICLE_ID';
|
|
21
|
+
|
|
22
|
+
await expect(deleteUnavailabilitiesByVehicle(client, vehicleId)).rejects.toThrow('Invalid args');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test('should handle 404 gracefully (idempotent)', async () => {
|
|
26
|
+
const vehicleId = '550e8400-e29b-41d4-a716-446655440000';
|
|
27
|
+
|
|
28
|
+
deleteMock.mockRejectedValueOnce({
|
|
29
|
+
formattedError: {
|
|
30
|
+
status: 404,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const result = await deleteUnavailabilitiesByVehicle(client, vehicleId);
|
|
35
|
+
expect(result).toBeUndefined();
|
|
36
|
+
expect(deleteMock).toBeCalledWith(
|
|
37
|
+
`/boapi/proxy/user/fleets/FLEET_ID/scheduledRules/unavailability/vehicles/${vehicleId}`
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('should delete unavailabilities by vehicle successfully', async () => {
|
|
42
|
+
const vehicleId = '550e8400-e29b-41d4-a716-446655440000';
|
|
43
|
+
|
|
44
|
+
deleteMock.mockResolvedValueOnce({
|
|
45
|
+
data: undefined,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const result = await deleteUnavailabilitiesByVehicle(client, vehicleId);
|
|
49
|
+
expect(result).toBeUndefined();
|
|
50
|
+
expect(deleteMock).toBeCalledWith(
|
|
51
|
+
`/boapi/proxy/user/fleets/FLEET_ID/scheduledRules/unavailability/vehicles/${vehicleId}`
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('should throw error on non-404 errors', async () => {
|
|
56
|
+
const vehicleId = '550e8400-e29b-41d4-a716-446655440000';
|
|
57
|
+
|
|
58
|
+
deleteMock.mockRejectedValueOnce({
|
|
59
|
+
formattedError: {
|
|
60
|
+
status: 500,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
await expect(deleteUnavailabilitiesByVehicle(client, vehicleId)).rejects.toEqual({
|
|
65
|
+
formattedError: {
|
|
66
|
+
status: 500,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
const schema = z.object({
|
|
5
|
+
vehicleId: z.string().trim().min(1).uuid(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export const deleteUnavailabilitiesByVehicle = async (client: Client, vehicleId: string): Promise<void> => {
|
|
9
|
+
const result = schema.safeParse({ vehicleId });
|
|
10
|
+
if (!result.success) {
|
|
11
|
+
throw new TypeError('Invalid args', {
|
|
12
|
+
cause: result.error.issues,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return client
|
|
16
|
+
.delete(
|
|
17
|
+
`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/scheduledRules/unavailability/vehicles/${result.data.vehicleId}`
|
|
18
|
+
)
|
|
19
|
+
.then(() => undefined)
|
|
20
|
+
.catch((error) => {
|
|
21
|
+
// Handle 404 gracefully (idempotent - if vehicle has no unavailabilities, that's fine)
|
|
22
|
+
if (error.formattedError?.status === 404) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
throw error;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
@@ -17,13 +17,13 @@ describe('deleteUnavailability', () => {
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
test('should return invalid args for invalid id', async () => {
|
|
20
|
-
const id =
|
|
20
|
+
const id = -1;
|
|
21
21
|
|
|
22
22
|
await expect(deleteUnavailability(client, id)).rejects.toThrow('Invalid args');
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
test('should handle 404 gracefully (idempotent)', async () => {
|
|
26
|
-
const id =
|
|
26
|
+
const id = 123;
|
|
27
27
|
|
|
28
28
|
deleteMock.mockRejectedValueOnce({
|
|
29
29
|
formattedError: {
|
|
@@ -39,7 +39,7 @@ describe('deleteUnavailability', () => {
|
|
|
39
39
|
});
|
|
40
40
|
|
|
41
41
|
test('should delete unavailability successfully', async () => {
|
|
42
|
-
const id =
|
|
42
|
+
const id = 123;
|
|
43
43
|
|
|
44
44
|
deleteMock.mockResolvedValueOnce({
|
|
45
45
|
data: undefined,
|
|
@@ -53,7 +53,7 @@ describe('deleteUnavailability', () => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
test('should throw error on non-404 errors', async () => {
|
|
56
|
-
const id =
|
|
56
|
+
const id = 123;
|
|
57
57
|
|
|
58
58
|
deleteMock.mockRejectedValueOnce({
|
|
59
59
|
formattedError: {
|
|
@@ -2,10 +2,10 @@ import { Client } from '@vulog/aima-client';
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
const schema = z.object({
|
|
5
|
-
id: z.
|
|
5
|
+
id: z.number().int().positive(),
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
export const deleteUnavailability = async (client: Client, id:
|
|
8
|
+
export const deleteUnavailability = async (client: Client, id: number): Promise<void> => {
|
|
9
9
|
const result = schema.safeParse({ id });
|
|
10
10
|
if (!result.success) {
|
|
11
11
|
throw new TypeError('Invalid args', {
|
|
@@ -51,7 +51,7 @@ describe('getUnavailabilities', () => {
|
|
|
51
51
|
|
|
52
52
|
const mockResponsePage1: Unavailability[] = [
|
|
53
53
|
{
|
|
54
|
-
id:
|
|
54
|
+
id: 123,
|
|
55
55
|
cronExpression: '0 0 23 * * ? *',
|
|
56
56
|
duration: 60,
|
|
57
57
|
maintenanceTitle: 'GetAround booking 234535',
|
|
@@ -83,7 +83,7 @@ describe('getUnavailabilities', () => {
|
|
|
83
83
|
|
|
84
84
|
const mockResponse: Unavailability[] = [
|
|
85
85
|
{
|
|
86
|
-
id:
|
|
86
|
+
id: 123,
|
|
87
87
|
cronExpression: '0 0 23 * * ? *',
|
|
88
88
|
duration: 60,
|
|
89
89
|
maintenanceTitle: 'GetAround booking 234535',
|
|
@@ -41,7 +41,7 @@ describe('getUnavailabilitiesByVehicle', () => {
|
|
|
41
41
|
|
|
42
42
|
const mockResponse: Unavailability[] = [
|
|
43
43
|
{
|
|
44
|
-
id:
|
|
44
|
+
id: 123,
|
|
45
45
|
cronExpression: '0 0 23 * * ? *',
|
|
46
46
|
duration: 60,
|
|
47
47
|
maintenanceTitle: 'GetAround booking 234535',
|
package/src/index.ts
CHANGED
|
@@ -3,5 +3,6 @@ export { getUnavailabilities } from './getUnavailabilities';
|
|
|
3
3
|
export { createUnavailability } from './createUnavailability';
|
|
4
4
|
export { updateUnavailability } from './updateUnavailability';
|
|
5
5
|
export { deleteUnavailability } from './deleteUnavailability';
|
|
6
|
+
export { deleteUnavailabilitiesByVehicle } from './deleteUnavailabilitiesByVehicle';
|
|
6
7
|
export { generateCronExpression } from './generateCronExpression';
|
|
7
8
|
export * from './types';
|
package/src/types.ts
CHANGED
|
@@ -18,7 +18,7 @@ describe('updateUnavailability', () => {
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
test('should return invalid args for invalid id', async () => {
|
|
21
|
-
const id =
|
|
21
|
+
const id = -1;
|
|
22
22
|
const body = {
|
|
23
23
|
cronExpression: '0 0 23 * * ? *',
|
|
24
24
|
duration: 60,
|
|
@@ -30,7 +30,7 @@ describe('updateUnavailability', () => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
test('should return invalid args for invalid body', async () => {
|
|
33
|
-
const id =
|
|
33
|
+
const id = 123;
|
|
34
34
|
const body = {
|
|
35
35
|
cronExpression: '',
|
|
36
36
|
duration: -1,
|
|
@@ -42,7 +42,7 @@ describe('updateUnavailability', () => {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
test('should update unavailability successfully', async () => {
|
|
45
|
-
const id =
|
|
45
|
+
const id = 123;
|
|
46
46
|
const body = {
|
|
47
47
|
cronExpression: '0 0 24 * * ? *',
|
|
48
48
|
duration: 120,
|
|
@@ -4,7 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
import { UpdateUnavailabilityBody, Unavailability } from './types';
|
|
5
5
|
|
|
6
6
|
const schema = z.object({
|
|
7
|
-
id: z.
|
|
7
|
+
id: z.number().int().positive(),
|
|
8
8
|
cronExpression: z.string().min(1),
|
|
9
9
|
duration: z.number().int().positive(),
|
|
10
10
|
maintenanceTitle: z.string().min(1),
|
|
@@ -13,7 +13,7 @@ const schema = z.object({
|
|
|
13
13
|
|
|
14
14
|
export const updateUnavailability = async (
|
|
15
15
|
client: Client,
|
|
16
|
-
id:
|
|
16
|
+
id: number,
|
|
17
17
|
body: UpdateUnavailabilityBody
|
|
18
18
|
): Promise<Unavailability> => {
|
|
19
19
|
const result = schema.safeParse({
|