Add models and routes for costs, consumption, equipment, maintenance, and production; implement CRUD operations and unit tests
This commit is contained in:
18
models/production_output.py
Normal file
18
models/production_output.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from sqlalchemy import Column, Integer, Float, String, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from config.database import Base
|
||||
|
||||
|
||||
class ProductionOutput(Base):
|
||||
__tablename__ = "production_output"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
scenario_id = Column(Integer, ForeignKey("scenario.id"), nullable=False)
|
||||
amount = Column(Float, nullable=False)
|
||||
description = Column(String, nullable=True)
|
||||
|
||||
scenario = relationship(
|
||||
"Scenario", back_populates="production_output_items")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<ProductionOutput id={self.id} scenario_id={self.scenario_id} amount={self.amount}>"
|
||||
Reference in New Issue
Block a user