[feat] negodata: 초청 메일 헤더에 회사 브랜딩(settings.branding.email_header) 배선
This commit is contained in:
1 parent
bb576af346
commit
0242ecff09
4 files changed
+29
-2
No files matched your search
@@ -8,7 +8,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from common.database.db_session_manager import DB_SESSION_MNG
|
||||
from common.database.model.models import (
|
||||
quotations, sessions, chats, nego_cards, wild_cards, items, suppliers, quotation_settings,
|
||||
version_nego_cards, version_wild_cards, users, supplier_items,
|
||||
version_nego_cards, version_wild_cards, users, supplier_items, companies,
|
||||
)
|
||||
from common.enums import CloseReason, ErrorType, QuotationStatus, SessionStatus
|
||||
from common.logger import LOG
|
||||
@@ -384,6 +384,25 @@ class QuotationCRUD(IQuotationCRUD):
|
||||
LOG.e_no_callstack(ex)
|
||||
return ErrorType.DB_RUN_FAILED, {}
|
||||
|
||||
async def get_email_header(self, cdb: AsyncSession, user_id):
|
||||
# 견적 소유 유저 → 회사 → companies.settings.branding.email_header. 초청 메일 헤더 브랜딩용. 없으면 None.
|
||||
try:
|
||||
query = (
|
||||
select(companies.settings)
|
||||
.select_from(users)
|
||||
.join(companies, companies.company_id == users.company_id)
|
||||
.where(users.user_id == user_id, companies.deleted == False) # noqa: E712
|
||||
.limit(1)
|
||||
)
|
||||
err, rows = await DB_SESSION_MNG.execute(cdb, query)
|
||||
if err != ErrorType.SUCCESS or not rows:
|
||||
return None
|
||||
settings = rows[0] or {}
|
||||
return (settings.get("branding") or {}).get("email_header")
|
||||
except Exception as ex:
|
||||
LOG.e_no_callstack(ex)
|
||||
return None
|
||||
|
||||
async def get_item_companies(self, cdb: AsyncSession, item_ids) -> Tuple[ErrorType, dict]:
|
||||
"""item_id -> company_id(소유 회사) 매핑. 앵커링 칸(회사×유형×가격구간) 해석 입력."""
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user