Skip to content

[3] [TASK] [Backend] [Validation] Add input validation on TelemetryPingDTO #122

@R4R35

Description

@R4R35

Description


Add field-level validation annotations on TelemetryPingDTO to reject structurally invalid requests before they reach the service layer. Without this, empty or malformed JSON can be saved directly to MongoDB.

Scope


  • Add @NotNull, @NotBlank on deviceId, storeId, itemId
  • Add @NotNull on lat, lng, accuracyMeters, timestamp
  • Add @Valid in the controller on the @RequestBody parameter
  • Return a meaningful 400 Bad Request response on validation failure

Done When


  • Sending an empty JSON body returns 400 Bad Request
  • Sending a request with missing fields returns 400 Bad Request
  • Valid requests still return 202 Accepted and are saved correctly

Priority


  • 🔴 High

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions