Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add relationship model convention #3764

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions synapse/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,25 @@ def getModelDefs(self):
'doc': 'A sophistication score with named values: very low, low, medium, high, and very high.'}),
),
'interfaces': (
('meta:relationship', {
'doc': 'Properties common to relationships between specific forms.',
'props': (
('source', ('guid', {}), {
'doc': 'The node that is related to the target node.'}),

('target', ('guid', {}), {
'doc': 'The node that the source node is related to.'}),

('type', ('taxonomy', {}), {
'doc': 'The type of relationship that the source node has to the target node.'}),

('status', ('str', {'enums': 'TODO'}), {
'doc': 'The latest known status of the relationship.'}),

('period', ('ival', {}), {
'doc': 'The time period that the relationship existed.'}),
),
}),
('meta:taxonomy', {
'doc': 'Properties common to taxonomies.',
'props': (
Expand Down
24 changes: 24 additions & 0 deletions synapse/models/orgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ def getModelDefs(self):
),
}}),

('ou:relationship:type:taxonomy', ('taxonomy', {}), {}),

('ou:relationship', ('guid', {}), {
'doc': 'A relationship between two organizations.',
'display': {
'columns': (
{'type': 'prop', 'opts': {'name': 'source::name'}},
{'type': 'prop', 'opts': {'name': 'type'}},
{'type': 'prop', 'opts': {'name': 'target::name'}},
),
}}),

('ou:orgtype', ('taxonomy', {}), {
'doc': 'An org type taxonomy.',
'interfaces': ('meta:taxonomy',),
Expand Down Expand Up @@ -721,6 +733,18 @@ def getModelDefs(self):
('org', ('ou:org', {}), {}),
('name', ('ou:name', {}), {}),
)),
('ou:relationship:type:taxonomy', {}, ()),
('ou:relationship', {}, (

('source', ('ou:org', {}), {
'doc': 'The organization which is related to the target organization.'}),

('target', ('ou:org', {}), {
'doc': 'The organization which the source organization is related to.'}),

('type', ('ou:relationship:type:taxonomy', {}), {
'doc': 'The type of relationship.'}),
)),
('ou:position', {}, (
('org', ('ou:org', {}), {
'doc': 'The org which has the position.',
Expand Down
Loading