Coverage for postrfp/web/adaptors/ref.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-10-22 21:34 +0000

1from postrfp.web.suxint import GetArg, PathArg 

2from postrfp.web.suxint.extractors import SchemaDocArg 

3from postrfp.web.adaptors.core import q_name, pager, user, session 

4from postrfp.shared.serial.refmodels import ( 

5 ContentSchema, 

6 ContentDocument, 

7 SubjectDocument, 

8 PolicyRequest, 

9 ContentSpecMapDocument, 

10) 

11 

12q_spec_id = GetArg("specId", arg_type="int", doc="ID of the ContentSpec") 

13 

14spec_id = PathArg("spec", doc="ID of the ContentSpec") 

15 

16spec_doc = SchemaDocArg(ContentSchema, as_dict=False) 

17content_doc = SchemaDocArg(ContentDocument, as_dict=False) 

18 

19content_id = PathArg("content", doc="ID of the Content") 

20 

21# Path arguments for administration handlers 

22subject_id = PathArg("subject", doc="ID of the Subject") 

23permission_id = PathArg("permission", doc="ID of the Permission") 

24 

25# QMapping adaptors 

26content_map_id = PathArg("map", doc="ID of the ContentSpecMap") 

27 

28map_doc = SchemaDocArg(ContentSpecMapDocument, as_dict=False) 

29 

30# Query parameters for permission report filtering 

31q_org_id = GetArg("org_id", doc="Organization ID to filter by") 

32q_subject_id = GetArg("subject_id", arg_type="int", doc="Subject ID to filter by") 

33q_content_id = GetArg("content_id", arg_type="int", doc="Content ID to filter by") 

34 

35q_term = GetArg("q_term", arg_type="str", doc="Search term to query by") 

36 

37# Subject-specific query parameters 

38q_type = GetArg( 

39 "q_type", 

40 arg_type="str", 

41 doc="Filter subjects by type (country, organization, market, sector, product, other)", 

42) 

43q_parent_id = GetArg( 

44 "q_parent_id", 

45 arg_type="int", 

46 doc="Filter to show only direct children of the specified parent subject", 

47) 

48 

49# Document arguments for permission management 

50grant_data = SchemaDocArg(PolicyRequest) 

51 

52# Document arguments for subject management 

53subject_data = SchemaDocArg(SubjectDocument, as_dict=False) 

54 

55__all__ = [ 

56 "q_name", 

57 "q_spec_id", 

58 "pager", 

59 "user", 

60 "session", 

61 "spec_doc", 

62 "spec_id", 

63 "content_id", 

64 "subject_id", 

65 "permission_id", 

66 "q_org_id", 

67 "q_subject_id", 

68 "q_content_id", 

69 "q_term", 

70 "q_type", 

71 "q_parent_id", 

72 "grant_data", 

73 "subject_data", 

74]