28 lines
831 B
Python
28 lines
831 B
Python
from sqlalchemy import Column, String, Integer
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from models.common.base import BaseModel
|
|
|
|
|
|
class environment(BaseModel):
|
|
"""
|
|
description: Technological infrastructure environments.
|
|
"""
|
|
__tablename__ = "tcc_environments"
|
|
_s_collection_name = "environments"
|
|
_s_class_name = "environment"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True, index=True)
|
|
name = Column(String(32), unique=True, index=True, nullable=False)
|
|
color = Column(String(7), index=False, nullable=True)
|
|
|
|
cluster = relationship("cluster", back_populates="environment")
|
|
pelement = relationship("pelement", back_populates="environment")
|
|
|
|
def to_dict(self):
|
|
result = BaseModel.to_dict(self)
|
|
|
|
result['name'] = result['name'].upper()
|
|
|
|
return result
|