diff --git a/app/db/models/measurement.server.ts b/app/db/models/measurement.server.ts index 4a4862b7..b53ae2dd 100644 --- a/app/db/models/measurement.server.ts +++ b/app/db/models/measurement.server.ts @@ -1,5 +1,4 @@ import { and, desc, eq, gt, gte, inArray, lt, lte, sql } from 'drizzle-orm' -import { ArchivedDeviceError } from './device.server' import { type LastMeasurement, location, @@ -235,25 +234,7 @@ export async function saveMeasurements( }) await drizzleClient.transaction(async (tx) => { - const [currentDevice] = await tx - .select({ - id: device.id, - archivedAt: device.archivedAt, - }) - .from(device) - .where(eq(device.id, minimalDevice.id)) - .limit(1) - timing?.mark('transactionDeviceLookup') - - if (!currentDevice) { - const error = new Error('Device not found') - error.name = 'NotFoundError' - throw error - } - - if (currentDevice.archivedAt) { - throw new ArchivedDeviceError(currentDevice.id) - } + timing?.mark('transactionStart') const locations = deviceLocationUpdates.length > 0