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

24 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-12-03 01:35 +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, if_match 

4from postrfp.shared.serial.refmodels import ( 

5 ContentSchema, 

6 ContentDocument, 

7 SubjectDocument, 

8 PolicyRequest, 

9 ContentSpecMapDocument, 

10 ContentPatch, 

11 SchemaUpdate, 

12) 

13 

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

15 

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

17 

18spec_doc = SchemaDocArg(ContentSchema, as_dict=False) 

19content_doc = SchemaDocArg(ContentDocument, as_dict=False) 

20 

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

22 

23# Path arguments for administration handlers 

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

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

26 

27# QMapping adaptors 

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

29 

30map_doc = SchemaDocArg(ContentSpecMapDocument, as_dict=False) 

31 

32patch_doc = SchemaDocArg(ContentPatch, as_dict=False) 

33 

34schema_update = SchemaDocArg(SchemaUpdate, as_dict=False) 

35 

36# Query parameters for permission report filtering 

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

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

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

40 

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

42 

43# Subject-specific query parameters 

44q_type = GetArg( 

45 "q_type", 

46 arg_type="str", 

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

48) 

49q_parent_id = GetArg( 

50 "q_parent_id", 

51 arg_type="int", 

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

53) 

54 

55# Document arguments for permission management 

56grant_data = SchemaDocArg(PolicyRequest) 

57 

58# Document arguments for subject management 

59subject_data = SchemaDocArg(SubjectDocument, as_dict=False) 

60 

61__all__ = [ 

62 "q_name", 

63 "q_spec_id", 

64 "pager", 

65 "user", 

66 "session", 

67 "if_match", 

68 "spec_doc", 

69 "spec_id", 

70 "content_id", 

71 "subject_id", 

72 "permission_id", 

73 "q_org_id", 

74 "q_subject_id", 

75 "q_content_id", 

76 "q_term", 

77 "q_type", 

78 "q_parent_id", 

79 "grant_data", 

80 "subject_data", 

81]