feat: appointment relation table
fix: relations for clinic doc and clinic
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
from sqlalchemy import Column, ForeignKey, Integer
|
||||
from database import Base
|
||||
from .CustomBase import CustomBase
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
class AppointmentRelations(Base, CustomBase):
|
||||
__tablename__ = "appointment_relations"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
appointment_type_id = Column(Integer, ForeignKey("master_appointment_types.id"))
|
||||
clinic_doctor_id = Column(Integer, ForeignKey("clinic_doctors.id"))
|
||||
|
||||
clinicDoctors = relationship("ClinicDoctors", back_populates="appointmentRelations")
|
||||
masterAppointmentTypes = relationship("MasterAppointmentTypes", back_populates="appointmentRelations")
|
||||
@@ -0,0 +1,17 @@
|
||||
from sqlalchemy import Column, Enum, Integer, String, ForeignKey,Table
|
||||
from database import Base
|
||||
from enums.enums import ClinicUserRoles, ClinicDoctorStatus
|
||||
from .CustomBase import CustomBase
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
class ClinicDoctors(Base, CustomBase):
|
||||
__tablename__ = "clinic_doctors"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String)
|
||||
role = Column(Enum(ClinicUserRoles))
|
||||
status = Column(Enum(ClinicDoctorStatus))
|
||||
|
||||
appointmentRelations = relationship("AppointmentRelations", back_populates="clinicDoctors")
|
||||
clinic_id = Column(Integer, ForeignKey("clinics.id"))
|
||||
clinic = relationship("Clinics", back_populates="clinicDoctors")
|
||||
@@ -42,3 +42,4 @@ class Clinics(Base, CustomBase):
|
||||
|
||||
|
||||
doctors = relationship("Doctors", back_populates="clinic")
|
||||
clinicDoctors = relationship("ClinicDoctors", back_populates="clinic")
|
||||
@@ -0,0 +1,13 @@
|
||||
from sqlalchemy import Column, Integer, String
|
||||
from database import Base
|
||||
from .CustomBase import CustomBase
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
class MasterAppointmentTypes(Base, CustomBase):
|
||||
__tablename__ = "master_appointment_types"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
type = Column(String)
|
||||
|
||||
appointmentRelations = relationship("AppointmentRelations", back_populates="masterAppointmentTypes")
|
||||
clinicDoctors = relationship("ClinicDoctors", back_populates="masterAppointmentTypes")
|
||||
@@ -4,6 +4,9 @@ from .Doctors import Doctors
|
||||
from .Patients import Patients
|
||||
from .Appointments import Appointments
|
||||
from .Calendar import Calenders
|
||||
from .AppointmentRelations import AppointmentRelations
|
||||
from .MasterAppointmentTypes import MasterAppointmentTypes
|
||||
from .ClinicDoctors import ClinicDoctors
|
||||
|
||||
__all__ = [
|
||||
"Users",
|
||||
@@ -12,4 +15,7 @@ __all__ = [
|
||||
"Patients",
|
||||
"Appointments",
|
||||
"Calenders",
|
||||
"AppointmentRelations",
|
||||
"MasterAppointmentTypes",
|
||||
"ClinicDoctors",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user