generated from dopt-python/py311
data loading of company profiles
This commit is contained in:
@@ -2,7 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import dataclasses as dc
|
||||
import datetime
|
||||
from typing import Any, TypeAlias, TypedDict, cast
|
||||
from typing import TYPE_CHECKING, Any, TypedDict, cast
|
||||
|
||||
import polars as pl
|
||||
import sqlalchemy as sql
|
||||
@@ -10,9 +10,11 @@ import sqlalchemy as sql
|
||||
from wce_crm import db
|
||||
from wce_crm.logging import logger_back as logger
|
||||
|
||||
InitRecId: TypeAlias = int
|
||||
if TYPE_CHECKING:
|
||||
from wce_crm.types import ExtAnId, ExtMaId, InitRecId
|
||||
|
||||
|
||||
# // externals
|
||||
class CompanyInfo(TypedDict):
|
||||
ma_id: str
|
||||
wce_id: str
|
||||
@@ -100,7 +102,7 @@ def initrec_comp_search_choices() -> tuple[tuple[str, int], ...]:
|
||||
|
||||
|
||||
def initrec_comp_search_get_info(
|
||||
ma_id: int,
|
||||
ma_id: ExtMaId,
|
||||
) -> CompanyInfo:
|
||||
logger.debug("[Call backend] comp_search_get_info")
|
||||
df = db.DF_CRM_MASTER.filter(pl.col.ma_id == ma_id)
|
||||
@@ -112,7 +114,7 @@ def initrec_comp_search_get_info(
|
||||
|
||||
|
||||
def initrec_comp_contact_person_search_choices(
|
||||
ma_id: int | None,
|
||||
ma_id: ExtMaId | None,
|
||||
use_both_names: bool,
|
||||
) -> tuple[tuple[str, int], ...]:
|
||||
# TODO no reload functionality
|
||||
@@ -140,7 +142,7 @@ def initrec_comp_contact_person_search_choices(
|
||||
|
||||
|
||||
def initrec_comp_contact_person_search_get_info(
|
||||
an_id: int,
|
||||
an_id: ExtAnId,
|
||||
) -> ContactPersonInfo:
|
||||
logger.debug("[Call backend] contact_person_search_get_info")
|
||||
df = db.DF_CONTACT_PERSON.filter(pl.col.an_id == an_id)
|
||||
@@ -151,6 +153,7 @@ def initrec_comp_contact_person_search_get_info(
|
||||
return cast(ContactPersonInfo, df.row(0, named=True))
|
||||
|
||||
|
||||
# // internals
|
||||
def initrec_insert_initial_recording(
|
||||
data: dict[str, Any],
|
||||
) -> InitRecId:
|
||||
@@ -210,7 +213,6 @@ def initrec_delete_initial_recording(
|
||||
@dc.dataclass(slots=True)
|
||||
class FrontpageCompany:
|
||||
erfassung_id: InitRecId
|
||||
# ma_id: int
|
||||
name: str
|
||||
Metadaten_aktualisierung: datetime.datetime
|
||||
is_company: bool
|
||||
|
||||
Reference in New Issue
Block a user