class StaticWarning(Document): """ StaticWarning class. Inherits from :class:`mongoengine.Document`. Holds multiple linter results, e.g., PMD_6.2 including line number, warning type and warning message. Format [{'version': 'PMD_6.2', 'ln': 15, 'l_ty': 'UEO', 'msg': 'Unused something'}] Index: commit_id, file_id :property commit_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.Commit` id to which this state belongs :property file_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.File` id to which this state refers to :property linter: (:class:`~mongoengine.fields.ListField`) of (:class:`~mongoengine.fields.DictField`) refers to warning from linter. :property metrics: (:class:`~mongoengine.fields.DictField`) dictionary of additional metrics, e.g., LLoC """ meta = { 'indexes': [ 'commit_id', 'file_id', ], 'shard_key': ('commit_id', 'file_id'), } commit_id = ObjectIdField(required=True) file_id = ObjectIdField(required=True) linter = ListField(DictField()) metrics = DictField()
class Comment(Document): author: str = StringField() post_id: str = ObjectIdField() comment: str = StringField(required=True) date_defined = DateTimeField(default=datetime.now) likes: int = IntField() liked_by: List = ListField(ObjectIdField())
class Limited_Offer(Document): company_id = StringField(max_length=200) created_date = DateTimeField() created_user = ObjectIdField() offer_count = IntField() banner_image = ImageField() coupons = ListField(ObjectIdField())
class challange(Document): done_by = ObjectIdField() clanChallange_id = ObjectIdField() accepted_by_head = BooleanField(default=False) sent_for_review = BooleanField(default=False) discription = StringField(max_length=1000) proof_of_completion = FileField()
class Rail(Document): _created_date = DateTimeField(default=datetime.datetime.now) _key_created_user = ObjectIdField() _last_modified_date = DateTimeField(default=datetime.datetime.now) _key_last_modified_user = ObjectIdField() _key_owner_user = ObjectIdField() analysis_date = DateTimeField(default=datetime.datetime.now) _key_organization = ReferenceField(Organization, required=True, reverse_delete_rule=2) _key_brand = ReferenceField(Brand, required=True, reverse_delete_rule=3) _key_kur_cinsi = ReferenceField(Currency, required=True, reverse_delete_rule=3) _key_iskonto = ReferenceField(Discount, required=True, reverse_delete_rule=3) _key_rail_size_1 = ReferenceField(RailSize, required=True, reverse_delete_rule=3) _key_rail_size_2 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_size_3 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_size_4 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_size_5 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_size_6 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_size_7 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_size_8 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_flans_size_1 = ReferenceField(RailSize, required=True, reverse_delete_rule=3) _key_rail_flans_size_2 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_flans_size_3 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_flans_size_4 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_flans_size_5 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_flans_size_6 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_flans_size_7 = ReferenceField(RailSize, reverse_delete_rule=1) _key_rail_flans_size_8 = ReferenceField(RailSize, reverse_delete_rule=1) birim_fiyat = DecimalField(required=True)
class CommitChanges(Document): """ CommitChanges class. Inherits from :class:`mongoengine.Document`. Index: old_commit_id, new_commit_id ShardKey: id :property old_commit_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.Commit` id to which this state belongs (older in revision system) :property new_commit_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.Commit` id to which this state belongs (newer in revision system) :property classification: (:class:`~mongoengine.fields.DictField`) classification for the changes """ meta = { 'indexes': ['old_commit_id', 'new_commit_id'], 'shard_key': ('id', ), } # PK: old_commit_id, new_commit_id # Shard Key: id old_commit_id = ObjectIdField(required=True, unique_with=['new_commit_id']) new_commit_id = ObjectIdField(required=True) classification = DictField()
class CodeGroupState(Document): """ CodeGroupState class. Inherits from :class:`mongoengine.Document`. Index: s_key, commit_id ShardKey: shard_key (sha1 hash of long_name, commit_id) :property s_key: (:class:`~mongoengine.fields.StringField`) shard key (sha1 hash of long_name, commit_id), as they can get too long for the normal shard key :property long_name: (:class:`~mongoengine.fields.StringField`) long name of the code group state (e.g., package1.package2) :property commit_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.Commit` id to which this state belongs :property cg_parent_ids: ((:class:`~mongoengine.fields.ListField` of (:class:`~mongoengine.fields.ObjectIdField`)) :class:`~pycoshark.mongomodels.CodeGroupState` ids which are the parent of this state :property cg_type: (:class:`~mongoengine.fields.StringField`) type of this state (e.g., package) :property metrics: (:class:`~mongoengine.fields.DictField`) dictionary of different metrics for this code group state """ meta = {'indexes': ['commit_id'], 'shard_key': ('s_key', )} s_key = StringField(required=True, unique=True) long_name = StringField(require=True) commit_id = ObjectIdField(required=True) cg_parent_ids = ListField(ObjectIdField()) cg_type = StringField() metrics = DictField() @staticmethod def calculate_identifier(long_name, commit_id): concat_string = long_name + str(commit_id) return hashlib.sha1(concat_string.encode('utf-8')).hexdigest() def identifier(self): return self.calculate_identifier(self.long_name, self.commit_id)
class MetaPackageState(Document): """ Document that inherits from :class:`mongoengine.Document`. Holds information for the meta_package_state collection. Here information about a collection of file_states is saved (e.g. packages) that do not belong to one file, but have associations to more than one file. :property commit_id: id of the commit to which the meta package state belongs (type: :class:`mongoengine.fields.ObjectIdField`) :property long_name: long_name of the state entity (type: :class:`mongoengine.fields.StringField`) :property name: name of the state entity (type: :class:`mongoengine.fields.StringField`) :property component_ids: component_ids of the state entity (e.g., pyvcssharhk.main.py) (type: :class:`mongoengine.fields.StringField`) :property parent_state: parent of the state entity (type: :class:`mongoengine.fields.ObjectFieldId`) :property metrics: metrics of the state entity (type: :class:`mongoengine.fields.DictField`) .. NOTE:: Unique (or primary keys) are the fields commit_id and long_name. """ meta = { 'indexes': [ 'commit_id' ], 'shard_key': ('long_name', 'commit_id'), } commit_id = ObjectIdField(required=True) parent_state = ObjectIdField() component_ids = ListField(ObjectIdField()) long_name = StringField(require=True, unique_with=['commit_id']) name = StringField() file_type = StringField() metrics = DictField()
class Tag(Document): """ Document that inherits from :class:`mongoengine.Document`. Holds information for the tag collection. :property projectId: id of the project, which belongs to the file action (type: :class:`mongoengine.fields.ObjectIdField`) :property name: name of the tag (type: :class:`mongoengine.fields.StringField`) :property message: message of the tag (type: :class:`mongoengine.fields.StringField`) :property taggerId: id of the person who created the tag (type: :class:`mongoengine.fields.ObjectIdField`) :property date: date of the creation of the tag (type: :class:`mongoengine.fields.DateTimeField`) :property offset: offset of the tag creation date for timezones (type: :class:`mongoengine.fields.IntField`) .. NOTE:: Unique (or primary key) are the fields: name and projectId. """ meta = { 'indexes': [ 'projectId', ], 'shard_key': ('name', 'projectId'), } #PK: project, name projectId = ObjectIdField(required=True) name = StringField(max_length=150, required=True, unique_with=['projectId']) message = StringField() taggerId = ObjectIdField() date = DateTimeField() offset = IntField()
class IssueComment(Document): """ IssueComment class. Inherits from :class:`mongoengine.Document` Index: issue_id, #external_id, (issue_id, -created_at) ShardKey: external_id, issue_id :property external_id: (:class:`~mongoengine.fields.StringField`) id that was assigned from the issue system to this comment :property issue_id: (:class:`~mongoengine.fields.ObjectIdField`) id of the :class:`~pycoshark.mongomodels.Issue` to which this event belongs :property created_at: (:class:`~mongoengine.fields.DateTimeField`) date when the event was created :property author_id: (:class:`~mongoengine.fields.ObjectIdField`) id of the :class:`~pycoshark.mongomodels.People` document that created the event :property comment: (:class:`~mongoengine.fields.StringField`) comment that was given """ meta = { 'indexes': [ 'issue_id', ], 'shard_key': ('external_id', 'issue_id'), } external_id = StringField(unique_with=['issue_id']) issue_id = ObjectIdField() created_at = DateTimeField() author_id = ObjectIdField() comment = StringField() def __str__(self): return "external_id: %s, issue_id: %s, created_at: %s, author_id: %s, comment: %s" % ( self.external_id, self.issue_id, self.created_at, self.author_id, self.comment)
class VCSSystem(Document): """ VCSSystem class. Inherits from :class:`mongoengine.Document` Index: #url ShardKey: #url :property url: (:class:`~mongoengine.fields.StringField`) url to the repository :property project_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.Project` id to which this vcs system belongs :property repository_type: (:class:`~mongoengine.fields.StringField`) type of the repository (e.g., git) :property last_updated: (:class:`~mongoengine.fields.DateTimeField`) date when the data in the database for this repository was last updates """ meta = { 'collection': 'vcs_system', 'indexes': ['#url'], 'shard_key': ('url', ), } # PK: url # Shard Key: hashed url url = StringField(required=True, unique=True) project_id = ObjectIdField(required=True) repository_type = StringField(required=True) last_updated = DateTimeField() submodules = ListField(ObjectIdField()) repository_file = FileField(collection_name='repository_data')
class Board(Document): created = DateTimeField(required=True, default=datetime.utcnow) created_by = ObjectIdField(required=True) name = StringField(required=True, min_length=1, max_length=256) owner_id = ObjectIdField(required=True) type = StringField(required=True)
class MachineEngine(Document): _created_date = DateTimeField(default=datetime.datetime.utcnow) _key_created_user = ObjectIdField() _last_modified_date = DateTimeField(default=datetime.datetime.utcnow) _key_last_modified_user = ObjectIdField() _key_owner_user = ObjectIdField() analysis_date = StringField(required=True) _key_organization = ReferenceField(Organization, required=True, reverse_delete_rule=2) _key_room_type = ReferenceField(EngineRoomType, required=True, reverse_delete_rule=3) _key_engine_speed = ReferenceField(EngineSpeed, required=True, reverse_delete_rule=3) _key_volume = ReferenceField(Volume, required=True, reverse_delete_rule=3) _key_capacity = ReferenceField(Capacity, required=True, reverse_delete_rule=3) _key_engine_type = ReferenceField(EngineType, required=True, reverse_delete_rule=3) _key_kur_cinsi = ReferenceField(Currency, required=True, reverse_delete_rule=3) _key_iskonto = ReferenceField(Discount, required=True, reverse_delete_rule=3) birim_fiyat = DecimalField(required=True)
class Notifications(EmbeddedDocument): _id = ObjectIdField(default=ObjectId) approved = BooleanField(default=False) healthOfficial = ObjectIdField() record = ObjectIdField() meta = {"collection": "notifications"}
class Card(Document): column_id = ObjectIdField(required=True) created = DateTimeField(required=True, default=datetime.utcnow) created_by = ObjectIdField(required=True) # TODO add last updated field # pylint: disable=fixme name = StringField(required=True, min_length=1, max_length=256)
class Line(Base): """ 设备线路 """ line = IntField(choices=(0, 1, 2, 3, 4), required=True) line_name = StringField(required=True) # 默认名 device_id = StringField(required=True) choice_plan = ObjectIdField() plan_status = BooleanField() limit = FloatField(required=True) # 电流容量 standard = IntField(required=True) # 电流阈值(默认78) load_type_id = ObjectIdField() meta = {'collection': 'line', 'strict': True} def keys(self): self.append('load_type') return self.fields @property def load_type(self): if self.load_type_id: load_type = LoadType.get(id=self.load_type_id) return load_type.load_type else: return "未选择"
class ControlPanel(Document): _created_date = DateTimeField(default=datetime.datetime.utcnow) _key_created_user = ObjectIdField() _last_modified_date = DateTimeField(default=datetime.datetime.utcnow) _key_last_modified_user = ObjectIdField() _key_owner_user = ObjectIdField() _key_brand = ReferenceField(Brand, required=True, reverse_delete_rule=3) _key_room_type = ReferenceField(EngineRoomType, required=True, reverse_delete_rule=3) _key_cp_size = ReferenceField(ControlPanelSize, required=True, reverse_delete_rule=3) _key_cp_button_type = ReferenceField(ControlPanelButtonType, required=True, reverse_delete_rule=3) _key_extra_type = ReferenceField(ControlPanelExtra, required=True, reverse_delete_rule=3) _key_organization = ReferenceField(Organization, required=True, reverse_delete_rule=2) _key_discount = ReferenceField(Discount, required=True, reverse_delete_rule=3) analysis_date = DateTimeField(default=datetime.datetime.utcnow) ready_installation = StringField(required=True) rfid_card = StringField(required=True) price = DecimalField(required=True)
class Branch(Document): """ Branch class. Inherits from :class:`mongoengine.Document`. Index: vcs_system_id ShardKey: name, vcs_system_id :property vcs_system_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.VCSSystem` id to which this branch belongs :property commit_id: (:class:`~mongoengine.fields.ObjectIdField`) target commit of the branch (last commit on that branch) :property name: (:class:`~mongoengine.fields.StringField`) name of the branch :property is_origin_head: (:class:`~mongoengine.fields.BooleanField`) if this branch is the default origin branch (usually master) """ meta = { 'indexes': [ 'vcs_system_id', ], 'shard_key': ('name', 'vcs_system_id'), } # PK: name, vcs_system_id # Shard Key: name, vcs_system_id vcs_system_id = ObjectIdField(required=True) commit_id = ObjectIdField(required=True) name = StringField(max_length=500, required=True, unique_with=['vcs_system_id']) is_origin_head = BooleanField(required=True, default=False)
class FileState(Document): """ Document that inherits from :class:`mongoengine.Document`. Holds information for the file_state collection. :property commit_id: id of the commit to which the file state belongs to (type: :class:`mongoengine.fields.ObjectIdField`) :property file_id: id of the file to which the state belongs (type: :class:`mongoengine.fields.ObjectIdField`) :property long_name: long_name of the state entity (e.g., pyvcssharhk.main.py) (type: :class:`mongoengine.fields.StringField`) :property component_ids: component_ids to which this entity belongs (type: :class:`mongoengine.fields.ListField` of :class:`mongoengine.fields.ObjectFieldId`) :property name: name of the state entity (type: :class:`mongoengine.fields.StringField`) :property file_type: file_type of the state entity (e.g., class, attribute, method, function, ...) (type: :class:`mongoengine.fields.StringField`) :property parent: parent of the state entity (e.g., if the entity is a method, the parent can be a class) (type: :class:`mongoengine.fields.ObjectFieldId`) :property metrics: metrics of the state entity (type: :class:`mongoengine.fields.DictField`) .. NOTE:: Unique (or primary keys) are the fields commit_id and file_id. """ meta = { 'indexes': [ 'commit_id', 'file_id', ], 'shard_key': ('long_name', 'commit_id', 'file_id'), } file_id = ObjectIdField(required=True) commit_id = ObjectIdField(required=True) parent = ObjectIdField() component_ids = ListField(ObjectIdField()) long_name = StringField(required=True, unique_with=['commit_id', 'file_id']) name = StringField() file_type = StringField() startLine = IntField() endLine = IntField() startColumn = IntField() endColumn = IntField() metrics = DictField()
class TestState(Document): """ TestState class. Inherits from :class:`mongoengine.Document`. Index: name, commit_id, file_id ShardKey: shard_key name, commit_id, file_id :property name: (:class:`~mongoengine.fields.StringField`) name of the TestState, e.g. de.ugoe.cs.Class.blub :property commit_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.Commit` id to which this state belongs :property file_id: (:class:`~mongoengine.fields.ObjectIdField`) :class:`~pycoshark.mongomodels.File` id to which this state refers to :property metrics: (:class:`~mongoengine.fields.DictField`) metrics for the test state :property mutations: ((:class:`~mongoengine.fields.ListField` of Mutations) with extra information about mutations """ meta = { 'indexes': [ 'commit_id', ], 'shard_key': ('name', 'commit_id', 'file_id'), } # PK: long_name, commit_id, file_id # Shard Key: long_name, commit_id, file_id name = StringField(required=True, unique_with=['commit_id', 'file_id']) file_id = ObjectIdField(required=True) commit_id = ObjectIdField(required=True) execution_time = FloatField() metrics = DictField() mutation_res = ListField(EmbeddedDocumentField(MutationResult), default=list)
class CloneInstance(Document): """ Document that inherits from :class:`mongoengine.Document`. Holds information for the clone_instance collection. :property commit_id: id of the commit, where the clone was detected (type: :class:`mongoengine.fields.ObjectIdField`) :property name: name of the clone entity (type: :class:`mongoengine.fields.StringField`) :property fileId: id of the file to which the clone belongs (type: :class:`mongoengine.fields.ObjectIdField`) :property cloneClass: name of the clone class (type: :class:`mongoengine.fields.StringField`) :property cloneClassMetrics: metrics of the clone class (type: :class:`mongoengine.fields.DictField`) :property cloneInstanceMetrics: metrics of the clone class (type: :class:`mongoengine.fields.DictField`) :property startLine: start line of the clone (type: :class:`mongoengine.fields.IntField`) :property endLine: end line of the clone (type: :class:`mongoengine.fields.IntField`) :property startColumn: start column of the clone (type: :class:`mongoengine.fields.IntField`) :property endColumn: end column of the clone (type: :class:`mongoengine.fields.IntField`) .. NOTE:: Unique (or primary keys) are the fields commit_id, name, and fileId. """ meta = { 'indexes': [ 'commit_id', 'fileId', ], 'shard_key': ('name', 'commit_id', 'fileId'), } commit_id = ObjectIdField(required=True) fileId = ObjectIdField(required=True) name = StringField(required=True, unique_with=['commit_id', 'fileId']) startLine = IntField(required=True) endLine = IntField(required=True) startColumn = IntField(required=True) endColumn = IntField(required=True) cloneInstanceMetrics = DictField(required=True) cloneClass = StringField(required=True) cloneClassMetrics = DictField(required=True)
class ReviewTask(Document): task_id = ObjectIdField(required=True) task_data_id = ObjectIdField(required=True) worker_id = ObjectIdField(required=True) original_session = ObjectIdField(required=True) reward = FloatField(required=True) questions = EmbeddedDocumentListField(Question) answers = EmbeddedDocumentListField(Answer)
class DoorType(Document): _created_date = DateTimeField(default=datetime.datetime.utcnow) _key_created_user = ObjectIdField() _last_modified_date = DateTimeField(default=datetime.datetime.utcnow) _key_last_modified_user = ObjectIdField() _key_owner_user = ObjectIdField() _key_organization = ReferenceField(Organization, required=True, reverse_delete_rule=2) door_type = StringField(required=True)
class RecycleBin(DynamicDocument): """回收站记录""" user_id = ObjectIdField() # 1/2 笔记/文件夹 type_ = IntField() # id id_ = ObjectIdField() create_time = DateTimeField(default=datetime.datetime.now)
class History(DynamicDocument): """访问记录""" notebook_id = ObjectIdField() note_id = ObjectIdField() note_title = StringField() user_id = ObjectIdField() create_time = DateTimeField(default=datetime.datetime.now)
class NotiContent(gj.EmbeddedDocument): index = IntField(default=1) text = StringField(required=True) category = StringField() user_id = ObjectIdField() username = StringField() post_id = ObjectIdField() read = IntField(default=0) create = DateTimeField(default=datetime.datetime.now)
class Discount(Document): _created_date = DateTimeField(default=datetime.datetime.utcnow) _key_created_user = ObjectIdField() _last_modified_date = DateTimeField(default=datetime.datetime.utcnow) _key_last_modified_user = ObjectIdField() _key_owner_user = ObjectIdField() aciklama = StringField(required=True) orani = DecimalField(required=True)
class ConsultationRequest(EmbeddedDocument): _id = ObjectIdField(default=ObjectId) patient = ObjectIdField() patientName = StringField() healthOfficial = ObjectIdField() consultationData = EmbeddedDocumentField(ConsultationData) approved = BooleanField(default=False) meta = {"collection": "consultationRequest"}
class CabinType(Document): _created_date = DateTimeField(default=datetime.datetime.utcnow) _key_created_user = ObjectIdField() _last_modified_date = DateTimeField(default=datetime.datetime.utcnow) _key_last_modified_user = ObjectIdField() _key_owner_user = ObjectIdField() _key_organization = ReferenceField(Organization, required=True) cabin_type = StringField(required=True)
class Record(EmbeddedDocument): _id = ObjectIdField(default=ObjectId) name = StringField(required=True) category = StringField(required=True) doctor = StringField(required=True) description = StringField(required=True) healthOfficials = ListField(ObjectIdField()) attachments = ListField(StringField()) meta = {"collection": "record"}