Tie points to locator serial numbers and store receiver telemetry
Adds devices/<serial>/log as a job-anchored MQTT ingest path: a locator identifies itself by serial in the topic (auto-registered on first sight, org resolved from the job in the payload) rather than by a pre-provisioned broker credential. Device.serialNumber is now globally unique so the bare topic segment is enough to resolve identity. Locator lookup/auto-register logic is shared (LocatorRegistryService) between this and the existing devices/<mqttUsername>/points path. New /sim page (own header, outside the main app nav) simulates a transmitter: pick an open job or create one, set a serial number and telemetry defaults, and send points one at a time or on an interval along a simulated walking path. It calls a new authenticated backend endpoint (POST /orgs/:orgId/sim/publish) that publishes onto the real broker rather than writing the DB directly, so the simulator exercises the actual ingest pipeline end-to-end. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
17
backend/src/sim/dto/sim.dto.ts
Normal file
17
backend/src/sim/dto/sim.dto.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { IsNotEmpty, IsString, MaxLength } from 'class-validator';
|
||||
import { MqttPointDto } from '../../ingest/dto/mqtt-messages.dto';
|
||||
|
||||
// What the simulator UI sends the backend. Mirrors a devices/<serial>/log
|
||||
// payload plus the two fields that live in the topic/routing rather than the
|
||||
// wire payload itself (serial, jobId) so this DTO doubles as validation for
|
||||
// both the REST call and the outgoing MQTT message.
|
||||
export class SimPublishPointDto extends MqttPointDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(64)
|
||||
serial: string;
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
jobId: string;
|
||||
}
|
||||
Reference in New Issue
Block a user