This commit is contained in:
Valeria Fadeeva 2025-06-09 14:32:12 +05:00
parent 747721031a
commit 3e1e1bf250
5 changed files with 2023 additions and 1956 deletions

View File

@ -17,11 +17,15 @@ class DatingOrm(Model):
id: Mapped[int] = mapped_column(primary_key=True, unique=True, autoincrement=True)
sessionkey: Mapped[str] = mapped_column(unique=True)
theme_name: Mapped[str]
sender_looking_relationship: Mapped[str]
sender_name: Mapped[str]
sender_sex: Mapped[str]
sender_age: Mapped[int]
sender_city: Mapped[str]
telegram_name: Mapped[str]
sender_relationship: Mapped[str]
sender_having_kids: Mapped[str]
sender_want_to_have_kids: Mapped[str]
interests_in_school_university: Mapped[str]
interests_in_sports: Mapped[str]
interests_in_work: Mapped[str]

View File

@ -5,15 +5,19 @@ from .schemas import SDatingAdd, SDating
class DatingRepository:
@classmethod
async def add_dating(cls, dating: SDatingAdd) -> int:
async def add_dating(cls, dating: SDatingAdd) -> int | None:
async with new_session() as session:
data = dating.model_dump()
new_dating = DatingOrm(**data)
try:
data = dating.model_dump()
new_dating = DatingOrm(**data)
session.add(new_dating)
await session.flush()
await session.commit()
return new_dating.id
session.add(new_dating)
await session.flush()
await session.commit()
return new_dating.id
except Exception as e:
print(e)
return None
@classmethod
async def get_datings(cls) -> list[SDating]:

View File

@ -5,11 +5,15 @@ from pydantic import BaseModel, ConfigDict
class SDatingAdd(BaseModel):
sessionkey: str
theme_name: str
sender_looking_relationship: str
sender_name: str
sender_sex: str
sender_age: int
sender_city: str
telegram_name: str
sender_relationship: str
sender_having_kids: str
sender_want_to_have_kids: str
interests_in_school_university: str
interests_in_sports: str
interests_in_work: str

View File

@ -20,6 +20,10 @@ else
fi
fi
if [ -f ".git/index.lock" ]; then
rm ".git/index.lock"
fi
git add .
git commit -m "Update"
git push $git

File diff suppressed because one or more lines are too long