(ctx context.Context, requestID string)
| 140 | } |
| 141 | |
| 142 | func (s *postgresStore) GetRequest(ctx context.Context, requestID string) (RequestRow, error) { |
| 143 | row := s.db.QueryRowContext(ctx, ` |
| 144 | SELECT request_id, trace_id, request_type, tenant_id, task_type, priority, pipeline_ref, |
| 145 | input_json, context_json, ai_request_json, policy_snapshot_json, status, selected_backend, route_reason, |
| 146 | created_at, updated_at |
| 147 | FROM requests WHERE request_id = $1`, requestID) |
| 148 | var r RequestRow |
| 149 | var createdMs, updatedMs int64 |
| 150 | var policySnap, aiReq sql.NullString |
| 151 | if err := row.Scan( |
| 152 | &r.RequestID, &r.TraceID, &r.RequestType, &r.TenantID, &r.TaskType, &r.Priority, &r.PipelineRef, |
| 153 | &r.InputJSON, &r.ContextJSON, &aiReq, &policySnap, &r.Status, &r.SelectedBackend, &r.RouteReason, |
| 154 | &createdMs, &updatedMs, |
| 155 | ); err != nil { |
| 156 | if errors.Is(err, sql.ErrNoRows) { |
| 157 | return RequestRow{}, ErrNotFound |
| 158 | } |
| 159 | return RequestRow{}, err |
| 160 | } |
| 161 | if aiReq.Valid { |
| 162 | r.AIRequestJSON = []byte(aiReq.String) |
| 163 | } |
| 164 | if policySnap.Valid { |
| 165 | r.PolicySnapshot = []byte(policySnap.String) |
| 166 | } |
| 167 | r.CreatedAt = time.UnixMilli(createdMs) |
| 168 | r.UpdatedAt = time.UnixMilli(updatedMs) |
| 169 | return r, nil |
| 170 | } |
| 171 | |
| 172 | func (s *postgresStore) ListSteps(ctx context.Context, requestID string) ([]StepRow, error) { |
| 173 | rows, err := s.db.QueryContext(ctx, ` |
no outgoing calls
no test coverage detected