Commit 62561f0d authored by Pablo Armingol's avatar Pablo Armingol
Browse files

Fix formatting of "component". Code cleanup

parent 167a42fa
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -68,6 +68,5 @@ def compose_components_data(
                'created_at'    : now,
                'updated_at'    : now,
            }
            LOGGER.debug('dict_component={:s}'.format(str(dict_component)))
            dict_components.append(dict_component)
    return dict_components
+0 −2
Original line number Diff line number Diff line
@@ -35,8 +35,6 @@ def compose_config_rules_data(
    dict_config_rules : List[Dict] = list()
    for position,config_rule in enumerate(config_rules):
        
        #LOGGER.info("REQUEST")
        #LOGGER.info(position,config_rule)
        str_kind = config_rule.WhichOneof('config_rule')
        kind = ConfigRuleKindEnum._member_map_.get(str_kind.upper()) # pylint: disable=no-member
        dict_config_rule = {
+9 −8
Original line number Diff line number Diff line
@@ -25,9 +25,9 @@ class ComponentModel(_Base): #Inherit
    component_uuid  = Column(UUID(as_uuid=False), primary_key=True)     #Unique identifier that serves as a primary key for this table
    device_uuid     = Column(ForeignKey('device.device_uuid',ondelete='CASCADE' ), nullable=False, index=True)  #Foreign Key relationship with the field device_uuid from the Device table (CASCADE' behavior for deletion, meaning when a device is deleted, its components will also be dele)
    name            = Column(String, nullable=False)                    #String field that stores the name of the component
    type            = Column(String, nullable=False)                    #String field that stores the name of the component
    attributes      = Column(String, nullable=False)                    #String field that stores data about the component 
    parent      = Column(String, nullable=False)                    #String field that stores data about the component 
    type            = Column(String, nullable=False)                    #String field that stores the type of the component
    attributes      = Column(String, nullable=False)                    #String field that stores the attributes of the component 
    parent          = Column(String, nullable=False)                    #String field that stores the parent of the component 
    created_at      = Column(DateTime, nullable=False)                  #Stores the creaton timestamp for the component
    updated_at      = Column(DateTime, nullable=False)                  #Stores the last upadted timestamp for the component

@@ -40,8 +40,9 @@ class ComponentModel(_Base): #Inherit
        }

    def dump(self) -> Dict:
        data = json.loads(self.attributes)
        data['component_uuid'] = {'uuid': self.component_uuid},
        data = dict()
        data['attributes']     = json.loads(self.attributes)
        data['component_uuid'] = {'uuid': self.component_uuid}
        data['name']           = self.name
        data['type']           = self.type
        data['parent']         = self.parent