GoodbyeSQL 0.5.2__tar.gz → 0.5.4__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.2
3
+ Version: 0.5.4
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.2
3
+ Version: 0.5.4
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,7 +6,6 @@ from fastapi import Depends
7
6
  from goodbyesql.registry import get_session
8
7
 
9
8
 
10
- @dataclass
11
9
  class GoodbyeSQLConfig(BaseSettings):
12
10
  user_model: List[str]
13
11
  username_field: str = 'username'
@@ -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
 
@@ -20,8 +21,20 @@ class GoodbyeSQL:
20
21
  query = select(model).where(field == username)
21
22
  result = await session.execute(query)
22
23
  user: None = result.scalar_one_or_none()
24
+ return user
23
25
 
24
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
25
38
 
26
39
  def check_my_library():
27
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.2',
8
+ version='0.5.4',
9
9
  packages=find_packages(),
10
10
  install_requires=[
11
11
  'sqlalchemy==2.0.43',
File without changes
File without changes