@@ -26,11 +26,106 @@ paths:
2626 get :
2727 tags :
2828 - " Officers"
29- summary : " Get all officers"
29+ summary : " Get officers"
3030 operationId : " getOfficers"
31+ description : >
32+ Returns a list of officer. A number of simple filters can be applied to limit the results. If no filters
33+ are applied, a random sample of officers will be returned.
3134 parameters :
3235 - $ref : ' ../common/pagination.yaml#/components/parameters/page'
3336 - $ref : ' ../common/pagination.yaml#/components/parameters/per_page'
37+ - active_after :
38+ name : active_after
39+ in : query
40+ description : >
41+ Filter officers who were active after this date. The date should be in the format YYYY-MM-DD.
42+ required : false
43+ schema :
44+ type : string
45+ format : date
46+ - active_before :
47+ name : active_before
48+ in : query
49+ description : >
50+ Filter officers who were active before this date. The date should be in the format YYYY-MM-DD.
51+ required : false
52+ schema :
53+ type : string
54+ format : date
55+ - state_id_value :
56+ name : state_id_value
57+ in : query
58+ description : >
59+ Filter officers by their state ID value. This may be a tax number, officer training number, or
60+ any other unique identifier used by a state. The state_id_state and state_id_name parameters
61+ must also be provided.
62+ required : false
63+ schema :
64+ type : string
65+ - state_id_name :
66+ name : state_id_name
67+ in : query
68+ description : >
69+ Filter officers by the name of their state ID. For example, "Driver's License", "Tax ID", etc.
70+ required : false
71+ schema :
72+ type : string
73+ - state_id_state :
74+ name : state_id_state
75+ in : query
76+ description : >
77+ Filter officers by the state of their state ID. For example, "CA" for California.
78+ required : false
79+ schema :
80+ type : string
81+ - agency :
82+ name : agency
83+ in : query
84+ description : >
85+ Filter officers by the agency they are employed by. The value should be a comma-separated list of agency uids.
86+ required : false
87+ schema :
88+ type : string
89+ - rank :
90+ name : rank
91+ in : query
92+ description : >
93+ Filter officers by their rank. The value should be a comma-separated list of ranks.
94+ required : false
95+ schema :
96+ type : string
97+ - unit :
98+ name : unit
99+ in : query
100+ description : >
101+ Filter officers by their unit. The value should be a comma-separated list of unit uids.
102+ required : false
103+ schema :
104+ type : string
105+ - name :
106+ name : name
107+ in : query
108+ description : >
109+ Filter officers by their name. The value should be a string in the format "first middle last suffix".
110+ required : false
111+ schema :
112+ type : string
113+ - ethnicity :
114+ name : ethnicity
115+ in : query
116+ description : >
117+ Filter officers by their ethnicity. The value should be a comma-separated list of ethnicities.
118+ required : false
119+ schema :
120+ type : string
121+ - badge_number :
122+ name : badge_number
123+ in : query
124+ description : >
125+ Filter officers by their badge number. The value should be a comma-separated list of badge numbers.
126+ required : false
127+ schema :
128+ type : string
34129 responses :
35130 " 200 " :
36131 description : " Successful operation"
@@ -81,6 +176,37 @@ paths:
81176 $ref : " #/components/schemas/OfficerList"
82177 ' 401 ' :
83178 $ref : ' ../common/error.yaml#/components/responses/unauthorizedError'
179+ /officers/filter :
180+ post :
181+ tags :
182+ - " Officers"
183+ summary : " Advanced Officer Filter"
184+ operationId : " getOfficersByFilter"
185+ description : >
186+ Get officers by advanced filter. This endpoint allows for more complex queries
187+ using a JSON body to specify the filters.
188+ parameters :
189+ - $ref : ' ../common/pagination.yaml#/components/parameters/page'
190+ - $ref : ' ../common/pagination.yaml#/components/parameters/per_page'
191+ requestBody :
192+ description : >
193+ A JSON object containing the filters to apply to the search.
194+ required : true
195+ content :
196+ application/json :
197+ schema :
198+ $ref : " #/components/schemas/OfficerFilter"
199+ responses :
200+ " 200 " :
201+ description : " Successful operation"
202+ content :
203+ application/json :
204+ schema :
205+ $ref : " #/components/schemas/OfficerList"
206+ ' 400 ' :
207+ $ref : ' ../common/error.yaml#/components/responses/validationError'
208+ ' 401 ' :
209+ $ref : ' ../common/error.yaml#/components/responses/unauthorizedError'
84210 /officers/{uid} :
85211 parameters :
86212 - name : uid
@@ -205,6 +331,52 @@ components:
205331 scheme : bearer
206332 bearerFormat : JWT
207333 schemas :
334+ OfficerFilter :
335+ type : object
336+ description : >
337+ An advanced filter that can be applied to an officer list request.
338+ properties :
339+ name :
340+ type : string
341+ description : >
342+ Filter officers by their name. The value should be a string in the format "first middle last suffix".
343+ location :
344+ allOf :
345+ - $ref : " #/components/schemas/LocationFilter"
346+ - type : object
347+ description : >
348+ Filter officers by locations in which they have worked. This is assesed based on the operating theatre of the units to which they've been assigned.
349+ state_ids :
350+ type : array
351+ description : >
352+ Filter officers by their state IDs. This can be used to filter by tax number, officer training number, or any other unique identifier used by a state.
353+ items :
354+ $ref : " #/components/schemas/StateIdFilter"
355+ ranks :
356+ type : array
357+ description : >
358+ Filter officers by their rank.
359+ items :
360+ type : string
361+ ethnicity :
362+ type : array
363+ description : >
364+ Filter officers by ethnicity.
365+ items :
366+ $ref : " #/components/schemas/EthnicityFilter"
367+ commanders :
368+ type : array
369+ description : >
370+ Return officers who have worked under the selected commanders.
371+ items :
372+ type : string
373+ description : The UIDs of the commanders to filter by.
374+ allegations :
375+ allOf :
376+ - $ref : " #/components/schemas/AllegationFilter"
377+ - type : object
378+ description : >
379+ Filter officers by allegations made against them.
208380 BaseEmployment :
209381 type : " object"
210382 properties :
0 commit comments