GoodbyeSQL 0.5.3__tar.gz → 0.5.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GoodbyeSQL
3
- Version: 0.5.3
3
+ Version: 0.5.5
4
4
  Description-Content-Type: text/markdown
5
5
  Requires-Dist: sqlalchemy==2.0.43
6
6
  Requires-Dist: fastapi==0.135.1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: GoodbyeSQL
3
- Version: 0.5.3
3
+ Version: 0.5.5
4
4
  Description-Content-Type: text/markdown
5
5
  Requires-Dist: sqlalchemy==2.0.43
6
6
  Requires-Dist: fastapi==0.135.1
@@ -1,4 +1,3 @@
1
- from dataclasses import dataclass
2
1
  from typing import Any
3
2
  from pydantic_settings import BaseSettings
4
3
  from typing import List, Annotated
@@ -7,10 +6,9 @@ from fastapi import Depends
7
6
  from goodbyesql.registry import get_session
8
7
 
9
8
 
10
- @dataclass
11
9
  class GoodbyeSQLConfig(BaseSettings):
12
- user_model: List[str]
13
- username_field: str = 'username'
10
+ user_model: Any
11
+ username_field: str = 'Any'
14
12
 
15
13
 
16
14
 
@@ -4,6 +4,7 @@ from goodbyesql.config import GoodbyeSQLConfig
4
4
  from typing import Annotated
5
5
  from fastapi import Depends
6
6
  from goodbyesql.registry import get_session
7
+ from pydantic import EmailStr
7
8
 
8
9
  DB_Session = Annotated[AsyncSession, Depends(get_session)]
9
10
 
@@ -23,6 +24,17 @@ class GoodbyeSQL:
23
24
  return user
24
25
 
25
26
 
27
+ async def get_info_by_email(self, *, session: DB_Session, email: EmailStr):
28
+
29
+ model = self.config.user_model
30
+ field = getattr(model, self.config.username_field)
31
+
32
+ query = select(model).where(field == email)
33
+ result = await session.execute(query)
34
+
35
+ info: None = result.scalar_one_or_none()
36
+
37
+ return info
26
38
 
27
39
  def check_my_library():
28
40
  print("It is working right now!")
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name='GoodbyeSQL',
8
- version='0.5.3',
8
+ version='0.5.5',
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  'sqlalchemy==2.0.43',
File without changes
File without changes