Skip to content

Commit

Permalink
fix: unable to remove peripheralDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Dec 10, 2024
1 parent c7bdfe6 commit 3d559f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion meteor/server/api/__tests__/peripheralDevice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ describe('test peripheralDevice general API methods', () => {
const deviceObj = await PeripheralDevices.findOneAsync(device?._id)
expect(deviceObj).toBeDefined()

await MeteorCall.peripheralDevice.removePeripheralDevice(device._id, device.token)
await MeteorCall.peripheralDevice.removePeripheralDevice(device._id)
}

{
Expand Down
16 changes: 8 additions & 8 deletions meteor/server/api/peripheralDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { convertPeripheralDeviceForGateway } from '../publications/peripheralDev
import { executePeripheralDeviceFunction } from './peripheralDevice/executeFunction'
import KoaRouter from '@koa/router'
import bodyParser from 'koa-bodyparser'
import { assertConnectionHasOneOfPermissions } from '../security/auth'

const apmNamespace = 'peripheralDevice'
export namespace ServerPeripheralDeviceAPI {
Expand Down Expand Up @@ -513,12 +514,11 @@ export namespace ServerPeripheralDeviceAPI {
},
})
}
export async function removePeripheralDevice(
context: MethodContext,
deviceId: PeripheralDeviceId,
token?: string
): Promise<void> {
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, token, context)
export async function removePeripheralDevice(context: MethodContext, deviceId: PeripheralDeviceId): Promise<void> {
assertConnectionHasOneOfPermissions(context.connection, 'configure')

const peripheralDevice = await PeripheralDevices.findOneAsync(deviceId)
if (!peripheralDevice) throw new Meteor.Error(404, `PeripheralDevice "${deviceId}" not found`)

logger.info(`Removing PeripheralDevice ${peripheralDevice._id}`)

Expand Down Expand Up @@ -850,8 +850,8 @@ class ServerPeripheralDeviceAPIClass extends MethodContextAPI implements NewPeri
async testMethod(deviceId: PeripheralDeviceId, deviceToken: string, returnValue: string, throwError?: boolean) {
return ServerPeripheralDeviceAPI.testMethod(this, deviceId, deviceToken, returnValue, throwError)
}
async removePeripheralDevice(deviceId: PeripheralDeviceId, token?: string) {
return ServerPeripheralDeviceAPI.removePeripheralDevice(this, deviceId, token)
async removePeripheralDevice(deviceId: PeripheralDeviceId) {
return ServerPeripheralDeviceAPI.removePeripheralDevice(this, deviceId)
}

// ------ Playout Gateway --------
Expand Down
2 changes: 1 addition & 1 deletion packages/shared-lib/src/peripheralDevice/methodsAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export interface NewPeripheralDeviceAPI {
timelineTriggerTime(deviceId: PeripheralDeviceId, deviceToken: string, r: TimelineTriggerTimeResult): Promise<void>
requestUserAuthToken(deviceId: PeripheralDeviceId, deviceToken: string, authUrl: string): Promise<void>
storeAccessToken(deviceId: PeripheralDeviceId, deviceToken: string, authToken: string): Promise<void>
removePeripheralDevice(deviceId: PeripheralDeviceId, deviceToken?: string): Promise<void>
removePeripheralDevice(deviceId: PeripheralDeviceId): Promise<void>
reportResolveDone(
deviceId: PeripheralDeviceId,
deviceToken: string,
Expand Down

0 comments on commit 3d559f1

Please sign in to comment.