Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailroom contact search API #213

Merged
merged 9 commits into from
Jan 20, 2020
Merged

Mailroom contact search API #213

merged 9 commits into from
Jan 20, 2020

Conversation

nicpottier
Copy link
Member

@nicpottier nicpottier commented Jan 9, 2020

Adds new endpoint to search for contacts within an org given a root group and the query. Returns the page of contact ids required, total number of hits and parsed query.

@codecov
Copy link

codecov bot commented Jan 9, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@d6dfab6). Click here to learn what that means.
The diff coverage is 75.2%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #213   +/-   ##
=========================================
  Coverage          ?   47.78%           
=========================================
  Files             ?       82           
  Lines             ?     7212           
  Branches          ?        0           
=========================================
  Hits              ?     3446           
  Misses            ?     3231           
  Partials          ?      535
Impacted Files Coverage Δ
goflow/engine.go 86.11% <100%> (ø)
goflow/flows.go 100% <100%> (ø)
models/classifiers.go 43.33% <16.66%> (ø)
models/env.go 39.43% <33.33%> (ø)
models/contacts.go 49.05% <44.44%> (ø)
web/contact/contact.go 62.96% <53.33%> (ø)
web/flow/flow.go 76.92% <90%> (ø)
search/search.go 94.66% <90%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6dfab6...19ef106. Read the comment docs.

@@ -71,7 +71,7 @@ To run the tests you need to create the test database:

```
$ createdb mailroom_test
$ createuser -P -E temba (set no password)
$ createuser -P -E -s mailroom_test (set no password)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new machines have you discover things!

{"term":{"is_active":true}},
{"term":{"is_blocked":false}},
{"term":{"is_stopped":false}}
{ "bool":{
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queries are a bit different now since the building of the root query doesn't force blocked and stopped anymore. (since those are valid searches)

}

// Error is used when an error is in the parsing of a field or query format
type Error struct {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

search.Error is the type for search errors that should be shown to the user and are therefore (400 status errors). All other types of errors will result in the contact search endpoint returning a 500 (IE, elastic is unreachable)

@nicpottier nicpottier changed the title Mailroom contact search API (wip) Mailroom contact search API Jan 19, 2020
}

resolver := func(key string) assets.Field {
return registry[key]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obviously doesn't matter in this case but my eyes have been trained to spot stuff like this (if item does't exist, nil struct gets wrapped in non-nil interface)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, ya, I'm not as trained to look for those yet, thanks for the reminder.

@nicpottier nicpottier merged commit 39343b5 into master Jan 20, 2020
@rowanseymour rowanseymour deleted the search-api branch June 5, 2020 14:57
rasoro pushed a commit to Ilhasoft/mailroom that referenced this pull request Mar 10, 2023
Fix to use DLRID for Bongolive status reports
rasoro pushed a commit to Ilhasoft/mailroom that referenced this pull request Dec 16, 2024
Read template components from components list field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants