Skip to content

Commit 090c991

Browse files
committed
FEAT: Place CommunityPostResponse on schema and improve email decryption function for readability
1 parent 2fdbf37 commit 090c991

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

app/routers/admin/routes.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
from typing import Annotated
33

44
from fastapi import APIRouter, Depends, Request, status
5-
from pydantic import BaseModel
65
from sqlmodel.ext.asyncio.session import AsyncSession
76

87
from app.routers.authentication import get_current_active_community
8+
from app.schemas import CommunityPostResponse
99
from app.services import auth
1010
from app.services.database.models import Community as DBCommunity # Precisa?
1111
from app.services.database.orm.community import create_community
@@ -28,16 +28,9 @@ async def create_admin(session: AsyncSession):
2828
)
2929
await create_community(session=session, community=community)
3030

31-
# session.add(community)
32-
# await session.commit()
33-
# await session.refresh(community)
3431
return {"msg": "Admin successfully created"}
3532

3633

37-
class CommunityPostResponse(BaseModel):
38-
status: str = "Community Criado"
39-
40-
4134
def setup():
4235
router = APIRouter(prefix="/admin", tags=["admin"])
4336

app/schemas.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ class CommunityInDB(Community):
4040
role: str
4141

4242

43+
class CommunityPostResponse(BaseModel):
44+
status: str = "Community Criado"
45+
46+
4347
class News(BaseModel):
4448
title: str
4549
content: str

app/services/encryption.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,5 @@ def encrypt_email(email: str) -> str:
2323

2424
def decrypt_email(encrypted_email: str) -> str:
2525
"""Descriptografa uma string de e-mail."""
26-
print("decipher email called")
27-
return cipher.decrypt(encrypted_email).decode()
26+
decrypted_email = cipher.decrypt(encrypted_email).decode()
27+
return decrypted_email

0 commit comments

Comments
 (0)