Skip to content

Refactor api #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Refactor api #2

wants to merge 8 commits into from

Conversation

BhavikaGouri
Copy link
Owner

No description provided.

Repository owner locked and limited conversation to collaborators Jun 16, 2025
@BhavikaGouri BhavikaGouri reopened this Jun 19, 2025
@BhavikaGouri BhavikaGouri requested a review from PunitGr June 19, 2025 17:32
app/.idea
app/.venv
app/orm-user.db
app/app/__pycache__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do **/__pycache__/ instead.

app/app/auth/__pycache__
app/app/core/__pycache__
app/app/db/__pycache__
app/app/models/__pycache__
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add linting to the project, have a look at: https://github.com/astral-sh/ruff

raise HTTPException(status_code=400, detail="Email already exists")

while True:
username = name + str(random.randint(1, 100))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use slugify instead.

router = APIRouter()

@router.post("/signup")
async def add_user(session: Session = Depends(get_session), name: str = "", password: str = "", email: str = ""):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend using Pydantic models (e.g., BaseModel classes) for the request body instead of passing parameters like name, email, and password directly in the function signature.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants