@internetderdinge/api 1.229.25 → 1.229.26
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.controller.js +0 -1
- package/dist/src/devicesNotifications/devicesNotifications.controller.js +0 -1
- package/dist/src/middlewares/auth.js +1 -1
- package/dist/src/middlewares/validateAi.js +1 -0
- package/dist/src/organizations/organizations.controller.js +0 -1
- package/dist/src/users/users.validation.js +3 -2
- package/package.json +1 -2
- package/src/accounts/accounts.controller.ts +0 -2
- package/src/devicesNotifications/devicesNotifications.controller.ts +0 -2
- package/src/middlewares/auth.ts +2 -0
- package/src/middlewares/validateAi.ts +2 -0
- package/src/organizations/organizations.controller.ts +0 -1
- package/src/users/users.validation.ts +3 -2
|
@@ -34,7 +34,6 @@ const avatar = catchAsync(async (req, res) => {
|
|
|
34
34
|
});
|
|
35
35
|
const updateEntry = catchAsync(async (req, res) => {
|
|
36
36
|
const account = await accountsService.getAccountById(req.auth.sub);
|
|
37
|
-
console.log("account", account);
|
|
38
37
|
const { isSocial } = account.identities[0];
|
|
39
38
|
const { given_name, family_name, email, notification, ...updateBody } = req.body;
|
|
40
39
|
const trimmedGivenName = typeof given_name === "string" ? given_name.trim() : undefined;
|
|
@@ -16,7 +16,6 @@ export const setDeviceToken = catchAsync(async (req, res) => {
|
|
|
16
16
|
user: res.req.auth.sub,
|
|
17
17
|
body: req.body,
|
|
18
18
|
});
|
|
19
|
-
console.log("Setting device tokenddddd for user:", res.req.auth.sub);
|
|
20
19
|
res.status(httpStatus.CREATED).send(user);
|
|
21
20
|
});
|
|
22
21
|
export const removeDeviceToken = catchAsync(async (req, res) => {
|
|
@@ -82,7 +82,7 @@ const auth = function authFactory(...requiredRights) {
|
|
|
82
82
|
if (tokenDoc) {
|
|
83
83
|
const ownerId = tokenDoc.owner;
|
|
84
84
|
const auth0Roles = await getAuth0RolesByOwner(ownerId);
|
|
85
|
-
console.log(`Authenticated API token request for owner ${ownerId}`, auth0Roles);
|
|
85
|
+
console.log(`Authenticated API token request for owner ${ownerId}`, auth0Roles, ROLES_CLAIM, "aaa");
|
|
86
86
|
req.auth = {
|
|
87
87
|
id: ownerId,
|
|
88
88
|
tokenId: tokenDoc._id,
|
|
@@ -4,6 +4,7 @@ import ApiError from "../utils/ApiError"; // keep .cjs import
|
|
|
4
4
|
export const isAiRole = (user) => {
|
|
5
5
|
if (!user)
|
|
6
6
|
return false;
|
|
7
|
+
console.log("Checking AI role for user:", user);
|
|
7
8
|
return user["https://memo.wirewire.de/roles"]?.includes("ai") ?? false;
|
|
8
9
|
};
|
|
9
10
|
export const validateAiRole = async (req, res, next) => {
|
|
@@ -21,7 +21,6 @@ export const createOrganization = catchAsync(async (req, res) => {
|
|
|
21
21
|
export const getOrganizations = catchAsync(async (req, res) => {
|
|
22
22
|
const filter = pick(req.query, ["name", "kind"]);
|
|
23
23
|
const options = pick(req.query, ["sortBy", "limit", "page"]);
|
|
24
|
-
console.log("getOrganizations", req.query, filter, options);
|
|
25
24
|
const filteredOptions = filterOptions(req.query, filter, {
|
|
26
25
|
objectIds: ["_id", "patient"],
|
|
27
26
|
search: ["name", "kind"],
|
|
@@ -6,7 +6,8 @@ extendZodWithOpenApi(z);
|
|
|
6
6
|
export const createUserSchema = {
|
|
7
7
|
body: z.object({
|
|
8
8
|
meta: z
|
|
9
|
-
.
|
|
9
|
+
.object({})
|
|
10
|
+
.passthrough()
|
|
10
11
|
.optional()
|
|
11
12
|
.openapi({
|
|
12
13
|
example: { key: "value" },
|
|
@@ -58,7 +59,7 @@ export const updateUserSchema = {
|
|
|
58
59
|
timezone: z.string().optional().openapi({ description: "IANA timezone" }),
|
|
59
60
|
avatar: z.string().optional().openapi({ description: "Avatar URL" }),
|
|
60
61
|
meta: z
|
|
61
|
-
.
|
|
62
|
+
.object({})
|
|
62
63
|
.optional()
|
|
63
64
|
.openapi({ description: "Additional metadata" }),
|
|
64
65
|
category: z
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetderdinge/api",
|
|
3
|
-
"version": "1.229.
|
|
3
|
+
"version": "1.229.26",
|
|
4
4
|
"description": "Shared OpenIoT API modules",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"axios": "^1.13.5",
|
|
39
39
|
"body-parser": "~2.2.2",
|
|
40
40
|
"body-parser-xml": "~2.0.5",
|
|
41
|
-
"canvas": "^3.2.1",
|
|
42
41
|
"compression": "^1.8.1",
|
|
43
42
|
"config": "^4.3.0",
|
|
44
43
|
"cors": "^2.8.6",
|
|
@@ -74,8 +74,6 @@ const updateEntry = catchAsync(
|
|
|
74
74
|
async (req: AuthenticatedRequest, res: Response): Promise<void> => {
|
|
75
75
|
const account = await accountsService.getAccountById(req.auth.sub);
|
|
76
76
|
|
|
77
|
-
console.log("account", account);
|
|
78
|
-
|
|
79
77
|
const { isSocial } = account.identities[0];
|
|
80
78
|
|
|
81
79
|
const {
|
package/src/middlewares/auth.ts
CHANGED
|
@@ -9,6 +9,8 @@ interface User {
|
|
|
9
9
|
// you can adjust the User source if your auth payload differs
|
|
10
10
|
export const isAiRole = (user?: User): boolean => {
|
|
11
11
|
if (!user) return false;
|
|
12
|
+
|
|
13
|
+
console.log("Checking AI role for user:", user);
|
|
12
14
|
return user["https://memo.wirewire.de/roles"]?.includes("ai") ?? false;
|
|
13
15
|
};
|
|
14
16
|
|
|
@@ -32,7 +32,6 @@ export const getOrganizations = catchAsync(
|
|
|
32
32
|
async (req: Request, res: Response): Promise<void> => {
|
|
33
33
|
const filter = pick(req.query, ["name", "kind"]);
|
|
34
34
|
const options = pick(req.query, ["sortBy", "limit", "page"]);
|
|
35
|
-
console.log("getOrganizations", req.query, filter, options);
|
|
36
35
|
|
|
37
36
|
const filteredOptions = filterOptions(req.query, filter, {
|
|
38
37
|
objectIds: ["_id", "patient"],
|
|
@@ -17,7 +17,8 @@ extendZodWithOpenApi(z);
|
|
|
17
17
|
export const createUserSchema = {
|
|
18
18
|
body: z.object({
|
|
19
19
|
meta: z
|
|
20
|
-
.
|
|
20
|
+
.object({})
|
|
21
|
+
.passthrough()
|
|
21
22
|
.optional()
|
|
22
23
|
.openapi({
|
|
23
24
|
example: { key: "value" },
|
|
@@ -75,7 +76,7 @@ export const updateUserSchema = {
|
|
|
75
76
|
timezone: z.string().optional().openapi({ description: "IANA timezone" }),
|
|
76
77
|
avatar: z.string().optional().openapi({ description: "Avatar URL" }),
|
|
77
78
|
meta: z
|
|
78
|
-
.
|
|
79
|
+
.object({})
|
|
79
80
|
.optional()
|
|
80
81
|
.openapi({ description: "Additional metadata" }),
|
|
81
82
|
category: z
|