|
33 | 33 | from lib.core.entities.classes import AnnotationClassEntity |
34 | 34 | from lib.core.entities.filters import ItemFilters |
35 | 35 | from lib.core.entities.filters import ProjectFilters |
36 | | -from lib.core.entities.filters import UserFilters |
| 36 | +from lib.core.entities.filters import ProjectUserFilters |
| 37 | +from lib.core.entities.filters import TeamUserFilters |
37 | 38 | from lib.core.entities.integrations import IntegrationEntity |
38 | 39 | from lib.core.entities.items import ProjectCategoryEntity |
39 | 40 | from lib.core.entities.work_managament import ScoreEntity |
|
56 | 57 | from lib.infrastructure.query_builder import IncludeHandler |
57 | 58 | from lib.infrastructure.query_builder import ItemFilterHandler |
58 | 59 | from lib.infrastructure.query_builder import ProjectFilterHandler |
| 60 | +from lib.infrastructure.query_builder import ProjectUserRoleFilterHandler |
59 | 61 | from lib.infrastructure.query_builder import QueryBuilderChain |
60 | | -from lib.infrastructure.query_builder import UserFilterHandler |
| 62 | +from lib.infrastructure.query_builder import TeamUserRoleFilterHandler |
| 63 | +from lib.infrastructure.query_builder import TeamUserStateFilterHandler |
61 | 64 | from lib.infrastructure.repositories import S3Repository |
62 | 65 | from lib.infrastructure.serviceprovider import ServiceProvider |
63 | 66 | from lib.infrastructure.services.http_client import HttpClient |
@@ -205,27 +208,50 @@ def list_users( |
205 | 208 | if project: |
206 | 209 | parent_entity = CustomFieldEntityEnum.PROJECT |
207 | 210 | project_id = context["project_id"] = project.id |
| 211 | + valid_fields = generate_schema( |
| 212 | + ProjectUserFilters.__annotations__, |
| 213 | + self.service_provider.get_custom_fields_templates( |
| 214 | + context, CustomFieldEntityEnum.CONTRIBUTOR, parent=parent_entity |
| 215 | + ), |
| 216 | + ) |
| 217 | + chain = QueryBuilderChain( |
| 218 | + [ |
| 219 | + FieldValidationHandler(valid_fields.keys()), |
| 220 | + ProjectUserRoleFilterHandler( |
| 221 | + team_id=self.service_provider.client.team_id, |
| 222 | + project=project, |
| 223 | + service_provider=self.service_provider, |
| 224 | + entity=CustomFieldEntityEnum.CONTRIBUTOR, |
| 225 | + parent=parent_entity, |
| 226 | + ), |
| 227 | + ] |
| 228 | + ) |
208 | 229 | else: |
209 | 230 | parent_entity = CustomFieldEntityEnum.TEAM |
210 | 231 | project_id = None |
211 | | - valid_fields = generate_schema( |
212 | | - UserFilters.__annotations__, |
213 | | - self.service_provider.get_custom_fields_templates( |
214 | | - context, CustomFieldEntityEnum.CONTRIBUTOR, parent=parent_entity |
215 | | - ), |
216 | | - ) |
217 | | - chain = QueryBuilderChain( |
218 | | - [ |
219 | | - FieldValidationHandler(valid_fields.keys()), |
220 | | - UserFilterHandler( |
221 | | - team_id=self.service_provider.client.team_id, |
222 | | - project_id=project_id, |
223 | | - service_provider=self.service_provider, |
224 | | - entity=CustomFieldEntityEnum.CONTRIBUTOR, |
225 | | - parent=parent_entity, |
| 232 | + valid_fields = generate_schema( |
| 233 | + TeamUserFilters.__annotations__, |
| 234 | + self.service_provider.get_custom_fields_templates( |
| 235 | + context, CustomFieldEntityEnum.CONTRIBUTOR, parent=parent_entity |
226 | 236 | ), |
227 | | - ] |
228 | | - ) |
| 237 | + ) |
| 238 | + chain = QueryBuilderChain( |
| 239 | + [ |
| 240 | + FieldValidationHandler(valid_fields.keys()), |
| 241 | + TeamUserRoleFilterHandler( |
| 242 | + team_id=self.service_provider.client.team_id, |
| 243 | + service_provider=self.service_provider, |
| 244 | + entity=CustomFieldEntityEnum.CONTRIBUTOR, |
| 245 | + parent=parent_entity, |
| 246 | + ), |
| 247 | + TeamUserStateFilterHandler( |
| 248 | + team_id=self.service_provider.client.team_id, |
| 249 | + service_provider=self.service_provider, |
| 250 | + entity=CustomFieldEntityEnum.CONTRIBUTOR, |
| 251 | + parent=parent_entity, |
| 252 | + ), |
| 253 | + ] |
| 254 | + ) |
229 | 255 | query = chain.handle(filters, EmptyQuery()) |
230 | 256 |
|
231 | 257 | if project and include and "categories" in include: |
|
0 commit comments