21 lines
919 B
Python
21 lines
919 B
Python
from sqlalchemy import Column, Integer, ForeignKey, DateTime, Boolean
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.domain.models.base import BaseModel
|
|
|
|
|
|
class ScheduledAppointment(BaseModel):
|
|
__tablename__ = 'scheduled_appointments'
|
|
|
|
scheduled_datetime = Column(DateTime, nullable=False, server_default=func.now())
|
|
is_canceled = Column(Boolean, nullable=False, default=False, server_default='false')
|
|
|
|
patient_id = Column(Integer, ForeignKey('patients.id'), nullable=False)
|
|
doctor_id = Column(Integer, ForeignKey('users.id'), nullable=False)
|
|
type_id = Column(Integer, ForeignKey('appointment_types.id'), nullable=False)
|
|
|
|
patient = relationship('Patient', back_populates='scheduled_appointments')
|
|
doctor = relationship('User', back_populates='scheduled_appointments')
|
|
type = relationship('AppointmentType', back_populates='scheduled_appointments')
|