feat: fcm apis
feat: push notification api
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
from sqlalchemy import Column, Integer, String
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy import ForeignKey
|
||||
|
||||
from database import Base
|
||||
from .CustomBase import CustomBase
|
||||
|
||||
|
||||
class Fcm(Base, CustomBase):
|
||||
__tablename__ = "fcm"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
token = Column(String)
|
||||
user_id = Column(Integer, ForeignKey("users.id"), nullable=False, index=True)
|
||||
user = relationship("Users", back_populates="fcm")
|
||||
@@ -0,0 +1,19 @@
|
||||
from sqlalchemy import Boolean, Column, Integer, String, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from database import Base
|
||||
from .CustomBase import CustomBase
|
||||
|
||||
class Notifications(Base, CustomBase):
|
||||
__tablename__ = "notifications"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
title = Column(String)
|
||||
message = Column(String)
|
||||
is_read = Column(Boolean, default=False)
|
||||
|
||||
sender_id = Column(Integer, ForeignKey("users.id"), nullable=False, index=True)
|
||||
sender = relationship("Users", foreign_keys=[sender_id], back_populates="sent_notifications")
|
||||
|
||||
receiver_id = Column(Integer, ForeignKey("users.id"), nullable=False, index=True)
|
||||
receiver = relationship("Users", foreign_keys=[receiver_id], back_populates="received_notifications")
|
||||
@@ -3,6 +3,7 @@ from database import Base
|
||||
from sqlalchemy import Enum
|
||||
from enums.enums import ClinicUserRoles, UserType
|
||||
from models.CustomBase import CustomBase
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
class Users(Base, CustomBase):
|
||||
__tablename__ = "users"
|
||||
@@ -13,3 +14,10 @@ class Users(Base, CustomBase):
|
||||
clinicRole = Column(Enum(ClinicUserRoles), nullable=True)
|
||||
userType = Column(Enum(UserType), nullable=True)
|
||||
profile_pic = Column(String, nullable=True)
|
||||
|
||||
# Notification relationships
|
||||
sent_notifications = relationship("Notifications", foreign_keys="Notifications.sender_id", back_populates="sender")
|
||||
received_notifications = relationship("Notifications", foreign_keys="Notifications.receiver_id", back_populates="receiver")
|
||||
|
||||
# FCM relationships
|
||||
fcm = relationship("Fcm", back_populates="user")
|
||||
|
||||
@@ -7,6 +7,9 @@ from .Calendar import Calenders
|
||||
from .AppointmentRelations import AppointmentRelations
|
||||
from .MasterAppointmentTypes import MasterAppointmentTypes
|
||||
from .ClinicDoctors import ClinicDoctors
|
||||
from .Notifications import Notifications
|
||||
from .CallTranscripts import CallTranscripts
|
||||
from .Fcm import Fcm
|
||||
|
||||
__all__ = [
|
||||
"Users",
|
||||
@@ -18,4 +21,7 @@ __all__ = [
|
||||
"AppointmentRelations",
|
||||
"MasterAppointmentTypes",
|
||||
"ClinicDoctors",
|
||||
"Notifications",
|
||||
"CallTranscripts",
|
||||
"Fcm",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user