Add manual failures UI and global list filtering
This commit is contained in:
@@ -128,3 +128,32 @@ func (r *FailureRepository) ListAll(ctx context.Context, limit int) ([]domain.Fa
|
||||
}
|
||||
return items, nil
|
||||
}
|
||||
|
||||
func (r *FailureRepository) Get(ctx context.Context, id string) (domain.FailureEvent, error) {
|
||||
row := r.db.QueryRowContext(ctx,
|
||||
`SELECT id, source, external_id, part_id, machine_id, failure_type, failure_time, details, confidence, created_at
|
||||
FROM failure_events
|
||||
WHERE id = ?`,
|
||||
id,
|
||||
)
|
||||
var event domain.FailureEvent
|
||||
var machineID sql.NullString
|
||||
var details sql.NullString
|
||||
var confidence sql.NullFloat64
|
||||
if err := row.Scan(&event.ID, &event.Source, &event.ExternalID, &event.PartID, &machineID, &event.FailureType, &event.FailureTime, &details, &confidence, &event.CreatedAt); err != nil {
|
||||
return domain.FailureEvent{}, err
|
||||
}
|
||||
if machineID.Valid {
|
||||
value := machineID.String
|
||||
event.MachineID = &value
|
||||
}
|
||||
if details.Valid {
|
||||
value := details.String
|
||||
event.Details = &value
|
||||
}
|
||||
if confidence.Valid {
|
||||
value := confidence.Float64
|
||||
event.Confidence = &value
|
||||
}
|
||||
return event, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user