fix: adjust enterprise api
parent
5e50570739
commit
e9a207b38e
@ -1,26 +1,18 @@
|
|||||||
|
|
||||||
from typing import Dict, List
|
|
||||||
|
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
from tasks.mail_enterprise_task import send_enterprise_email_task
|
from tasks.mail_enterprise_task import send_enterprise_email_task
|
||||||
|
|
||||||
|
|
||||||
class DifyMail(BaseModel):
|
class DifyMail(BaseModel):
|
||||||
to: List[str]
|
to: list[str]
|
||||||
subject: str
|
subject: str
|
||||||
body: str
|
body: str
|
||||||
substitutions: Dict[str, str] = {}
|
substitutions: dict[str, str] = {}
|
||||||
|
|
||||||
|
|
||||||
class EnterpriseMailService:
|
class EnterpriseMailService:
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def send_mail(cls, mail: DifyMail):
|
def send_mail(cls, mail: DifyMail):
|
||||||
|
|
||||||
send_enterprise_email_task.delay(
|
send_enterprise_email_task.delay(
|
||||||
to=mail.to,
|
to=mail.to, subject=mail.subject, body=mail.body, substitutions=mail.substitutions
|
||||||
subject=mail.subject,
|
|
||||||
body=mail.body,
|
|
||||||
substitutions=mail.substitutions
|
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue