Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
invisig0th committed Oct 18, 2024
1 parent c5677a2 commit 41e77ef
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
24 changes: 19 additions & 5 deletions synapse/models/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ def getModelDefs(self):
return (('doc', {
'interfaces': (
('doc:document', {
'template': {'document': 'document'},

'template': {
'type': 'NEWP',
'document': 'document',
'documents': 'documents'},

'props': (

('id', ('str', {'strip': True}), {
Expand All @@ -16,6 +21,9 @@ def getModelDefs(self):
('name', ('str', {'lower': True, 'onespace': True}), {
'doc': 'The {document} name.'}),

('type', ('{type}', {}), {
'doc': 'The type of {document}.'}),

('text', ('str', {}), {
'doc': 'The text of the {document}.'}),

Expand All @@ -32,13 +40,13 @@ def getModelDefs(self):
'doc': 'The contact information of the primary author.'}),

('contributors', ('array', {'type': 'ps:contact', 'sorted': True, 'uniq': True}), {
'doc': 'An array of contacts which contributed to the {document}'}),
'doc': 'An array of contacts which contributed to the {document}.'}),

('version', ('it:semver', {}), {
'doc': 'The version of the {document}.'}),

('supersedes', ('array', {'type': '$self', 'sorted': True, 'uniq': True}), {
'doc': 'An array of {document}s which are superseded by this {document}.'}),
'doc': 'An array of {documents} which are superseded by this {document}.'}),
),
}),
),
Expand All @@ -50,7 +58,10 @@ def getModelDefs(self):

('doc:policy', ('guid', {}), {
'interfaces': ('doc:document',),
'template': {'document': 'policy'},
'template': {
'document': 'policy',
'documents': 'policies',
'type': 'doc:policy:type:taxonomy'},
'doc': 'Guiding principles used to reach a set of goals.'}),

('doc:standard:type:taxonomy', ('taxonomy', {}), {
Expand All @@ -59,7 +70,10 @@ def getModelDefs(self):

('doc:standard', ('guid', {}), {
'interfaces': ('doc:document',),
'template': {'document': 'standard'},
'template': {
'document': 'standard',
'documents': 'standards',
'type': 'doc:standard:type:taxonomy'},
'doc': 'A group of requirements which define how to implement a policy or goal.'}),
),
'forms': (
Expand Down
3 changes: 3 additions & 0 deletions synapse/models/orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,9 @@ def getModelDefs(self):

('doc', ('ndef', {'forms': ('doc:policy', 'doc:standard')}), {
'doc': 'The document enacted by the organization.'}),

('scope', ('ndef', {}), {
'doc': 'The scope of responsbility for the assignee to enact the document.'}),
)),

('ou:requirement:type:taxonomy', {}, ()),
Expand Down
3 changes: 3 additions & 0 deletions synapse/tests/test_model_orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ async def test_ou_simple(self):
:completed=20241018
:creator=root
:assignee=visi
:scope=(ou:team, *)
:ext:creator={[ ps:contact=* :name=root ]}
:ext:assignee={[ ps:contact=* :name=visi ]}
]
Expand All @@ -732,10 +733,12 @@ async def test_ou_simple(self):
self.eq(visi.iden, nodes[0].get('assignee'))
self.eq(core.auth.rootuser.iden, nodes[0].get('creator'))

self.nn(nodes[0].get('scope'))
self.nn(nodes[0].get('ext:creator'))
self.nn(nodes[0].get('ext:assignee'))

self.len(1, await core.nodes('ou:enacted -> proj:project'))
self.len(1, await core.nodes('ou:enacted :scope -> ou:team'))
self.len(1, await core.nodes('ou:enacted :ext:creator -> ps:contact +:name=root'))
self.len(1, await core.nodes('ou:enacted :ext:assignee -> ps:contact +:name=visi'))

Expand Down

0 comments on commit 41e77ef

Please sign in to comment.