Spaces:
Runtime error
Runtime error
File size: 1,404 Bytes
7a511fb 5cb75d9 7a511fb 5cb75d9 7a511fb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
from enum import Enum as PyEnum
from sqlalchemy import (
Boolean,
Column,
DateTime,
Enum,
Float,
ForeignKey,
Integer,
String,
func,
)
from sqlalchemy.dialects.postgresql import UUID
from pydantic import BaseModel
from ._base import Base
class Weights(PyEnum):
NONE = "NONE"
LOW = "LOW"
MEDIUM = "MEDIUM"
HIGH = "HIGH"
class ComparativeWeights(Base):
__tablename__ = "comparative_weights"
id = Column(UUID(as_uuid=True), primary_key=True, nullable=False)
rfp_id = Column(
UUID(as_uuid=True),
ForeignKey("rfps.id", ondelete="CASCADE"),
nullable=False,
unique=True,
)
technical_weight = Column(Enum(Weights, name="comparativeweights"), nullable=False)
management_weight = Column(Enum(Weights, name="comparativeweights"), nullable=False)
past_performance_weight = Column(
Enum(Weights, name="comparativeweights"), nullable=False
)
price_weight = Column(Enum(Weights, name="comparativeweights"), nullable=False)
strengths_weight = Column(Float, nullable=False, default=15)
weaknesses_weight = Column(Float, nullable=False, default=5)
flag = Column(Boolean(), nullable=True, default=False)
created_at = Column(DateTime, nullable=False, default=func.now())
updated_at = Column(
DateTime, nullable=False, default=func.now(), onupdate=func.now()
)
|