health-apps-backend/models/Appointments.py

21 lines
709 B
Python

from sqlalchemy import Column, DateTime, Enum, Integer, ForeignKey
from sqlalchemy.orm import relationship
from enums.enums import AppointmentStatus
from database import Base
from .CustomBase import CustomBase
class Appointments(Base, CustomBase):
__tablename__ = "appointments"
id = Column(Integer, primary_key=True, index=True)
appointment_time = Column(DateTime)
status = Column(Enum(AppointmentStatus))
doctor_id = Column(Integer, ForeignKey("doctors.id"), index=True)
doctor = relationship("Doctors", back_populates="appointments")
patient_id = Column(Integer, ForeignKey("patients.id"), index=True)
patient = relationship("Patients", back_populates="appointments")