Initial Commit
This commit is contained in:
27
api/app/models/common/core/environment.py
Normal file
27
api/app/models/common/core/environment.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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
|
||||
Reference in New Issue
Block a user