diff --git a/api/data/auburn_db.go b/api/data/auburn_db.go index 62d8342..b51e55e 100644 --- a/api/data/auburn_db.go +++ b/api/data/auburn_db.go @@ -67,14 +67,14 @@ func (c *Client) AuburnOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: date.Format("2006-01-02"), Name: "Auburn PD", - ID: "apd", + ID: "auburn-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/auburn/officer", + Path: "/auburn-wa/officer", QueryParams: []string{"badge", "first_name", "last_name"}, }, "fuzzy": { - Path: "/auburn/officer/search", + Path: "/auburn-wa/officer/search", QueryParams: []string{"first_name", "last_name"}, }, }, diff --git a/api/data/bellevue_db.go b/api/data/bellevue_db.go index b8c2e08..f2bbef3 100644 --- a/api/data/bellevue_db.go +++ b/api/data/bellevue_db.go @@ -59,14 +59,14 @@ func (c *Client) BellevueOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: "2021-05-01", Name: "Bellevue PD", - ID: "bpd", + ID: "bellevue-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/bellevue/officer", + Path: "/bellevue-wa/officer", QueryParams: []string{"badge", "first_name", "last_name"}, }, "fuzzy": { - Path: "/bellevue/officer/search", + Path: "/bellevue-wa/officer/search", QueryParams: []string{"first_name", "last_name"}, }, }, diff --git a/api/data/lakewood_db.go b/api/data/lakewood_db.go index 7a896b4..19a3e33 100644 --- a/api/data/lakewood_db.go +++ b/api/data/lakewood_db.go @@ -73,14 +73,14 @@ func (c *Client) LakewoodOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: date.Format("2006-01-02"), Name: "Lakewood PD", - ID: "lpd", + ID: "lakewood-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/lakewood/officer", + Path: "/lakewood-wa/officer", QueryParams: []string{"first_name", "last_name"}, }, "fuzzy": { - Path: "/lakewood/officer/search", + Path: "/lakewood-wa/officer/search", QueryParams: []string{"first_name", "last_name"}, }, }, diff --git a/api/data/olympia_db.go b/api/data/olympia_db.go index 85fa989..9e083c2 100644 --- a/api/data/olympia_db.go +++ b/api/data/olympia_db.go @@ -73,14 +73,14 @@ func (c *Client) OlympiaOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: date.Format("2006-01-02"), Name: "Olympia PD", - ID: "opd", + ID: "olympia-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/olympia/officer", + Path: "/olympia-wa/officer", QueryParams: []string{"badge", "first_name", "last_name"}, }, "fuzzy": { - Path: "/olympia/officer/search", + Path: "/olympia-wa/officer/search", QueryParams: []string{"first_name", "last_name"}, }, }, diff --git a/api/data/port_db.go b/api/data/port_db.go index 123e11f..1487a55 100644 --- a/api/data/port_db.go +++ b/api/data/port_db.go @@ -47,14 +47,14 @@ func (c *Client) PortOfSeattleOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: "2021-05-01", Name: "Port Of Seattle PD", - ID: "pospd", + ID: "port_of_seattle-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/port_of_seattle/officer", + Path: "/port_of_seattle-wa/officer", QueryParams: []string{"badge", "name"}, }, "fuzzy": { - Path: "/port_of_seattle/officer/search", + Path: "/port_of_seattle-wa/officer/search", QueryParams: []string{"name"}, }, }, diff --git a/api/data/portland_db.go b/api/data/portland_db.go index ba69042..dfc5086 100644 --- a/api/data/portland_db.go +++ b/api/data/portland_db.go @@ -268,14 +268,14 @@ func (c *Client) PortlandOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: max_date.Format("2006-01-02"), Name: "Portland PB", - ID: "ppb", + ID: "portland-or", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/portland/officer", + Path: "/portland-or/officer", QueryParams: []string{"badge", "first_name", "last_name", "employee_id", "helmet_id", "helmet_id_three_digit"}, }, "fuzzy": { - Path: "/portland/officer/search", + Path: "/portland-or/officer/search", QueryParams: []string{"first_name", "last_name"}, }, }, diff --git a/api/data/renton_db.go b/api/data/renton_db.go index cefe567..73eb662 100644 --- a/api/data/renton_db.go +++ b/api/data/renton_db.go @@ -77,14 +77,14 @@ func (c *Client) RentonOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: "2021-05-01", Name: "Renton PD", - ID: "rpd", + ID: "renton-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/renton/officer", + Path: "/renton-wa/officer", QueryParams: []string{"first_name", "last_name"}, }, "fuzzy": { - Path: "/renton/officer/search", + Path: "/renton-wa/officer/search", QueryParams: []string{"first_name", "last_name"}, }, }, diff --git a/api/data/seattle_db.go b/api/data/seattle_db.go index 566cb6e..914efe5 100644 --- a/api/data/seattle_db.go +++ b/api/data/seattle_db.go @@ -97,18 +97,18 @@ func (c *Client) SeattleOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: date.Format("2006-01-02"), Name: "Seattle PD", - ID: "spd", + ID: "seattle-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/seattle/officer", + Path: "/seattle-wa/officer", QueryParams: []string{"badge", "first_name", "last_name"}, }, "fuzzy": { - Path: "/seattle/officer/search", + Path: "/seattle-wa/officer/search", QueryParams: []string{"first_name", "last_name"}, }, "historical-exact": { - Path: "/seattle/officer/historical", + Path: "/seattle-wa/officer/historical", QueryParams: []string{"badge"}, }, }, diff --git a/api/data/tacoma_db.go b/api/data/tacoma_db.go index cce5e4c..b2af41e 100644 --- a/api/data/tacoma_db.go +++ b/api/data/tacoma_db.go @@ -56,14 +56,14 @@ func (c *Client) TacomaOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: "2019", Name: "Tacoma PD", - ID: "tpd", + ID: "tacoma-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/tacoma/officer", + Path: "/tacoma-wa/officer", QueryParams: []string{"first_name", "last_name"}, }, "fuzzy": { - Path: "/tacoma/officer/search", + Path: "/tacoma-wa/officer/search", QueryParams: []string{"first_name", "last_name"}, }, }, diff --git a/api/data/thurston_db.go b/api/data/thurston_db.go index 4efc659..3191953 100644 --- a/api/data/thurston_db.go +++ b/api/data/thurston_db.go @@ -47,14 +47,14 @@ func (c *Client) ThurstonCountyOfficerMetadata() *DepartmentMetadata { }, LastAvailableRosterDate: "2021-05-01", Name: "Thurston County Sheriff's Department", - ID: "tcsd", + ID: "thurston_county-wa", SearchRoutes: map[string]*SearchRouteMetadata{ "exact": { - Path: "/thurston_county/officer", + Path: "/thurston_county-wa/officer", QueryParams: []string{"first_name", "last_name"}, }, "fuzzy": { - Path: "/thurston_county/officer/search", + Path: "/thurston_county-wa/officer/search", QueryParams: []string{"first_name", "last_name"}, }, }, diff --git a/api/router/router.go b/api/router/router.go index 0add2f8..b7d94f0 100644 --- a/api/router/router.go +++ b/api/router/router.go @@ -37,6 +37,48 @@ func NewRouter(h handler.Interface) http.Handler { router.HandleFunc("/ping", h.Ping).Methods("GET") router.HandleFunc("/departments", h.DescribeDepartments).Methods("GET") + router.HandleFunc("/seattle-wa/metadata", h.SeattleOfficerMetadata).Methods("GET") + router.HandleFunc("/seattle-wa/officer", h.SeattleStrictMatch).Methods("GET") + router.HandleFunc("/seattle-wa/officer/search", h.SeattleFuzzySearch).Methods("GET") + router.HandleFunc("/seattle-wa/officer/historical", h.SeattleStrictMatchHistorical).Methods("GET") + + router.HandleFunc("/tacoma-wa/metadata", h.TacomaOfficerMetadata).Methods("GET") + router.HandleFunc("/tacoma-wa/officer", h.TacomaStrictMatch).Methods("GET") + router.HandleFunc("/tacoma-wa/officer/search", h.TacomaFuzzySearch).Methods("GET") + + router.HandleFunc("/portland-or/metadata", h.PortlandOfficerMetadata).Methods("GET") + router.HandleFunc("/portland-or/officer", h.PortlandStrictMatch).Methods("GET") + router.HandleFunc("/portland-or/officer/search", h.PortlandFuzzySearch).Methods("GET") + + router.HandleFunc("/auburn-wa/metadata", h.AuburnOfficerMetadata).Methods("GET") + router.HandleFunc("/auburn-wa/officer", h.AuburnStrictMatch).Methods("GET") + router.HandleFunc("/auburn-wa/officer/search", h.AuburnFuzzySearch).Methods("GET") + + router.HandleFunc("/lakewood-wa/metadata", h.LakewoodOfficerMetadata).Methods("GET") + router.HandleFunc("/lakewood-wa/officer", h.LakewoodStrictMatch).Methods("GET") + router.HandleFunc("/lakewood-wa/officer/search", h.LakewoodFuzzySearch).Methods("GET") + + router.HandleFunc("/bellevue-wa/metadata", h.BellevueOfficerMetadata).Methods("GET") + router.HandleFunc("/bellevue-wa/officer", h.BellevueStrictMatch).Methods("GET") + router.HandleFunc("/bellevue-wa/officer/search", h.BellevueFuzzySearch).Methods("GET") + + router.HandleFunc("/port_of_seattle-wa/metadata", h.PortOfSeattleOfficerMetadata).Methods("GET") + router.HandleFunc("/port_of_seattle-wa/officer", h.PortOfSeattleStrictMatch).Methods("GET") + router.HandleFunc("/port_of_seattle-wa/officer/search", h.PortOfSeattleFuzzySearch).Methods("GET") + + router.HandleFunc("/thurston_county-wa/metadata", h.ThurstonCountyOfficerMetadata).Methods("GET") + router.HandleFunc("/thurston_county-wa/officer", h.ThurstonCountyStrictMatch).Methods("GET") + router.HandleFunc("/thurston_county-wa/officer/search", h.ThurstonCountyFuzzySearch).Methods("GET") + + router.HandleFunc("/renton-wa/metadata", h.RentonOfficerMetadata).Methods("GET") + router.HandleFunc("/renton-wa/officer", h.RentonStrictMatch).Methods("GET") + router.HandleFunc("/renton-wa/officer/search", h.RentonFuzzySearch).Methods("GET") + + router.HandleFunc("/olympia-wa/metadata", h.OlympiaOfficerMetadata).Methods("GET") + router.HandleFunc("/olympia-wa/officer", h.OlympiaStrictMatch).Methods("GET") + router.HandleFunc("/olympia-wa/officer/search", h.OlympiaFuzzySearch).Methods("GET") + + // Backwards compatability routes, don't change router.HandleFunc("/seattle/metadata", h.SeattleOfficerMetadata).Methods("GET") router.HandleFunc("/seattle/officer", h.SeattleStrictMatch).Methods("GET") router.HandleFunc("/seattle/officer/search", h.SeattleFuzzySearch).Methods("GET")