MCPcopy Create free account
hub / github.com/diffgram/diffgram / Discussion

Class Discussion

shared/database/discussion/discussion.py:11–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class Discussion(Base):
12 """
13
14
15 """
16 __tablename__ = 'discussion'
17
18 id = Column(Integer, primary_key = True)
19 created_time = Column(DateTime, default = datetime.datetime.utcnow)
20 # todo updating time, updated member
21 title = Column(String())
22
23 description = Column(String())
24
25 member_created_id = Column(Integer, ForeignKey('member.id'))
26 member_created = relationship("Member", foreign_keys = [member_created_id])
27
28 project_id = Column(Integer, ForeignKey('project.id'))
29 project = relationship("Project", back_populates = "discussion_list")
30
31 status = Column(String(), default = 'open')
32
33 type = Column(String(), default = 'issue')
34
35 assignees = relationship(DiscussionMember, back_populates = 'discussion')
36
37 comment_list = relationship("DiscussionComment", back_populates = 'discussion')
38
39
40 # In future version we might have polygon, boxes etc...
41 marker_type = Column(String(), default = 'point')
42
43 # This can have an x,y coordinate, polygon, circle, box. We leave it as a dict to allow flexibility for future
44 # issue visualizations
45 marker_data = Column(MutableDict.as_mutable(JSONEncodedDict))
46
47 # For video case, the frame where the marker was placed at.
48 marker_frame_number = Column(Integer(), nullable = True)
49
50 # Then do we add an annotation specific activity? what would that look like?
51
52 # Ref to a specific image / group of images?
53 # Ref to a specific commit? and how that relates to the above
54 # Wouldn't always have issues but...
55
56 def detach_all_instances(self, session):
57 issue_relations = session.query(discussion_relation_models.DiscussionRelation).filter(
58 discussion_relation_models.DiscussionRelation.instance_id.isnot(None)
59 )
60 issue_relations.delete()
61 return
62
63 def attach_element(self, session: object, element: dict, add_to_session = True, flush_session = True):
64 element_id = element.get('id')
65 if element_id is None:
66 return
67 issue_relation = None
68 if element_id is None:

Callers 2

create_discussionFunction · 0.90
newMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected