@internetderdinge/api 1.229.39 → 1.229.41
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/src/accounts/accounts.schemas.js +40 -10
- package/dist/src/accounts/accounts.validation.js +47 -10
- package/dist/src/admin/adminSearch.route.js +4 -0
- package/dist/src/devices/devices.route.js +6 -2
- package/dist/src/devices/devices.schemas.js +54 -14
- package/dist/src/devices/devices.validation.js +80 -13
- package/dist/src/index.js +1 -0
- package/dist/src/iotdevice/iotdevice.schemas.js +117 -33
- package/dist/src/iotdevice/iotdevice.validation.js +27 -5
- package/dist/src/organizations/organizations.schemas.js +28 -5
- package/dist/src/organizations/organizations.validation.js +22 -11
- package/dist/src/tokens/tokens.schemas.js +35 -12
- package/dist/src/tokens/tokens.validation.js +8 -2
- package/dist/src/users/users.schemas.js +40 -11
- package/dist/src/users/users.validation.js +70 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/accounts/accounts.schemas.ts +40 -10
- package/src/accounts/accounts.validation.ts +64 -26
- package/src/admin/adminSearch.route.ts +4 -0
- package/src/devices/devices.route.ts +10 -2
- package/src/devices/devices.schemas.ts +55 -14
- package/src/devices/devices.validation.ts +97 -28
- package/src/index.ts +4 -0
- package/src/iotdevice/iotdevice.schemas.ts +117 -33
- package/src/iotdevice/iotdevice.validation.ts +38 -16
- package/src/organizations/organizations.schemas.ts +28 -5
- package/src/organizations/organizations.validation.ts +49 -37
- package/src/tokens/tokens.schemas.ts +35 -12
- package/src/tokens/tokens.validation.ts +9 -3
- package/src/users/users.schemas.ts +40 -11
- package/src/users/users.validation.ts +88 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetderdinge/api",
|
|
3
|
-
"version": "1.229.
|
|
3
|
+
"version": "1.229.41",
|
|
4
4
|
"description": "Shared OpenIoT API modules",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"yalc:publish": "yalc publish --push",
|
|
15
15
|
"deps:versions": "node --input-type=module -e \"import { createRequire } from 'node:module'; const require = createRequire(import.meta.url); const out = (name) => { const pkgPath = require.resolve(name + '/package.json'); const version = require(pkgPath).version; console.log(name + '@' + version + ' -> ' + pkgPath); }; out('zod'); out('@asteasolutions/zod-to-openapi');\"",
|
|
16
16
|
"deploy:version": "node ./scripts/release-version.mjs",
|
|
17
|
-
"release
|
|
17
|
+
"release": "node ./scripts/release-and-sync-paperless.mjs",
|
|
18
18
|
"lint": "eslint .",
|
|
19
19
|
"lint:fix": "eslint . --fix"
|
|
20
20
|
},
|
|
@@ -1,15 +1,45 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
export const accountResponseSchema = z.object({
|
|
4
|
-
id: z
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
id: z
|
|
5
|
+
.string()
|
|
6
|
+
.openapi({
|
|
7
|
+
example: "auth0|60452f4c0dc85b0062326",
|
|
8
|
+
description: "Authentication provider account ID",
|
|
9
|
+
}),
|
|
10
|
+
email: z.string().email().openapi({ example: "jane.doe@example.com" }),
|
|
11
|
+
firstName: z.string().optional().openapi({ example: "Jane" }),
|
|
12
|
+
lastName: z.string().optional().openapi({ example: "Doe" }),
|
|
13
|
+
organizationId: z
|
|
14
|
+
.string()
|
|
15
|
+
.openapi({
|
|
16
|
+
example: "682fd0d7d4a6325d9d45b86e",
|
|
17
|
+
description: "Organization ObjectId",
|
|
18
|
+
}),
|
|
19
|
+
roles: z
|
|
20
|
+
.array(z.string())
|
|
21
|
+
.openapi({ example: ["admin", "user"], description: "Account roles" }),
|
|
22
|
+
isMfaEnabled: z.boolean().openapi({ example: true }),
|
|
23
|
+
createdAt: z
|
|
24
|
+
.string()
|
|
25
|
+
.datetime()
|
|
26
|
+
.openapi({ example: "2026-05-21T09:30:00.000Z" }),
|
|
27
|
+
updatedAt: z
|
|
28
|
+
.string()
|
|
29
|
+
.datetime()
|
|
30
|
+
.openapi({ example: "2026-05-21T10:15:00.000Z" }),
|
|
31
|
+
}).openapi({
|
|
32
|
+
example: {
|
|
33
|
+
id: "auth0|60452f4c0dc85b0062326",
|
|
34
|
+
email: "jane.doe@example.com",
|
|
35
|
+
firstName: "Jane",
|
|
36
|
+
lastName: "Doe",
|
|
37
|
+
organizationId: "682fd0d7d4a6325d9d45b86e",
|
|
38
|
+
roles: ["admin", "user"],
|
|
39
|
+
isMfaEnabled: true,
|
|
40
|
+
createdAt: "2026-05-21T09:30:00.000Z",
|
|
41
|
+
updatedAt: "2026-05-21T10:15:00.000Z",
|
|
42
|
+
},
|
|
13
43
|
});
|
|
14
44
|
|
|
15
45
|
// If you ever need the TS type:
|
|
@@ -13,22 +13,36 @@ import {
|
|
|
13
13
|
extendZodWithOpenApi(z);
|
|
14
14
|
|
|
15
15
|
export const createAccountSchema = {
|
|
16
|
-
body: z
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
body: z
|
|
17
|
+
.object({
|
|
18
|
+
name: z
|
|
19
|
+
.string()
|
|
20
|
+
.openapi({ example: "Sample Entry", description: "Name of the entry" })
|
|
21
|
+
.optional(),
|
|
22
|
+
medication: zObjectId.openapi({ description: "Medication ObjectId" }),
|
|
23
|
+
organization: zObjectId.openapi({ description: "Organization ObjectId" }),
|
|
24
|
+
patient: zObjectId.openapi({ description: "Patient ObjectId" }),
|
|
25
|
+
meta: z
|
|
26
|
+
.record(z.string(), z.any())
|
|
27
|
+
.openapi({
|
|
28
|
+
example: { key: "value" },
|
|
29
|
+
description: "Additional metadata for the entry",
|
|
30
|
+
})
|
|
31
|
+
.optional(),
|
|
32
|
+
})
|
|
33
|
+
.openapi({
|
|
34
|
+
example: {
|
|
35
|
+
name: "Sample Entry",
|
|
36
|
+
medication: "682fd0d7d4a6325d9d45b871",
|
|
37
|
+
organization:
|
|
38
|
+
process.env.SCHEMA_EXAMPLE_ORGANIZATION_ID ||
|
|
39
|
+
"682fd0d7d4a6325d9d45b86e",
|
|
40
|
+
patient: process.env.SCHEMA_EXAMPLE_USER_ID || "682fd0d7d4a6325d9d45b86d",
|
|
41
|
+
meta: {
|
|
42
|
+
source: "manual",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
32
46
|
};
|
|
33
47
|
|
|
34
48
|
export const getUsersSchema = zPagination;
|
|
@@ -67,21 +81,38 @@ export const updateAccountSchema = {
|
|
|
67
81
|
(value) => (value === "" ? undefined : value),
|
|
68
82
|
z.string().email().optional(),
|
|
69
83
|
)
|
|
70
|
-
.openapi({
|
|
84
|
+
.openapi({
|
|
85
|
+
example: "jane.doe@example.com",
|
|
86
|
+
description: "User email address",
|
|
87
|
+
}),
|
|
71
88
|
given_name: z
|
|
72
89
|
.string()
|
|
73
90
|
.optional()
|
|
74
|
-
.openapi({ example: "
|
|
91
|
+
.openapi({ example: "Jane", description: "Given name" }),
|
|
75
92
|
family_name: z
|
|
76
93
|
.string()
|
|
77
94
|
.optional()
|
|
78
95
|
.openapi({ example: "Doe", description: "Family name" }),
|
|
79
|
-
debug: z.boolean().optional(),
|
|
80
|
-
demo: z.boolean().optional(),
|
|
96
|
+
debug: z.boolean().optional().openapi({ example: false }),
|
|
97
|
+
demo: z.boolean().optional().openapi({ example: false }),
|
|
81
98
|
notification: z
|
|
82
99
|
.record(z.string(), z.any())
|
|
83
100
|
.optional()
|
|
84
|
-
.openapi({
|
|
101
|
+
.openapi({
|
|
102
|
+
example: { email: true, push: false },
|
|
103
|
+
description: "Notification settings object",
|
|
104
|
+
}),
|
|
105
|
+
}).openapi({
|
|
106
|
+
example: {
|
|
107
|
+
language: "en",
|
|
108
|
+
email: "jane.doe@example.com",
|
|
109
|
+
given_name: "Jane",
|
|
110
|
+
family_name: "Doe",
|
|
111
|
+
notification: {
|
|
112
|
+
email: true,
|
|
113
|
+
push: false,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
85
116
|
}),
|
|
86
117
|
};
|
|
87
118
|
|
|
@@ -104,11 +135,18 @@ export const currentAccountMfaEnrollSchema = {
|
|
|
104
135
|
};
|
|
105
136
|
|
|
106
137
|
export const setDeviceTokenSchema = {
|
|
107
|
-
body: z
|
|
108
|
-
|
|
109
|
-
.string()
|
|
110
|
-
|
|
111
|
-
|
|
138
|
+
body: z
|
|
139
|
+
.object({
|
|
140
|
+
token: z.string().openapi({
|
|
141
|
+
example: "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
|
|
142
|
+
description: "Device token to set",
|
|
143
|
+
}),
|
|
144
|
+
})
|
|
145
|
+
.openapi({
|
|
146
|
+
example: {
|
|
147
|
+
token: "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
112
150
|
};
|
|
113
151
|
|
|
114
152
|
export const getAvatarSchema = {};
|
|
@@ -31,6 +31,7 @@ export const adminSearchRouteSpecs: RouteSpec[] = [
|
|
|
31
31
|
requestSchema: adminStatsSchema,
|
|
32
32
|
responseSchema: adminStatsResponseSchema,
|
|
33
33
|
handler: getStats,
|
|
34
|
+
privateDocs: true,
|
|
34
35
|
summary: "Get admin stats",
|
|
35
36
|
description: "Returns total counts for organizations, users, and devices.",
|
|
36
37
|
},
|
|
@@ -42,6 +43,7 @@ export const adminSearchRouteSpecs: RouteSpec[] = [
|
|
|
42
43
|
responseSchema: adminSearchResponseSchema,
|
|
43
44
|
handler: searchAdmin,
|
|
44
45
|
summary: "Search organizations, users, and devices",
|
|
46
|
+
privateDocs: true,
|
|
45
47
|
description:
|
|
46
48
|
"Performs an admin-only global search over organizations, users, and devices.",
|
|
47
49
|
},
|
|
@@ -52,6 +54,7 @@ export const adminSearchRouteSpecs: RouteSpec[] = [
|
|
|
52
54
|
requestSchema: adminIotDevicesSchema,
|
|
53
55
|
responseSchema: adminIotDevicesResponseSchema,
|
|
54
56
|
handler: getIotDevices,
|
|
57
|
+
privateDocs: true,
|
|
55
58
|
summary: "List IoT devices",
|
|
56
59
|
description:
|
|
57
60
|
"Returns the IoT device status list used for admin device/order sync workflows.",
|
|
@@ -63,6 +66,7 @@ export const adminSearchRouteSpecs: RouteSpec[] = [
|
|
|
63
66
|
requestSchema: adminDevicesSchema,
|
|
64
67
|
responseSchema: adminDevicesResponseSchema,
|
|
65
68
|
handler: getDevices,
|
|
69
|
+
privateDocs: true,
|
|
66
70
|
summary: "List MongoDB devices",
|
|
67
71
|
description:
|
|
68
72
|
"Returns all device documents from MongoDB for admin sync workflows.",
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
validateOrganizationDelete,
|
|
35
35
|
validateOrganizationUpdate,
|
|
36
36
|
} from "../middlewares/validateAction.js";
|
|
37
|
+
import type { BuildRouterAndDocsOptions } from "../utils/buildRouterAndDocs.js";
|
|
37
38
|
|
|
38
39
|
export const devicesRouteSpecs: RouteSpec[] = [
|
|
39
40
|
{
|
|
@@ -166,7 +167,14 @@ export const devicesRouteSpecs: RouteSpec[] = [
|
|
|
166
167
|
},
|
|
167
168
|
];
|
|
168
169
|
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
export function createDevicesRoute(
|
|
171
|
+
options: BuildRouterAndDocsOptions = {},
|
|
172
|
+
): Router {
|
|
173
|
+
const router: Router = Router();
|
|
174
|
+
buildRouterAndDocs(router, devicesRouteSpecs, "/devices", ["Devices"], options);
|
|
175
|
+
return router;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const router = createDevicesRoute();
|
|
171
179
|
|
|
172
180
|
export default router;
|
|
@@ -2,29 +2,64 @@ import { z } from "zod";
|
|
|
2
2
|
import { zObjectId } from "../utils/zValidations.js";
|
|
3
3
|
|
|
4
4
|
export const deviceResponseSchema = z.object({
|
|
5
|
-
id: z.string(),
|
|
6
|
-
name: z.string(),
|
|
7
|
-
serialNumber: z.string().optional(),
|
|
8
|
-
status: z.enum(["online", "offline", "error"]),
|
|
9
|
-
createdAt: z
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
id: z.string().openapi({ example: "682fd0d7d4a6325d9d45b86f" }),
|
|
6
|
+
name: z.string().openapi({ example: "Kitchen Display" }),
|
|
7
|
+
serialNumber: z.string().optional().openapi({ example: "nrf-352656106701140" }),
|
|
8
|
+
status: z.enum(["online", "offline", "error"]).openapi({ example: "online" }),
|
|
9
|
+
createdAt: z
|
|
10
|
+
.string()
|
|
11
|
+
.datetime()
|
|
12
|
+
.openapi({ example: "2026-05-21T09:30:00.000Z" }),
|
|
13
|
+
updatedAt: z
|
|
14
|
+
.string()
|
|
15
|
+
.datetime()
|
|
16
|
+
.openapi({ example: "2026-05-21T10:15:00.000Z" }),
|
|
17
|
+
}).openapi({
|
|
18
|
+
example: {
|
|
19
|
+
id: "682fd0d7d4a6325d9d45b86f",
|
|
20
|
+
name: "Kitchen Display",
|
|
21
|
+
serialNumber: "nrf-352656106701140",
|
|
22
|
+
status: "online",
|
|
23
|
+
createdAt: "2026-05-21T09:30:00.000Z",
|
|
24
|
+
updatedAt: "2026-05-21T10:15:00.000Z",
|
|
25
|
+
},
|
|
12
26
|
});
|
|
13
27
|
|
|
14
28
|
export const devicesResponseSchema = deviceResponseSchema.array();
|
|
15
29
|
|
|
16
30
|
export const eventResponseSchema = z.object({
|
|
17
|
-
id: z.string(),
|
|
18
|
-
deviceId: z.string(),
|
|
19
|
-
type: z.string(),
|
|
20
|
-
payload: z
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
id: z.string().openapi({ example: "evt_01HX0000000000000000000000" }),
|
|
32
|
+
deviceId: z.string().openapi({ example: "682fd0d7d4a6325d9d45b86f" }),
|
|
33
|
+
type: z.string().openapi({ example: "state" }),
|
|
34
|
+
payload: z
|
|
35
|
+
.record(z.string(), z.any())
|
|
36
|
+
.openapi({ example: { battery: 87, online: true } }),
|
|
37
|
+
timestamp: z
|
|
38
|
+
.string()
|
|
39
|
+
.datetime()
|
|
40
|
+
.openapi({ example: "2026-05-21T10:15:00.000Z" }),
|
|
41
|
+
}).openapi({
|
|
42
|
+
example: {
|
|
43
|
+
id: "evt_01HX0000000000000000000000",
|
|
44
|
+
deviceId: "682fd0d7d4a6325d9d45b86f",
|
|
45
|
+
type: "state",
|
|
46
|
+
payload: {
|
|
47
|
+
battery: 87,
|
|
48
|
+
online: true,
|
|
49
|
+
},
|
|
50
|
+
timestamp: "2026-05-21T10:15:00.000Z",
|
|
51
|
+
},
|
|
23
52
|
});
|
|
24
53
|
|
|
25
54
|
export const genericResponseSchema = z
|
|
26
55
|
.record(z.string(), z.any())
|
|
27
|
-
.openapi({
|
|
56
|
+
.openapi({
|
|
57
|
+
description: "Generic response payload",
|
|
58
|
+
example: {
|
|
59
|
+
success: true,
|
|
60
|
+
message: "Operation completed successfully",
|
|
61
|
+
},
|
|
62
|
+
});
|
|
28
63
|
|
|
29
64
|
export const imageResponseSchema = z.object({
|
|
30
65
|
uuid: z.string(),
|
|
@@ -93,4 +128,10 @@ export const resetResponseSchema = z.object({
|
|
|
93
128
|
example: true,
|
|
94
129
|
description: "Indicates if the reset operation was successful",
|
|
95
130
|
}),
|
|
131
|
+
}).openapi({
|
|
132
|
+
example: {
|
|
133
|
+
message:
|
|
134
|
+
"Reset all Variables and Memory and reboot Device: nrf-352656106701140",
|
|
135
|
+
success: true,
|
|
136
|
+
},
|
|
96
137
|
});
|
|
@@ -26,7 +26,23 @@ export const createEntrySchema = {
|
|
|
26
26
|
paper: zObjectId.optional().nullable(),
|
|
27
27
|
date: z.string().datetime().optional(),
|
|
28
28
|
})
|
|
29
|
-
.openapi({
|
|
29
|
+
.openapi({
|
|
30
|
+
description: "Create a new device entry",
|
|
31
|
+
example: {
|
|
32
|
+
name: "Kitchen Display",
|
|
33
|
+
deviceId: "nrf-352656106701140",
|
|
34
|
+
kind: "paper-display",
|
|
35
|
+
organization:
|
|
36
|
+
process.env.SCHEMA_EXAMPLE_ORGANIZATION_ID ||
|
|
37
|
+
"682fd0d7d4a6325d9d45b86e",
|
|
38
|
+
patient: process.env.SCHEMA_EXAMPLE_USER_ID || "682fd0d7d4a6325d9d45b86d",
|
|
39
|
+
paper: process.env.SCHEMA_EXAMPLE_PAPER_ID || null,
|
|
40
|
+
date: "2026-05-21T09:30:00.000Z",
|
|
41
|
+
meta: {
|
|
42
|
+
room: "kitchen",
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
30
46
|
};
|
|
31
47
|
|
|
32
48
|
export const getUsersSchema = {
|
|
@@ -63,7 +79,19 @@ export const updateEntrySchema = {
|
|
|
63
79
|
lut: z.string().optional(),
|
|
64
80
|
sleepTime: z.string().optional(),
|
|
65
81
|
clearScreen: z.boolean().optional(),
|
|
66
|
-
}).openapi({
|
|
82
|
+
}).openapi({
|
|
83
|
+
description: "Fields to update on a device entry",
|
|
84
|
+
example: {
|
|
85
|
+
name: "Kitchen Display",
|
|
86
|
+
kind: "paper-display",
|
|
87
|
+
meta: {
|
|
88
|
+
room: "kitchen",
|
|
89
|
+
},
|
|
90
|
+
alarmEnable: 1,
|
|
91
|
+
takeOffsetTime: 15,
|
|
92
|
+
clearScreen: false,
|
|
93
|
+
},
|
|
94
|
+
}),
|
|
67
95
|
};
|
|
68
96
|
|
|
69
97
|
export const getEventsSchema = {
|
|
@@ -88,28 +116,45 @@ export const createCustomerPortalSessionSchema = {
|
|
|
88
116
|
params: z.object({
|
|
89
117
|
deviceId: zObjectId.openapi({ description: "Device ObjectId" }),
|
|
90
118
|
}),
|
|
91
|
-
body: z
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
119
|
+
body: z
|
|
120
|
+
.object({
|
|
121
|
+
domain: z.string().url().openapi({
|
|
122
|
+
description: "Domain for return URL",
|
|
123
|
+
example: "https://web.wirewire.de",
|
|
124
|
+
}),
|
|
125
|
+
})
|
|
126
|
+
.openapi({
|
|
127
|
+
example: {
|
|
128
|
+
domain: "https://web.wirewire.de",
|
|
129
|
+
},
|
|
95
130
|
}),
|
|
96
|
-
}),
|
|
97
131
|
};
|
|
98
132
|
export const createDeviceSchema = {
|
|
99
|
-
body: z
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
133
|
+
body: z
|
|
134
|
+
.object({
|
|
135
|
+
kind: z.string().optional().openapi({ example: "paper-display" }),
|
|
136
|
+
patient: zObjectIdFor("patient")
|
|
137
|
+
.optional()
|
|
138
|
+
.nullable()
|
|
139
|
+
.openapi({ description: "Patient ObjectId", example: null }),
|
|
140
|
+
paper: zObjectIdFor("paper")
|
|
141
|
+
.optional()
|
|
142
|
+
.nullable()
|
|
143
|
+
.openapi({ description: "Paper ObjectId", example: null }),
|
|
144
|
+
organization: zObjectIdFor("organization").openapi({
|
|
145
|
+
description: "Organization ObjectId",
|
|
146
|
+
}),
|
|
147
|
+
})
|
|
148
|
+
.openapi({
|
|
149
|
+
example: {
|
|
150
|
+
kind: "paper-display",
|
|
151
|
+
patient: process.env.SCHEMA_EXAMPLE_USER_ID || "682fd0d7d4a6325d9d45b86d",
|
|
152
|
+
paper: process.env.SCHEMA_EXAMPLE_PAPER_ID || null,
|
|
153
|
+
organization:
|
|
154
|
+
process.env.SCHEMA_EXAMPLE_ORGANIZATION_ID ||
|
|
155
|
+
"682fd0d7d4a6325d9d45b86e",
|
|
156
|
+
},
|
|
111
157
|
}),
|
|
112
|
-
}),
|
|
113
158
|
};
|
|
114
159
|
export const deleteDeviceSchema = zDelete("deviceId");
|
|
115
160
|
export const getDeviceSchema = zGet("deviceId");
|
|
@@ -195,16 +240,40 @@ export const uploadSingleImageFromWebsiteSchema = {};
|
|
|
195
240
|
export const updateDeviceSchema = {
|
|
196
241
|
...zUpdate("deviceId"),
|
|
197
242
|
body: zPatchBody({
|
|
198
|
-
intake: z
|
|
199
|
-
|
|
243
|
+
intake: z
|
|
244
|
+
.record(z.string(), z.any())
|
|
245
|
+
.optional()
|
|
246
|
+
.openapi({ example: { morning: "08:00", evening: "20:00" } }),
|
|
247
|
+
meta: z
|
|
248
|
+
.record(z.string(), z.any())
|
|
249
|
+
.optional()
|
|
250
|
+
.openapi({ example: { room: "kitchen" } }),
|
|
200
251
|
organization: zObjectId.optional(),
|
|
201
252
|
patient: zObjectId.optional().nullable(),
|
|
202
253
|
paper: zObjectId.optional().nullable(),
|
|
203
|
-
kind: z.string().optional(),
|
|
204
|
-
deviceId: z.string().optional(),
|
|
205
|
-
alarmEnable: z.number().int().optional(),
|
|
206
|
-
takeOffsetTime: z.number().int().optional(),
|
|
207
|
-
iotDevice: z
|
|
208
|
-
|
|
254
|
+
kind: z.string().optional().openapi({ example: "paper-display" }),
|
|
255
|
+
deviceId: z.string().optional().openapi({ example: "nrf-352656106701140" }),
|
|
256
|
+
alarmEnable: z.number().int().optional().openapi({ example: 1 }),
|
|
257
|
+
takeOffsetTime: z.number().int().optional().openapi({ example: 15 }),
|
|
258
|
+
iotDevice: z
|
|
259
|
+
.record(z.string(), z.any())
|
|
260
|
+
.optional()
|
|
261
|
+
.openapi({ example: { firmwareVersion: "1.2.3" } }),
|
|
262
|
+
payment: z
|
|
263
|
+
.record(z.string(), z.any())
|
|
264
|
+
.optional()
|
|
265
|
+
.openapi({ example: { status: "active" } }),
|
|
266
|
+
}).openapi({
|
|
267
|
+
example: {
|
|
268
|
+
kind: "paper-display",
|
|
269
|
+
deviceId: "nrf-352656106701140",
|
|
270
|
+
patient: process.env.SCHEMA_EXAMPLE_USER_ID || "682fd0d7d4a6325d9d45b86d",
|
|
271
|
+
paper: process.env.SCHEMA_EXAMPLE_PAPER_ID || null,
|
|
272
|
+
meta: {
|
|
273
|
+
room: "kitchen",
|
|
274
|
+
},
|
|
275
|
+
alarmEnable: 1,
|
|
276
|
+
takeOffsetTime: 15,
|
|
277
|
+
},
|
|
209
278
|
}),
|
|
210
279
|
};
|
package/src/index.ts
CHANGED
|
@@ -26,6 +26,10 @@ export * from "../src/organizations/organizations.controller";
|
|
|
26
26
|
export { default as organizationsService } from "../src/organizations/organizations.service";
|
|
27
27
|
export { default as Organization } from "../src/organizations/organizations.model";
|
|
28
28
|
export { default as devicesRoute } from "../src/devices/devices.route";
|
|
29
|
+
export {
|
|
30
|
+
createDevicesRoute,
|
|
31
|
+
devicesRouteSpecs,
|
|
32
|
+
} from "../src/devices/devices.route";
|
|
29
33
|
export { default as devicesService } from "../src/devices/devices.service";
|
|
30
34
|
export { default as Device } from "../src/devices/devices.model";
|
|
31
35
|
export * from "../src/devices/devices.validation";
|