Skip to content
This repository was archived by the owner on Apr 2, 2022. It is now read-only.
This repository was archived by the owner on Apr 2, 2022. It is now read-only.

Event API fails to search on type_id  #29

@bardbess

Description

@bardbess

When doing a search from ember on the type column I'm getting the following exception.

App 14766 stdout: Processing by Api::V1::EventsController#index as JSON
App 14766 stdout:   Parameters: {"descending"=>"1", "detailed"=>"{\"type\":[\"\\\"bounced\\\"\"]}", "like"=>"true", "limit"=>"10", "offset"=>"0", "sortby"=>"timestamp"}
App 14766 stdout: PG::UndefinedColumn: ERROR:  column "type" does not exist
App 14766 stdout: LINE 1: SELECT COUNT(*) FROM "events"  WHERE ("type" LIKE '%"bounced...
App 14766 stdout:                                               ^
App 14766 stdout: : SELECT COUNT(*) FROM "events"  WHERE ("type" LIKE '%"bounced"%')
App 14766 stdout: Completed 500 Internal Server Error in 2ms
App 14766 stdout: 
App 14766 stdout: ActiveRecord::StatementInvalid (PG::UndefinedColumn: ERROR:  column "type" does not exist
App 14766 stdout: LINE 1: SELECT COUNT(*) FROM "events"  WHERE ("type" LIKE '%"bounced...
App 14766 stdout:                                               ^
App 14766 stdout: : SELECT COUNT(*) FROM "events"  WHERE ("type" LIKE '%"bounced"%')):
App 14766 stdout:   app/controllers/api/v1/events_controller.rb:61:in `index'

The request is searching on the type column rather than the type_id column.

I can see there is a conditions in the receiver for renaming this key when coming back from sendgrid. Looks like the events_controller can be safely corrected to accept type_id

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