Migrate ingest and API paths to string IDs
This commit is contained in:
@@ -33,8 +33,8 @@ type failureIngestRequest struct {
|
||||
|
||||
type failureIngestItem struct {
|
||||
ExternalID string `json:"external_id"`
|
||||
ComponentID int64 `json:"component_id"`
|
||||
AssetID *int64 `json:"asset_id"`
|
||||
ComponentID string `json:"component_id"`
|
||||
AssetID *string `json:"asset_id"`
|
||||
FailureType string `json:"failure_type"`
|
||||
FailureTime string `json:"failure_time"`
|
||||
Details *string `json:"details"`
|
||||
@@ -79,7 +79,7 @@ func (h failureHandlers) handleFailureIngest(w http.ResponseWriter, r *http.Requ
|
||||
writeError(w, http.StatusBadRequest, "failures.external_id is required")
|
||||
return
|
||||
}
|
||||
if item.ComponentID <= 0 {
|
||||
if item.ComponentID == "" {
|
||||
writeError(w, http.StatusBadRequest, "failures.component_id is required")
|
||||
return
|
||||
}
|
||||
@@ -122,8 +122,8 @@ func (h failureHandlers) handleFailureIngest(w http.ResponseWriter, r *http.Requ
|
||||
_, err = h.deps.Failures.Upsert(r.Context(), tx, domain.FailureEvent{
|
||||
Source: strings.TrimSpace(req.Source),
|
||||
ExternalID: strings.TrimSpace(item.ExternalID),
|
||||
ComponentID: item.ComponentID,
|
||||
AssetID: item.AssetID,
|
||||
PartID: item.ComponentID,
|
||||
MachineID: item.AssetID,
|
||||
FailureType: strings.TrimSpace(item.FailureType),
|
||||
FailureTime: failureTime,
|
||||
Details: item.Details,
|
||||
|
||||
Reference in New Issue
Block a user