mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-29 10:56:24 +02:00
add (backend) google calendar connection flow
This commit is contained in:
parent
d98dfd40b5
commit
9abaf4fd2a
3 changed files with 176 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ class DocumentType(str, Enum):
|
|||
JIRA_CONNECTOR = "JIRA_CONNECTOR"
|
||||
CONFLUENCE_CONNECTOR = "CONFLUENCE_CONNECTOR"
|
||||
CLICKUP_CONNECTOR = "CLICKUP_CONNECTOR"
|
||||
GOOGLE_CALENDAR_CONNECTOR = "GOOGLE_CALENDAR_CONNECTOR"
|
||||
|
||||
|
||||
class SearchSourceConnectorType(str, Enum):
|
||||
|
|
@ -60,6 +61,7 @@ class SearchSourceConnectorType(str, Enum):
|
|||
JIRA_CONNECTOR = "JIRA_CONNECTOR"
|
||||
CONFLUENCE_CONNECTOR = "CONFLUENCE_CONNECTOR"
|
||||
CLICKUP_CONNECTOR = "CLICKUP_CONNECTOR"
|
||||
GOOGLE_CALENDAR_CONNECTOR = "GOOGLE_CALENDAR_CONNECTOR"
|
||||
|
||||
|
||||
class ChatType(str, Enum):
|
||||
|
|
@ -244,6 +246,21 @@ class SearchSourceConnector(BaseModel, TimestampMixin):
|
|||
user = relationship("User", back_populates="search_source_connectors")
|
||||
|
||||
|
||||
class GoogleCalendarAccount(BaseModel):
|
||||
__tablename__ = "google_calendar_accounts"
|
||||
|
||||
user_id = Column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("user.id", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
unique=True,
|
||||
)
|
||||
|
||||
access_token = Column(String, nullable=False)
|
||||
refresh_token = Column(String, nullable=False)
|
||||
user = relationship("User", back_populates="calendar_account")
|
||||
|
||||
|
||||
class LLMConfig(BaseModel, TimestampMixin):
|
||||
__tablename__ = "llm_configs"
|
||||
|
||||
|
|
@ -297,6 +314,12 @@ if config.AUTH_TYPE == "GOOGLE":
|
|||
search_source_connectors = relationship(
|
||||
"SearchSourceConnector", back_populates="user"
|
||||
)
|
||||
calendar_account = relationship(
|
||||
"GoogleCalendarAccount",
|
||||
back_populates="user",
|
||||
uselist=False,
|
||||
cascade="all, delete-orphan",
|
||||
)
|
||||
llm_configs = relationship(
|
||||
"LLMConfig",
|
||||
back_populates="user",
|
||||
|
|
@ -331,6 +354,12 @@ else:
|
|||
search_source_connectors = relationship(
|
||||
"SearchSourceConnector", back_populates="user"
|
||||
)
|
||||
calendar_account = relationship(
|
||||
"GoogleCalendarAccount",
|
||||
back_populates="user",
|
||||
uselist=False,
|
||||
cascade="all, delete-orphan",
|
||||
)
|
||||
llm_configs = relationship(
|
||||
"LLMConfig",
|
||||
back_populates="user",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue