@internetderdinge/api 1.229.9 → 1.229.10

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.
@@ -7,7 +7,7 @@ import { validateQuerySearchUserAndOrganization } from "../middlewares/validateQ
7
7
  import { validateDevice } from "../middlewares/validateDevice.js";
8
8
  import * as devicesController from "./devices.controller.js";
9
9
  import { resetDevice } from "./devices.controller.js";
10
- import { createDeviceSchema, queryDevicesSchema, getDeviceSchema, updateDeviceSchema, getEventsSchema, pingDeviceSchema, registerDeviceSchema, ledLightSchema, rebootDeviceSchema, getImageSchema, updateSingleImageMetaSchema, uploadSingleImageSchema, resetDeviceSchema, } from "./devices.validation.js";
10
+ import { createDeviceSchema, queryDevicesSchema, getDeviceSchema, updateDeviceSchema, deleteDeviceSchema, getEventsSchema, pingDeviceSchema, registerDeviceSchema, ledLightSchema, rebootDeviceSchema, getImageSchema, updateSingleImageMetaSchema, uploadSingleImageSchema, resetDeviceSchema, } from "./devices.validation.js";
11
11
  import { deviceResponseSchema, devicesResponseSchema, eventResponseSchema, genericResponseSchema, imageResponseSchema, uploadResponseSchema, resetResponseSchema, } from "./devices.schemas.js";
12
12
  import { validateOrganizationDelete, validateOrganizationUpdate, } from "../middlewares/validateAction.js";
13
13
  export const devicesRouteSpecs = [
@@ -68,6 +68,9 @@ export const devicesRouteSpecs = [
68
68
  {
69
69
  method: "delete",
70
70
  path: "/:deviceId",
71
+ validate: [auth("manageUsers"), validateDevice, validateOrganizationDelete],
72
+ requestSchema: deleteDeviceSchema,
73
+ responseSchema: genericResponseSchema,
71
74
  handler: devicesController.deleteEntry,
72
75
  summary: "Delete a device",
73
76
  description: "Remove the specified device from the system.",
package/dist/src/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as i18n } from "../src/i18n/i18n";
10
10
  export { default as usersRoute } from "../src/users/users.route";
11
11
  export { default as accountsRoute } from "../src/accounts/accounts.route";
12
12
  export { default as accountsService } from "../src/accounts/accounts.service";
13
+ export { auth0 } from "../src/accounts/auth0.service";
13
14
  export { default as organizationsRoute } from "../src/organizations/organizations.route";
14
15
  export { default as organizationsService } from "../src/organizations/organizations.service";
15
16
  export { default as Organization } from "../src/organizations/organizations.model";
@@ -1,7 +1,6 @@
1
1
  import httpStatus from "http-status";
2
2
  import ApiError from "../utils/ApiError";
3
3
  const isAdmin = (user) => {
4
- return false;
5
4
  if (!user)
6
5
  return false;
7
6
  // return false; // TODO: Remove this line when the user object is properly defined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetderdinge/api",
3
- "version": "1.229.9",
3
+ "version": "1.229.10",
4
4
  "description": "Shared OpenIoT API modules",
5
5
  "main": "dist/src/index.js",
6
6
  "type": "module",
@@ -105,6 +105,9 @@ export const devicesRouteSpecs: RouteSpec[] = [
105
105
  {
106
106
  method: "delete",
107
107
  path: "/:deviceId",
108
+ validate: [auth("manageUsers"), validateDevice, validateOrganizationDelete],
109
+ requestSchema: deleteDeviceSchema,
110
+ responseSchema: genericResponseSchema,
108
111
  handler: devicesController.deleteEntry,
109
112
  summary: "Delete a device",
110
113
  description: "Remove the specified device from the system.",
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export { default as i18n } from "../src/i18n/i18n";
15
15
  export { default as usersRoute } from "../src/users/users.route";
16
16
  export { default as accountsRoute } from "../src/accounts/accounts.route";
17
17
  export { default as accountsService } from "../src/accounts/accounts.service";
18
+ export { auth0 } from "../src/accounts/auth0.service";
18
19
  export { default as organizationsRoute } from "../src/organizations/organizations.route";
19
20
  export { default as organizationsService } from "../src/organizations/organizations.service";
20
21
  export { default as Organization } from "../src/organizations/organizations.model";
@@ -3,7 +3,6 @@ import ApiError from "../utils/ApiError";
3
3
  import type { Request, Response, NextFunction } from "express";
4
4
 
5
5
  const isAdmin = (user: Record<string, any> | undefined): boolean => {
6
- return false;
7
6
  if (!user) return false;
8
7
 
9
8
  // return false; // TODO: Remove this line when the user object is properly defined